UNPKG

586 kBJavaScriptView Raw
1(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2(function (process,global){
3'use strict';
4
5/* eslint no-unused-vars: off */
6/* eslint-env commonjs */
7
8/**
9 * Shim process.stdout.
10 */
11
12process.stdout = require('browser-stdout')({label: false});
13
14var Mocha = require('./lib/mocha');
15
16/**
17 * Create a Mocha instance.
18 *
19 * @return {undefined}
20 */
21
22var mocha = new Mocha({reporter: 'html'});
23
24/**
25 * Save timer references to avoid Sinon interfering (see GH-237).
26 */
27
28var Date = global.Date;
29var setTimeout = global.setTimeout;
30var setInterval = global.setInterval;
31var clearTimeout = global.clearTimeout;
32var clearInterval = global.clearInterval;
33
34var uncaughtExceptionHandlers = [];
35
36var originalOnerrorHandler = global.onerror;
37
38/**
39 * Remove uncaughtException listener.
40 * Revert to original onerror handler if previously defined.
41 */
42
43process.removeListener = function(e, fn) {
44 if (e === 'uncaughtException') {
45 if (originalOnerrorHandler) {
46 global.onerror = originalOnerrorHandler;
47 } else {
48 global.onerror = function() {};
49 }
50 var i = uncaughtExceptionHandlers.indexOf(fn);
51 if (i !== -1) {
52 uncaughtExceptionHandlers.splice(i, 1);
53 }
54 }
55};
56
57/**
58 * Implements uncaughtException listener.
59 */
60
61process.on = function(e, fn) {
62 if (e === 'uncaughtException') {
63 global.onerror = function(err, url, line) {
64 fn(new Error(err + ' (' + url + ':' + line + ')'));
65 return !mocha.allowUncaught;
66 };
67 uncaughtExceptionHandlers.push(fn);
68 }
69};
70
71// The BDD UI is registered by default, but no UI will be functional in the
72// browser without an explicit call to the overridden `mocha.ui` (see below).
73// Ensure that this default UI does not expose its methods to the global scope.
74mocha.suite.removeAllListeners('pre-require');
75
76var immediateQueue = [];
77var immediateTimeout;
78
79function timeslice() {
80 var immediateStart = new Date().getTime();
81 while (immediateQueue.length && new Date().getTime() - immediateStart < 100) {
82 immediateQueue.shift()();
83 }
84 if (immediateQueue.length) {
85 immediateTimeout = setTimeout(timeslice, 0);
86 } else {
87 immediateTimeout = null;
88 }
89}
90
91/**
92 * High-performance override of Runner.immediately.
93 */
94
95Mocha.Runner.immediately = function(callback) {
96 immediateQueue.push(callback);
97 if (!immediateTimeout) {
98 immediateTimeout = setTimeout(timeslice, 0);
99 }
100};
101
102/**
103 * Function to allow assertion libraries to throw errors directly into mocha.
104 * This is useful when running tests in a browser because window.onerror will
105 * only receive the 'message' attribute of the Error.
106 */
107mocha.throwError = function(err) {
108 uncaughtExceptionHandlers.forEach(function(fn) {
109 fn(err);
110 });
111 throw err;
112};
113
114/**
115 * Override ui to ensure that the ui functions are initialized.
116 * Normally this would happen in Mocha.prototype.loadFiles.
117 */
118
119mocha.ui = function(ui) {
120 Mocha.prototype.ui.call(this, ui);
121 this.suite.emit('pre-require', global, null, this);
122 return this;
123};
124
125/**
126 * Setup mocha with the given setting options.
127 */
128
129mocha.setup = function(opts) {
130 if (typeof opts === 'string') {
131 opts = {ui: opts};
132 }
133 for (var opt in opts) {
134 if (opts.hasOwnProperty(opt)) {
135 this[opt](opts[opt]);
136 }
137 }
138 return this;
139};
140
141/**
142 * Run mocha, returning the Runner.
143 */
144
145mocha.run = function(fn) {
146 var options = mocha.options;
147 mocha.globals('location');
148
149 var query = Mocha.utils.parseQuery(global.location.search || '');
150 if (query.grep) {
151 mocha.grep(query.grep);
152 }
153 if (query.fgrep) {
154 mocha.fgrep(query.fgrep);
155 }
156 if (query.invert) {
157 mocha.invert();
158 }
159
160 return Mocha.prototype.run.call(mocha, function(err) {
161 // The DOM Document is not available in Web Workers.
162 var document = global.document;
163 if (
164 document &&
165 document.getElementById('mocha') &&
166 options.noHighlighting !== true
167 ) {
168 Mocha.utils.highlightTags('code');
169 }
170 if (fn) {
171 fn(err);
172 }
173 });
174};
175
176/**
177 * Expose the process shim.
178 * https://github.com/mochajs/mocha/pull/916
179 */
180
181Mocha.process = process;
182
183/**
184 * Expose mocha.
185 */
186
187global.Mocha = Mocha;
188global.mocha = mocha;
189
190// this allows test/acceptance/required-tokens.js to pass; thus,
191// you can now do `const describe = require('mocha').describe` in a
192// browser context (assuming browserification). should fix #880
193module.exports = global;
194
195}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
196},{"./lib/mocha":14,"_process":69,"browser-stdout":41}],2:[function(require,module,exports){
197(function (process,global){
198'use strict';
199
200/**
201 * Web Notifications module.
202 * @module Growl
203 */
204
205/**
206 * Save timer references to avoid Sinon interfering (see GH-237).
207 */
208var Date = global.Date;
209var setTimeout = global.setTimeout;
210var EVENT_RUN_END = require('../runner').constants.EVENT_RUN_END;
211
212/**
213 * Checks if browser notification support exists.
214 *
215 * @public
216 * @see {@link https://caniuse.com/#feat=notifications|Browser support (notifications)}
217 * @see {@link https://caniuse.com/#feat=promises|Browser support (promises)}
218 * @see {@link Mocha#growl}
219 * @see {@link Mocha#isGrowlCapable}
220 * @return {boolean} whether browser notification support exists
221 */
222exports.isCapable = function() {
223 var hasNotificationSupport = 'Notification' in window;
224 var hasPromiseSupport = typeof Promise === 'function';
225 return process.browser && hasNotificationSupport && hasPromiseSupport;
226};
227
228/**
229 * Implements browser notifications as a pseudo-reporter.
230 *
231 * @public
232 * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/notification|Notification API}
233 * @see {@link https://developers.google.com/web/fundamentals/push-notifications/display-a-notification|Displaying a Notification}
234 * @see {@link Growl#isPermitted}
235 * @see {@link Mocha#_growl}
236 * @param {Runner} runner - Runner instance.
237 */
238exports.notify = function(runner) {
239 var promise = isPermitted();
240
241 /**
242 * Attempt notification.
243 */
244 var sendNotification = function() {
245 // If user hasn't responded yet... "No notification for you!" (Seinfeld)
246 Promise.race([promise, Promise.resolve(undefined)])
247 .then(canNotify)
248 .then(function() {
249 display(runner);
250 })
251 .catch(notPermitted);
252 };
253
254 runner.once(EVENT_RUN_END, sendNotification);
255};
256
257/**
258 * Checks if browser notification is permitted by user.
259 *
260 * @private
261 * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Notification/permission|Notification.permission}
262 * @see {@link Mocha#growl}
263 * @see {@link Mocha#isGrowlPermitted}
264 * @returns {Promise<boolean>} promise determining if browser notification
265 * permissible when fulfilled.
266 */
267function isPermitted() {
268 var permitted = {
269 granted: function allow() {
270 return Promise.resolve(true);
271 },
272 denied: function deny() {
273 return Promise.resolve(false);
274 },
275 default: function ask() {
276 return Notification.requestPermission().then(function(permission) {
277 return permission === 'granted';
278 });
279 }
280 };
281
282 return permitted[Notification.permission]();
283}
284
285/**
286 * @summary
287 * Determines if notification should proceed.
288 *
289 * @description
290 * Notification shall <strong>not</strong> proceed unless `value` is true.
291 *
292 * `value` will equal one of:
293 * <ul>
294 * <li><code>true</code> (from `isPermitted`)</li>
295 * <li><code>false</code> (from `isPermitted`)</li>
296 * <li><code>undefined</code> (from `Promise.race`)</li>
297 * </ul>
298 *
299 * @private
300 * @param {boolean|undefined} value - Determines if notification permissible.
301 * @returns {Promise<undefined>} Notification can proceed
302 */
303function canNotify(value) {
304 if (!value) {
305 var why = value === false ? 'blocked' : 'unacknowledged';
306 var reason = 'not permitted by user (' + why + ')';
307 return Promise.reject(new Error(reason));
308 }
309 return Promise.resolve();
310}
311
312/**
313 * Displays the notification.
314 *
315 * @private
316 * @param {Runner} runner - Runner instance.
317 */
318function display(runner) {
319 var stats = runner.stats;
320 var symbol = {
321 cross: '\u274C',
322 tick: '\u2705'
323 };
324 var logo = require('../../package').notifyLogo;
325 var _message;
326 var message;
327 var title;
328
329 if (stats.failures) {
330 _message = stats.failures + ' of ' + stats.tests + ' tests failed';
331 message = symbol.cross + ' ' + _message;
332 title = 'Failed';
333 } else {
334 _message = stats.passes + ' tests passed in ' + stats.duration + 'ms';
335 message = symbol.tick + ' ' + _message;
336 title = 'Passed';
337 }
338
339 // Send notification
340 var options = {
341 badge: logo,
342 body: message,
343 dir: 'ltr',
344 icon: logo,
345 lang: 'en-US',
346 name: 'mocha',
347 requireInteraction: false,
348 timestamp: Date.now()
349 };
350 var notification = new Notification(title, options);
351
352 // Autoclose after brief delay (makes various browsers act same)
353 var FORCE_DURATION = 4000;
354 setTimeout(notification.close.bind(notification), FORCE_DURATION);
355}
356
357/**
358 * As notifications are tangential to our purpose, just log the error.
359 *
360 * @private
361 * @param {Error} err - Why notification didn't happen.
362 */
363function notPermitted(err) {
364 console.error('notification error:', err.message);
365}
366
367}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
368},{"../../package":90,"../runner":34,"_process":69}],3:[function(require,module,exports){
369'use strict';
370
371/**
372 * Expose `Progress`.
373 */
374
375module.exports = Progress;
376
377/**
378 * Initialize a new `Progress` indicator.
379 */
380function Progress() {
381 this.percent = 0;
382 this.size(0);
383 this.fontSize(11);
384 this.font('helvetica, arial, sans-serif');
385}
386
387/**
388 * Set progress size to `size`.
389 *
390 * @public
391 * @param {number} size
392 * @return {Progress} Progress instance.
393 */
394Progress.prototype.size = function(size) {
395 this._size = size;
396 return this;
397};
398
399/**
400 * Set text to `text`.
401 *
402 * @public
403 * @param {string} text
404 * @return {Progress} Progress instance.
405 */
406Progress.prototype.text = function(text) {
407 this._text = text;
408 return this;
409};
410
411/**
412 * Set font size to `size`.
413 *
414 * @public
415 * @param {number} size
416 * @return {Progress} Progress instance.
417 */
418Progress.prototype.fontSize = function(size) {
419 this._fontSize = size;
420 return this;
421};
422
423/**
424 * Set font to `family`.
425 *
426 * @param {string} family
427 * @return {Progress} Progress instance.
428 */
429Progress.prototype.font = function(family) {
430 this._font = family;
431 return this;
432};
433
434/**
435 * Update percentage to `n`.
436 *
437 * @param {number} n
438 * @return {Progress} Progress instance.
439 */
440Progress.prototype.update = function(n) {
441 this.percent = n;
442 return this;
443};
444
445/**
446 * Draw on `ctx`.
447 *
448 * @param {CanvasRenderingContext2d} ctx
449 * @return {Progress} Progress instance.
450 */
451Progress.prototype.draw = function(ctx) {
452 try {
453 var percent = Math.min(this.percent, 100);
454 var size = this._size;
455 var half = size / 2;
456 var x = half;
457 var y = half;
458 var rad = half - 1;
459 var fontSize = this._fontSize;
460
461 ctx.font = fontSize + 'px ' + this._font;
462
463 var angle = Math.PI * 2 * (percent / 100);
464 ctx.clearRect(0, 0, size, size);
465
466 // outer circle
467 ctx.strokeStyle = '#9f9f9f';
468 ctx.beginPath();
469 ctx.arc(x, y, rad, 0, angle, false);
470 ctx.stroke();
471
472 // inner circle
473 ctx.strokeStyle = '#eee';
474 ctx.beginPath();
475 ctx.arc(x, y, rad - 1, 0, angle, true);
476 ctx.stroke();
477
478 // text
479 var text = this._text || (percent | 0) + '%';
480 var w = ctx.measureText(text).width;
481
482 ctx.fillText(text, x - w / 2 + 1, y + fontSize / 2 - 1);
483 } catch (ignore) {
484 // don't fail if we can't render progress
485 }
486 return this;
487};
488
489},{}],4:[function(require,module,exports){
490(function (global){
491'use strict';
492
493exports.isatty = function isatty() {
494 return true;
495};
496
497exports.getWindowSize = function getWindowSize() {
498 if ('innerHeight' in global) {
499 return [global.innerHeight, global.innerWidth];
500 }
501 // In a Web Worker, the DOM Window is not available.
502 return [640, 480];
503};
504
505}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
506},{}],5:[function(require,module,exports){
507'use strict';
508/**
509 * @module Context
510 */
511/**
512 * Expose `Context`.
513 */
514
515module.exports = Context;
516
517/**
518 * Initialize a new `Context`.
519 *
520 * @private
521 */
522function Context() {}
523
524/**
525 * Set or get the context `Runnable` to `runnable`.
526 *
527 * @private
528 * @param {Runnable} runnable
529 * @return {Context} context
530 */
531Context.prototype.runnable = function(runnable) {
532 if (!arguments.length) {
533 return this._runnable;
534 }
535 this.test = this._runnable = runnable;
536 return this;
537};
538
539/**
540 * Set or get test timeout `ms`.
541 *
542 * @private
543 * @param {number} ms
544 * @return {Context} self
545 */
546Context.prototype.timeout = function(ms) {
547 if (!arguments.length) {
548 return this.runnable().timeout();
549 }
550 this.runnable().timeout(ms);
551 return this;
552};
553
554/**
555 * Set test timeout `enabled`.
556 *
557 * @private
558 * @param {boolean} enabled
559 * @return {Context} self
560 */
561Context.prototype.enableTimeouts = function(enabled) {
562 if (!arguments.length) {
563 return this.runnable().enableTimeouts();
564 }
565 this.runnable().enableTimeouts(enabled);
566 return this;
567};
568
569/**
570 * Set or get test slowness threshold `ms`.
571 *
572 * @private
573 * @param {number} ms
574 * @return {Context} self
575 */
576Context.prototype.slow = function(ms) {
577 if (!arguments.length) {
578 return this.runnable().slow();
579 }
580 this.runnable().slow(ms);
581 return this;
582};
583
584/**
585 * Mark a test as skipped.
586 *
587 * @private
588 * @throws Pending
589 */
590Context.prototype.skip = function() {
591 this.runnable().skip();
592};
593
594/**
595 * Set or get a number of allowed retries on failed tests
596 *
597 * @private
598 * @param {number} n
599 * @return {Context} self
600 */
601Context.prototype.retries = function(n) {
602 if (!arguments.length) {
603 return this.runnable().retries();
604 }
605 this.runnable().retries(n);
606 return this;
607};
608
609},{}],6:[function(require,module,exports){
610'use strict';
611/**
612 * @module Errors
613 */
614/**
615 * Factory functions to create throwable error objects
616 */
617
618/**
619 * Creates an error object to be thrown when no files to be tested could be found using specified pattern.
620 *
621 * @public
622 * @param {string} message - Error message to be displayed.
623 * @param {string} pattern - User-specified argument value.
624 * @returns {Error} instance detailing the error condition
625 */
626function createNoFilesMatchPatternError(message, pattern) {
627 var err = new Error(message);
628 err.code = 'ERR_MOCHA_NO_FILES_MATCH_PATTERN';
629 err.pattern = pattern;
630 return err;
631}
632
633/**
634 * Creates an error object to be thrown when the reporter specified in the options was not found.
635 *
636 * @public
637 * @param {string} message - Error message to be displayed.
638 * @param {string} reporter - User-specified reporter value.
639 * @returns {Error} instance detailing the error condition
640 */
641function createInvalidReporterError(message, reporter) {
642 var err = new TypeError(message);
643 err.code = 'ERR_MOCHA_INVALID_REPORTER';
644 err.reporter = reporter;
645 return err;
646}
647
648/**
649 * Creates an error object to be thrown when the interface specified in the options was not found.
650 *
651 * @public
652 * @param {string} message - Error message to be displayed.
653 * @param {string} ui - User-specified interface value.
654 * @returns {Error} instance detailing the error condition
655 */
656function createInvalidInterfaceError(message, ui) {
657 var err = new Error(message);
658 err.code = 'ERR_MOCHA_INVALID_INTERFACE';
659 err.interface = ui;
660 return err;
661}
662
663/**
664 * Creates an error object to be thrown when a behavior, option, or parameter is unsupported.
665 *
666 * @public
667 * @param {string} message - Error message to be displayed.
668 * @returns {Error} instance detailing the error condition
669 */
670function createUnsupportedError(message) {
671 var err = new Error(message);
672 err.code = 'ERR_MOCHA_UNSUPPORTED';
673 return err;
674}
675
676/**
677 * Creates an error object to be thrown when an argument is missing.
678 *
679 * @public
680 * @param {string} message - Error message to be displayed.
681 * @param {string} argument - Argument name.
682 * @param {string} expected - Expected argument datatype.
683 * @returns {Error} instance detailing the error condition
684 */
685function createMissingArgumentError(message, argument, expected) {
686 return createInvalidArgumentTypeError(message, argument, expected);
687}
688
689/**
690 * Creates an error object to be thrown when an argument did not use the supported type
691 *
692 * @public
693 * @param {string} message - Error message to be displayed.
694 * @param {string} argument - Argument name.
695 * @param {string} expected - Expected argument datatype.
696 * @returns {Error} instance detailing the error condition
697 */
698function createInvalidArgumentTypeError(message, argument, expected) {
699 var err = new TypeError(message);
700 err.code = 'ERR_MOCHA_INVALID_ARG_TYPE';
701 err.argument = argument;
702 err.expected = expected;
703 err.actual = typeof argument;
704 return err;
705}
706
707/**
708 * Creates an error object to be thrown when an argument did not use the supported value
709 *
710 * @public
711 * @param {string} message - Error message to be displayed.
712 * @param {string} argument - Argument name.
713 * @param {string} value - Argument value.
714 * @param {string} [reason] - Why value is invalid.
715 * @returns {Error} instance detailing the error condition
716 */
717function createInvalidArgumentValueError(message, argument, value, reason) {
718 var err = new TypeError(message);
719 err.code = 'ERR_MOCHA_INVALID_ARG_VALUE';
720 err.argument = argument;
721 err.value = value;
722 err.reason = typeof reason !== 'undefined' ? reason : 'is invalid';
723 return err;
724}
725
726/**
727 * Creates an error object to be thrown when an exception was caught, but the `Error` is falsy or undefined.
728 *
729 * @public
730 * @param {string} message - Error message to be displayed.
731 * @returns {Error} instance detailing the error condition
732 */
733function createInvalidExceptionError(message, value) {
734 var err = new Error(message);
735 err.code = 'ERR_MOCHA_INVALID_EXCEPTION';
736 err.valueType = typeof value;
737 err.value = value;
738 return err;
739}
740
741module.exports = {
742 createInvalidArgumentTypeError: createInvalidArgumentTypeError,
743 createInvalidArgumentValueError: createInvalidArgumentValueError,
744 createInvalidExceptionError: createInvalidExceptionError,
745 createInvalidInterfaceError: createInvalidInterfaceError,
746 createInvalidReporterError: createInvalidReporterError,
747 createMissingArgumentError: createMissingArgumentError,
748 createNoFilesMatchPatternError: createNoFilesMatchPatternError,
749 createUnsupportedError: createUnsupportedError
750};
751
752},{}],7:[function(require,module,exports){
753'use strict';
754
755var Runnable = require('./runnable');
756var inherits = require('./utils').inherits;
757
758/**
759 * Expose `Hook`.
760 */
761
762module.exports = Hook;
763
764/**
765 * Initialize a new `Hook` with the given `title` and callback `fn`
766 *
767 * @class
768 * @extends Runnable
769 * @param {String} title
770 * @param {Function} fn
771 */
772function Hook(title, fn) {
773 Runnable.call(this, title, fn);
774 this.type = 'hook';
775}
776
777/**
778 * Inherit from `Runnable.prototype`.
779 */
780inherits(Hook, Runnable);
781
782/**
783 * Get or set the test `err`.
784 *
785 * @memberof Hook
786 * @public
787 * @param {Error} err
788 * @return {Error}
789 */
790Hook.prototype.error = function(err) {
791 if (!arguments.length) {
792 err = this._error;
793 this._error = null;
794 return err;
795 }
796
797 this._error = err;
798};
799
800},{"./runnable":33,"./utils":38}],8:[function(require,module,exports){
801'use strict';
802
803var Test = require('../test');
804var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
805 .EVENT_FILE_PRE_REQUIRE;
806
807/**
808 * BDD-style interface:
809 *
810 * describe('Array', function() {
811 * describe('#indexOf()', function() {
812 * it('should return -1 when not present', function() {
813 * // ...
814 * });
815 *
816 * it('should return the index when present', function() {
817 * // ...
818 * });
819 * });
820 * });
821 *
822 * @param {Suite} suite Root suite.
823 */
824module.exports = function bddInterface(suite) {
825 var suites = [suite];
826
827 suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
828 var common = require('./common')(suites, context, mocha);
829
830 context.before = common.before;
831 context.after = common.after;
832 context.beforeEach = common.beforeEach;
833 context.afterEach = common.afterEach;
834 context.run = mocha.options.delay && common.runWithSuite(suite);
835 /**
836 * Describe a "suite" with the given `title`
837 * and callback `fn` containing nested suites
838 * and/or tests.
839 */
840
841 context.describe = context.context = function(title, fn) {
842 return common.suite.create({
843 title: title,
844 file: file,
845 fn: fn
846 });
847 };
848
849 /**
850 * Pending describe.
851 */
852
853 context.xdescribe = context.xcontext = context.describe.skip = function(
854 title,
855 fn
856 ) {
857 return common.suite.skip({
858 title: title,
859 file: file,
860 fn: fn
861 });
862 };
863
864 /**
865 * Exclusive suite.
866 */
867
868 context.describe.only = function(title, fn) {
869 return common.suite.only({
870 title: title,
871 file: file,
872 fn: fn
873 });
874 };
875
876 /**
877 * Describe a specification or test-case
878 * with the given `title` and callback `fn`
879 * acting as a thunk.
880 */
881
882 context.it = context.specify = function(title, fn) {
883 var suite = suites[0];
884 if (suite.isPending()) {
885 fn = null;
886 }
887 var test = new Test(title, fn);
888 test.file = file;
889 suite.addTest(test);
890 return test;
891 };
892
893 /**
894 * Exclusive test-case.
895 */
896
897 context.it.only = function(title, fn) {
898 return common.test.only(mocha, context.it(title, fn));
899 };
900
901 /**
902 * Pending test case.
903 */
904
905 context.xit = context.xspecify = context.it.skip = function(title) {
906 return context.it(title);
907 };
908
909 /**
910 * Number of attempts to retry.
911 */
912 context.it.retries = function(n) {
913 context.retries(n);
914 };
915 });
916};
917
918module.exports.description = 'BDD or RSpec style [default]';
919
920},{"../suite":36,"../test":37,"./common":9}],9:[function(require,module,exports){
921'use strict';
922
923var Suite = require('../suite');
924var errors = require('../errors');
925var createMissingArgumentError = errors.createMissingArgumentError;
926
927/**
928 * Functions common to more than one interface.
929 *
930 * @param {Suite[]} suites
931 * @param {Context} context
932 * @param {Mocha} mocha
933 * @return {Object} An object containing common functions.
934 */
935module.exports = function(suites, context, mocha) {
936 /**
937 * Check if the suite should be tested.
938 *
939 * @private
940 * @param {Suite} suite - suite to check
941 * @returns {boolean}
942 */
943 function shouldBeTested(suite) {
944 return (
945 !mocha.options.grep ||
946 (mocha.options.grep &&
947 mocha.options.grep.test(suite.fullTitle()) &&
948 !mocha.options.invert)
949 );
950 }
951
952 return {
953 /**
954 * This is only present if flag --delay is passed into Mocha. It triggers
955 * root suite execution.
956 *
957 * @param {Suite} suite The root suite.
958 * @return {Function} A function which runs the root suite
959 */
960 runWithSuite: function runWithSuite(suite) {
961 return function run() {
962 suite.run();
963 };
964 },
965
966 /**
967 * Execute before running tests.
968 *
969 * @param {string} name
970 * @param {Function} fn
971 */
972 before: function(name, fn) {
973 suites[0].beforeAll(name, fn);
974 },
975
976 /**
977 * Execute after running tests.
978 *
979 * @param {string} name
980 * @param {Function} fn
981 */
982 after: function(name, fn) {
983 suites[0].afterAll(name, fn);
984 },
985
986 /**
987 * Execute before each test case.
988 *
989 * @param {string} name
990 * @param {Function} fn
991 */
992 beforeEach: function(name, fn) {
993 suites[0].beforeEach(name, fn);
994 },
995
996 /**
997 * Execute after each test case.
998 *
999 * @param {string} name
1000 * @param {Function} fn
1001 */
1002 afterEach: function(name, fn) {
1003 suites[0].afterEach(name, fn);
1004 },
1005
1006 suite: {
1007 /**
1008 * Create an exclusive Suite; convenience function
1009 * See docstring for create() below.
1010 *
1011 * @param {Object} opts
1012 * @returns {Suite}
1013 */
1014 only: function only(opts) {
1015 opts.isOnly = true;
1016 return this.create(opts);
1017 },
1018
1019 /**
1020 * Create a Suite, but skip it; convenience function
1021 * See docstring for create() below.
1022 *
1023 * @param {Object} opts
1024 * @returns {Suite}
1025 */
1026 skip: function skip(opts) {
1027 opts.pending = true;
1028 return this.create(opts);
1029 },
1030
1031 /**
1032 * Creates a suite.
1033 *
1034 * @param {Object} opts Options
1035 * @param {string} opts.title Title of Suite
1036 * @param {Function} [opts.fn] Suite Function (not always applicable)
1037 * @param {boolean} [opts.pending] Is Suite pending?
1038 * @param {string} [opts.file] Filepath where this Suite resides
1039 * @param {boolean} [opts.isOnly] Is Suite exclusive?
1040 * @returns {Suite}
1041 */
1042 create: function create(opts) {
1043 var suite = Suite.create(suites[0], opts.title);
1044 suite.pending = Boolean(opts.pending);
1045 suite.file = opts.file;
1046 suites.unshift(suite);
1047 if (opts.isOnly) {
1048 if (mocha.options.forbidOnly && shouldBeTested(suite)) {
1049 throw new Error('`.only` forbidden');
1050 }
1051
1052 suite.parent.appendOnlySuite(suite);
1053 }
1054 if (suite.pending) {
1055 if (mocha.options.forbidPending && shouldBeTested(suite)) {
1056 throw new Error('Pending test forbidden');
1057 }
1058 }
1059 if (typeof opts.fn === 'function') {
1060 opts.fn.call(suite);
1061 suites.shift();
1062 } else if (typeof opts.fn === 'undefined' && !suite.pending) {
1063 throw createMissingArgumentError(
1064 'Suite "' +
1065 suite.fullTitle() +
1066 '" was defined but no callback was supplied. ' +
1067 'Supply a callback or explicitly skip the suite.',
1068 'callback',
1069 'function'
1070 );
1071 } else if (!opts.fn && suite.pending) {
1072 suites.shift();
1073 }
1074
1075 return suite;
1076 }
1077 },
1078
1079 test: {
1080 /**
1081 * Exclusive test-case.
1082 *
1083 * @param {Object} mocha
1084 * @param {Function} test
1085 * @returns {*}
1086 */
1087 only: function(mocha, test) {
1088 test.parent.appendOnlyTest(test);
1089 return test;
1090 },
1091
1092 /**
1093 * Pending test case.
1094 *
1095 * @param {string} title
1096 */
1097 skip: function(title) {
1098 context.test(title);
1099 },
1100
1101 /**
1102 * Number of retry attempts
1103 *
1104 * @param {number} n
1105 */
1106 retries: function(n) {
1107 context.retries(n);
1108 }
1109 }
1110 };
1111};
1112
1113},{"../errors":6,"../suite":36}],10:[function(require,module,exports){
1114'use strict';
1115var Suite = require('../suite');
1116var Test = require('../test');
1117
1118/**
1119 * Exports-style (as Node.js module) interface:
1120 *
1121 * exports.Array = {
1122 * '#indexOf()': {
1123 * 'should return -1 when the value is not present': function() {
1124 *
1125 * },
1126 *
1127 * 'should return the correct index when the value is present': function() {
1128 *
1129 * }
1130 * }
1131 * };
1132 *
1133 * @param {Suite} suite Root suite.
1134 */
1135module.exports = function(suite) {
1136 var suites = [suite];
1137
1138 suite.on(Suite.constants.EVENT_FILE_REQUIRE, visit);
1139
1140 function visit(obj, file) {
1141 var suite;
1142 for (var key in obj) {
1143 if (typeof obj[key] === 'function') {
1144 var fn = obj[key];
1145 switch (key) {
1146 case 'before':
1147 suites[0].beforeAll(fn);
1148 break;
1149 case 'after':
1150 suites[0].afterAll(fn);
1151 break;
1152 case 'beforeEach':
1153 suites[0].beforeEach(fn);
1154 break;
1155 case 'afterEach':
1156 suites[0].afterEach(fn);
1157 break;
1158 default:
1159 var test = new Test(key, fn);
1160 test.file = file;
1161 suites[0].addTest(test);
1162 }
1163 } else {
1164 suite = Suite.create(suites[0], key);
1165 suites.unshift(suite);
1166 visit(obj[key], file);
1167 suites.shift();
1168 }
1169 }
1170 }
1171};
1172
1173module.exports.description = 'Node.js module ("exports") style';
1174
1175},{"../suite":36,"../test":37}],11:[function(require,module,exports){
1176'use strict';
1177
1178exports.bdd = require('./bdd');
1179exports.tdd = require('./tdd');
1180exports.qunit = require('./qunit');
1181exports.exports = require('./exports');
1182
1183},{"./bdd":8,"./exports":10,"./qunit":12,"./tdd":13}],12:[function(require,module,exports){
1184'use strict';
1185
1186var Test = require('../test');
1187var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
1188 .EVENT_FILE_PRE_REQUIRE;
1189
1190/**
1191 * QUnit-style interface:
1192 *
1193 * suite('Array');
1194 *
1195 * test('#length', function() {
1196 * var arr = [1,2,3];
1197 * ok(arr.length == 3);
1198 * });
1199 *
1200 * test('#indexOf()', function() {
1201 * var arr = [1,2,3];
1202 * ok(arr.indexOf(1) == 0);
1203 * ok(arr.indexOf(2) == 1);
1204 * ok(arr.indexOf(3) == 2);
1205 * });
1206 *
1207 * suite('String');
1208 *
1209 * test('#length', function() {
1210 * ok('foo'.length == 3);
1211 * });
1212 *
1213 * @param {Suite} suite Root suite.
1214 */
1215module.exports = function qUnitInterface(suite) {
1216 var suites = [suite];
1217
1218 suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
1219 var common = require('./common')(suites, context, mocha);
1220
1221 context.before = common.before;
1222 context.after = common.after;
1223 context.beforeEach = common.beforeEach;
1224 context.afterEach = common.afterEach;
1225 context.run = mocha.options.delay && common.runWithSuite(suite);
1226 /**
1227 * Describe a "suite" with the given `title`.
1228 */
1229
1230 context.suite = function(title) {
1231 if (suites.length > 1) {
1232 suites.shift();
1233 }
1234 return common.suite.create({
1235 title: title,
1236 file: file,
1237 fn: false
1238 });
1239 };
1240
1241 /**
1242 * Exclusive Suite.
1243 */
1244
1245 context.suite.only = function(title) {
1246 if (suites.length > 1) {
1247 suites.shift();
1248 }
1249 return common.suite.only({
1250 title: title,
1251 file: file,
1252 fn: false
1253 });
1254 };
1255
1256 /**
1257 * Describe a specification or test-case
1258 * with the given `title` and callback `fn`
1259 * acting as a thunk.
1260 */
1261
1262 context.test = function(title, fn) {
1263 var test = new Test(title, fn);
1264 test.file = file;
1265 suites[0].addTest(test);
1266 return test;
1267 };
1268
1269 /**
1270 * Exclusive test-case.
1271 */
1272
1273 context.test.only = function(title, fn) {
1274 return common.test.only(mocha, context.test(title, fn));
1275 };
1276
1277 context.test.skip = common.test.skip;
1278 context.test.retries = common.test.retries;
1279 });
1280};
1281
1282module.exports.description = 'QUnit style';
1283
1284},{"../suite":36,"../test":37,"./common":9}],13:[function(require,module,exports){
1285'use strict';
1286
1287var Test = require('../test');
1288var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
1289 .EVENT_FILE_PRE_REQUIRE;
1290
1291/**
1292 * TDD-style interface:
1293 *
1294 * suite('Array', function() {
1295 * suite('#indexOf()', function() {
1296 * suiteSetup(function() {
1297 *
1298 * });
1299 *
1300 * test('should return -1 when not present', function() {
1301 *
1302 * });
1303 *
1304 * test('should return the index when present', function() {
1305 *
1306 * });
1307 *
1308 * suiteTeardown(function() {
1309 *
1310 * });
1311 * });
1312 * });
1313 *
1314 * @param {Suite} suite Root suite.
1315 */
1316module.exports = function(suite) {
1317 var suites = [suite];
1318
1319 suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
1320 var common = require('./common')(suites, context, mocha);
1321
1322 context.setup = common.beforeEach;
1323 context.teardown = common.afterEach;
1324 context.suiteSetup = common.before;
1325 context.suiteTeardown = common.after;
1326 context.run = mocha.options.delay && common.runWithSuite(suite);
1327
1328 /**
1329 * Describe a "suite" with the given `title` and callback `fn` containing
1330 * nested suites and/or tests.
1331 */
1332 context.suite = function(title, fn) {
1333 return common.suite.create({
1334 title: title,
1335 file: file,
1336 fn: fn
1337 });
1338 };
1339
1340 /**
1341 * Pending suite.
1342 */
1343 context.suite.skip = function(title, fn) {
1344 return common.suite.skip({
1345 title: title,
1346 file: file,
1347 fn: fn
1348 });
1349 };
1350
1351 /**
1352 * Exclusive test-case.
1353 */
1354 context.suite.only = function(title, fn) {
1355 return common.suite.only({
1356 title: title,
1357 file: file,
1358 fn: fn
1359 });
1360 };
1361
1362 /**
1363 * Describe a specification or test-case with the given `title` and
1364 * callback `fn` acting as a thunk.
1365 */
1366 context.test = function(title, fn) {
1367 var suite = suites[0];
1368 if (suite.isPending()) {
1369 fn = null;
1370 }
1371 var test = new Test(title, fn);
1372 test.file = file;
1373 suite.addTest(test);
1374 return test;
1375 };
1376
1377 /**
1378 * Exclusive test-case.
1379 */
1380
1381 context.test.only = function(title, fn) {
1382 return common.test.only(mocha, context.test(title, fn));
1383 };
1384
1385 context.test.skip = common.test.skip;
1386 context.test.retries = common.test.retries;
1387 });
1388};
1389
1390module.exports.description =
1391 'traditional "suite"/"test" instead of BDD\'s "describe"/"it"';
1392
1393},{"../suite":36,"../test":37,"./common":9}],14:[function(require,module,exports){
1394(function (process,global){
1395'use strict';
1396
1397/*!
1398 * mocha
1399 * Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
1400 * MIT Licensed
1401 */
1402
1403var escapeRe = require('escape-string-regexp');
1404var path = require('path');
1405var builtinReporters = require('./reporters');
1406var growl = require('./growl');
1407var utils = require('./utils');
1408var mocharc = require('./mocharc.json');
1409var errors = require('./errors');
1410var Suite = require('./suite');
1411var createStatsCollector = require('./stats-collector');
1412var createInvalidReporterError = errors.createInvalidReporterError;
1413var createInvalidInterfaceError = errors.createInvalidInterfaceError;
1414var EVENT_FILE_PRE_REQUIRE = Suite.constants.EVENT_FILE_PRE_REQUIRE;
1415var EVENT_FILE_POST_REQUIRE = Suite.constants.EVENT_FILE_POST_REQUIRE;
1416var EVENT_FILE_REQUIRE = Suite.constants.EVENT_FILE_REQUIRE;
1417var sQuote = utils.sQuote;
1418
1419exports = module.exports = Mocha;
1420
1421/**
1422 * To require local UIs and reporters when running in node.
1423 */
1424
1425if (!process.browser) {
1426 var cwd = process.cwd();
1427 module.paths.push(cwd, path.join(cwd, 'node_modules'));
1428}
1429
1430/**
1431 * Expose internals.
1432 */
1433
1434/**
1435 * @public
1436 * @class utils
1437 * @memberof Mocha
1438 */
1439exports.utils = utils;
1440exports.interfaces = require('./interfaces');
1441/**
1442 * @public
1443 * @memberof Mocha
1444 */
1445exports.reporters = builtinReporters;
1446exports.Runnable = require('./runnable');
1447exports.Context = require('./context');
1448/**
1449 *
1450 * @memberof Mocha
1451 */
1452exports.Runner = require('./runner');
1453exports.Suite = Suite;
1454exports.Hook = require('./hook');
1455exports.Test = require('./test');
1456
1457/**
1458 * Constructs a new Mocha instance with `options`.
1459 *
1460 * @public
1461 * @class Mocha
1462 * @param {Object} [options] - Settings object.
1463 * @param {boolean} [options.allowUncaught] - Propagate uncaught errors?
1464 * @param {boolean} [options.asyncOnly] - Force `done` callback or promise?
1465 * @param {boolean} [options.bail] - Bail after first test failure?
1466 * @param {boolean} [options.checkLeaks] - If true, check leaks.
1467 * @param {boolean} [options.delay] - Delay root suite execution?
1468 * @param {boolean} [options.enableTimeouts] - Enable timeouts?
1469 * @param {string} [options.fgrep] - Test filter given string.
1470 * @param {boolean} [options.forbidOnly] - Tests marked `only` fail the suite?
1471 * @param {boolean} [options.forbidPending] - Pending tests fail the suite?
1472 * @param {boolean} [options.fullStackTrace] - Full stacktrace upon failure?
1473 * @param {string[]} [options.global] - Variables expected in global scope.
1474 * @param {RegExp|string} [options.grep] - Test filter given regular expression.
1475 * @param {boolean} [options.growl] - Enable desktop notifications?
1476 * @param {boolean} [options.hideDiff] - Suppress diffs from failures?
1477 * @param {boolean} [options.ignoreLeaks] - Ignore global leaks?
1478 * @param {boolean} [options.invert] - Invert test filter matches?
1479 * @param {boolean} [options.noHighlighting] - Disable syntax highlighting?
1480 * @param {string} [options.reporter] - Reporter name.
1481 * @param {Object} [options.reporterOption] - Reporter settings object.
1482 * @param {number} [options.retries] - Number of times to retry failed tests.
1483 * @param {number} [options.slow] - Slow threshold value.
1484 * @param {number|string} [options.timeout] - Timeout threshold value.
1485 * @param {string} [options.ui] - Interface name.
1486 * @param {boolean} [options.color] - Color TTY output from reporter?
1487 * @param {boolean} [options.useInlineDiffs] - Use inline diffs?
1488 */
1489function Mocha(options) {
1490 options = utils.assign({}, mocharc, options || {});
1491 this.files = [];
1492 this.options = options;
1493 // root suite
1494 this.suite = new exports.Suite('', new exports.Context(), true);
1495
1496 if ('useColors' in options) {
1497 utils.deprecate(
1498 'useColors is DEPRECATED and will be removed from a future version of Mocha. Instead, use the "color" option'
1499 );
1500 options.color = 'color' in options ? options.color : options.useColors;
1501 }
1502
1503 this.grep(options.grep)
1504 .fgrep(options.fgrep)
1505 .ui(options.ui)
1506 .bail(options.bail)
1507 .reporter(options.reporter, options.reporterOptions)
1508 .useColors(options.color)
1509 .slow(options.slow)
1510 .useInlineDiffs(options.inlineDiffs)
1511 .globals(options.globals);
1512
1513 if ('enableTimeouts' in options) {
1514 utils.deprecate(
1515 'enableTimeouts is DEPRECATED and will be removed from a future version of Mocha. Instead, use "timeout: false" to disable timeouts.'
1516 );
1517 if (options.enableTimeouts === false) {
1518 this.timeout(0);
1519 }
1520 }
1521
1522 // this guard exists because Suite#timeout does not consider `undefined` to be valid input
1523 if (typeof options.timeout !== 'undefined') {
1524 this.timeout(options.timeout === false ? 0 : options.timeout);
1525 }
1526
1527 if ('retries' in options) {
1528 this.retries(options.retries);
1529 }
1530
1531 if ('diff' in options) {
1532 this.hideDiff(!options.diff);
1533 }
1534
1535 [
1536 'allowUncaught',
1537 'asyncOnly',
1538 'checkLeaks',
1539 'delay',
1540 'forbidOnly',
1541 'forbidPending',
1542 'fullTrace',
1543 'growl',
1544 'invert'
1545 ].forEach(function(opt) {
1546 if (options[opt]) {
1547 this[opt]();
1548 }
1549 }, this);
1550}
1551
1552/**
1553 * Enables or disables bailing on the first failure.
1554 *
1555 * @public
1556 * @see {@link https://mochajs.org/#-b---bail|CLI option}
1557 * @param {boolean} [bail=true] - Whether to bail on first error.
1558 * @returns {Mocha} this
1559 * @chainable
1560 */
1561Mocha.prototype.bail = function(bail) {
1562 if (!arguments.length) {
1563 bail = true;
1564 }
1565 this.suite.bail(bail);
1566 return this;
1567};
1568
1569/**
1570 * @summary
1571 * Adds `file` to be loaded for execution.
1572 *
1573 * @description
1574 * Useful for generic setup code that must be included within test suite.
1575 *
1576 * @public
1577 * @see {@link https://mochajs.org/#--file-file|CLI option}
1578 * @param {string} file - Pathname of file to be loaded.
1579 * @returns {Mocha} this
1580 * @chainable
1581 */
1582Mocha.prototype.addFile = function(file) {
1583 this.files.push(file);
1584 return this;
1585};
1586
1587/**
1588 * Sets reporter to `reporter`, defaults to "spec".
1589 *
1590 * @public
1591 * @see {@link https://mochajs.org/#-r---reporter-name|CLI option}
1592 * @see {@link https://mochajs.org/#reporters|Reporters}
1593 * @param {String|Function} reporter - Reporter name or constructor.
1594 * @param {Object} [reporterOptions] - Options used to configure the reporter.
1595 * @returns {Mocha} this
1596 * @chainable
1597 * @throws {Error} if requested reporter cannot be loaded
1598 * @example
1599 *
1600 * // Use XUnit reporter and direct its output to file
1601 * mocha.reporter('xunit', { output: '/path/to/testspec.xunit.xml' });
1602 */
1603Mocha.prototype.reporter = function(reporter, reporterOptions) {
1604 if (typeof reporter === 'function') {
1605 this._reporter = reporter;
1606 } else {
1607 reporter = reporter || 'spec';
1608 var _reporter;
1609 // Try to load a built-in reporter.
1610 if (builtinReporters[reporter]) {
1611 _reporter = builtinReporters[reporter];
1612 }
1613 // Try to load reporters from process.cwd() and node_modules
1614 if (!_reporter) {
1615 try {
1616 _reporter = require(reporter);
1617 } catch (err) {
1618 if (
1619 err.code !== 'MODULE_NOT_FOUND' ||
1620 err.message.indexOf('Cannot find module') !== -1
1621 ) {
1622 // Try to load reporters from a path (absolute or relative)
1623 try {
1624 _reporter = require(path.resolve(process.cwd(), reporter));
1625 } catch (_err) {
1626 _err.code !== 'MODULE_NOT_FOUND' ||
1627 _err.message.indexOf('Cannot find module') !== -1
1628 ? console.warn(sQuote(reporter) + ' reporter not found')
1629 : console.warn(
1630 sQuote(reporter) +
1631 ' reporter blew up with error:\n' +
1632 err.stack
1633 );
1634 }
1635 } else {
1636 console.warn(
1637 sQuote(reporter) + ' reporter blew up with error:\n' + err.stack
1638 );
1639 }
1640 }
1641 }
1642 if (!_reporter) {
1643 throw createInvalidReporterError(
1644 'invalid reporter ' + sQuote(reporter),
1645 reporter
1646 );
1647 }
1648 this._reporter = _reporter;
1649 }
1650 this.options.reporterOptions = reporterOptions;
1651 return this;
1652};
1653
1654/**
1655 * Sets test UI `name`, defaults to "bdd".
1656 *
1657 * @public
1658 * @see {@link https://mochajs.org/#-u---ui-name|CLI option}
1659 * @see {@link https://mochajs.org/#interfaces|Interface DSLs}
1660 * @param {string|Function} [ui=bdd] - Interface name or class.
1661 * @returns {Mocha} this
1662 * @chainable
1663 * @throws {Error} if requested interface cannot be loaded
1664 */
1665Mocha.prototype.ui = function(ui) {
1666 var bindInterface;
1667 if (typeof ui === 'function') {
1668 bindInterface = ui;
1669 } else {
1670 ui = ui || 'bdd';
1671 bindInterface = exports.interfaces[ui];
1672 if (!bindInterface) {
1673 try {
1674 bindInterface = require(ui);
1675 } catch (err) {
1676 throw createInvalidInterfaceError(
1677 'invalid interface ' + sQuote(ui),
1678 ui
1679 );
1680 }
1681 }
1682 }
1683 bindInterface(this.suite);
1684
1685 this.suite.on(EVENT_FILE_PRE_REQUIRE, function(context) {
1686 exports.afterEach = context.afterEach || context.teardown;
1687 exports.after = context.after || context.suiteTeardown;
1688 exports.beforeEach = context.beforeEach || context.setup;
1689 exports.before = context.before || context.suiteSetup;
1690 exports.describe = context.describe || context.suite;
1691 exports.it = context.it || context.test;
1692 exports.xit = context.xit || (context.test && context.test.skip);
1693 exports.setup = context.setup || context.beforeEach;
1694 exports.suiteSetup = context.suiteSetup || context.before;
1695 exports.suiteTeardown = context.suiteTeardown || context.after;
1696 exports.suite = context.suite || context.describe;
1697 exports.teardown = context.teardown || context.afterEach;
1698 exports.test = context.test || context.it;
1699 exports.run = context.run;
1700 });
1701
1702 return this;
1703};
1704
1705/**
1706 * Loads `files` prior to execution.
1707 *
1708 * @description
1709 * The implementation relies on Node's `require` to execute
1710 * the test interface functions and will be subject to its cache.
1711 *
1712 * @private
1713 * @see {@link Mocha#addFile}
1714 * @see {@link Mocha#run}
1715 * @see {@link Mocha#unloadFiles}
1716 * @param {Function} [fn] - Callback invoked upon completion.
1717 */
1718Mocha.prototype.loadFiles = function(fn) {
1719 var self = this;
1720 var suite = this.suite;
1721 this.files.forEach(function(file) {
1722 file = path.resolve(file);
1723 suite.emit(EVENT_FILE_PRE_REQUIRE, global, file, self);
1724 suite.emit(EVENT_FILE_REQUIRE, require(file), file, self);
1725 suite.emit(EVENT_FILE_POST_REQUIRE, global, file, self);
1726 });
1727 fn && fn();
1728};
1729
1730/**
1731 * Removes a previously loaded file from Node's `require` cache.
1732 *
1733 * @private
1734 * @static
1735 * @see {@link Mocha#unloadFiles}
1736 * @param {string} file - Pathname of file to be unloaded.
1737 */
1738Mocha.unloadFile = function(file) {
1739 delete require.cache[require.resolve(file)];
1740};
1741
1742/**
1743 * Unloads `files` from Node's `require` cache.
1744 *
1745 * @description
1746 * This allows files to be "freshly" reloaded, providing the ability
1747 * to reuse a Mocha instance programmatically.
1748 *
1749 * <strong>Intended for consumers &mdash; not used internally</strong>
1750 *
1751 * @public
1752 * @see {@link Mocha.unloadFile}
1753 * @see {@link Mocha#loadFiles}
1754 * @see {@link Mocha#run}
1755 * @returns {Mocha} this
1756 * @chainable
1757 */
1758Mocha.prototype.unloadFiles = function() {
1759 this.files.forEach(Mocha.unloadFile);
1760 return this;
1761};
1762
1763/**
1764 * Sets `grep` filter after escaping RegExp special characters.
1765 *
1766 * @public
1767 * @see {@link Mocha#grep}
1768 * @param {string} str - Value to be converted to a regexp.
1769 * @returns {Mocha} this
1770 * @chainable
1771 * @example
1772 *
1773 * // Select tests whose full title begins with `"foo"` followed by a period
1774 * mocha.fgrep('foo.');
1775 */
1776Mocha.prototype.fgrep = function(str) {
1777 if (!str) {
1778 return this;
1779 }
1780 return this.grep(new RegExp(escapeRe(str)));
1781};
1782
1783/**
1784 * @summary
1785 * Sets `grep` filter used to select specific tests for execution.
1786 *
1787 * @description
1788 * If `re` is a regexp-like string, it will be converted to regexp.
1789 * The regexp is tested against the full title of each test (i.e., the
1790 * name of the test preceded by titles of each its ancestral suites).
1791 * As such, using an <em>exact-match</em> fixed pattern against the
1792 * test name itself will not yield any matches.
1793 * <br>
1794 * <strong>Previous filter value will be overwritten on each call!</strong>
1795 *
1796 * @public
1797 * @see {@link https://mochajs.org/#-g---grep-pattern|CLI option}
1798 * @see {@link Mocha#fgrep}
1799 * @see {@link Mocha#invert}
1800 * @param {RegExp|String} re - Regular expression used to select tests.
1801 * @return {Mocha} this
1802 * @chainable
1803 * @example
1804 *
1805 * // Select tests whose full title contains `"match"`, ignoring case
1806 * mocha.grep(/match/i);
1807 * @example
1808 *
1809 * // Same as above but with regexp-like string argument
1810 * mocha.grep('/match/i');
1811 * @example
1812 *
1813 * // ## Anti-example
1814 * // Given embedded test `it('only-this-test')`...
1815 * mocha.grep('/^only-this-test$/'); // NO! Use `.only()` to do this!
1816 */
1817Mocha.prototype.grep = function(re) {
1818 if (utils.isString(re)) {
1819 // extract args if it's regex-like, i.e: [string, pattern, flag]
1820 var arg = re.match(/^\/(.*)\/(g|i|)$|.*/);
1821 this.options.grep = new RegExp(arg[1] || arg[0], arg[2]);
1822 } else {
1823 this.options.grep = re;
1824 }
1825 return this;
1826};
1827
1828/**
1829 * Inverts `grep` matches.
1830 *
1831 * @public
1832 * @see {@link Mocha#grep}
1833 * @return {Mocha} this
1834 * @chainable
1835 * @example
1836 *
1837 * // Select tests whose full title does *not* contain `"match"`, ignoring case
1838 * mocha.grep(/match/i).invert();
1839 */
1840Mocha.prototype.invert = function() {
1841 this.options.invert = true;
1842 return this;
1843};
1844
1845/**
1846 * Enables or disables ignoring global leaks.
1847 *
1848 * @public
1849 * @see {@link Mocha#checkLeaks}
1850 * @param {boolean} ignoreLeaks - Whether to ignore global leaks.
1851 * @return {Mocha} this
1852 * @chainable
1853 * @example
1854 *
1855 * // Ignore global leaks
1856 * mocha.ignoreLeaks(true);
1857 */
1858Mocha.prototype.ignoreLeaks = function(ignoreLeaks) {
1859 this.options.ignoreLeaks = Boolean(ignoreLeaks);
1860 return this;
1861};
1862
1863/**
1864 * Enables checking for global variables leaked while running tests.
1865 *
1866 * @public
1867 * @see {@link https://mochajs.org/#--check-leaks|CLI option}
1868 * @see {@link Mocha#ignoreLeaks}
1869 * @return {Mocha} this
1870 * @chainable
1871 */
1872Mocha.prototype.checkLeaks = function() {
1873 this.options.ignoreLeaks = false;
1874 return this;
1875};
1876
1877/**
1878 * Displays full stack trace upon test failure.
1879 *
1880 * @public
1881 * @return {Mocha} this
1882 * @chainable
1883 */
1884Mocha.prototype.fullTrace = function() {
1885 this.options.fullStackTrace = true;
1886 return this;
1887};
1888
1889/**
1890 * Enables desktop notification support if prerequisite software installed.
1891 *
1892 * @public
1893 * @see {@link Mocha#isGrowlCapable}
1894 * @see {@link Mocha#_growl}
1895 * @return {Mocha} this
1896 * @chainable
1897 */
1898Mocha.prototype.growl = function() {
1899 this.options.growl = this.isGrowlCapable();
1900 if (!this.options.growl) {
1901 var detail = process.browser
1902 ? 'notification support not available in this browser...'
1903 : 'notification support prerequisites not installed...';
1904 console.error(detail + ' cannot enable!');
1905 }
1906 return this;
1907};
1908
1909/**
1910 * @summary
1911 * Determines if Growl support seems likely.
1912 *
1913 * @description
1914 * <strong>Not available when run in browser.</strong>
1915 *
1916 * @private
1917 * @see {@link Growl#isCapable}
1918 * @see {@link Mocha#growl}
1919 * @return {boolean} whether Growl support can be expected
1920 */
1921Mocha.prototype.isGrowlCapable = growl.isCapable;
1922
1923/**
1924 * Implements desktop notifications using a pseudo-reporter.
1925 *
1926 * @private
1927 * @see {@link Mocha#growl}
1928 * @see {@link Growl#notify}
1929 * @param {Runner} runner - Runner instance.
1930 */
1931Mocha.prototype._growl = growl.notify;
1932
1933/**
1934 * Specifies whitelist of variable names to be expected in global scope.
1935 *
1936 * @public
1937 * @see {@link https://mochajs.org/#--globals-names|CLI option}
1938 * @see {@link Mocha#checkLeaks}
1939 * @param {String[]|String} globals - Accepted global variable name(s).
1940 * @return {Mocha} this
1941 * @chainable
1942 * @example
1943 *
1944 * // Specify variables to be expected in global scope
1945 * mocha.globals(['jQuery', 'MyLib']);
1946 */
1947Mocha.prototype.globals = function(globals) {
1948 this.options.globals = (this.options.globals || [])
1949 .concat(globals)
1950 .filter(Boolean);
1951 return this;
1952};
1953
1954/**
1955 * Enables or disables TTY color output by screen-oriented reporters.
1956 *
1957 * @public
1958 * @param {boolean} colors - Whether to enable color output.
1959 * @return {Mocha} this
1960 * @chainable
1961 */
1962Mocha.prototype.useColors = function(colors) {
1963 if (colors !== undefined) {
1964 this.options.useColors = colors;
1965 }
1966 return this;
1967};
1968
1969/**
1970 * Determines if reporter should use inline diffs (rather than +/-)
1971 * in test failure output.
1972 *
1973 * @public
1974 * @param {boolean} inlineDiffs - Whether to use inline diffs.
1975 * @return {Mocha} this
1976 * @chainable
1977 */
1978Mocha.prototype.useInlineDiffs = function(inlineDiffs) {
1979 this.options.useInlineDiffs = inlineDiffs !== undefined && inlineDiffs;
1980 return this;
1981};
1982
1983/**
1984 * Determines if reporter should include diffs in test failure output.
1985 *
1986 * @public
1987 * @param {boolean} hideDiff - Whether to hide diffs.
1988 * @return {Mocha} this
1989 * @chainable
1990 */
1991Mocha.prototype.hideDiff = function(hideDiff) {
1992 this.options.hideDiff = hideDiff !== undefined && hideDiff;
1993 return this;
1994};
1995
1996/**
1997 * @summary
1998 * Sets timeout threshold value.
1999 *
2000 * @description
2001 * A string argument can use shorthand (such as "2s") and will be converted.
2002 * If the value is `0`, timeouts will be disabled.
2003 *
2004 * @public
2005 * @see {@link https://mochajs.org/#-t---timeout-ms|CLI option}
2006 * @see {@link https://mochajs.org/#--no-timeouts|CLI option}
2007 * @see {@link https://mochajs.org/#timeouts|Timeouts}
2008 * @see {@link Mocha#enableTimeouts}
2009 * @param {number|string} msecs - Timeout threshold value.
2010 * @return {Mocha} this
2011 * @chainable
2012 * @example
2013 *
2014 * // Sets timeout to one second
2015 * mocha.timeout(1000);
2016 * @example
2017 *
2018 * // Same as above but using string argument
2019 * mocha.timeout('1s');
2020 */
2021Mocha.prototype.timeout = function(msecs) {
2022 this.suite.timeout(msecs);
2023 return this;
2024};
2025
2026/**
2027 * Sets the number of times to retry failed tests.
2028 *
2029 * @public
2030 * @see {@link https://mochajs.org/#retry-tests|Retry Tests}
2031 * @param {number} retry - Number of times to retry failed tests.
2032 * @return {Mocha} this
2033 * @chainable
2034 * @example
2035 *
2036 * // Allow any failed test to retry one more time
2037 * mocha.retries(1);
2038 */
2039Mocha.prototype.retries = function(n) {
2040 this.suite.retries(n);
2041 return this;
2042};
2043
2044/**
2045 * Sets slowness threshold value.
2046 *
2047 * @public
2048 * @see {@link https://mochajs.org/#-s---slow-ms|CLI option}
2049 * @param {number} msecs - Slowness threshold value.
2050 * @return {Mocha} this
2051 * @chainable
2052 * @example
2053 *
2054 * // Sets "slow" threshold to half a second
2055 * mocha.slow(500);
2056 * @example
2057 *
2058 * // Same as above but using string argument
2059 * mocha.slow('0.5s');
2060 */
2061Mocha.prototype.slow = function(msecs) {
2062 this.suite.slow(msecs);
2063 return this;
2064};
2065
2066/**
2067 * Enables or disables timeouts.
2068 *
2069 * @public
2070 * @see {@link https://mochajs.org/#-t---timeout-ms|CLI option}
2071 * @see {@link https://mochajs.org/#--no-timeouts|CLI option}
2072 * @param {boolean} enableTimeouts - Whether to enable timeouts.
2073 * @return {Mocha} this
2074 * @chainable
2075 */
2076Mocha.prototype.enableTimeouts = function(enableTimeouts) {
2077 this.suite.enableTimeouts(
2078 arguments.length && enableTimeouts !== undefined ? enableTimeouts : true
2079 );
2080 return this;
2081};
2082
2083/**
2084 * Forces all tests to either accept a `done` callback or return a promise.
2085 *
2086 * @public
2087 * @return {Mocha} this
2088 * @chainable
2089 */
2090Mocha.prototype.asyncOnly = function() {
2091 this.options.asyncOnly = true;
2092 return this;
2093};
2094
2095/**
2096 * Disables syntax highlighting (in browser).
2097 *
2098 * @public
2099 * @return {Mocha} this
2100 * @chainable
2101 */
2102Mocha.prototype.noHighlighting = function() {
2103 this.options.noHighlighting = true;
2104 return this;
2105};
2106
2107/**
2108 * Enables uncaught errors to propagate (in browser).
2109 *
2110 * @public
2111 * @return {Mocha} this
2112 * @chainable
2113 */
2114Mocha.prototype.allowUncaught = function() {
2115 this.options.allowUncaught = true;
2116 return this;
2117};
2118
2119/**
2120 * @summary
2121 * Delays root suite execution.
2122 *
2123 * @description
2124 * Used to perform asynch operations before any suites are run.
2125 *
2126 * @public
2127 * @see {@link https://mochajs.org/#delayed-root-suite|delayed root suite}
2128 * @returns {Mocha} this
2129 * @chainable
2130 */
2131Mocha.prototype.delay = function delay() {
2132 this.options.delay = true;
2133 return this;
2134};
2135
2136/**
2137 * Causes tests marked `only` to fail the suite.
2138 *
2139 * @public
2140 * @returns {Mocha} this
2141 * @chainable
2142 */
2143Mocha.prototype.forbidOnly = function() {
2144 this.options.forbidOnly = true;
2145 return this;
2146};
2147
2148/**
2149 * Causes pending tests and tests marked `skip` to fail the suite.
2150 *
2151 * @public
2152 * @returns {Mocha} this
2153 * @chainable
2154 */
2155Mocha.prototype.forbidPending = function() {
2156 this.options.forbidPending = true;
2157 return this;
2158};
2159
2160/**
2161 * Mocha version as specified by "package.json".
2162 *
2163 * @name Mocha#version
2164 * @type string
2165 * @readonly
2166 */
2167Object.defineProperty(Mocha.prototype, 'version', {
2168 value: require('../package.json').version,
2169 configurable: false,
2170 enumerable: true,
2171 writable: false
2172});
2173
2174/**
2175 * Callback to be invoked when test execution is complete.
2176 *
2177 * @callback DoneCB
2178 * @param {number} failures - Number of failures that occurred.
2179 */
2180
2181/**
2182 * Runs root suite and invokes `fn()` when complete.
2183 *
2184 * @description
2185 * To run tests multiple times (or to run tests in files that are
2186 * already in the `require` cache), make sure to clear them from
2187 * the cache first!
2188 *
2189 * @public
2190 * @see {@link Mocha#loadFiles}
2191 * @see {@link Mocha#unloadFiles}
2192 * @see {@link Runner#run}
2193 * @param {DoneCB} [fn] - Callback invoked when test execution completed.
2194 * @return {Runner} runner instance
2195 */
2196Mocha.prototype.run = function(fn) {
2197 if (this.files.length) {
2198 this.loadFiles();
2199 }
2200 var suite = this.suite;
2201 var options = this.options;
2202 options.files = this.files;
2203 var runner = new exports.Runner(suite, options.delay);
2204 createStatsCollector(runner);
2205 var reporter = new this._reporter(runner, options);
2206 runner.ignoreLeaks = options.ignoreLeaks !== false;
2207 runner.fullStackTrace = options.fullStackTrace;
2208 runner.asyncOnly = options.asyncOnly;
2209 runner.allowUncaught = options.allowUncaught;
2210 runner.forbidOnly = options.forbidOnly;
2211 runner.forbidPending = options.forbidPending;
2212 if (options.grep) {
2213 runner.grep(options.grep, options.invert);
2214 }
2215 if (options.globals) {
2216 runner.globals(options.globals);
2217 }
2218 if (options.growl) {
2219 this._growl(runner);
2220 }
2221 if (options.useColors !== undefined) {
2222 exports.reporters.Base.useColors = options.useColors;
2223 }
2224 exports.reporters.Base.inlineDiffs = options.useInlineDiffs;
2225 exports.reporters.Base.hideDiff = options.hideDiff;
2226
2227 function done(failures) {
2228 fn = fn || utils.noop;
2229 if (reporter.done) {
2230 reporter.done(failures, fn);
2231 } else {
2232 fn(failures);
2233 }
2234 }
2235
2236 return runner.run(done);
2237};
2238
2239}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
2240},{"../package.json":90,"./context":5,"./errors":6,"./growl":2,"./hook":7,"./interfaces":11,"./mocharc.json":15,"./reporters":21,"./runnable":33,"./runner":34,"./stats-collector":35,"./suite":36,"./test":37,"./utils":38,"_process":69,"escape-string-regexp":49,"path":42}],15:[function(require,module,exports){
2241module.exports={
2242 "diff": true,
2243 "extension": ["js"],
2244 "opts": "./test/mocha.opts",
2245 "package": "./package.json",
2246 "reporter": "spec",
2247 "slow": 75,
2248 "timeout": 2000,
2249 "ui": "bdd"
2250}
2251
2252},{}],16:[function(require,module,exports){
2253'use strict';
2254
2255module.exports = Pending;
2256
2257/**
2258 * Initialize a new `Pending` error with the given message.
2259 *
2260 * @param {string} message
2261 */
2262function Pending(message) {
2263 this.message = message;
2264}
2265
2266},{}],17:[function(require,module,exports){
2267(function (process){
2268'use strict';
2269/**
2270 * @module Base
2271 */
2272/**
2273 * Module dependencies.
2274 */
2275
2276var tty = require('tty');
2277var diff = require('diff');
2278var milliseconds = require('ms');
2279var utils = require('../utils');
2280var supportsColor = process.browser ? null : require('supports-color');
2281var constants = require('../runner').constants;
2282var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
2283var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
2284
2285/**
2286 * Expose `Base`.
2287 */
2288
2289exports = module.exports = Base;
2290
2291/**
2292 * Check if both stdio streams are associated with a tty.
2293 */
2294
2295var isatty = tty.isatty(1) && tty.isatty(2);
2296
2297/**
2298 * Enable coloring by default, except in the browser interface.
2299 */
2300
2301exports.useColors =
2302 !process.browser &&
2303 (supportsColor.stdout || process.env.MOCHA_COLORS !== undefined);
2304
2305/**
2306 * Inline diffs instead of +/-
2307 */
2308
2309exports.inlineDiffs = false;
2310
2311/**
2312 * Default color map.
2313 */
2314
2315exports.colors = {
2316 pass: 90,
2317 fail: 31,
2318 'bright pass': 92,
2319 'bright fail': 91,
2320 'bright yellow': 93,
2321 pending: 36,
2322 suite: 0,
2323 'error title': 0,
2324 'error message': 31,
2325 'error stack': 90,
2326 checkmark: 32,
2327 fast: 90,
2328 medium: 33,
2329 slow: 31,
2330 green: 32,
2331 light: 90,
2332 'diff gutter': 90,
2333 'diff added': 32,
2334 'diff removed': 31
2335};
2336
2337/**
2338 * Default symbol map.
2339 */
2340
2341exports.symbols = {
2342 ok: '✓',
2343 err: '✖',
2344 dot: '․',
2345 comma: ',',
2346 bang: '!'
2347};
2348
2349// With node.js on Windows: use symbols available in terminal default fonts
2350if (process.platform === 'win32') {
2351 exports.symbols.ok = '\u221A';
2352 exports.symbols.err = '\u00D7';
2353 exports.symbols.dot = '.';
2354}
2355
2356/**
2357 * Color `str` with the given `type`,
2358 * allowing colors to be disabled,
2359 * as well as user-defined color
2360 * schemes.
2361 *
2362 * @private
2363 * @param {string} type
2364 * @param {string} str
2365 * @return {string}
2366 */
2367var color = (exports.color = function(type, str) {
2368 if (!exports.useColors) {
2369 return String(str);
2370 }
2371 return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m';
2372});
2373
2374/**
2375 * Expose term window size, with some defaults for when stderr is not a tty.
2376 */
2377
2378exports.window = {
2379 width: 75
2380};
2381
2382if (isatty) {
2383 exports.window.width = process.stdout.getWindowSize
2384 ? process.stdout.getWindowSize(1)[0]
2385 : tty.getWindowSize()[1];
2386}
2387
2388/**
2389 * Expose some basic cursor interactions that are common among reporters.
2390 */
2391
2392exports.cursor = {
2393 hide: function() {
2394 isatty && process.stdout.write('\u001b[?25l');
2395 },
2396
2397 show: function() {
2398 isatty && process.stdout.write('\u001b[?25h');
2399 },
2400
2401 deleteLine: function() {
2402 isatty && process.stdout.write('\u001b[2K');
2403 },
2404
2405 beginningOfLine: function() {
2406 isatty && process.stdout.write('\u001b[0G');
2407 },
2408
2409 CR: function() {
2410 if (isatty) {
2411 exports.cursor.deleteLine();
2412 exports.cursor.beginningOfLine();
2413 } else {
2414 process.stdout.write('\r');
2415 }
2416 }
2417};
2418
2419function showDiff(err) {
2420 return (
2421 err &&
2422 err.showDiff !== false &&
2423 sameType(err.actual, err.expected) &&
2424 err.expected !== undefined
2425 );
2426}
2427
2428function stringifyDiffObjs(err) {
2429 if (!utils.isString(err.actual) || !utils.isString(err.expected)) {
2430 err.actual = utils.stringify(err.actual);
2431 err.expected = utils.stringify(err.expected);
2432 }
2433}
2434
2435/**
2436 * Returns a diff between 2 strings with coloured ANSI output.
2437 *
2438 * @description
2439 * The diff will be either inline or unified dependent on the value
2440 * of `Base.inlineDiff`.
2441 *
2442 * @param {string} actual
2443 * @param {string} expected
2444 * @return {string} Diff
2445 */
2446var generateDiff = (exports.generateDiff = function(actual, expected) {
2447 return exports.inlineDiffs
2448 ? inlineDiff(actual, expected)
2449 : unifiedDiff(actual, expected);
2450});
2451
2452/**
2453 * Outputs the given `failures` as a list.
2454 *
2455 * @public
2456 * @memberof Mocha.reporters.Base
2457 * @variation 1
2458 * @param {Object[]} failures - Each is Test instance with corresponding
2459 * Error property
2460 */
2461exports.list = function(failures) {
2462 console.log();
2463 failures.forEach(function(test, i) {
2464 // format
2465 var fmt =
2466 color('error title', ' %s) %s:\n') +
2467 color('error message', ' %s') +
2468 color('error stack', '\n%s\n');
2469
2470 // msg
2471 var msg;
2472 var err = test.err;
2473 var message;
2474 if (err.message && typeof err.message.toString === 'function') {
2475 message = err.message + '';
2476 } else if (typeof err.inspect === 'function') {
2477 message = err.inspect() + '';
2478 } else {
2479 message = '';
2480 }
2481 var stack = err.stack || message;
2482 var index = message ? stack.indexOf(message) : -1;
2483
2484 if (index === -1) {
2485 msg = message;
2486 } else {
2487 index += message.length;
2488 msg = stack.slice(0, index);
2489 // remove msg from stack
2490 stack = stack.slice(index + 1);
2491 }
2492
2493 // uncaught
2494 if (err.uncaught) {
2495 msg = 'Uncaught ' + msg;
2496 }
2497 // explicitly show diff
2498 if (!exports.hideDiff && showDiff(err)) {
2499 stringifyDiffObjs(err);
2500 fmt =
2501 color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n');
2502 var match = message.match(/^([^:]+): expected/);
2503 msg = '\n ' + color('error message', match ? match[1] : msg);
2504
2505 msg += generateDiff(err.actual, err.expected);
2506 }
2507
2508 // indent stack trace
2509 stack = stack.replace(/^/gm, ' ');
2510
2511 // indented test title
2512 var testTitle = '';
2513 test.titlePath().forEach(function(str, index) {
2514 if (index !== 0) {
2515 testTitle += '\n ';
2516 }
2517 for (var i = 0; i < index; i++) {
2518 testTitle += ' ';
2519 }
2520 testTitle += str;
2521 });
2522
2523 console.log(fmt, i + 1, testTitle, msg, stack);
2524 });
2525};
2526
2527/**
2528 * Constructs a new `Base` reporter instance.
2529 *
2530 * @description
2531 * All other reporters generally inherit from this reporter.
2532 *
2533 * @public
2534 * @class
2535 * @memberof Mocha.reporters
2536 * @param {Runner} runner - Instance triggers reporter actions.
2537 * @param {Object} [options] - runner options
2538 */
2539function Base(runner, options) {
2540 var failures = (this.failures = []);
2541
2542 if (!runner) {
2543 throw new TypeError('Missing runner argument');
2544 }
2545 this.options = options || {};
2546 this.runner = runner;
2547 this.stats = runner.stats; // assigned so Reporters keep a closer reference
2548
2549 runner.on(EVENT_TEST_PASS, function(test) {
2550 if (test.duration > test.slow()) {
2551 test.speed = 'slow';
2552 } else if (test.duration > test.slow() / 2) {
2553 test.speed = 'medium';
2554 } else {
2555 test.speed = 'fast';
2556 }
2557 });
2558
2559 runner.on(EVENT_TEST_FAIL, function(test, err) {
2560 if (showDiff(err)) {
2561 stringifyDiffObjs(err);
2562 }
2563 test.err = err;
2564 failures.push(test);
2565 });
2566}
2567
2568/**
2569 * Outputs common epilogue used by many of the bundled reporters.
2570 *
2571 * @public
2572 * @memberof Mocha.reporters.Base
2573 */
2574Base.prototype.epilogue = function() {
2575 var stats = this.stats;
2576 var fmt;
2577
2578 console.log();
2579
2580 // passes
2581 fmt =
2582 color('bright pass', ' ') +
2583 color('green', ' %d passing') +
2584 color('light', ' (%s)');
2585
2586 console.log(fmt, stats.passes || 0, milliseconds(stats.duration));
2587
2588 // pending
2589 if (stats.pending) {
2590 fmt = color('pending', ' ') + color('pending', ' %d pending');
2591
2592 console.log(fmt, stats.pending);
2593 }
2594
2595 // failures
2596 if (stats.failures) {
2597 fmt = color('fail', ' %d failing');
2598
2599 console.log(fmt, stats.failures);
2600
2601 Base.list(this.failures);
2602 console.log();
2603 }
2604
2605 console.log();
2606};
2607
2608/**
2609 * Pads the given `str` to `len`.
2610 *
2611 * @private
2612 * @param {string} str
2613 * @param {string} len
2614 * @return {string}
2615 */
2616function pad(str, len) {
2617 str = String(str);
2618 return Array(len - str.length + 1).join(' ') + str;
2619}
2620
2621/**
2622 * Returns inline diff between 2 strings with coloured ANSI output.
2623 *
2624 * @private
2625 * @param {String} actual
2626 * @param {String} expected
2627 * @return {string} Diff
2628 */
2629function inlineDiff(actual, expected) {
2630 var msg = errorDiff(actual, expected);
2631
2632 // linenos
2633 var lines = msg.split('\n');
2634 if (lines.length > 4) {
2635 var width = String(lines.length).length;
2636 msg = lines
2637 .map(function(str, i) {
2638 return pad(++i, width) + ' |' + ' ' + str;
2639 })
2640 .join('\n');
2641 }
2642
2643 // legend
2644 msg =
2645 '\n' +
2646 color('diff removed', 'actual') +
2647 ' ' +
2648 color('diff added', 'expected') +
2649 '\n\n' +
2650 msg +
2651 '\n';
2652
2653 // indent
2654 msg = msg.replace(/^/gm, ' ');
2655 return msg;
2656}
2657
2658/**
2659 * Returns unified diff between two strings with coloured ANSI output.
2660 *
2661 * @private
2662 * @param {String} actual
2663 * @param {String} expected
2664 * @return {string} The diff.
2665 */
2666function unifiedDiff(actual, expected) {
2667 var indent = ' ';
2668 function cleanUp(line) {
2669 if (line[0] === '+') {
2670 return indent + colorLines('diff added', line);
2671 }
2672 if (line[0] === '-') {
2673 return indent + colorLines('diff removed', line);
2674 }
2675 if (line.match(/@@/)) {
2676 return '--';
2677 }
2678 if (line.match(/\\ No newline/)) {
2679 return null;
2680 }
2681 return indent + line;
2682 }
2683 function notBlank(line) {
2684 return typeof line !== 'undefined' && line !== null;
2685 }
2686 var msg = diff.createPatch('string', actual, expected);
2687 var lines = msg.split('\n').splice(5);
2688 return (
2689 '\n ' +
2690 colorLines('diff added', '+ expected') +
2691 ' ' +
2692 colorLines('diff removed', '- actual') +
2693 '\n\n' +
2694 lines
2695 .map(cleanUp)
2696 .filter(notBlank)
2697 .join('\n')
2698 );
2699}
2700
2701/**
2702 * Returns character diff for `err`.
2703 *
2704 * @private
2705 * @param {String} actual
2706 * @param {String} expected
2707 * @return {string} the diff
2708 */
2709function errorDiff(actual, expected) {
2710 return diff
2711 .diffWordsWithSpace(actual, expected)
2712 .map(function(str) {
2713 if (str.added) {
2714 return colorLines('diff added', str.value);
2715 }
2716 if (str.removed) {
2717 return colorLines('diff removed', str.value);
2718 }
2719 return str.value;
2720 })
2721 .join('');
2722}
2723
2724/**
2725 * Colors lines for `str`, using the color `name`.
2726 *
2727 * @private
2728 * @param {string} name
2729 * @param {string} str
2730 * @return {string}
2731 */
2732function colorLines(name, str) {
2733 return str
2734 .split('\n')
2735 .map(function(str) {
2736 return color(name, str);
2737 })
2738 .join('\n');
2739}
2740
2741/**
2742 * Object#toString reference.
2743 */
2744var objToString = Object.prototype.toString;
2745
2746/**
2747 * Checks that a / b have the same type.
2748 *
2749 * @private
2750 * @param {Object} a
2751 * @param {Object} b
2752 * @return {boolean}
2753 */
2754function sameType(a, b) {
2755 return objToString.call(a) === objToString.call(b);
2756}
2757
2758Base.abstract = true;
2759
2760}).call(this,require('_process'))
2761},{"../runner":34,"../utils":38,"_process":69,"diff":48,"ms":60,"supports-color":42,"tty":4}],18:[function(require,module,exports){
2762'use strict';
2763/**
2764 * @module Doc
2765 */
2766/**
2767 * Module dependencies.
2768 */
2769
2770var Base = require('./base');
2771var utils = require('../utils');
2772var constants = require('../runner').constants;
2773var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
2774var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
2775var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
2776var EVENT_SUITE_END = constants.EVENT_SUITE_END;
2777
2778/**
2779 * Expose `Doc`.
2780 */
2781
2782exports = module.exports = Doc;
2783
2784/**
2785 * Constructs a new `Doc` reporter instance.
2786 *
2787 * @public
2788 * @class
2789 * @memberof Mocha.reporters
2790 * @extends Mocha.reporters.Base
2791 * @param {Runner} runner - Instance triggers reporter actions.
2792 * @param {Object} [options] - runner options
2793 */
2794function Doc(runner, options) {
2795 Base.call(this, runner, options);
2796
2797 var indents = 2;
2798
2799 function indent() {
2800 return Array(indents).join(' ');
2801 }
2802
2803 runner.on(EVENT_SUITE_BEGIN, function(suite) {
2804 if (suite.root) {
2805 return;
2806 }
2807 ++indents;
2808 console.log('%s<section class="suite">', indent());
2809 ++indents;
2810 console.log('%s<h1>%s</h1>', indent(), utils.escape(suite.title));
2811 console.log('%s<dl>', indent());
2812 });
2813
2814 runner.on(EVENT_SUITE_END, function(suite) {
2815 if (suite.root) {
2816 return;
2817 }
2818 console.log('%s</dl>', indent());
2819 --indents;
2820 console.log('%s</section>', indent());
2821 --indents;
2822 });
2823
2824 runner.on(EVENT_TEST_PASS, function(test) {
2825 console.log('%s <dt>%s</dt>', indent(), utils.escape(test.title));
2826 var code = utils.escape(utils.clean(test.body));
2827 console.log('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
2828 });
2829
2830 runner.on(EVENT_TEST_FAIL, function(test, err) {
2831 console.log(
2832 '%s <dt class="error">%s</dt>',
2833 indent(),
2834 utils.escape(test.title)
2835 );
2836 var code = utils.escape(utils.clean(test.body));
2837 console.log(
2838 '%s <dd class="error"><pre><code>%s</code></pre></dd>',
2839 indent(),
2840 code
2841 );
2842 console.log('%s <dd class="error">%s</dd>', indent(), utils.escape(err));
2843 });
2844}
2845
2846Doc.description = 'HTML documentation';
2847
2848},{"../runner":34,"../utils":38,"./base":17}],19:[function(require,module,exports){
2849(function (process){
2850'use strict';
2851/**
2852 * @module Dot
2853 */
2854/**
2855 * Module dependencies.
2856 */
2857
2858var Base = require('./base');
2859var inherits = require('../utils').inherits;
2860var constants = require('../runner').constants;
2861var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
2862var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
2863var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
2864var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
2865var EVENT_RUN_END = constants.EVENT_RUN_END;
2866
2867/**
2868 * Expose `Dot`.
2869 */
2870
2871exports = module.exports = Dot;
2872
2873/**
2874 * Constructs a new `Dot` reporter instance.
2875 *
2876 * @public
2877 * @class
2878 * @memberof Mocha.reporters
2879 * @extends Mocha.reporters.Base
2880 * @param {Runner} runner - Instance triggers reporter actions.
2881 * @param {Object} [options] - runner options
2882 */
2883function Dot(runner, options) {
2884 Base.call(this, runner, options);
2885
2886 var self = this;
2887 var width = (Base.window.width * 0.75) | 0;
2888 var n = -1;
2889
2890 runner.on(EVENT_RUN_BEGIN, function() {
2891 process.stdout.write('\n');
2892 });
2893
2894 runner.on(EVENT_TEST_PENDING, function() {
2895 if (++n % width === 0) {
2896 process.stdout.write('\n ');
2897 }
2898 process.stdout.write(Base.color('pending', Base.symbols.comma));
2899 });
2900
2901 runner.on(EVENT_TEST_PASS, function(test) {
2902 if (++n % width === 0) {
2903 process.stdout.write('\n ');
2904 }
2905 if (test.speed === 'slow') {
2906 process.stdout.write(Base.color('bright yellow', Base.symbols.dot));
2907 } else {
2908 process.stdout.write(Base.color(test.speed, Base.symbols.dot));
2909 }
2910 });
2911
2912 runner.on(EVENT_TEST_FAIL, function() {
2913 if (++n % width === 0) {
2914 process.stdout.write('\n ');
2915 }
2916 process.stdout.write(Base.color('fail', Base.symbols.bang));
2917 });
2918
2919 runner.once(EVENT_RUN_END, function() {
2920 console.log();
2921 self.epilogue();
2922 });
2923}
2924
2925/**
2926 * Inherit from `Base.prototype`.
2927 */
2928inherits(Dot, Base);
2929
2930Dot.description = 'dot matrix representation';
2931
2932}).call(this,require('_process'))
2933},{"../runner":34,"../utils":38,"./base":17,"_process":69}],20:[function(require,module,exports){
2934(function (global){
2935'use strict';
2936
2937/* eslint-env browser */
2938/**
2939 * @module HTML
2940 */
2941/**
2942 * Module dependencies.
2943 */
2944
2945var Base = require('./base');
2946var utils = require('../utils');
2947var Progress = require('../browser/progress');
2948var escapeRe = require('escape-string-regexp');
2949var constants = require('../runner').constants;
2950var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
2951var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
2952var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
2953var EVENT_SUITE_END = constants.EVENT_SUITE_END;
2954var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
2955var escape = utils.escape;
2956
2957/**
2958 * Save timer references to avoid Sinon interfering (see GH-237).
2959 */
2960
2961var Date = global.Date;
2962
2963/**
2964 * Expose `HTML`.
2965 */
2966
2967exports = module.exports = HTML;
2968
2969/**
2970 * Stats template.
2971 */
2972
2973var statsTemplate =
2974 '<ul id="mocha-stats">' +
2975 '<li class="progress"><canvas width="40" height="40"></canvas></li>' +
2976 '<li class="passes"><a href="javascript:void(0);">passes:</a> <em>0</em></li>' +
2977 '<li class="failures"><a href="javascript:void(0);">failures:</a> <em>0</em></li>' +
2978 '<li class="duration">duration: <em>0</em>s</li>' +
2979 '</ul>';
2980
2981var playIcon = '&#x2023;';
2982
2983/**
2984 * Constructs a new `HTML` reporter instance.
2985 *
2986 * @public
2987 * @class
2988 * @memberof Mocha.reporters
2989 * @extends Mocha.reporters.Base
2990 * @param {Runner} runner - Instance triggers reporter actions.
2991 * @param {Object} [options] - runner options
2992 */
2993function HTML(runner, options) {
2994 Base.call(this, runner, options);
2995
2996 var self = this;
2997 var stats = this.stats;
2998 var stat = fragment(statsTemplate);
2999 var items = stat.getElementsByTagName('li');
3000 var passes = items[1].getElementsByTagName('em')[0];
3001 var passesLink = items[1].getElementsByTagName('a')[0];
3002 var failures = items[2].getElementsByTagName('em')[0];
3003 var failuresLink = items[2].getElementsByTagName('a')[0];
3004 var duration = items[3].getElementsByTagName('em')[0];
3005 var canvas = stat.getElementsByTagName('canvas')[0];
3006 var report = fragment('<ul id="mocha-report"></ul>');
3007 var stack = [report];
3008 var progress;
3009 var ctx;
3010 var root = document.getElementById('mocha');
3011
3012 if (canvas.getContext) {
3013 var ratio = window.devicePixelRatio || 1;
3014 canvas.style.width = canvas.width;
3015 canvas.style.height = canvas.height;
3016 canvas.width *= ratio;
3017 canvas.height *= ratio;
3018 ctx = canvas.getContext('2d');
3019 ctx.scale(ratio, ratio);
3020 progress = new Progress();
3021 }
3022
3023 if (!root) {
3024 return error('#mocha div missing, add it to your document');
3025 }
3026
3027 // pass toggle
3028 on(passesLink, 'click', function(evt) {
3029 evt.preventDefault();
3030 unhide();
3031 var name = /pass/.test(report.className) ? '' : ' pass';
3032 report.className = report.className.replace(/fail|pass/g, '') + name;
3033 if (report.className.trim()) {
3034 hideSuitesWithout('test pass');
3035 }
3036 });
3037
3038 // failure toggle
3039 on(failuresLink, 'click', function(evt) {
3040 evt.preventDefault();
3041 unhide();
3042 var name = /fail/.test(report.className) ? '' : ' fail';
3043 report.className = report.className.replace(/fail|pass/g, '') + name;
3044 if (report.className.trim()) {
3045 hideSuitesWithout('test fail');
3046 }
3047 });
3048
3049 root.appendChild(stat);
3050 root.appendChild(report);
3051
3052 if (progress) {
3053 progress.size(40);
3054 }
3055
3056 runner.on(EVENT_SUITE_BEGIN, function(suite) {
3057 if (suite.root) {
3058 return;
3059 }
3060
3061 // suite
3062 var url = self.suiteURL(suite);
3063 var el = fragment(
3064 '<li class="suite"><h1><a href="%s">%s</a></h1></li>',
3065 url,
3066 escape(suite.title)
3067 );
3068
3069 // container
3070 stack[0].appendChild(el);
3071 stack.unshift(document.createElement('ul'));
3072 el.appendChild(stack[0]);
3073 });
3074
3075 runner.on(EVENT_SUITE_END, function(suite) {
3076 if (suite.root) {
3077 updateStats();
3078 return;
3079 }
3080 stack.shift();
3081 });
3082
3083 runner.on(EVENT_TEST_PASS, function(test) {
3084 var url = self.testURL(test);
3085 var markup =
3086 '<li class="test pass %e"><h2>%e<span class="duration">%ems</span> ' +
3087 '<a href="%s" class="replay">' +
3088 playIcon +
3089 '</a></h2></li>';
3090 var el = fragment(markup, test.speed, test.title, test.duration, url);
3091 self.addCodeToggle(el, test.body);
3092 appendToStack(el);
3093 updateStats();
3094 });
3095
3096 runner.on(EVENT_TEST_FAIL, function(test) {
3097 var el = fragment(
3098 '<li class="test fail"><h2>%e <a href="%e" class="replay">' +
3099 playIcon +
3100 '</a></h2></li>',
3101 test.title,
3102 self.testURL(test)
3103 );
3104 var stackString; // Note: Includes leading newline
3105 var message = test.err.toString();
3106
3107 // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we
3108 // check for the result of the stringifying.
3109 if (message === '[object Error]') {
3110 message = test.err.message;
3111 }
3112
3113 if (test.err.stack) {
3114 var indexOfMessage = test.err.stack.indexOf(test.err.message);
3115 if (indexOfMessage === -1) {
3116 stackString = test.err.stack;
3117 } else {
3118 stackString = test.err.stack.substr(
3119 test.err.message.length + indexOfMessage
3120 );
3121 }
3122 } else if (test.err.sourceURL && test.err.line !== undefined) {
3123 // Safari doesn't give you a stack. Let's at least provide a source line.
3124 stackString = '\n(' + test.err.sourceURL + ':' + test.err.line + ')';
3125 }
3126
3127 stackString = stackString || '';
3128
3129 if (test.err.htmlMessage && stackString) {
3130 el.appendChild(
3131 fragment(
3132 '<div class="html-error">%s\n<pre class="error">%e</pre></div>',
3133 test.err.htmlMessage,
3134 stackString
3135 )
3136 );
3137 } else if (test.err.htmlMessage) {
3138 el.appendChild(
3139 fragment('<div class="html-error">%s</div>', test.err.htmlMessage)
3140 );
3141 } else {
3142 el.appendChild(
3143 fragment('<pre class="error">%e%e</pre>', message, stackString)
3144 );
3145 }
3146
3147 self.addCodeToggle(el, test.body);
3148 appendToStack(el);
3149 updateStats();
3150 });
3151
3152 runner.on(EVENT_TEST_PENDING, function(test) {
3153 var el = fragment(
3154 '<li class="test pass pending"><h2>%e</h2></li>',
3155 test.title
3156 );
3157 appendToStack(el);
3158 updateStats();
3159 });
3160
3161 function appendToStack(el) {
3162 // Don't call .appendChild if #mocha-report was already .shift()'ed off the stack.
3163 if (stack[0]) {
3164 stack[0].appendChild(el);
3165 }
3166 }
3167
3168 function updateStats() {
3169 // TODO: add to stats
3170 var percent = ((stats.tests / runner.total) * 100) | 0;
3171 if (progress) {
3172 progress.update(percent).draw(ctx);
3173 }
3174
3175 // update stats
3176 var ms = new Date() - stats.start;
3177 text(passes, stats.passes);
3178 text(failures, stats.failures);
3179 text(duration, (ms / 1000).toFixed(2));
3180 }
3181}
3182
3183/**
3184 * Makes a URL, preserving querystring ("search") parameters.
3185 *
3186 * @param {string} s
3187 * @return {string} A new URL.
3188 */
3189function makeUrl(s) {
3190 var search = window.location.search;
3191
3192 // Remove previous grep query parameter if present
3193 if (search) {
3194 search = search.replace(/[?&]grep=[^&\s]*/g, '').replace(/^&/, '?');
3195 }
3196
3197 return (
3198 window.location.pathname +
3199 (search ? search + '&' : '?') +
3200 'grep=' +
3201 encodeURIComponent(escapeRe(s))
3202 );
3203}
3204
3205/**
3206 * Provide suite URL.
3207 *
3208 * @param {Object} [suite]
3209 */
3210HTML.prototype.suiteURL = function(suite) {
3211 return makeUrl(suite.fullTitle());
3212};
3213
3214/**
3215 * Provide test URL.
3216 *
3217 * @param {Object} [test]
3218 */
3219HTML.prototype.testURL = function(test) {
3220 return makeUrl(test.fullTitle());
3221};
3222
3223/**
3224 * Adds code toggle functionality for the provided test's list element.
3225 *
3226 * @param {HTMLLIElement} el
3227 * @param {string} contents
3228 */
3229HTML.prototype.addCodeToggle = function(el, contents) {
3230 var h2 = el.getElementsByTagName('h2')[0];
3231
3232 on(h2, 'click', function() {
3233 pre.style.display = pre.style.display === 'none' ? 'block' : 'none';
3234 });
3235
3236 var pre = fragment('<pre><code>%e</code></pre>', utils.clean(contents));
3237 el.appendChild(pre);
3238 pre.style.display = 'none';
3239};
3240
3241/**
3242 * Display error `msg`.
3243 *
3244 * @param {string} msg
3245 */
3246function error(msg) {
3247 document.body.appendChild(fragment('<div id="mocha-error">%s</div>', msg));
3248}
3249
3250/**
3251 * Return a DOM fragment from `html`.
3252 *
3253 * @param {string} html
3254 */
3255function fragment(html) {
3256 var args = arguments;
3257 var div = document.createElement('div');
3258 var i = 1;
3259
3260 div.innerHTML = html.replace(/%([se])/g, function(_, type) {
3261 switch (type) {
3262 case 's':
3263 return String(args[i++]);
3264 case 'e':
3265 return escape(args[i++]);
3266 // no default
3267 }
3268 });
3269
3270 return div.firstChild;
3271}
3272
3273/**
3274 * Check for suites that do not have elements
3275 * with `classname`, and hide them.
3276 *
3277 * @param {text} classname
3278 */
3279function hideSuitesWithout(classname) {
3280 var suites = document.getElementsByClassName('suite');
3281 for (var i = 0; i < suites.length; i++) {
3282 var els = suites[i].getElementsByClassName(classname);
3283 if (!els.length) {
3284 suites[i].className += ' hidden';
3285 }
3286 }
3287}
3288
3289/**
3290 * Unhide .hidden suites.
3291 */
3292function unhide() {
3293 var els = document.getElementsByClassName('suite hidden');
3294 for (var i = 0; i < els.length; ++i) {
3295 els[i].className = els[i].className.replace('suite hidden', 'suite');
3296 }
3297}
3298
3299/**
3300 * Set an element's text contents.
3301 *
3302 * @param {HTMLElement} el
3303 * @param {string} contents
3304 */
3305function text(el, contents) {
3306 if (el.textContent) {
3307 el.textContent = contents;
3308 } else {
3309 el.innerText = contents;
3310 }
3311}
3312
3313/**
3314 * Listen on `event` with callback `fn`.
3315 */
3316function on(el, event, fn) {
3317 if (el.addEventListener) {
3318 el.addEventListener(event, fn, false);
3319 } else {
3320 el.attachEvent('on' + event, fn);
3321 }
3322}
3323
3324HTML.browserOnly = true;
3325
3326}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
3327},{"../browser/progress":3,"../runner":34,"../utils":38,"./base":17,"escape-string-regexp":49}],21:[function(require,module,exports){
3328'use strict';
3329
3330// Alias exports to a their normalized format Mocha#reporter to prevent a need
3331// for dynamic (try/catch) requires, which Browserify doesn't handle.
3332exports.Base = exports.base = require('./base');
3333exports.Dot = exports.dot = require('./dot');
3334exports.Doc = exports.doc = require('./doc');
3335exports.TAP = exports.tap = require('./tap');
3336exports.JSON = exports.json = require('./json');
3337exports.HTML = exports.html = require('./html');
3338exports.List = exports.list = require('./list');
3339exports.Min = exports.min = require('./min');
3340exports.Spec = exports.spec = require('./spec');
3341exports.Nyan = exports.nyan = require('./nyan');
3342exports.XUnit = exports.xunit = require('./xunit');
3343exports.Markdown = exports.markdown = require('./markdown');
3344exports.Progress = exports.progress = require('./progress');
3345exports.Landing = exports.landing = require('./landing');
3346exports.JSONStream = exports['json-stream'] = require('./json-stream');
3347
3348},{"./base":17,"./doc":18,"./dot":19,"./html":20,"./json":23,"./json-stream":22,"./landing":24,"./list":25,"./markdown":26,"./min":27,"./nyan":28,"./progress":29,"./spec":30,"./tap":31,"./xunit":32}],22:[function(require,module,exports){
3349(function (process){
3350'use strict';
3351/**
3352 * @module JSONStream
3353 */
3354/**
3355 * Module dependencies.
3356 */
3357
3358var Base = require('./base');
3359var constants = require('../runner').constants;
3360var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
3361var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
3362var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
3363var EVENT_RUN_END = constants.EVENT_RUN_END;
3364
3365/**
3366 * Expose `JSONStream`.
3367 */
3368
3369exports = module.exports = JSONStream;
3370
3371/**
3372 * Constructs a new `JSONStream` reporter instance.
3373 *
3374 * @public
3375 * @class
3376 * @memberof Mocha.reporters
3377 * @extends Mocha.reporters.Base
3378 * @param {Runner} runner - Instance triggers reporter actions.
3379 * @param {Object} [options] - runner options
3380 */
3381function JSONStream(runner, options) {
3382 Base.call(this, runner, options);
3383
3384 var self = this;
3385 var total = runner.total;
3386
3387 runner.once(EVENT_RUN_BEGIN, function() {
3388 writeEvent(['start', {total: total}]);
3389 });
3390
3391 runner.on(EVENT_TEST_PASS, function(test) {
3392 writeEvent(['pass', clean(test)]);
3393 });
3394
3395 runner.on(EVENT_TEST_FAIL, function(test, err) {
3396 test = clean(test);
3397 test.err = err.message;
3398 test.stack = err.stack || null;
3399 writeEvent(['fail', test]);
3400 });
3401
3402 runner.once(EVENT_RUN_END, function() {
3403 writeEvent(['end', self.stats]);
3404 });
3405}
3406
3407/**
3408 * Mocha event to be written to the output stream.
3409 * @typedef {Array} JSONStream~MochaEvent
3410 */
3411
3412/**
3413 * Writes Mocha event to reporter output stream.
3414 *
3415 * @private
3416 * @param {JSONStream~MochaEvent} event - Mocha event to be output.
3417 */
3418function writeEvent(event) {
3419 process.stdout.write(JSON.stringify(event) + '\n');
3420}
3421
3422/**
3423 * Returns an object literal representation of `test`
3424 * free of cyclic properties, etc.
3425 *
3426 * @private
3427 * @param {Test} test - Instance used as data source.
3428 * @return {Object} object containing pared-down test instance data
3429 */
3430function clean(test) {
3431 return {
3432 title: test.title,
3433 fullTitle: test.fullTitle(),
3434 duration: test.duration,
3435 currentRetry: test.currentRetry()
3436 };
3437}
3438
3439JSONStream.description = 'newline delimited JSON events';
3440
3441}).call(this,require('_process'))
3442},{"../runner":34,"./base":17,"_process":69}],23:[function(require,module,exports){
3443(function (process){
3444'use strict';
3445/**
3446 * @module JSON
3447 */
3448/**
3449 * Module dependencies.
3450 */
3451
3452var Base = require('./base');
3453var constants = require('../runner').constants;
3454var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
3455var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
3456var EVENT_TEST_END = constants.EVENT_TEST_END;
3457var EVENT_RUN_END = constants.EVENT_RUN_END;
3458var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
3459
3460/**
3461 * Expose `JSON`.
3462 */
3463
3464exports = module.exports = JSONReporter;
3465
3466/**
3467 * Constructs a new `JSON` reporter instance.
3468 *
3469 * @public
3470 * @class JSON
3471 * @memberof Mocha.reporters
3472 * @extends Mocha.reporters.Base
3473 * @param {Runner} runner - Instance triggers reporter actions.
3474 * @param {Object} [options] - runner options
3475 */
3476function JSONReporter(runner, options) {
3477 Base.call(this, runner, options);
3478
3479 var self = this;
3480 var tests = [];
3481 var pending = [];
3482 var failures = [];
3483 var passes = [];
3484
3485 runner.on(EVENT_TEST_END, function(test) {
3486 tests.push(test);
3487 });
3488
3489 runner.on(EVENT_TEST_PASS, function(test) {
3490 passes.push(test);
3491 });
3492
3493 runner.on(EVENT_TEST_FAIL, function(test) {
3494 failures.push(test);
3495 });
3496
3497 runner.on(EVENT_TEST_PENDING, function(test) {
3498 pending.push(test);
3499 });
3500
3501 runner.once(EVENT_RUN_END, function() {
3502 var obj = {
3503 stats: self.stats,
3504 tests: tests.map(clean),
3505 pending: pending.map(clean),
3506 failures: failures.map(clean),
3507 passes: passes.map(clean)
3508 };
3509
3510 runner.testResults = obj;
3511
3512 process.stdout.write(JSON.stringify(obj, null, 2));
3513 });
3514}
3515
3516/**
3517 * Return a plain-object representation of `test`
3518 * free of cyclic properties etc.
3519 *
3520 * @private
3521 * @param {Object} test
3522 * @return {Object}
3523 */
3524function clean(test) {
3525 var err = test.err || {};
3526 if (err instanceof Error) {
3527 err = errorJSON(err);
3528 }
3529
3530 return {
3531 title: test.title,
3532 fullTitle: test.fullTitle(),
3533 duration: test.duration,
3534 currentRetry: test.currentRetry(),
3535 err: cleanCycles(err)
3536 };
3537}
3538
3539/**
3540 * Replaces any circular references inside `obj` with '[object Object]'
3541 *
3542 * @private
3543 * @param {Object} obj
3544 * @return {Object}
3545 */
3546function cleanCycles(obj) {
3547 var cache = [];
3548 return JSON.parse(
3549 JSON.stringify(obj, function(key, value) {
3550 if (typeof value === 'object' && value !== null) {
3551 if (cache.indexOf(value) !== -1) {
3552 // Instead of going in a circle, we'll print [object Object]
3553 return '' + value;
3554 }
3555 cache.push(value);
3556 }
3557
3558 return value;
3559 })
3560 );
3561}
3562
3563/**
3564 * Transform an Error object into a JSON object.
3565 *
3566 * @private
3567 * @param {Error} err
3568 * @return {Object}
3569 */
3570function errorJSON(err) {
3571 var res = {};
3572 Object.getOwnPropertyNames(err).forEach(function(key) {
3573 res[key] = err[key];
3574 }, err);
3575 return res;
3576}
3577
3578JSONReporter.description = 'single JSON object';
3579
3580}).call(this,require('_process'))
3581},{"../runner":34,"./base":17,"_process":69}],24:[function(require,module,exports){
3582(function (process){
3583'use strict';
3584/**
3585 * @module Landing
3586 */
3587/**
3588 * Module dependencies.
3589 */
3590
3591var Base = require('./base');
3592var inherits = require('../utils').inherits;
3593var constants = require('../runner').constants;
3594var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
3595var EVENT_RUN_END = constants.EVENT_RUN_END;
3596var EVENT_TEST_END = constants.EVENT_TEST_END;
3597var STATE_FAILED = require('../runnable').constants.STATE_FAILED;
3598
3599var cursor = Base.cursor;
3600var color = Base.color;
3601
3602/**
3603 * Expose `Landing`.
3604 */
3605
3606exports = module.exports = Landing;
3607
3608/**
3609 * Airplane color.
3610 */
3611
3612Base.colors.plane = 0;
3613
3614/**
3615 * Airplane crash color.
3616 */
3617
3618Base.colors['plane crash'] = 31;
3619
3620/**
3621 * Runway color.
3622 */
3623
3624Base.colors.runway = 90;
3625
3626/**
3627 * Constructs a new `Landing` reporter instance.
3628 *
3629 * @public
3630 * @class
3631 * @memberof Mocha.reporters
3632 * @extends Mocha.reporters.Base
3633 * @param {Runner} runner - Instance triggers reporter actions.
3634 * @param {Object} [options] - runner options
3635 */
3636function Landing(runner, options) {
3637 Base.call(this, runner, options);
3638
3639 var self = this;
3640 var width = (Base.window.width * 0.75) | 0;
3641 var total = runner.total;
3642 var stream = process.stdout;
3643 var plane = color('plane', '✈');
3644 var crashed = -1;
3645 var n = 0;
3646
3647 function runway() {
3648 var buf = Array(width).join('-');
3649 return ' ' + color('runway', buf);
3650 }
3651
3652 runner.on(EVENT_RUN_BEGIN, function() {
3653 stream.write('\n\n\n ');
3654 cursor.hide();
3655 });
3656
3657 runner.on(EVENT_TEST_END, function(test) {
3658 // check if the plane crashed
3659 var col = crashed === -1 ? ((width * ++n) / total) | 0 : crashed;
3660
3661 // show the crash
3662 if (test.state === STATE_FAILED) {
3663 plane = color('plane crash', '✈');
3664 crashed = col;
3665 }
3666
3667 // render landing strip
3668 stream.write('\u001b[' + (width + 1) + 'D\u001b[2A');
3669 stream.write(runway());
3670 stream.write('\n ');
3671 stream.write(color('runway', Array(col).join('⋅')));
3672 stream.write(plane);
3673 stream.write(color('runway', Array(width - col).join('⋅') + '\n'));
3674 stream.write(runway());
3675 stream.write('\u001b[0m');
3676 });
3677
3678 runner.once(EVENT_RUN_END, function() {
3679 cursor.show();
3680 console.log();
3681 self.epilogue();
3682 });
3683}
3684
3685/**
3686 * Inherit from `Base.prototype`.
3687 */
3688inherits(Landing, Base);
3689
3690Landing.description = 'Unicode landing strip';
3691
3692}).call(this,require('_process'))
3693},{"../runnable":33,"../runner":34,"../utils":38,"./base":17,"_process":69}],25:[function(require,module,exports){
3694(function (process){
3695'use strict';
3696/**
3697 * @module List
3698 */
3699/**
3700 * Module dependencies.
3701 */
3702
3703var Base = require('./base');
3704var inherits = require('../utils').inherits;
3705var constants = require('../runner').constants;
3706var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
3707var EVENT_RUN_END = constants.EVENT_RUN_END;
3708var EVENT_TEST_BEGIN = constants.EVENT_TEST_BEGIN;
3709var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
3710var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
3711var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
3712var color = Base.color;
3713var cursor = Base.cursor;
3714
3715/**
3716 * Expose `List`.
3717 */
3718
3719exports = module.exports = List;
3720
3721/**
3722 * Constructs a new `List` reporter instance.
3723 *
3724 * @public
3725 * @class
3726 * @memberof Mocha.reporters
3727 * @extends Mocha.reporters.Base
3728 * @param {Runner} runner - Instance triggers reporter actions.
3729 * @param {Object} [options] - runner options
3730 */
3731function List(runner, options) {
3732 Base.call(this, runner, options);
3733
3734 var self = this;
3735 var n = 0;
3736
3737 runner.on(EVENT_RUN_BEGIN, function() {
3738 console.log();
3739 });
3740
3741 runner.on(EVENT_TEST_BEGIN, function(test) {
3742 process.stdout.write(color('pass', ' ' + test.fullTitle() + ': '));
3743 });
3744
3745 runner.on(EVENT_TEST_PENDING, function(test) {
3746 var fmt = color('checkmark', ' -') + color('pending', ' %s');
3747 console.log(fmt, test.fullTitle());
3748 });
3749
3750 runner.on(EVENT_TEST_PASS, function(test) {
3751 var fmt =
3752 color('checkmark', ' ' + Base.symbols.ok) +
3753 color('pass', ' %s: ') +
3754 color(test.speed, '%dms');
3755 cursor.CR();
3756 console.log(fmt, test.fullTitle(), test.duration);
3757 });
3758
3759 runner.on(EVENT_TEST_FAIL, function(test) {
3760 cursor.CR();
3761 console.log(color('fail', ' %d) %s'), ++n, test.fullTitle());
3762 });
3763
3764 runner.once(EVENT_RUN_END, self.epilogue.bind(self));
3765}
3766
3767/**
3768 * Inherit from `Base.prototype`.
3769 */
3770inherits(List, Base);
3771
3772List.description = 'like "spec" reporter but flat';
3773
3774}).call(this,require('_process'))
3775},{"../runner":34,"../utils":38,"./base":17,"_process":69}],26:[function(require,module,exports){
3776(function (process){
3777'use strict';
3778/**
3779 * @module Markdown
3780 */
3781/**
3782 * Module dependencies.
3783 */
3784
3785var Base = require('./base');
3786var utils = require('../utils');
3787var constants = require('../runner').constants;
3788var EVENT_RUN_END = constants.EVENT_RUN_END;
3789var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
3790var EVENT_SUITE_END = constants.EVENT_SUITE_END;
3791var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
3792
3793/**
3794 * Constants
3795 */
3796
3797var SUITE_PREFIX = '$';
3798
3799/**
3800 * Expose `Markdown`.
3801 */
3802
3803exports = module.exports = Markdown;
3804
3805/**
3806 * Constructs a new `Markdown` reporter instance.
3807 *
3808 * @public
3809 * @class
3810 * @memberof Mocha.reporters
3811 * @extends Mocha.reporters.Base
3812 * @param {Runner} runner - Instance triggers reporter actions.
3813 * @param {Object} [options] - runner options
3814 */
3815function Markdown(runner, options) {
3816 Base.call(this, runner, options);
3817
3818 var level = 0;
3819 var buf = '';
3820
3821 function title(str) {
3822 return Array(level).join('#') + ' ' + str;
3823 }
3824
3825 function mapTOC(suite, obj) {
3826 var ret = obj;
3827 var key = SUITE_PREFIX + suite.title;
3828
3829 obj = obj[key] = obj[key] || {suite: suite};
3830 suite.suites.forEach(function(suite) {
3831 mapTOC(suite, obj);
3832 });
3833
3834 return ret;
3835 }
3836
3837 function stringifyTOC(obj, level) {
3838 ++level;
3839 var buf = '';
3840 var link;
3841 for (var key in obj) {
3842 if (key === 'suite') {
3843 continue;
3844 }
3845 if (key !== SUITE_PREFIX) {
3846 link = ' - [' + key.substring(1) + ']';
3847 link += '(#' + utils.slug(obj[key].suite.fullTitle()) + ')\n';
3848 buf += Array(level).join(' ') + link;
3849 }
3850 buf += stringifyTOC(obj[key], level);
3851 }
3852 return buf;
3853 }
3854
3855 function generateTOC(suite) {
3856 var obj = mapTOC(suite, {});
3857 return stringifyTOC(obj, 0);
3858 }
3859
3860 generateTOC(runner.suite);
3861
3862 runner.on(EVENT_SUITE_BEGIN, function(suite) {
3863 ++level;
3864 var slug = utils.slug(suite.fullTitle());
3865 buf += '<a name="' + slug + '"></a>' + '\n';
3866 buf += title(suite.title) + '\n';
3867 });
3868
3869 runner.on(EVENT_SUITE_END, function() {
3870 --level;
3871 });
3872
3873 runner.on(EVENT_TEST_PASS, function(test) {
3874 var code = utils.clean(test.body);
3875 buf += test.title + '.\n';
3876 buf += '\n```js\n';
3877 buf += code + '\n';
3878 buf += '```\n\n';
3879 });
3880
3881 runner.once(EVENT_RUN_END, function() {
3882 process.stdout.write('# TOC\n');
3883 process.stdout.write(generateTOC(runner.suite));
3884 process.stdout.write(buf);
3885 });
3886}
3887
3888Markdown.description = 'GitHub Flavored Markdown';
3889
3890}).call(this,require('_process'))
3891},{"../runner":34,"../utils":38,"./base":17,"_process":69}],27:[function(require,module,exports){
3892(function (process){
3893'use strict';
3894/**
3895 * @module Min
3896 */
3897/**
3898 * Module dependencies.
3899 */
3900
3901var Base = require('./base');
3902var inherits = require('../utils').inherits;
3903var constants = require('../runner').constants;
3904var EVENT_RUN_END = constants.EVENT_RUN_END;
3905var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
3906
3907/**
3908 * Expose `Min`.
3909 */
3910
3911exports = module.exports = Min;
3912
3913/**
3914 * Constructs a new `Min` reporter instance.
3915 *
3916 * @description
3917 * This minimal test reporter is best used with '--watch'.
3918 *
3919 * @public
3920 * @class
3921 * @memberof Mocha.reporters
3922 * @extends Mocha.reporters.Base
3923 * @param {Runner} runner - Instance triggers reporter actions.
3924 * @param {Object} [options] - runner options
3925 */
3926function Min(runner, options) {
3927 Base.call(this, runner, options);
3928
3929 runner.on(EVENT_RUN_BEGIN, function() {
3930 // clear screen
3931 process.stdout.write('\u001b[2J');
3932 // set cursor position
3933 process.stdout.write('\u001b[1;3H');
3934 });
3935
3936 runner.once(EVENT_RUN_END, this.epilogue.bind(this));
3937}
3938
3939/**
3940 * Inherit from `Base.prototype`.
3941 */
3942inherits(Min, Base);
3943
3944Min.description = 'essentially just a summary';
3945
3946}).call(this,require('_process'))
3947},{"../runner":34,"../utils":38,"./base":17,"_process":69}],28:[function(require,module,exports){
3948(function (process){
3949'use strict';
3950/**
3951 * @module Nyan
3952 */
3953/**
3954 * Module dependencies.
3955 */
3956
3957var Base = require('./base');
3958var constants = require('../runner').constants;
3959var inherits = require('../utils').inherits;
3960var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
3961var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
3962var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
3963var EVENT_RUN_END = constants.EVENT_RUN_END;
3964var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
3965
3966/**
3967 * Expose `Dot`.
3968 */
3969
3970exports = module.exports = NyanCat;
3971
3972/**
3973 * Constructs a new `Nyan` reporter instance.
3974 *
3975 * @public
3976 * @class Nyan
3977 * @memberof Mocha.reporters
3978 * @extends Mocha.reporters.Base
3979 * @param {Runner} runner - Instance triggers reporter actions.
3980 * @param {Object} [options] - runner options
3981 */
3982function NyanCat(runner, options) {
3983 Base.call(this, runner, options);
3984
3985 var self = this;
3986 var width = (Base.window.width * 0.75) | 0;
3987 var nyanCatWidth = (this.nyanCatWidth = 11);
3988
3989 this.colorIndex = 0;
3990 this.numberOfLines = 4;
3991 this.rainbowColors = self.generateColors();
3992 this.scoreboardWidth = 5;
3993 this.tick = 0;
3994 this.trajectories = [[], [], [], []];
3995 this.trajectoryWidthMax = width - nyanCatWidth;
3996
3997 runner.on(EVENT_RUN_BEGIN, function() {
3998 Base.cursor.hide();
3999 self.draw();
4000 });
4001
4002 runner.on(EVENT_TEST_PENDING, function() {
4003 self.draw();
4004 });
4005
4006 runner.on(EVENT_TEST_PASS, function() {
4007 self.draw();
4008 });
4009
4010 runner.on(EVENT_TEST_FAIL, function() {
4011 self.draw();
4012 });
4013
4014 runner.once(EVENT_RUN_END, function() {
4015 Base.cursor.show();
4016 for (var i = 0; i < self.numberOfLines; i++) {
4017 write('\n');
4018 }
4019 self.epilogue();
4020 });
4021}
4022
4023/**
4024 * Inherit from `Base.prototype`.
4025 */
4026inherits(NyanCat, Base);
4027
4028/**
4029 * Draw the nyan cat
4030 *
4031 * @private
4032 */
4033
4034NyanCat.prototype.draw = function() {
4035 this.appendRainbow();
4036 this.drawScoreboard();
4037 this.drawRainbow();
4038 this.drawNyanCat();
4039 this.tick = !this.tick;
4040};
4041
4042/**
4043 * Draw the "scoreboard" showing the number
4044 * of passes, failures and pending tests.
4045 *
4046 * @private
4047 */
4048
4049NyanCat.prototype.drawScoreboard = function() {
4050 var stats = this.stats;
4051
4052 function draw(type, n) {
4053 write(' ');
4054 write(Base.color(type, n));
4055 write('\n');
4056 }
4057
4058 draw('green', stats.passes);
4059 draw('fail', stats.failures);
4060 draw('pending', stats.pending);
4061 write('\n');
4062
4063 this.cursorUp(this.numberOfLines);
4064};
4065
4066/**
4067 * Append the rainbow.
4068 *
4069 * @private
4070 */
4071
4072NyanCat.prototype.appendRainbow = function() {
4073 var segment = this.tick ? '_' : '-';
4074 var rainbowified = this.rainbowify(segment);
4075
4076 for (var index = 0; index < this.numberOfLines; index++) {
4077 var trajectory = this.trajectories[index];
4078 if (trajectory.length >= this.trajectoryWidthMax) {
4079 trajectory.shift();
4080 }
4081 trajectory.push(rainbowified);
4082 }
4083};
4084
4085/**
4086 * Draw the rainbow.
4087 *
4088 * @private
4089 */
4090
4091NyanCat.prototype.drawRainbow = function() {
4092 var self = this;
4093
4094 this.trajectories.forEach(function(line) {
4095 write('\u001b[' + self.scoreboardWidth + 'C');
4096 write(line.join(''));
4097 write('\n');
4098 });
4099
4100 this.cursorUp(this.numberOfLines);
4101};
4102
4103/**
4104 * Draw the nyan cat
4105 *
4106 * @private
4107 */
4108NyanCat.prototype.drawNyanCat = function() {
4109 var self = this;
4110 var startWidth = this.scoreboardWidth + this.trajectories[0].length;
4111 var dist = '\u001b[' + startWidth + 'C';
4112 var padding = '';
4113
4114 write(dist);
4115 write('_,------,');
4116 write('\n');
4117
4118 write(dist);
4119 padding = self.tick ? ' ' : ' ';
4120 write('_|' + padding + '/\\_/\\ ');
4121 write('\n');
4122
4123 write(dist);
4124 padding = self.tick ? '_' : '__';
4125 var tail = self.tick ? '~' : '^';
4126 write(tail + '|' + padding + this.face() + ' ');
4127 write('\n');
4128
4129 write(dist);
4130 padding = self.tick ? ' ' : ' ';
4131 write(padding + '"" "" ');
4132 write('\n');
4133
4134 this.cursorUp(this.numberOfLines);
4135};
4136
4137/**
4138 * Draw nyan cat face.
4139 *
4140 * @private
4141 * @return {string}
4142 */
4143
4144NyanCat.prototype.face = function() {
4145 var stats = this.stats;
4146 if (stats.failures) {
4147 return '( x .x)';
4148 } else if (stats.pending) {
4149 return '( o .o)';
4150 } else if (stats.passes) {
4151 return '( ^ .^)';
4152 }
4153 return '( - .-)';
4154};
4155
4156/**
4157 * Move cursor up `n`.
4158 *
4159 * @private
4160 * @param {number} n
4161 */
4162
4163NyanCat.prototype.cursorUp = function(n) {
4164 write('\u001b[' + n + 'A');
4165};
4166
4167/**
4168 * Move cursor down `n`.
4169 *
4170 * @private
4171 * @param {number} n
4172 */
4173
4174NyanCat.prototype.cursorDown = function(n) {
4175 write('\u001b[' + n + 'B');
4176};
4177
4178/**
4179 * Generate rainbow colors.
4180 *
4181 * @private
4182 * @return {Array}
4183 */
4184NyanCat.prototype.generateColors = function() {
4185 var colors = [];
4186
4187 for (var i = 0; i < 6 * 7; i++) {
4188 var pi3 = Math.floor(Math.PI / 3);
4189 var n = i * (1.0 / 6);
4190 var r = Math.floor(3 * Math.sin(n) + 3);
4191 var g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3);
4192 var b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3);
4193 colors.push(36 * r + 6 * g + b + 16);
4194 }
4195
4196 return colors;
4197};
4198
4199/**
4200 * Apply rainbow to the given `str`.
4201 *
4202 * @private
4203 * @param {string} str
4204 * @return {string}
4205 */
4206NyanCat.prototype.rainbowify = function(str) {
4207 if (!Base.useColors) {
4208 return str;
4209 }
4210 var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length];
4211 this.colorIndex += 1;
4212 return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m';
4213};
4214
4215/**
4216 * Stdout helper.
4217 *
4218 * @param {string} string A message to write to stdout.
4219 */
4220function write(string) {
4221 process.stdout.write(string);
4222}
4223
4224NyanCat.description = '"nyan cat"';
4225
4226}).call(this,require('_process'))
4227},{"../runner":34,"../utils":38,"./base":17,"_process":69}],29:[function(require,module,exports){
4228(function (process){
4229'use strict';
4230/**
4231 * @module Progress
4232 */
4233/**
4234 * Module dependencies.
4235 */
4236
4237var Base = require('./base');
4238var constants = require('../runner').constants;
4239var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
4240var EVENT_TEST_END = constants.EVENT_TEST_END;
4241var EVENT_RUN_END = constants.EVENT_RUN_END;
4242var inherits = require('../utils').inherits;
4243var color = Base.color;
4244var cursor = Base.cursor;
4245
4246/**
4247 * Expose `Progress`.
4248 */
4249
4250exports = module.exports = Progress;
4251
4252/**
4253 * General progress bar color.
4254 */
4255
4256Base.colors.progress = 90;
4257
4258/**
4259 * Constructs a new `Progress` reporter instance.
4260 *
4261 * @public
4262 * @class
4263 * @memberof Mocha.reporters
4264 * @extends Mocha.reporters.Base
4265 * @param {Runner} runner - Instance triggers reporter actions.
4266 * @param {Object} [options] - runner options
4267 */
4268function Progress(runner, options) {
4269 Base.call(this, runner, options);
4270
4271 var self = this;
4272 var width = (Base.window.width * 0.5) | 0;
4273 var total = runner.total;
4274 var complete = 0;
4275 var lastN = -1;
4276
4277 // default chars
4278 options = options || {};
4279 var reporterOptions = options.reporterOptions || {};
4280
4281 options.open = reporterOptions.open || '[';
4282 options.complete = reporterOptions.complete || '▬';
4283 options.incomplete = reporterOptions.incomplete || Base.symbols.dot;
4284 options.close = reporterOptions.close || ']';
4285 options.verbose = reporterOptions.verbose || false;
4286
4287 // tests started
4288 runner.on(EVENT_RUN_BEGIN, function() {
4289 console.log();
4290 cursor.hide();
4291 });
4292
4293 // tests complete
4294 runner.on(EVENT_TEST_END, function() {
4295 complete++;
4296
4297 var percent = complete / total;
4298 var n = (width * percent) | 0;
4299 var i = width - n;
4300
4301 if (n === lastN && !options.verbose) {
4302 // Don't re-render the line if it hasn't changed
4303 return;
4304 }
4305 lastN = n;
4306
4307 cursor.CR();
4308 process.stdout.write('\u001b[J');
4309 process.stdout.write(color('progress', ' ' + options.open));
4310 process.stdout.write(Array(n).join(options.complete));
4311 process.stdout.write(Array(i).join(options.incomplete));
4312 process.stdout.write(color('progress', options.close));
4313 if (options.verbose) {
4314 process.stdout.write(color('progress', ' ' + complete + ' of ' + total));
4315 }
4316 });
4317
4318 // tests are complete, output some stats
4319 // and the failures if any
4320 runner.once(EVENT_RUN_END, function() {
4321 cursor.show();
4322 console.log();
4323 self.epilogue();
4324 });
4325}
4326
4327/**
4328 * Inherit from `Base.prototype`.
4329 */
4330inherits(Progress, Base);
4331
4332Progress.description = 'a progress bar';
4333
4334}).call(this,require('_process'))
4335},{"../runner":34,"../utils":38,"./base":17,"_process":69}],30:[function(require,module,exports){
4336'use strict';
4337/**
4338 * @module Spec
4339 */
4340/**
4341 * Module dependencies.
4342 */
4343
4344var Base = require('./base');
4345var constants = require('../runner').constants;
4346var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
4347var EVENT_RUN_END = constants.EVENT_RUN_END;
4348var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
4349var EVENT_SUITE_END = constants.EVENT_SUITE_END;
4350var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
4351var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
4352var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
4353var inherits = require('../utils').inherits;
4354var color = Base.color;
4355
4356/**
4357 * Expose `Spec`.
4358 */
4359
4360exports = module.exports = Spec;
4361
4362/**
4363 * Constructs a new `Spec` reporter instance.
4364 *
4365 * @public
4366 * @class
4367 * @memberof Mocha.reporters
4368 * @extends Mocha.reporters.Base
4369 * @param {Runner} runner - Instance triggers reporter actions.
4370 * @param {Object} [options] - runner options
4371 */
4372function Spec(runner, options) {
4373 Base.call(this, runner, options);
4374
4375 var self = this;
4376 var indents = 0;
4377 var n = 0;
4378
4379 function indent() {
4380 return Array(indents).join(' ');
4381 }
4382
4383 runner.on(EVENT_RUN_BEGIN, function() {
4384 console.log();
4385 });
4386
4387 runner.on(EVENT_SUITE_BEGIN, function(suite) {
4388 ++indents;
4389 console.log(color('suite', '%s%s'), indent(), suite.title);
4390 });
4391
4392 runner.on(EVENT_SUITE_END, function() {
4393 --indents;
4394 if (indents === 1) {
4395 console.log();
4396 }
4397 });
4398
4399 runner.on(EVENT_TEST_PENDING, function(test) {
4400 var fmt = indent() + color('pending', ' - %s');
4401 console.log(fmt, test.title);
4402 });
4403
4404 runner.on(EVENT_TEST_PASS, function(test) {
4405 var fmt;
4406 if (test.speed === 'fast') {
4407 fmt =
4408 indent() +
4409 color('checkmark', ' ' + Base.symbols.ok) +
4410 color('pass', ' %s');
4411 console.log(fmt, test.title);
4412 } else {
4413 fmt =
4414 indent() +
4415 color('checkmark', ' ' + Base.symbols.ok) +
4416 color('pass', ' %s') +
4417 color(test.speed, ' (%dms)');
4418 console.log(fmt, test.title, test.duration);
4419 }
4420 });
4421
4422 runner.on(EVENT_TEST_FAIL, function(test) {
4423 console.log(indent() + color('fail', ' %d) %s'), ++n, test.title);
4424 });
4425
4426 runner.once(EVENT_RUN_END, self.epilogue.bind(self));
4427}
4428
4429/**
4430 * Inherit from `Base.prototype`.
4431 */
4432inherits(Spec, Base);
4433
4434Spec.description = 'hierarchical & verbose [default]';
4435
4436},{"../runner":34,"../utils":38,"./base":17}],31:[function(require,module,exports){
4437(function (process){
4438'use strict';
4439/**
4440 * @module TAP
4441 */
4442/**
4443 * Module dependencies.
4444 */
4445
4446var util = require('util');
4447var Base = require('./base');
4448var constants = require('../runner').constants;
4449var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
4450var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
4451var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
4452var EVENT_RUN_END = constants.EVENT_RUN_END;
4453var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
4454var EVENT_TEST_END = constants.EVENT_TEST_END;
4455var inherits = require('../utils').inherits;
4456var sprintf = util.format;
4457
4458/**
4459 * Expose `TAP`.
4460 */
4461
4462exports = module.exports = TAP;
4463
4464/**
4465 * Constructs a new `TAP` reporter instance.
4466 *
4467 * @public
4468 * @class
4469 * @memberof Mocha.reporters
4470 * @extends Mocha.reporters.Base
4471 * @param {Runner} runner - Instance triggers reporter actions.
4472 * @param {Object} [options] - runner options
4473 */
4474function TAP(runner, options) {
4475 Base.call(this, runner, options);
4476
4477 var self = this;
4478 var n = 1;
4479
4480 var tapVersion = '12';
4481 if (options && options.reporterOptions) {
4482 if (options.reporterOptions.tapVersion) {
4483 tapVersion = options.reporterOptions.tapVersion.toString();
4484 }
4485 }
4486
4487 this._producer = createProducer(tapVersion);
4488
4489 runner.once(EVENT_RUN_BEGIN, function() {
4490 var ntests = runner.grepTotal(runner.suite);
4491 self._producer.writeVersion();
4492 self._producer.writePlan(ntests);
4493 });
4494
4495 runner.on(EVENT_TEST_END, function() {
4496 ++n;
4497 });
4498
4499 runner.on(EVENT_TEST_PENDING, function(test) {
4500 self._producer.writePending(n, test);
4501 });
4502
4503 runner.on(EVENT_TEST_PASS, function(test) {
4504 self._producer.writePass(n, test);
4505 });
4506
4507 runner.on(EVENT_TEST_FAIL, function(test, err) {
4508 self._producer.writeFail(n, test, err);
4509 });
4510
4511 runner.once(EVENT_RUN_END, function() {
4512 self._producer.writeEpilogue(runner.stats);
4513 });
4514}
4515
4516/**
4517 * Inherit from `Base.prototype`.
4518 */
4519inherits(TAP, Base);
4520
4521/**
4522 * Returns a TAP-safe title of `test`.
4523 *
4524 * @private
4525 * @param {Test} test - Test instance.
4526 * @return {String} title with any hash character removed
4527 */
4528function title(test) {
4529 return test.fullTitle().replace(/#/g, '');
4530}
4531
4532/**
4533 * Writes newline-terminated formatted string to reporter output stream.
4534 *
4535 * @private
4536 * @param {string} format - `printf`-like format string
4537 * @param {...*} [varArgs] - Format string arguments
4538 */
4539function println(format, varArgs) {
4540 var vargs = Array.from(arguments);
4541 vargs[0] += '\n';
4542 process.stdout.write(sprintf.apply(null, vargs));
4543}
4544
4545/**
4546 * Returns a `tapVersion`-appropriate TAP producer instance, if possible.
4547 *
4548 * @private
4549 * @param {string} tapVersion - Version of TAP specification to produce.
4550 * @returns {TAPProducer} specification-appropriate instance
4551 * @throws {Error} if specification version has no associated producer.
4552 */
4553function createProducer(tapVersion) {
4554 var producers = {
4555 '12': new TAP12Producer(),
4556 '13': new TAP13Producer()
4557 };
4558 var producer = producers[tapVersion];
4559
4560 if (!producer) {
4561 throw new Error(
4562 'invalid or unsupported TAP version: ' + JSON.stringify(tapVersion)
4563 );
4564 }
4565
4566 return producer;
4567}
4568
4569/**
4570 * @summary
4571 * Constructs a new TAPProducer.
4572 *
4573 * @description
4574 * <em>Only</em> to be used as an abstract base class.
4575 *
4576 * @private
4577 * @constructor
4578 */
4579function TAPProducer() {}
4580
4581/**
4582 * Writes the TAP version to reporter output stream.
4583 *
4584 * @abstract
4585 */
4586TAPProducer.prototype.writeVersion = function() {};
4587
4588/**
4589 * Writes the plan to reporter output stream.
4590 *
4591 * @abstract
4592 * @param {number} ntests - Number of tests that are planned to run.
4593 */
4594TAPProducer.prototype.writePlan = function(ntests) {
4595 println('%d..%d', 1, ntests);
4596};
4597
4598/**
4599 * Writes that test passed to reporter output stream.
4600 *
4601 * @abstract
4602 * @param {number} n - Index of test that passed.
4603 * @param {Test} test - Instance containing test information.
4604 */
4605TAPProducer.prototype.writePass = function(n, test) {
4606 println('ok %d %s', n, title(test));
4607};
4608
4609/**
4610 * Writes that test was skipped to reporter output stream.
4611 *
4612 * @abstract
4613 * @param {number} n - Index of test that was skipped.
4614 * @param {Test} test - Instance containing test information.
4615 */
4616TAPProducer.prototype.writePending = function(n, test) {
4617 println('ok %d %s # SKIP -', n, title(test));
4618};
4619
4620/**
4621 * Writes that test failed to reporter output stream.
4622 *
4623 * @abstract
4624 * @param {number} n - Index of test that failed.
4625 * @param {Test} test - Instance containing test information.
4626 * @param {Error} err - Reason the test failed.
4627 */
4628TAPProducer.prototype.writeFail = function(n, test, err) {
4629 println('not ok %d %s', n, title(test));
4630};
4631
4632/**
4633 * Writes the summary epilogue to reporter output stream.
4634 *
4635 * @abstract
4636 * @param {Object} stats - Object containing run statistics.
4637 */
4638TAPProducer.prototype.writeEpilogue = function(stats) {
4639 // :TBD: Why is this not counting pending tests?
4640 println('# tests ' + (stats.passes + stats.failures));
4641 println('# pass ' + stats.passes);
4642 // :TBD: Why are we not showing pending results?
4643 println('# fail ' + stats.failures);
4644};
4645
4646/**
4647 * @summary
4648 * Constructs a new TAP12Producer.
4649 *
4650 * @description
4651 * Produces output conforming to the TAP12 specification.
4652 *
4653 * @private
4654 * @constructor
4655 * @extends TAPProducer
4656 * @see {@link https://testanything.org/tap-specification.html|Specification}
4657 */
4658function TAP12Producer() {
4659 /**
4660 * Writes that test failed to reporter output stream, with error formatting.
4661 * @override
4662 */
4663 this.writeFail = function(n, test, err) {
4664 TAPProducer.prototype.writeFail.call(this, n, test, err);
4665 if (err.message) {
4666 println(err.message.replace(/^/gm, ' '));
4667 }
4668 if (err.stack) {
4669 println(err.stack.replace(/^/gm, ' '));
4670 }
4671 };
4672}
4673
4674/**
4675 * Inherit from `TAPProducer.prototype`.
4676 */
4677inherits(TAP12Producer, TAPProducer);
4678
4679/**
4680 * @summary
4681 * Constructs a new TAP13Producer.
4682 *
4683 * @description
4684 * Produces output conforming to the TAP13 specification.
4685 *
4686 * @private
4687 * @constructor
4688 * @extends TAPProducer
4689 * @see {@link https://testanything.org/tap-version-13-specification.html|Specification}
4690 */
4691function TAP13Producer() {
4692 /**
4693 * Writes the TAP version to reporter output stream.
4694 * @override
4695 */
4696 this.writeVersion = function() {
4697 println('TAP version 13');
4698 };
4699
4700 /**
4701 * Writes that test failed to reporter output stream, with error formatting.
4702 * @override
4703 */
4704 this.writeFail = function(n, test, err) {
4705 TAPProducer.prototype.writeFail.call(this, n, test, err);
4706 var emitYamlBlock = err.message != null || err.stack != null;
4707 if (emitYamlBlock) {
4708 println(indent(1) + '---');
4709 if (err.message) {
4710 println(indent(2) + 'message: |-');
4711 println(err.message.replace(/^/gm, indent(3)));
4712 }
4713 if (err.stack) {
4714 println(indent(2) + 'stack: |-');
4715 println(err.stack.replace(/^/gm, indent(3)));
4716 }
4717 println(indent(1) + '...');
4718 }
4719 };
4720
4721 function indent(level) {
4722 return Array(level + 1).join(' ');
4723 }
4724}
4725
4726/**
4727 * Inherit from `TAPProducer.prototype`.
4728 */
4729inherits(TAP13Producer, TAPProducer);
4730
4731TAP.description = 'TAP-compatible output';
4732
4733}).call(this,require('_process'))
4734},{"../runner":34,"../utils":38,"./base":17,"_process":69,"util":89}],32:[function(require,module,exports){
4735(function (process,global){
4736'use strict';
4737/**
4738 * @module XUnit
4739 */
4740/**
4741 * Module dependencies.
4742 */
4743
4744var Base = require('./base');
4745var utils = require('../utils');
4746var fs = require('fs');
4747var mkdirp = require('mkdirp');
4748var path = require('path');
4749var errors = require('../errors');
4750var createUnsupportedError = errors.createUnsupportedError;
4751var constants = require('../runner').constants;
4752var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
4753var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
4754var EVENT_RUN_END = constants.EVENT_RUN_END;
4755var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
4756var STATE_FAILED = require('../runnable').constants.STATE_FAILED;
4757var inherits = utils.inherits;
4758var escape = utils.escape;
4759
4760/**
4761 * Save timer references to avoid Sinon interfering (see GH-237).
4762 */
4763var Date = global.Date;
4764
4765/**
4766 * Expose `XUnit`.
4767 */
4768
4769exports = module.exports = XUnit;
4770
4771/**
4772 * Constructs a new `XUnit` reporter instance.
4773 *
4774 * @public
4775 * @class
4776 * @memberof Mocha.reporters
4777 * @extends Mocha.reporters.Base
4778 * @param {Runner} runner - Instance triggers reporter actions.
4779 * @param {Object} [options] - runner options
4780 */
4781function XUnit(runner, options) {
4782 Base.call(this, runner, options);
4783
4784 var stats = this.stats;
4785 var tests = [];
4786 var self = this;
4787
4788 // the name of the test suite, as it will appear in the resulting XML file
4789 var suiteName;
4790
4791 // the default name of the test suite if none is provided
4792 var DEFAULT_SUITE_NAME = 'Mocha Tests';
4793
4794 if (options && options.reporterOptions) {
4795 if (options.reporterOptions.output) {
4796 if (!fs.createWriteStream) {
4797 throw createUnsupportedError('file output not supported in browser');
4798 }
4799
4800 mkdirp.sync(path.dirname(options.reporterOptions.output));
4801 self.fileStream = fs.createWriteStream(options.reporterOptions.output);
4802 }
4803
4804 // get the suite name from the reporter options (if provided)
4805 suiteName = options.reporterOptions.suiteName;
4806 }
4807
4808 // fall back to the default suite name
4809 suiteName = suiteName || DEFAULT_SUITE_NAME;
4810
4811 runner.on(EVENT_TEST_PENDING, function(test) {
4812 tests.push(test);
4813 });
4814
4815 runner.on(EVENT_TEST_PASS, function(test) {
4816 tests.push(test);
4817 });
4818
4819 runner.on(EVENT_TEST_FAIL, function(test) {
4820 tests.push(test);
4821 });
4822
4823 runner.once(EVENT_RUN_END, function() {
4824 self.write(
4825 tag(
4826 'testsuite',
4827 {
4828 name: suiteName,
4829 tests: stats.tests,
4830 failures: 0,
4831 errors: stats.failures,
4832 skipped: stats.tests - stats.failures - stats.passes,
4833 timestamp: new Date().toUTCString(),
4834 time: stats.duration / 1000 || 0
4835 },
4836 false
4837 )
4838 );
4839
4840 tests.forEach(function(t) {
4841 self.test(t);
4842 });
4843
4844 self.write('</testsuite>');
4845 });
4846}
4847
4848/**
4849 * Inherit from `Base.prototype`.
4850 */
4851inherits(XUnit, Base);
4852
4853/**
4854 * Override done to close the stream (if it's a file).
4855 *
4856 * @param failures
4857 * @param {Function} fn
4858 */
4859XUnit.prototype.done = function(failures, fn) {
4860 if (this.fileStream) {
4861 this.fileStream.end(function() {
4862 fn(failures);
4863 });
4864 } else {
4865 fn(failures);
4866 }
4867};
4868
4869/**
4870 * Write out the given line.
4871 *
4872 * @param {string} line
4873 */
4874XUnit.prototype.write = function(line) {
4875 if (this.fileStream) {
4876 this.fileStream.write(line + '\n');
4877 } else if (typeof process === 'object' && process.stdout) {
4878 process.stdout.write(line + '\n');
4879 } else {
4880 console.log(line);
4881 }
4882};
4883
4884/**
4885 * Output tag for the given `test.`
4886 *
4887 * @param {Test} test
4888 */
4889XUnit.prototype.test = function(test) {
4890 Base.useColors = false;
4891
4892 var attrs = {
4893 classname: test.parent.fullTitle(),
4894 name: test.title,
4895 time: test.duration / 1000 || 0
4896 };
4897
4898 if (test.state === STATE_FAILED) {
4899 var err = test.err;
4900 var diff =
4901 Base.hideDiff || !err.actual || !err.expected
4902 ? ''
4903 : '\n' + Base.generateDiff(err.actual, err.expected);
4904 this.write(
4905 tag(
4906 'testcase',
4907 attrs,
4908 false,
4909 tag(
4910 'failure',
4911 {},
4912 false,
4913 escape(err.message) + escape(diff) + '\n' + escape(err.stack)
4914 )
4915 )
4916 );
4917 } else if (test.isPending()) {
4918 this.write(tag('testcase', attrs, false, tag('skipped', {}, true)));
4919 } else {
4920 this.write(tag('testcase', attrs, true));
4921 }
4922};
4923
4924/**
4925 * HTML tag helper.
4926 *
4927 * @param name
4928 * @param attrs
4929 * @param close
4930 * @param content
4931 * @return {string}
4932 */
4933function tag(name, attrs, close, content) {
4934 var end = close ? '/>' : '>';
4935 var pairs = [];
4936 var tag;
4937
4938 for (var key in attrs) {
4939 if (Object.prototype.hasOwnProperty.call(attrs, key)) {
4940 pairs.push(key + '="' + escape(attrs[key]) + '"');
4941 }
4942 }
4943
4944 tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end;
4945 if (content) {
4946 tag += content + '</' + name + end;
4947 }
4948 return tag;
4949}
4950
4951XUnit.description = 'XUnit-compatible XML output';
4952
4953}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
4954},{"../errors":6,"../runnable":33,"../runner":34,"../utils":38,"./base":17,"_process":69,"fs":42,"mkdirp":59,"path":42}],33:[function(require,module,exports){
4955(function (global){
4956'use strict';
4957
4958var EventEmitter = require('events').EventEmitter;
4959var Pending = require('./pending');
4960var debug = require('debug')('mocha:runnable');
4961var milliseconds = require('ms');
4962var utils = require('./utils');
4963var createInvalidExceptionError = require('./errors')
4964 .createInvalidExceptionError;
4965
4966/**
4967 * Save timer references to avoid Sinon interfering (see GH-237).
4968 */
4969var Date = global.Date;
4970var setTimeout = global.setTimeout;
4971var clearTimeout = global.clearTimeout;
4972var toString = Object.prototype.toString;
4973
4974module.exports = Runnable;
4975
4976/**
4977 * Initialize a new `Runnable` with the given `title` and callback `fn`.
4978 *
4979 * @class
4980 * @extends external:EventEmitter
4981 * @public
4982 * @param {String} title
4983 * @param {Function} fn
4984 */
4985function Runnable(title, fn) {
4986 this.title = title;
4987 this.fn = fn;
4988 this.body = (fn || '').toString();
4989 this.async = fn && fn.length;
4990 this.sync = !this.async;
4991 this._timeout = 2000;
4992 this._slow = 75;
4993 this._enableTimeouts = true;
4994 this.timedOut = false;
4995 this._retries = -1;
4996 this._currentRetry = 0;
4997 this.pending = false;
4998}
4999
5000/**
5001 * Inherit from `EventEmitter.prototype`.
5002 */
5003utils.inherits(Runnable, EventEmitter);
5004
5005/**
5006 * Get current timeout value in msecs.
5007 *
5008 * @private
5009 * @returns {number} current timeout threshold value
5010 */
5011/**
5012 * @summary
5013 * Set timeout threshold value (msecs).
5014 *
5015 * @description
5016 * A string argument can use shorthand (e.g., "2s") and will be converted.
5017 * The value will be clamped to range [<code>0</code>, <code>2^<sup>31</sup>-1</code>].
5018 * If clamped value matches either range endpoint, timeouts will be disabled.
5019 *
5020 * @private
5021 * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout#Maximum_delay_value}
5022 * @param {number|string} ms - Timeout threshold value.
5023 * @returns {Runnable} this
5024 * @chainable
5025 */
5026Runnable.prototype.timeout = function(ms) {
5027 if (!arguments.length) {
5028 return this._timeout;
5029 }
5030 if (typeof ms === 'string') {
5031 ms = milliseconds(ms);
5032 }
5033
5034 // Clamp to range
5035 var INT_MAX = Math.pow(2, 31) - 1;
5036 var range = [0, INT_MAX];
5037 ms = utils.clamp(ms, range);
5038
5039 // see #1652 for reasoning
5040 if (ms === range[0] || ms === range[1]) {
5041 this._enableTimeouts = false;
5042 }
5043 debug('timeout %d', ms);
5044 this._timeout = ms;
5045 if (this.timer) {
5046 this.resetTimeout();
5047 }
5048 return this;
5049};
5050
5051/**
5052 * Set or get slow `ms`.
5053 *
5054 * @private
5055 * @param {number|string} ms
5056 * @return {Runnable|number} ms or Runnable instance.
5057 */
5058Runnable.prototype.slow = function(ms) {
5059 if (!arguments.length || typeof ms === 'undefined') {
5060 return this._slow;
5061 }
5062 if (typeof ms === 'string') {
5063 ms = milliseconds(ms);
5064 }
5065 debug('slow %d', ms);
5066 this._slow = ms;
5067 return this;
5068};
5069
5070/**
5071 * Set and get whether timeout is `enabled`.
5072 *
5073 * @private
5074 * @param {boolean} enabled
5075 * @return {Runnable|boolean} enabled or Runnable instance.
5076 */
5077Runnable.prototype.enableTimeouts = function(enabled) {
5078 if (!arguments.length) {
5079 return this._enableTimeouts;
5080 }
5081 debug('enableTimeouts %s', enabled);
5082 this._enableTimeouts = enabled;
5083 return this;
5084};
5085
5086/**
5087 * Halt and mark as pending.
5088 *
5089 * @memberof Mocha.Runnable
5090 * @public
5091 */
5092Runnable.prototype.skip = function() {
5093 throw new Pending('sync skip');
5094};
5095
5096/**
5097 * Check if this runnable or its parent suite is marked as pending.
5098 *
5099 * @private
5100 */
5101Runnable.prototype.isPending = function() {
5102 return this.pending || (this.parent && this.parent.isPending());
5103};
5104
5105/**
5106 * Return `true` if this Runnable has failed.
5107 * @return {boolean}
5108 * @private
5109 */
5110Runnable.prototype.isFailed = function() {
5111 return !this.isPending() && this.state === constants.STATE_FAILED;
5112};
5113
5114/**
5115 * Return `true` if this Runnable has passed.
5116 * @return {boolean}
5117 * @private
5118 */
5119Runnable.prototype.isPassed = function() {
5120 return !this.isPending() && this.state === constants.STATE_PASSED;
5121};
5122
5123/**
5124 * Set or get number of retries.
5125 *
5126 * @private
5127 */
5128Runnable.prototype.retries = function(n) {
5129 if (!arguments.length) {
5130 return this._retries;
5131 }
5132 this._retries = n;
5133};
5134
5135/**
5136 * Set or get current retry
5137 *
5138 * @private
5139 */
5140Runnable.prototype.currentRetry = function(n) {
5141 if (!arguments.length) {
5142 return this._currentRetry;
5143 }
5144 this._currentRetry = n;
5145};
5146
5147/**
5148 * Return the full title generated by recursively concatenating the parent's
5149 * full title.
5150 *
5151 * @memberof Mocha.Runnable
5152 * @public
5153 * @return {string}
5154 */
5155Runnable.prototype.fullTitle = function() {
5156 return this.titlePath().join(' ');
5157};
5158
5159/**
5160 * Return the title path generated by concatenating the parent's title path with the title.
5161 *
5162 * @memberof Mocha.Runnable
5163 * @public
5164 * @return {string}
5165 */
5166Runnable.prototype.titlePath = function() {
5167 return this.parent.titlePath().concat([this.title]);
5168};
5169
5170/**
5171 * Clear the timeout.
5172 *
5173 * @private
5174 */
5175Runnable.prototype.clearTimeout = function() {
5176 clearTimeout(this.timer);
5177};
5178
5179/**
5180 * Inspect the runnable void of private properties.
5181 *
5182 * @private
5183 * @return {string}
5184 */
5185Runnable.prototype.inspect = function() {
5186 return JSON.stringify(
5187 this,
5188 function(key, val) {
5189 if (key[0] === '_') {
5190 return;
5191 }
5192 if (key === 'parent') {
5193 return '#<Suite>';
5194 }
5195 if (key === 'ctx') {
5196 return '#<Context>';
5197 }
5198 return val;
5199 },
5200 2
5201 );
5202};
5203
5204/**
5205 * Reset the timeout.
5206 *
5207 * @private
5208 */
5209Runnable.prototype.resetTimeout = function() {
5210 var self = this;
5211 var ms = this.timeout() || 1e9;
5212
5213 if (!this._enableTimeouts) {
5214 return;
5215 }
5216 this.clearTimeout();
5217 this.timer = setTimeout(function() {
5218 if (!self._enableTimeouts) {
5219 return;
5220 }
5221 self.callback(self._timeoutError(ms));
5222 self.timedOut = true;
5223 }, ms);
5224};
5225
5226/**
5227 * Set or get a list of whitelisted globals for this test run.
5228 *
5229 * @private
5230 * @param {string[]} globals
5231 */
5232Runnable.prototype.globals = function(globals) {
5233 if (!arguments.length) {
5234 return this._allowedGlobals;
5235 }
5236 this._allowedGlobals = globals;
5237};
5238
5239/**
5240 * Run the test and invoke `fn(err)`.
5241 *
5242 * @param {Function} fn
5243 * @private
5244 */
5245Runnable.prototype.run = function(fn) {
5246 var self = this;
5247 var start = new Date();
5248 var ctx = this.ctx;
5249 var finished;
5250 var emitted;
5251
5252 // Sometimes the ctx exists, but it is not runnable
5253 if (ctx && ctx.runnable) {
5254 ctx.runnable(this);
5255 }
5256
5257 // called multiple times
5258 function multiple(err) {
5259 if (emitted) {
5260 return;
5261 }
5262 emitted = true;
5263 var msg = 'done() called multiple times';
5264 if (err && err.message) {
5265 err.message += " (and Mocha's " + msg + ')';
5266 self.emit('error', err);
5267 } else {
5268 self.emit('error', new Error(msg));
5269 }
5270 }
5271
5272 // finished
5273 function done(err) {
5274 var ms = self.timeout();
5275 if (self.timedOut) {
5276 return;
5277 }
5278
5279 if (finished) {
5280 return multiple(err);
5281 }
5282
5283 self.clearTimeout();
5284 self.duration = new Date() - start;
5285 finished = true;
5286 if (!err && self.duration > ms && self._enableTimeouts) {
5287 err = self._timeoutError(ms);
5288 }
5289 fn(err);
5290 }
5291
5292 // for .resetTimeout()
5293 this.callback = done;
5294
5295 // explicit async with `done` argument
5296 if (this.async) {
5297 this.resetTimeout();
5298
5299 // allows skip() to be used in an explicit async context
5300 this.skip = function asyncSkip() {
5301 done(new Pending('async skip call'));
5302 // halt execution. the Runnable will be marked pending
5303 // by the previous call, and the uncaught handler will ignore
5304 // the failure.
5305 throw new Pending('async skip; aborting execution');
5306 };
5307
5308 if (this.allowUncaught) {
5309 return callFnAsync(this.fn);
5310 }
5311 try {
5312 callFnAsync(this.fn);
5313 } catch (err) {
5314 emitted = true;
5315 done(Runnable.toValueOrError(err));
5316 }
5317 return;
5318 }
5319
5320 if (this.allowUncaught) {
5321 if (this.isPending()) {
5322 done();
5323 } else {
5324 callFn(this.fn);
5325 }
5326 return;
5327 }
5328
5329 // sync or promise-returning
5330 try {
5331 if (this.isPending()) {
5332 done();
5333 } else {
5334 callFn(this.fn);
5335 }
5336 } catch (err) {
5337 emitted = true;
5338 done(Runnable.toValueOrError(err));
5339 }
5340
5341 function callFn(fn) {
5342 var result = fn.call(ctx);
5343 if (result && typeof result.then === 'function') {
5344 self.resetTimeout();
5345 result.then(
5346 function() {
5347 done();
5348 // Return null so libraries like bluebird do not warn about
5349 // subsequently constructed Promises.
5350 return null;
5351 },
5352 function(reason) {
5353 done(reason || new Error('Promise rejected with no or falsy reason'));
5354 }
5355 );
5356 } else {
5357 if (self.asyncOnly) {
5358 return done(
5359 new Error(
5360 '--async-only option in use without declaring `done()` or returning a promise'
5361 )
5362 );
5363 }
5364
5365 done();
5366 }
5367 }
5368
5369 function callFnAsync(fn) {
5370 var result = fn.call(ctx, function(err) {
5371 if (err instanceof Error || toString.call(err) === '[object Error]') {
5372 return done(err);
5373 }
5374 if (err) {
5375 if (Object.prototype.toString.call(err) === '[object Object]') {
5376 return done(
5377 new Error('done() invoked with non-Error: ' + JSON.stringify(err))
5378 );
5379 }
5380 return done(new Error('done() invoked with non-Error: ' + err));
5381 }
5382 if (result && utils.isPromise(result)) {
5383 return done(
5384 new Error(
5385 'Resolution method is overspecified. Specify a callback *or* return a Promise; not both.'
5386 )
5387 );
5388 }
5389
5390 done();
5391 });
5392 }
5393};
5394
5395/**
5396 * Instantiates a "timeout" error
5397 *
5398 * @param {number} ms - Timeout (in milliseconds)
5399 * @returns {Error} a "timeout" error
5400 * @private
5401 */
5402Runnable.prototype._timeoutError = function(ms) {
5403 var msg =
5404 'Timeout of ' +
5405 ms +
5406 'ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.';
5407 if (this.file) {
5408 msg += ' (' + this.file + ')';
5409 }
5410 return new Error(msg);
5411};
5412
5413var constants = utils.defineConstants(
5414 /**
5415 * {@link Runnable}-related constants.
5416 * @public
5417 * @memberof Runnable
5418 * @readonly
5419 * @static
5420 * @alias constants
5421 * @enum {string}
5422 */
5423 {
5424 /**
5425 * Value of `state` prop when a `Runnable` has failed
5426 */
5427 STATE_FAILED: 'failed',
5428 /**
5429 * Value of `state` prop when a `Runnable` has passed
5430 */
5431 STATE_PASSED: 'passed'
5432 }
5433);
5434
5435/**
5436 * Given `value`, return identity if truthy, otherwise create an "invalid exception" error and return that.
5437 * @param {*} [value] - Value to return, if present
5438 * @returns {*|Error} `value`, otherwise an `Error`
5439 * @private
5440 */
5441Runnable.toValueOrError = function(value) {
5442 return (
5443 value ||
5444 createInvalidExceptionError(
5445 'Runnable failed with falsy or undefined exception. Please throw an Error instead.',
5446 value
5447 )
5448 );
5449};
5450
5451Runnable.constants = constants;
5452
5453}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
5454},{"./errors":6,"./pending":16,"./utils":38,"debug":45,"events":50,"ms":60}],34:[function(require,module,exports){
5455(function (process,global){
5456'use strict';
5457
5458/**
5459 * Module dependencies.
5460 */
5461var util = require('util');
5462var EventEmitter = require('events').EventEmitter;
5463var Pending = require('./pending');
5464var utils = require('./utils');
5465var inherits = utils.inherits;
5466var debug = require('debug')('mocha:runner');
5467var Runnable = require('./runnable');
5468var Suite = require('./suite');
5469var HOOK_TYPE_BEFORE_EACH = Suite.constants.HOOK_TYPE_BEFORE_EACH;
5470var HOOK_TYPE_AFTER_EACH = Suite.constants.HOOK_TYPE_AFTER_EACH;
5471var HOOK_TYPE_AFTER_ALL = Suite.constants.HOOK_TYPE_AFTER_ALL;
5472var HOOK_TYPE_BEFORE_ALL = Suite.constants.HOOK_TYPE_BEFORE_ALL;
5473var EVENT_ROOT_SUITE_RUN = Suite.constants.EVENT_ROOT_SUITE_RUN;
5474var STATE_FAILED = Runnable.constants.STATE_FAILED;
5475var STATE_PASSED = Runnable.constants.STATE_PASSED;
5476var dQuote = utils.dQuote;
5477var ngettext = utils.ngettext;
5478var sQuote = utils.sQuote;
5479var stackFilter = utils.stackTraceFilter();
5480var stringify = utils.stringify;
5481var type = utils.type;
5482var createInvalidExceptionError = require('./errors')
5483 .createInvalidExceptionError;
5484
5485/**
5486 * Non-enumerable globals.
5487 * @readonly
5488 */
5489var globals = [
5490 'setTimeout',
5491 'clearTimeout',
5492 'setInterval',
5493 'clearInterval',
5494 'XMLHttpRequest',
5495 'Date',
5496 'setImmediate',
5497 'clearImmediate'
5498];
5499
5500var constants = utils.defineConstants(
5501 /**
5502 * {@link Runner}-related constants.
5503 * @public
5504 * @memberof Runner
5505 * @readonly
5506 * @alias constants
5507 * @static
5508 * @enum {string}
5509 */
5510 {
5511 /**
5512 * Emitted when {@link Hook} execution begins
5513 */
5514 EVENT_HOOK_BEGIN: 'hook',
5515 /**
5516 * Emitted when {@link Hook} execution ends
5517 */
5518 EVENT_HOOK_END: 'hook end',
5519 /**
5520 * Emitted when Root {@link Suite} execution begins (all files have been parsed and hooks/tests are ready for execution)
5521 */
5522 EVENT_RUN_BEGIN: 'start',
5523 /**
5524 * Emitted when Root {@link Suite} execution has been delayed via `delay` option
5525 */
5526 EVENT_DELAY_BEGIN: 'waiting',
5527 /**
5528 * Emitted when delayed Root {@link Suite} execution is triggered by user via `global.run()`
5529 */
5530 EVENT_DELAY_END: 'ready',
5531 /**
5532 * Emitted when Root {@link Suite} execution ends
5533 */
5534 EVENT_RUN_END: 'end',
5535 /**
5536 * Emitted when {@link Suite} execution begins
5537 */
5538 EVENT_SUITE_BEGIN: 'suite',
5539 /**
5540 * Emitted when {@link Suite} execution ends
5541 */
5542 EVENT_SUITE_END: 'suite end',
5543 /**
5544 * Emitted when {@link Test} execution begins
5545 */
5546 EVENT_TEST_BEGIN: 'test',
5547 /**
5548 * Emitted when {@link Test} execution ends
5549 */
5550 EVENT_TEST_END: 'test end',
5551 /**
5552 * Emitted when {@link Test} execution fails
5553 */
5554 EVENT_TEST_FAIL: 'fail',
5555 /**
5556 * Emitted when {@link Test} execution succeeds
5557 */
5558 EVENT_TEST_PASS: 'pass',
5559 /**
5560 * Emitted when {@link Test} becomes pending
5561 */
5562 EVENT_TEST_PENDING: 'pending',
5563 /**
5564 * Emitted when {@link Test} execution has failed, but will retry
5565 */
5566 EVENT_TEST_RETRY: 'retry'
5567 }
5568);
5569
5570module.exports = Runner;
5571
5572/**
5573 * Initialize a `Runner` at the Root {@link Suite}, which represents a hierarchy of {@link Suite|Suites} and {@link Test|Tests}.
5574 *
5575 * @extends external:EventEmitter
5576 * @public
5577 * @class
5578 * @param {Suite} suite Root suite
5579 * @param {boolean} [delay] Whether or not to delay execution of root suite
5580 * until ready.
5581 */
5582function Runner(suite, delay) {
5583 var self = this;
5584 this._globals = [];
5585 this._abort = false;
5586 this._delay = delay;
5587 this.suite = suite;
5588 this.started = false;
5589 this.total = suite.total();
5590 this.failures = 0;
5591 this.on(constants.EVENT_TEST_END, function(test) {
5592 self.checkGlobals(test);
5593 });
5594 this.on(constants.EVENT_HOOK_END, function(hook) {
5595 self.checkGlobals(hook);
5596 });
5597 this._defaultGrep = /.*/;
5598 this.grep(this._defaultGrep);
5599 this.globals(this.globalProps().concat(extraGlobals()));
5600}
5601
5602/**
5603 * Wrapper for setImmediate, process.nextTick, or browser polyfill.
5604 *
5605 * @param {Function} fn
5606 * @private
5607 */
5608Runner.immediately = global.setImmediate || process.nextTick;
5609
5610/**
5611 * Inherit from `EventEmitter.prototype`.
5612 */
5613inherits(Runner, EventEmitter);
5614
5615/**
5616 * Run tests with full titles matching `re`. Updates runner.total
5617 * with number of tests matched.
5618 *
5619 * @public
5620 * @memberof Runner
5621 * @param {RegExp} re
5622 * @param {boolean} invert
5623 * @return {Runner} Runner instance.
5624 */
5625Runner.prototype.grep = function(re, invert) {
5626 debug('grep %s', re);
5627 this._grep = re;
5628 this._invert = invert;
5629 this.total = this.grepTotal(this.suite);
5630 return this;
5631};
5632
5633/**
5634 * Returns the number of tests matching the grep search for the
5635 * given suite.
5636 *
5637 * @memberof Runner
5638 * @public
5639 * @param {Suite} suite
5640 * @return {number}
5641 */
5642Runner.prototype.grepTotal = function(suite) {
5643 var self = this;
5644 var total = 0;
5645
5646 suite.eachTest(function(test) {
5647 var match = self._grep.test(test.fullTitle());
5648 if (self._invert) {
5649 match = !match;
5650 }
5651 if (match) {
5652 total++;
5653 }
5654 });
5655
5656 return total;
5657};
5658
5659/**
5660 * Return a list of global properties.
5661 *
5662 * @return {Array}
5663 * @private
5664 */
5665Runner.prototype.globalProps = function() {
5666 var props = Object.keys(global);
5667
5668 // non-enumerables
5669 for (var i = 0; i < globals.length; ++i) {
5670 if (~props.indexOf(globals[i])) {
5671 continue;
5672 }
5673 props.push(globals[i]);
5674 }
5675
5676 return props;
5677};
5678
5679/**
5680 * Allow the given `arr` of globals.
5681 *
5682 * @public
5683 * @memberof Runner
5684 * @param {Array} arr
5685 * @return {Runner} Runner instance.
5686 */
5687Runner.prototype.globals = function(arr) {
5688 if (!arguments.length) {
5689 return this._globals;
5690 }
5691 debug('globals %j', arr);
5692 this._globals = this._globals.concat(arr);
5693 return this;
5694};
5695
5696/**
5697 * Check for global variable leaks.
5698 *
5699 * @private
5700 */
5701Runner.prototype.checkGlobals = function(test) {
5702 if (this.ignoreLeaks) {
5703 return;
5704 }
5705 var ok = this._globals;
5706
5707 var globals = this.globalProps();
5708 var leaks;
5709
5710 if (test) {
5711 ok = ok.concat(test._allowedGlobals || []);
5712 }
5713
5714 if (this.prevGlobalsLength === globals.length) {
5715 return;
5716 }
5717 this.prevGlobalsLength = globals.length;
5718
5719 leaks = filterLeaks(ok, globals);
5720 this._globals = this._globals.concat(leaks);
5721
5722 if (leaks.length) {
5723 var format = ngettext(
5724 leaks.length,
5725 'global leak detected: %s',
5726 'global leaks detected: %s'
5727 );
5728 var error = new Error(util.format(format, leaks.map(sQuote).join(', ')));
5729 this.fail(test, error);
5730 }
5731};
5732
5733/**
5734 * Fail the given `test`.
5735 *
5736 * @private
5737 * @param {Test} test
5738 * @param {Error} err
5739 */
5740Runner.prototype.fail = function(test, err) {
5741 if (test.isPending()) {
5742 return;
5743 }
5744
5745 ++this.failures;
5746 test.state = STATE_FAILED;
5747
5748 if (!isError(err)) {
5749 err = thrown2Error(err);
5750 }
5751
5752 try {
5753 err.stack =
5754 this.fullStackTrace || !err.stack ? err.stack : stackFilter(err.stack);
5755 } catch (ignore) {
5756 // some environments do not take kindly to monkeying with the stack
5757 }
5758
5759 this.emit(constants.EVENT_TEST_FAIL, test, err);
5760};
5761
5762/**
5763 * Fail the given `hook` with `err`.
5764 *
5765 * Hook failures work in the following pattern:
5766 * - If bail, run corresponding `after each` and `after` hooks,
5767 * then exit
5768 * - Failed `before` hook skips all tests in a suite and subsuites,
5769 * but jumps to corresponding `after` hook
5770 * - Failed `before each` hook skips remaining tests in a
5771 * suite and jumps to corresponding `after each` hook,
5772 * which is run only once
5773 * - Failed `after` hook does not alter
5774 * execution order
5775 * - Failed `after each` hook skips remaining tests in a
5776 * suite and subsuites, but executes other `after each`
5777 * hooks
5778 *
5779 * @private
5780 * @param {Hook} hook
5781 * @param {Error} err
5782 */
5783Runner.prototype.failHook = function(hook, err) {
5784 hook.originalTitle = hook.originalTitle || hook.title;
5785 if (hook.ctx && hook.ctx.currentTest) {
5786 hook.title =
5787 hook.originalTitle + ' for ' + dQuote(hook.ctx.currentTest.title);
5788 } else {
5789 var parentTitle;
5790 if (hook.parent.title) {
5791 parentTitle = hook.parent.title;
5792 } else {
5793 parentTitle = hook.parent.root ? '{root}' : '';
5794 }
5795 hook.title = hook.originalTitle + ' in ' + dQuote(parentTitle);
5796 }
5797
5798 this.fail(hook, err);
5799};
5800
5801/**
5802 * Run hook `name` callbacks and then invoke `fn()`.
5803 *
5804 * @private
5805 * @param {string} name
5806 * @param {Function} fn
5807 */
5808
5809Runner.prototype.hook = function(name, fn) {
5810 var suite = this.suite;
5811 var hooks = suite.getHooks(name);
5812 var self = this;
5813
5814 function next(i) {
5815 var hook = hooks[i];
5816 if (!hook) {
5817 return fn();
5818 }
5819 self.currentRunnable = hook;
5820
5821 if (name === HOOK_TYPE_BEFORE_ALL) {
5822 hook.ctx.currentTest = hook.parent.tests[0];
5823 } else if (name === HOOK_TYPE_AFTER_ALL) {
5824 hook.ctx.currentTest = hook.parent.tests[hook.parent.tests.length - 1];
5825 } else {
5826 hook.ctx.currentTest = self.test;
5827 }
5828
5829 hook.allowUncaught = self.allowUncaught;
5830
5831 self.emit(constants.EVENT_HOOK_BEGIN, hook);
5832
5833 if (!hook.listeners('error').length) {
5834 hook.on('error', function(err) {
5835 self.failHook(hook, err);
5836 });
5837 }
5838
5839 hook.run(function(err) {
5840 var testError = hook.error();
5841 if (testError) {
5842 self.fail(self.test, testError);
5843 }
5844 if (err) {
5845 if (err instanceof Pending) {
5846 if (name === HOOK_TYPE_AFTER_ALL) {
5847 utils.deprecate(
5848 'Skipping a test within an "after all" hook is DEPRECATED and will throw an exception in a future version of Mocha. ' +
5849 'Use a return statement or other means to abort hook execution.'
5850 );
5851 }
5852 if (name === HOOK_TYPE_BEFORE_EACH || name === HOOK_TYPE_AFTER_EACH) {
5853 if (self.test) {
5854 self.test.pending = true;
5855 }
5856 } else {
5857 suite.tests.forEach(function(test) {
5858 test.pending = true;
5859 });
5860 suite.suites.forEach(function(suite) {
5861 suite.pending = true;
5862 });
5863 // a pending hook won't be executed twice.
5864 hook.pending = true;
5865 }
5866 } else {
5867 self.failHook(hook, err);
5868
5869 // stop executing hooks, notify callee of hook err
5870 return fn(err);
5871 }
5872 }
5873 self.emit(constants.EVENT_HOOK_END, hook);
5874 delete hook.ctx.currentTest;
5875 next(++i);
5876 });
5877 }
5878
5879 Runner.immediately(function() {
5880 next(0);
5881 });
5882};
5883
5884/**
5885 * Run hook `name` for the given array of `suites`
5886 * in order, and callback `fn(err, errSuite)`.
5887 *
5888 * @private
5889 * @param {string} name
5890 * @param {Array} suites
5891 * @param {Function} fn
5892 */
5893Runner.prototype.hooks = function(name, suites, fn) {
5894 var self = this;
5895 var orig = this.suite;
5896
5897 function next(suite) {
5898 self.suite = suite;
5899
5900 if (!suite) {
5901 self.suite = orig;
5902 return fn();
5903 }
5904
5905 self.hook(name, function(err) {
5906 if (err) {
5907 var errSuite = self.suite;
5908 self.suite = orig;
5909 return fn(err, errSuite);
5910 }
5911
5912 next(suites.pop());
5913 });
5914 }
5915
5916 next(suites.pop());
5917};
5918
5919/**
5920 * Run hooks from the top level down.
5921 *
5922 * @param {String} name
5923 * @param {Function} fn
5924 * @private
5925 */
5926Runner.prototype.hookUp = function(name, fn) {
5927 var suites = [this.suite].concat(this.parents()).reverse();
5928 this.hooks(name, suites, fn);
5929};
5930
5931/**
5932 * Run hooks from the bottom up.
5933 *
5934 * @param {String} name
5935 * @param {Function} fn
5936 * @private
5937 */
5938Runner.prototype.hookDown = function(name, fn) {
5939 var suites = [this.suite].concat(this.parents());
5940 this.hooks(name, suites, fn);
5941};
5942
5943/**
5944 * Return an array of parent Suites from
5945 * closest to furthest.
5946 *
5947 * @return {Array}
5948 * @private
5949 */
5950Runner.prototype.parents = function() {
5951 var suite = this.suite;
5952 var suites = [];
5953 while (suite.parent) {
5954 suite = suite.parent;
5955 suites.push(suite);
5956 }
5957 return suites;
5958};
5959
5960/**
5961 * Run the current test and callback `fn(err)`.
5962 *
5963 * @param {Function} fn
5964 * @private
5965 */
5966Runner.prototype.runTest = function(fn) {
5967 var self = this;
5968 var test = this.test;
5969
5970 if (!test) {
5971 return;
5972 }
5973
5974 var suite = this.parents().reverse()[0] || this.suite;
5975 if (this.forbidOnly && suite.hasOnly()) {
5976 fn(new Error('`.only` forbidden'));
5977 return;
5978 }
5979 if (this.asyncOnly) {
5980 test.asyncOnly = true;
5981 }
5982 test.on('error', function(err) {
5983 self.fail(test, err);
5984 });
5985 if (this.allowUncaught) {
5986 test.allowUncaught = true;
5987 return test.run(fn);
5988 }
5989 try {
5990 test.run(fn);
5991 } catch (err) {
5992 fn(err);
5993 }
5994};
5995
5996/**
5997 * Run tests in the given `suite` and invoke the callback `fn()` when complete.
5998 *
5999 * @private
6000 * @param {Suite} suite
6001 * @param {Function} fn
6002 */
6003Runner.prototype.runTests = function(suite, fn) {
6004 var self = this;
6005 var tests = suite.tests.slice();
6006 var test;
6007
6008 function hookErr(_, errSuite, after) {
6009 // before/after Each hook for errSuite failed:
6010 var orig = self.suite;
6011
6012 // for failed 'after each' hook start from errSuite parent,
6013 // otherwise start from errSuite itself
6014 self.suite = after ? errSuite.parent : errSuite;
6015
6016 if (self.suite) {
6017 // call hookUp afterEach
6018 self.hookUp(HOOK_TYPE_AFTER_EACH, function(err2, errSuite2) {
6019 self.suite = orig;
6020 // some hooks may fail even now
6021 if (err2) {
6022 return hookErr(err2, errSuite2, true);
6023 }
6024 // report error suite
6025 fn(errSuite);
6026 });
6027 } else {
6028 // there is no need calling other 'after each' hooks
6029 self.suite = orig;
6030 fn(errSuite);
6031 }
6032 }
6033
6034 function next(err, errSuite) {
6035 // if we bail after first err
6036 if (self.failures && suite._bail) {
6037 tests = [];
6038 }
6039
6040 if (self._abort) {
6041 return fn();
6042 }
6043
6044 if (err) {
6045 return hookErr(err, errSuite, true);
6046 }
6047
6048 // next test
6049 test = tests.shift();
6050
6051 // all done
6052 if (!test) {
6053 return fn();
6054 }
6055
6056 // grep
6057 var match = self._grep.test(test.fullTitle());
6058 if (self._invert) {
6059 match = !match;
6060 }
6061 if (!match) {
6062 // Run immediately only if we have defined a grep. When we
6063 // define a grep — It can cause maximum callstack error if
6064 // the grep is doing a large recursive loop by neglecting
6065 // all tests. The run immediately function also comes with
6066 // a performance cost. So we don't want to run immediately
6067 // if we run the whole test suite, because running the whole
6068 // test suite don't do any immediate recursive loops. Thus,
6069 // allowing a JS runtime to breathe.
6070 if (self._grep !== self._defaultGrep) {
6071 Runner.immediately(next);
6072 } else {
6073 next();
6074 }
6075 return;
6076 }
6077
6078 if (test.isPending()) {
6079 if (self.forbidPending) {
6080 test.isPending = alwaysFalse;
6081 self.fail(test, new Error('Pending test forbidden'));
6082 delete test.isPending;
6083 } else {
6084 self.emit(constants.EVENT_TEST_PENDING, test);
6085 }
6086 self.emit(constants.EVENT_TEST_END, test);
6087 return next();
6088 }
6089
6090 // execute test and hook(s)
6091 self.emit(constants.EVENT_TEST_BEGIN, (self.test = test));
6092 self.hookDown(HOOK_TYPE_BEFORE_EACH, function(err, errSuite) {
6093 if (test.isPending()) {
6094 if (self.forbidPending) {
6095 test.isPending = alwaysFalse;
6096 self.fail(test, new Error('Pending test forbidden'));
6097 delete test.isPending;
6098 } else {
6099 self.emit(constants.EVENT_TEST_PENDING, test);
6100 }
6101 self.emit(constants.EVENT_TEST_END, test);
6102 return next();
6103 }
6104 if (err) {
6105 return hookErr(err, errSuite, false);
6106 }
6107 self.currentRunnable = self.test;
6108 self.runTest(function(err) {
6109 test = self.test;
6110 if (err) {
6111 var retry = test.currentRetry();
6112 if (err instanceof Pending && self.forbidPending) {
6113 self.fail(test, new Error('Pending test forbidden'));
6114 } else if (err instanceof Pending) {
6115 test.pending = true;
6116 self.emit(constants.EVENT_TEST_PENDING, test);
6117 } else if (retry < test.retries()) {
6118 var clonedTest = test.clone();
6119 clonedTest.currentRetry(retry + 1);
6120 tests.unshift(clonedTest);
6121
6122 self.emit(constants.EVENT_TEST_RETRY, test, err);
6123
6124 // Early return + hook trigger so that it doesn't
6125 // increment the count wrong
6126 return self.hookUp(HOOK_TYPE_AFTER_EACH, next);
6127 } else {
6128 self.fail(test, err);
6129 }
6130 self.emit(constants.EVENT_TEST_END, test);
6131
6132 if (err instanceof Pending) {
6133 return next();
6134 }
6135
6136 return self.hookUp(HOOK_TYPE_AFTER_EACH, next);
6137 }
6138
6139 test.state = STATE_PASSED;
6140 self.emit(constants.EVENT_TEST_PASS, test);
6141 self.emit(constants.EVENT_TEST_END, test);
6142 self.hookUp(HOOK_TYPE_AFTER_EACH, next);
6143 });
6144 });
6145 }
6146
6147 this.next = next;
6148 this.hookErr = hookErr;
6149 next();
6150};
6151
6152function alwaysFalse() {
6153 return false;
6154}
6155
6156/**
6157 * Run the given `suite` and invoke the callback `fn()` when complete.
6158 *
6159 * @private
6160 * @param {Suite} suite
6161 * @param {Function} fn
6162 */
6163Runner.prototype.runSuite = function(suite, fn) {
6164 var i = 0;
6165 var self = this;
6166 var total = this.grepTotal(suite);
6167 var afterAllHookCalled = false;
6168
6169 debug('run suite %s', suite.fullTitle());
6170
6171 if (!total || (self.failures && suite._bail)) {
6172 return fn();
6173 }
6174
6175 this.emit(constants.EVENT_SUITE_BEGIN, (this.suite = suite));
6176
6177 function next(errSuite) {
6178 if (errSuite) {
6179 // current suite failed on a hook from errSuite
6180 if (errSuite === suite) {
6181 // if errSuite is current suite
6182 // continue to the next sibling suite
6183 return done();
6184 }
6185 // errSuite is among the parents of current suite
6186 // stop execution of errSuite and all sub-suites
6187 return done(errSuite);
6188 }
6189
6190 if (self._abort) {
6191 return done();
6192 }
6193
6194 var curr = suite.suites[i++];
6195 if (!curr) {
6196 return done();
6197 }
6198
6199 // Avoid grep neglecting large number of tests causing a
6200 // huge recursive loop and thus a maximum call stack error.
6201 // See comment in `this.runTests()` for more information.
6202 if (self._grep !== self._defaultGrep) {
6203 Runner.immediately(function() {
6204 self.runSuite(curr, next);
6205 });
6206 } else {
6207 self.runSuite(curr, next);
6208 }
6209 }
6210
6211 function done(errSuite) {
6212 self.suite = suite;
6213 self.nextSuite = next;
6214
6215 if (afterAllHookCalled) {
6216 fn(errSuite);
6217 } else {
6218 // mark that the afterAll block has been called once
6219 // and so can be skipped if there is an error in it.
6220 afterAllHookCalled = true;
6221
6222 // remove reference to test
6223 delete self.test;
6224
6225 self.hook(HOOK_TYPE_AFTER_ALL, function() {
6226 self.emit(constants.EVENT_SUITE_END, suite);
6227 fn(errSuite);
6228 });
6229 }
6230 }
6231
6232 this.nextSuite = next;
6233
6234 this.hook(HOOK_TYPE_BEFORE_ALL, function(err) {
6235 if (err) {
6236 return done();
6237 }
6238 self.runTests(suite, next);
6239 });
6240};
6241
6242/**
6243 * Handle uncaught exceptions.
6244 *
6245 * @param {Error} err
6246 * @private
6247 */
6248Runner.prototype.uncaught = function(err) {
6249 if (err instanceof Pending) {
6250 return;
6251 }
6252 if (err) {
6253 debug('uncaught exception %O', err);
6254 } else {
6255 debug('uncaught undefined/falsy exception');
6256 err = createInvalidExceptionError(
6257 'Caught falsy/undefined exception which would otherwise be uncaught. No stack trace found; try a debugger',
6258 err
6259 );
6260 }
6261
6262 if (!isError(err)) {
6263 err = thrown2Error(err);
6264 }
6265 err.uncaught = true;
6266
6267 var runnable = this.currentRunnable;
6268
6269 if (!runnable) {
6270 runnable = new Runnable('Uncaught error outside test suite');
6271 runnable.parent = this.suite;
6272
6273 if (this.started) {
6274 this.fail(runnable, err);
6275 } else {
6276 // Can't recover from this failure
6277 this.emit(constants.EVENT_RUN_BEGIN);
6278 this.fail(runnable, err);
6279 this.emit(constants.EVENT_RUN_END);
6280 }
6281
6282 return;
6283 }
6284
6285 runnable.clearTimeout();
6286
6287 // Ignore errors if already failed or pending
6288 // See #3226
6289 if (runnable.isFailed() || runnable.isPending()) {
6290 return;
6291 }
6292 // we cannot recover gracefully if a Runnable has already passed
6293 // then fails asynchronously
6294 var alreadyPassed = runnable.isPassed();
6295 // this will change the state to "failed" regardless of the current value
6296 this.fail(runnable, err);
6297 if (!alreadyPassed) {
6298 // recover from test
6299 if (runnable.type === constants.EVENT_TEST_BEGIN) {
6300 this.emit(constants.EVENT_TEST_END, runnable);
6301 this.hookUp(HOOK_TYPE_AFTER_EACH, this.next);
6302 return;
6303 }
6304 debug(runnable);
6305
6306 // recover from hooks
6307 var errSuite = this.suite;
6308
6309 // XXX how about a less awful way to determine this?
6310 // if hook failure is in afterEach block
6311 if (runnable.fullTitle().indexOf('after each') > -1) {
6312 return this.hookErr(err, errSuite, true);
6313 }
6314 // if hook failure is in beforeEach block
6315 if (runnable.fullTitle().indexOf('before each') > -1) {
6316 return this.hookErr(err, errSuite, false);
6317 }
6318 // if hook failure is in after or before blocks
6319 return this.nextSuite(errSuite);
6320 }
6321
6322 // bail
6323 this.emit(constants.EVENT_RUN_END);
6324};
6325
6326/**
6327 * Run the root suite and invoke `fn(failures)`
6328 * on completion.
6329 *
6330 * @public
6331 * @memberof Runner
6332 * @param {Function} fn
6333 * @return {Runner} Runner instance.
6334 */
6335Runner.prototype.run = function(fn) {
6336 var self = this;
6337 var rootSuite = this.suite;
6338
6339 fn = fn || function() {};
6340
6341 function uncaught(err) {
6342 self.uncaught(err);
6343 }
6344
6345 function start() {
6346 // If there is an `only` filter
6347 if (rootSuite.hasOnly()) {
6348 rootSuite.filterOnly();
6349 }
6350 self.started = true;
6351 if (self._delay) {
6352 self.emit(constants.EVENT_DELAY_END);
6353 }
6354 self.emit(constants.EVENT_RUN_BEGIN);
6355
6356 self.runSuite(rootSuite, function() {
6357 debug('finished running');
6358 self.emit(constants.EVENT_RUN_END);
6359 });
6360 }
6361
6362 debug(constants.EVENT_RUN_BEGIN);
6363
6364 // references cleanup to avoid memory leaks
6365 this.on(constants.EVENT_SUITE_END, function(suite) {
6366 suite.cleanReferences();
6367 });
6368
6369 // callback
6370 this.on(constants.EVENT_RUN_END, function() {
6371 debug(constants.EVENT_RUN_END);
6372 process.removeListener('uncaughtException', uncaught);
6373 fn(self.failures);
6374 });
6375
6376 // uncaught exception
6377 process.on('uncaughtException', uncaught);
6378
6379 if (this._delay) {
6380 // for reporters, I guess.
6381 // might be nice to debounce some dots while we wait.
6382 this.emit(constants.EVENT_DELAY_BEGIN, rootSuite);
6383 rootSuite.once(EVENT_ROOT_SUITE_RUN, start);
6384 } else {
6385 start();
6386 }
6387
6388 return this;
6389};
6390
6391/**
6392 * Cleanly abort execution.
6393 *
6394 * @memberof Runner
6395 * @public
6396 * @return {Runner} Runner instance.
6397 */
6398Runner.prototype.abort = function() {
6399 debug('aborting');
6400 this._abort = true;
6401
6402 return this;
6403};
6404
6405/**
6406 * Filter leaks with the given globals flagged as `ok`.
6407 *
6408 * @private
6409 * @param {Array} ok
6410 * @param {Array} globals
6411 * @return {Array}
6412 */
6413function filterLeaks(ok, globals) {
6414 return globals.filter(function(key) {
6415 // Firefox and Chrome exposes iframes as index inside the window object
6416 if (/^\d+/.test(key)) {
6417 return false;
6418 }
6419
6420 // in firefox
6421 // if runner runs in an iframe, this iframe's window.getInterface method
6422 // not init at first it is assigned in some seconds
6423 if (global.navigator && /^getInterface/.test(key)) {
6424 return false;
6425 }
6426
6427 // an iframe could be approached by window[iframeIndex]
6428 // in ie6,7,8 and opera, iframeIndex is enumerable, this could cause leak
6429 if (global.navigator && /^\d+/.test(key)) {
6430 return false;
6431 }
6432
6433 // Opera and IE expose global variables for HTML element IDs (issue #243)
6434 if (/^mocha-/.test(key)) {
6435 return false;
6436 }
6437
6438 var matched = ok.filter(function(ok) {
6439 if (~ok.indexOf('*')) {
6440 return key.indexOf(ok.split('*')[0]) === 0;
6441 }
6442 return key === ok;
6443 });
6444 return !matched.length && (!global.navigator || key !== 'onerror');
6445 });
6446}
6447
6448/**
6449 * Check if argument is an instance of Error object or a duck-typed equivalent.
6450 *
6451 * @private
6452 * @param {Object} err - object to check
6453 * @param {string} err.message - error message
6454 * @returns {boolean}
6455 */
6456function isError(err) {
6457 return err instanceof Error || (err && typeof err.message === 'string');
6458}
6459
6460/**
6461 *
6462 * Converts thrown non-extensible type into proper Error.
6463 *
6464 * @private
6465 * @param {*} thrown - Non-extensible type thrown by code
6466 * @return {Error}
6467 */
6468function thrown2Error(err) {
6469 return new Error(
6470 'the ' + type(err) + ' ' + stringify(err) + ' was thrown, throw an Error :)'
6471 );
6472}
6473
6474/**
6475 * Array of globals dependent on the environment.
6476 *
6477 * @return {Array}
6478 * @deprecated
6479 * @todo remove; long since unsupported
6480 * @private
6481 */
6482function extraGlobals() {
6483 if (typeof process === 'object' && typeof process.version === 'string') {
6484 var parts = process.version.split('.');
6485 var nodeVersion = parts.reduce(function(a, v) {
6486 return (a << 8) | v;
6487 });
6488
6489 // 'errno' was renamed to process._errno in v0.9.11.
6490 if (nodeVersion < 0x00090b) {
6491 return ['errno'];
6492 }
6493 }
6494
6495 return [];
6496}
6497
6498Runner.constants = constants;
6499
6500/**
6501 * Node.js' `EventEmitter`
6502 * @external EventEmitter
6503 * @see {@link https://nodejs.org/api/events.html#events_class_eventemitter}
6504 */
6505
6506}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
6507},{"./errors":6,"./pending":16,"./runnable":33,"./suite":36,"./utils":38,"_process":69,"debug":45,"events":50,"util":89}],35:[function(require,module,exports){
6508(function (global){
6509'use strict';
6510
6511/**
6512 * Provides a factory function for a {@link StatsCollector} object.
6513 * @module
6514 */
6515
6516var constants = require('./runner').constants;
6517var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
6518var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
6519var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
6520var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
6521var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
6522var EVENT_RUN_END = constants.EVENT_RUN_END;
6523var EVENT_TEST_END = constants.EVENT_TEST_END;
6524
6525/**
6526 * Test statistics collector.
6527 *
6528 * @public
6529 * @typedef {Object} StatsCollector
6530 * @property {number} suites - integer count of suites run.
6531 * @property {number} tests - integer count of tests run.
6532 * @property {number} passes - integer count of passing tests.
6533 * @property {number} pending - integer count of pending tests.
6534 * @property {number} failures - integer count of failed tests.
6535 * @property {Date} start - time when testing began.
6536 * @property {Date} end - time when testing concluded.
6537 * @property {number} duration - number of msecs that testing took.
6538 */
6539
6540var Date = global.Date;
6541
6542/**
6543 * Provides stats such as test duration, number of tests passed / failed etc., by listening for events emitted by `runner`.
6544 *
6545 * @private
6546 * @param {Runner} runner - Runner instance
6547 * @throws {TypeError} If falsy `runner`
6548 */
6549function createStatsCollector(runner) {
6550 /**
6551 * @type StatsCollector
6552 */
6553 var stats = {
6554 suites: 0,
6555 tests: 0,
6556 passes: 0,
6557 pending: 0,
6558 failures: 0
6559 };
6560
6561 if (!runner) {
6562 throw new TypeError('Missing runner argument');
6563 }
6564
6565 runner.stats = stats;
6566
6567 runner.once(EVENT_RUN_BEGIN, function() {
6568 stats.start = new Date();
6569 });
6570 runner.on(EVENT_SUITE_BEGIN, function(suite) {
6571 suite.root || stats.suites++;
6572 });
6573 runner.on(EVENT_TEST_PASS, function() {
6574 stats.passes++;
6575 });
6576 runner.on(EVENT_TEST_FAIL, function() {
6577 stats.failures++;
6578 });
6579 runner.on(EVENT_TEST_PENDING, function() {
6580 stats.pending++;
6581 });
6582 runner.on(EVENT_TEST_END, function() {
6583 stats.tests++;
6584 });
6585 runner.once(EVENT_RUN_END, function() {
6586 stats.end = new Date();
6587 stats.duration = stats.end - stats.start;
6588 });
6589}
6590
6591module.exports = createStatsCollector;
6592
6593}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
6594},{"./runner":34}],36:[function(require,module,exports){
6595'use strict';
6596
6597/**
6598 * Module dependencies.
6599 */
6600var EventEmitter = require('events').EventEmitter;
6601var Hook = require('./hook');
6602var utils = require('./utils');
6603var inherits = utils.inherits;
6604var debug = require('debug')('mocha:suite');
6605var milliseconds = require('ms');
6606var errors = require('./errors');
6607var createInvalidArgumentTypeError = errors.createInvalidArgumentTypeError;
6608
6609/**
6610 * Expose `Suite`.
6611 */
6612
6613exports = module.exports = Suite;
6614
6615/**
6616 * Create a new `Suite` with the given `title` and parent `Suite`.
6617 *
6618 * @public
6619 * @param {Suite} parent - Parent suite (required!)
6620 * @param {string} title - Title
6621 * @return {Suite}
6622 */
6623Suite.create = function(parent, title) {
6624 var suite = new Suite(title, parent.ctx);
6625 suite.parent = parent;
6626 title = suite.fullTitle();
6627 parent.addSuite(suite);
6628 return suite;
6629};
6630
6631/**
6632 * Constructs a new `Suite` instance with the given `title`, `ctx`, and `isRoot`.
6633 *
6634 * @public
6635 * @class
6636 * @extends EventEmitter
6637 * @see {@link https://nodejs.org/api/events.html#events_class_eventemitter|EventEmitter}
6638 * @param {string} title - Suite title.
6639 * @param {Context} parentContext - Parent context instance.
6640 * @param {boolean} [isRoot=false] - Whether this is the root suite.
6641 */
6642function Suite(title, parentContext, isRoot) {
6643 if (!utils.isString(title)) {
6644 throw createInvalidArgumentTypeError(
6645 'Suite argument "title" must be a string. Received type "' +
6646 typeof title +
6647 '"',
6648 'title',
6649 'string'
6650 );
6651 }
6652 this.title = title;
6653 function Context() {}
6654 Context.prototype = parentContext;
6655 this.ctx = new Context();
6656 this.suites = [];
6657 this.tests = [];
6658 this.pending = false;
6659 this._beforeEach = [];
6660 this._beforeAll = [];
6661 this._afterEach = [];
6662 this._afterAll = [];
6663 this.root = isRoot === true;
6664 this._timeout = 2000;
6665 this._enableTimeouts = true;
6666 this._slow = 75;
6667 this._bail = false;
6668 this._retries = -1;
6669 this._onlyTests = [];
6670 this._onlySuites = [];
6671 this.delayed = false;
6672
6673 this.on('newListener', function(event) {
6674 if (deprecatedEvents[event]) {
6675 utils.deprecate(
6676 'Event "' +
6677 event +
6678 '" is deprecated. Please let the Mocha team know about your use case: https://git.io/v6Lwm'
6679 );
6680 }
6681 });
6682}
6683
6684/**
6685 * Inherit from `EventEmitter.prototype`.
6686 */
6687inherits(Suite, EventEmitter);
6688
6689/**
6690 * Return a clone of this `Suite`.
6691 *
6692 * @private
6693 * @return {Suite}
6694 */
6695Suite.prototype.clone = function() {
6696 var suite = new Suite(this.title);
6697 debug('clone');
6698 suite.ctx = this.ctx;
6699 suite.root = this.root;
6700 suite.timeout(this.timeout());
6701 suite.retries(this.retries());
6702 suite.enableTimeouts(this.enableTimeouts());
6703 suite.slow(this.slow());
6704 suite.bail(this.bail());
6705 return suite;
6706};
6707
6708/**
6709 * Set or get timeout `ms` or short-hand such as "2s".
6710 *
6711 * @private
6712 * @todo Do not attempt to set value if `ms` is undefined
6713 * @param {number|string} ms
6714 * @return {Suite|number} for chaining
6715 */
6716Suite.prototype.timeout = function(ms) {
6717 if (!arguments.length) {
6718 return this._timeout;
6719 }
6720 if (ms.toString() === '0') {
6721 this._enableTimeouts = false;
6722 }
6723 if (typeof ms === 'string') {
6724 ms = milliseconds(ms);
6725 }
6726 debug('timeout %d', ms);
6727 this._timeout = parseInt(ms, 10);
6728 return this;
6729};
6730
6731/**
6732 * Set or get number of times to retry a failed test.
6733 *
6734 * @private
6735 * @param {number|string} n
6736 * @return {Suite|number} for chaining
6737 */
6738Suite.prototype.retries = function(n) {
6739 if (!arguments.length) {
6740 return this._retries;
6741 }
6742 debug('retries %d', n);
6743 this._retries = parseInt(n, 10) || 0;
6744 return this;
6745};
6746
6747/**
6748 * Set or get timeout to `enabled`.
6749 *
6750 * @private
6751 * @param {boolean} enabled
6752 * @return {Suite|boolean} self or enabled
6753 */
6754Suite.prototype.enableTimeouts = function(enabled) {
6755 if (!arguments.length) {
6756 return this._enableTimeouts;
6757 }
6758 debug('enableTimeouts %s', enabled);
6759 this._enableTimeouts = enabled;
6760 return this;
6761};
6762
6763/**
6764 * Set or get slow `ms` or short-hand such as "2s".
6765 *
6766 * @private
6767 * @param {number|string} ms
6768 * @return {Suite|number} for chaining
6769 */
6770Suite.prototype.slow = function(ms) {
6771 if (!arguments.length) {
6772 return this._slow;
6773 }
6774 if (typeof ms === 'string') {
6775 ms = milliseconds(ms);
6776 }
6777 debug('slow %d', ms);
6778 this._slow = ms;
6779 return this;
6780};
6781
6782/**
6783 * Set or get whether to bail after first error.
6784 *
6785 * @private
6786 * @param {boolean} bail
6787 * @return {Suite|number} for chaining
6788 */
6789Suite.prototype.bail = function(bail) {
6790 if (!arguments.length) {
6791 return this._bail;
6792 }
6793 debug('bail %s', bail);
6794 this._bail = bail;
6795 return this;
6796};
6797
6798/**
6799 * Check if this suite or its parent suite is marked as pending.
6800 *
6801 * @private
6802 */
6803Suite.prototype.isPending = function() {
6804 return this.pending || (this.parent && this.parent.isPending());
6805};
6806
6807/**
6808 * Generic hook-creator.
6809 * @private
6810 * @param {string} title - Title of hook
6811 * @param {Function} fn - Hook callback
6812 * @returns {Hook} A new hook
6813 */
6814Suite.prototype._createHook = function(title, fn) {
6815 var hook = new Hook(title, fn);
6816 hook.parent = this;
6817 hook.timeout(this.timeout());
6818 hook.retries(this.retries());
6819 hook.enableTimeouts(this.enableTimeouts());
6820 hook.slow(this.slow());
6821 hook.ctx = this.ctx;
6822 hook.file = this.file;
6823 return hook;
6824};
6825
6826/**
6827 * Run `fn(test[, done])` before running tests.
6828 *
6829 * @private
6830 * @param {string} title
6831 * @param {Function} fn
6832 * @return {Suite} for chaining
6833 */
6834Suite.prototype.beforeAll = function(title, fn) {
6835 if (this.isPending()) {
6836 return this;
6837 }
6838 if (typeof title === 'function') {
6839 fn = title;
6840 title = fn.name;
6841 }
6842 title = '"before all" hook' + (title ? ': ' + title : '');
6843
6844 var hook = this._createHook(title, fn);
6845 this._beforeAll.push(hook);
6846 this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_ALL, hook);
6847 return this;
6848};
6849
6850/**
6851 * Run `fn(test[, done])` after running tests.
6852 *
6853 * @private
6854 * @param {string} title
6855 * @param {Function} fn
6856 * @return {Suite} for chaining
6857 */
6858Suite.prototype.afterAll = function(title, fn) {
6859 if (this.isPending()) {
6860 return this;
6861 }
6862 if (typeof title === 'function') {
6863 fn = title;
6864 title = fn.name;
6865 }
6866 title = '"after all" hook' + (title ? ': ' + title : '');
6867
6868 var hook = this._createHook(title, fn);
6869 this._afterAll.push(hook);
6870 this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_ALL, hook);
6871 return this;
6872};
6873
6874/**
6875 * Run `fn(test[, done])` before each test case.
6876 *
6877 * @private
6878 * @param {string} title
6879 * @param {Function} fn
6880 * @return {Suite} for chaining
6881 */
6882Suite.prototype.beforeEach = function(title, fn) {
6883 if (this.isPending()) {
6884 return this;
6885 }
6886 if (typeof title === 'function') {
6887 fn = title;
6888 title = fn.name;
6889 }
6890 title = '"before each" hook' + (title ? ': ' + title : '');
6891
6892 var hook = this._createHook(title, fn);
6893 this._beforeEach.push(hook);
6894 this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_EACH, hook);
6895 return this;
6896};
6897
6898/**
6899 * Run `fn(test[, done])` after each test case.
6900 *
6901 * @private
6902 * @param {string} title
6903 * @param {Function} fn
6904 * @return {Suite} for chaining
6905 */
6906Suite.prototype.afterEach = function(title, fn) {
6907 if (this.isPending()) {
6908 return this;
6909 }
6910 if (typeof title === 'function') {
6911 fn = title;
6912 title = fn.name;
6913 }
6914 title = '"after each" hook' + (title ? ': ' + title : '');
6915
6916 var hook = this._createHook(title, fn);
6917 this._afterEach.push(hook);
6918 this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_EACH, hook);
6919 return this;
6920};
6921
6922/**
6923 * Add a test `suite`.
6924 *
6925 * @private
6926 * @param {Suite} suite
6927 * @return {Suite} for chaining
6928 */
6929Suite.prototype.addSuite = function(suite) {
6930 suite.parent = this;
6931 suite.root = false;
6932 suite.timeout(this.timeout());
6933 suite.retries(this.retries());
6934 suite.enableTimeouts(this.enableTimeouts());
6935 suite.slow(this.slow());
6936 suite.bail(this.bail());
6937 this.suites.push(suite);
6938 this.emit(constants.EVENT_SUITE_ADD_SUITE, suite);
6939 return this;
6940};
6941
6942/**
6943 * Add a `test` to this suite.
6944 *
6945 * @private
6946 * @param {Test} test
6947 * @return {Suite} for chaining
6948 */
6949Suite.prototype.addTest = function(test) {
6950 test.parent = this;
6951 test.timeout(this.timeout());
6952 test.retries(this.retries());
6953 test.enableTimeouts(this.enableTimeouts());
6954 test.slow(this.slow());
6955 test.ctx = this.ctx;
6956 this.tests.push(test);
6957 this.emit(constants.EVENT_SUITE_ADD_TEST, test);
6958 return this;
6959};
6960
6961/**
6962 * Return the full title generated by recursively concatenating the parent's
6963 * full title.
6964 *
6965 * @memberof Suite
6966 * @public
6967 * @return {string}
6968 */
6969Suite.prototype.fullTitle = function() {
6970 return this.titlePath().join(' ');
6971};
6972
6973/**
6974 * Return the title path generated by recursively concatenating the parent's
6975 * title path.
6976 *
6977 * @memberof Suite
6978 * @public
6979 * @return {string}
6980 */
6981Suite.prototype.titlePath = function() {
6982 var result = [];
6983 if (this.parent) {
6984 result = result.concat(this.parent.titlePath());
6985 }
6986 if (!this.root) {
6987 result.push(this.title);
6988 }
6989 return result;
6990};
6991
6992/**
6993 * Return the total number of tests.
6994 *
6995 * @memberof Suite
6996 * @public
6997 * @return {number}
6998 */
6999Suite.prototype.total = function() {
7000 return (
7001 this.suites.reduce(function(sum, suite) {
7002 return sum + suite.total();
7003 }, 0) + this.tests.length
7004 );
7005};
7006
7007/**
7008 * Iterates through each suite recursively to find all tests. Applies a
7009 * function in the format `fn(test)`.
7010 *
7011 * @private
7012 * @param {Function} fn
7013 * @return {Suite}
7014 */
7015Suite.prototype.eachTest = function(fn) {
7016 this.tests.forEach(fn);
7017 this.suites.forEach(function(suite) {
7018 suite.eachTest(fn);
7019 });
7020 return this;
7021};
7022
7023/**
7024 * This will run the root suite if we happen to be running in delayed mode.
7025 * @private
7026 */
7027Suite.prototype.run = function run() {
7028 if (this.root) {
7029 this.emit(constants.EVENT_ROOT_SUITE_RUN);
7030 }
7031};
7032
7033/**
7034 * Determines whether a suite has an `only` test or suite as a descendant.
7035 *
7036 * @private
7037 * @returns {Boolean}
7038 */
7039Suite.prototype.hasOnly = function hasOnly() {
7040 return (
7041 this._onlyTests.length > 0 ||
7042 this._onlySuites.length > 0 ||
7043 this.suites.some(function(suite) {
7044 return suite.hasOnly();
7045 })
7046 );
7047};
7048
7049/**
7050 * Filter suites based on `isOnly` logic.
7051 *
7052 * @private
7053 * @returns {Boolean}
7054 */
7055Suite.prototype.filterOnly = function filterOnly() {
7056 if (this._onlyTests.length) {
7057 // If the suite contains `only` tests, run those and ignore any nested suites.
7058 this.tests = this._onlyTests;
7059 this.suites = [];
7060 } else {
7061 // Otherwise, do not run any of the tests in this suite.
7062 this.tests = [];
7063 this._onlySuites.forEach(function(onlySuite) {
7064 // If there are other `only` tests/suites nested in the current `only` suite, then filter that `only` suite.
7065 // Otherwise, all of the tests on this `only` suite should be run, so don't filter it.
7066 if (onlySuite.hasOnly()) {
7067 onlySuite.filterOnly();
7068 }
7069 });
7070 // Run the `only` suites, as well as any other suites that have `only` tests/suites as descendants.
7071 var onlySuites = this._onlySuites;
7072 this.suites = this.suites.filter(function(childSuite) {
7073 return onlySuites.indexOf(childSuite) !== -1 || childSuite.filterOnly();
7074 });
7075 }
7076 // Keep the suite only if there is something to run
7077 return this.tests.length > 0 || this.suites.length > 0;
7078};
7079
7080/**
7081 * Adds a suite to the list of subsuites marked `only`.
7082 *
7083 * @private
7084 * @param {Suite} suite
7085 */
7086Suite.prototype.appendOnlySuite = function(suite) {
7087 this._onlySuites.push(suite);
7088};
7089
7090/**
7091 * Adds a test to the list of tests marked `only`.
7092 *
7093 * @private
7094 * @param {Test} test
7095 */
7096Suite.prototype.appendOnlyTest = function(test) {
7097 this._onlyTests.push(test);
7098};
7099
7100/**
7101 * Returns the array of hooks by hook name; see `HOOK_TYPE_*` constants.
7102 * @private
7103 */
7104Suite.prototype.getHooks = function getHooks(name) {
7105 return this['_' + name];
7106};
7107
7108/**
7109 * Cleans up the references to all the deferred functions
7110 * (before/after/beforeEach/afterEach) and tests of a Suite.
7111 * These must be deleted otherwise a memory leak can happen,
7112 * as those functions may reference variables from closures,
7113 * thus those variables can never be garbage collected as long
7114 * as the deferred functions exist.
7115 *
7116 * @private
7117 */
7118Suite.prototype.cleanReferences = function cleanReferences() {
7119 function cleanArrReferences(arr) {
7120 for (var i = 0; i < arr.length; i++) {
7121 delete arr[i].fn;
7122 }
7123 }
7124
7125 if (Array.isArray(this._beforeAll)) {
7126 cleanArrReferences(this._beforeAll);
7127 }
7128
7129 if (Array.isArray(this._beforeEach)) {
7130 cleanArrReferences(this._beforeEach);
7131 }
7132
7133 if (Array.isArray(this._afterAll)) {
7134 cleanArrReferences(this._afterAll);
7135 }
7136
7137 if (Array.isArray(this._afterEach)) {
7138 cleanArrReferences(this._afterEach);
7139 }
7140
7141 for (var i = 0; i < this.tests.length; i++) {
7142 delete this.tests[i].fn;
7143 }
7144};
7145
7146var constants = utils.defineConstants(
7147 /**
7148 * {@link Suite}-related constants.
7149 * @public
7150 * @memberof Suite
7151 * @alias constants
7152 * @readonly
7153 * @static
7154 * @enum {string}
7155 */
7156 {
7157 /**
7158 * Event emitted after a test file has been loaded Not emitted in browser.
7159 */
7160 EVENT_FILE_POST_REQUIRE: 'post-require',
7161 /**
7162 * Event emitted before a test file has been loaded. In browser, this is emitted once an interface has been selected.
7163 */
7164 EVENT_FILE_PRE_REQUIRE: 'pre-require',
7165 /**
7166 * Event emitted immediately after a test file has been loaded. Not emitted in browser.
7167 */
7168 EVENT_FILE_REQUIRE: 'require',
7169 /**
7170 * Event emitted when `global.run()` is called (use with `delay` option)
7171 */
7172 EVENT_ROOT_SUITE_RUN: 'run',
7173
7174 /**
7175 * Namespace for collection of a `Suite`'s "after all" hooks
7176 */
7177 HOOK_TYPE_AFTER_ALL: 'afterAll',
7178 /**
7179 * Namespace for collection of a `Suite`'s "after each" hooks
7180 */
7181 HOOK_TYPE_AFTER_EACH: 'afterEach',
7182 /**
7183 * Namespace for collection of a `Suite`'s "before all" hooks
7184 */
7185 HOOK_TYPE_BEFORE_ALL: 'beforeAll',
7186 /**
7187 * Namespace for collection of a `Suite`'s "before all" hooks
7188 */
7189 HOOK_TYPE_BEFORE_EACH: 'beforeEach',
7190
7191 // the following events are all deprecated
7192
7193 /**
7194 * Emitted after an "after all" `Hook` has been added to a `Suite`. Deprecated
7195 */
7196 EVENT_SUITE_ADD_HOOK_AFTER_ALL: 'afterAll',
7197 /**
7198 * Emitted after an "after each" `Hook` has been added to a `Suite` Deprecated
7199 */
7200 EVENT_SUITE_ADD_HOOK_AFTER_EACH: 'afterEach',
7201 /**
7202 * Emitted after an "before all" `Hook` has been added to a `Suite` Deprecated
7203 */
7204 EVENT_SUITE_ADD_HOOK_BEFORE_ALL: 'beforeAll',
7205 /**
7206 * Emitted after an "before each" `Hook` has been added to a `Suite` Deprecated
7207 */
7208 EVENT_SUITE_ADD_HOOK_BEFORE_EACH: 'beforeEach',
7209 /**
7210 * Emitted after a child `Suite` has been added to a `Suite`. Deprecated
7211 */
7212 EVENT_SUITE_ADD_SUITE: 'suite',
7213 /**
7214 * Emitted after a `Test` has been added to a `Suite`. Deprecated
7215 */
7216 EVENT_SUITE_ADD_TEST: 'test'
7217 }
7218);
7219
7220/**
7221 * @summary There are no known use cases for these events.
7222 * @desc This is a `Set`-like object having all keys being the constant's string value and the value being `true`.
7223 * @todo Remove eventually
7224 * @type {Object<string,boolean>}
7225 * @ignore
7226 */
7227var deprecatedEvents = Object.keys(constants)
7228 .filter(function(constant) {
7229 return constant.substring(0, 15) === 'EVENT_SUITE_ADD';
7230 })
7231 .reduce(function(acc, constant) {
7232 acc[constants[constant]] = true;
7233 return acc;
7234 }, utils.createMap());
7235
7236Suite.constants = constants;
7237
7238},{"./errors":6,"./hook":7,"./utils":38,"debug":45,"events":50,"ms":60}],37:[function(require,module,exports){
7239'use strict';
7240var Runnable = require('./runnable');
7241var utils = require('./utils');
7242var errors = require('./errors');
7243var createInvalidArgumentTypeError = errors.createInvalidArgumentTypeError;
7244var isString = utils.isString;
7245
7246module.exports = Test;
7247
7248/**
7249 * Initialize a new `Test` with the given `title` and callback `fn`.
7250 *
7251 * @public
7252 * @class
7253 * @extends Runnable
7254 * @param {String} title - Test title (required)
7255 * @param {Function} [fn] - Test callback. If omitted, the Test is considered "pending"
7256 */
7257function Test(title, fn) {
7258 if (!isString(title)) {
7259 throw createInvalidArgumentTypeError(
7260 'Test argument "title" should be a string. Received type "' +
7261 typeof title +
7262 '"',
7263 'title',
7264 'string'
7265 );
7266 }
7267 Runnable.call(this, title, fn);
7268 this.pending = !fn;
7269 this.type = 'test';
7270}
7271
7272/**
7273 * Inherit from `Runnable.prototype`.
7274 */
7275utils.inherits(Test, Runnable);
7276
7277Test.prototype.clone = function() {
7278 var test = new Test(this.title, this.fn);
7279 test.timeout(this.timeout());
7280 test.slow(this.slow());
7281 test.enableTimeouts(this.enableTimeouts());
7282 test.retries(this.retries());
7283 test.currentRetry(this.currentRetry());
7284 test.globals(this.globals());
7285 test.parent = this.parent;
7286 test.file = this.file;
7287 test.ctx = this.ctx;
7288 return test;
7289};
7290
7291},{"./errors":6,"./runnable":33,"./utils":38}],38:[function(require,module,exports){
7292(function (process,Buffer){
7293'use strict';
7294
7295/**
7296 * Various utility functions used throughout Mocha's codebase.
7297 * @module utils
7298 */
7299
7300/**
7301 * Module dependencies.
7302 */
7303
7304var fs = require('fs');
7305var path = require('path');
7306var util = require('util');
7307var glob = require('glob');
7308var he = require('he');
7309var errors = require('./errors');
7310var createNoFilesMatchPatternError = errors.createNoFilesMatchPatternError;
7311var createMissingArgumentError = errors.createMissingArgumentError;
7312
7313var assign = (exports.assign = require('object.assign').getPolyfill());
7314
7315/**
7316 * Inherit the prototype methods from one constructor into another.
7317 *
7318 * @param {function} ctor - Constructor function which needs to inherit the
7319 * prototype.
7320 * @param {function} superCtor - Constructor function to inherit prototype from.
7321 * @throws {TypeError} if either constructor is null, or if super constructor
7322 * lacks a prototype.
7323 */
7324exports.inherits = util.inherits;
7325
7326/**
7327 * Escape special characters in the given string of html.
7328 *
7329 * @private
7330 * @param {string} html
7331 * @return {string}
7332 */
7333exports.escape = function(html) {
7334 return he.encode(String(html), {useNamedReferences: false});
7335};
7336
7337/**
7338 * Test if the given obj is type of string.
7339 *
7340 * @private
7341 * @param {Object} obj
7342 * @return {boolean}
7343 */
7344exports.isString = function(obj) {
7345 return typeof obj === 'string';
7346};
7347
7348/**
7349 * Watch the given `files` for changes
7350 * and invoke `fn(file)` on modification.
7351 *
7352 * @private
7353 * @param {Array} files
7354 * @param {Function} fn
7355 */
7356exports.watch = function(files, fn) {
7357 var options = {interval: 100};
7358 var debug = require('debug')('mocha:watch');
7359 files.forEach(function(file) {
7360 debug('file %s', file);
7361 fs.watchFile(file, options, function(curr, prev) {
7362 if (prev.mtime < curr.mtime) {
7363 fn(file);
7364 }
7365 });
7366 });
7367};
7368
7369/**
7370 * Predicate to screen `pathname` for further consideration.
7371 *
7372 * @description
7373 * Returns <code>false</code> for pathname referencing:
7374 * <ul>
7375 * <li>'npm' package installation directory
7376 * <li>'git' version control directory
7377 * </ul>
7378 *
7379 * @private
7380 * @param {string} pathname - File or directory name to screen
7381 * @return {boolean} whether pathname should be further considered
7382 * @example
7383 * ['node_modules', 'test.js'].filter(considerFurther); // => ['test.js']
7384 */
7385function considerFurther(pathname) {
7386 var ignore = ['node_modules', '.git'];
7387
7388 return !~ignore.indexOf(pathname);
7389}
7390
7391/**
7392 * Lookup files in the given `dir`.
7393 *
7394 * @description
7395 * Filenames are returned in _traversal_ order by the OS/filesystem.
7396 * **Make no assumption that the names will be sorted in any fashion.**
7397 *
7398 * @private
7399 * @param {string} dir
7400 * @param {string[]} [exts=['js']]
7401 * @param {Array} [ret=[]]
7402 * @return {Array}
7403 */
7404exports.files = function(dir, exts, ret) {
7405 ret = ret || [];
7406 exts = exts || ['js'];
7407
7408 fs.readdirSync(dir)
7409 .filter(considerFurther)
7410 .forEach(function(dirent) {
7411 var pathname = path.join(dir, dirent);
7412 if (fs.lstatSync(pathname).isDirectory()) {
7413 exports.files(pathname, exts, ret);
7414 } else if (hasMatchingExtname(pathname, exts)) {
7415 ret.push(pathname);
7416 }
7417 });
7418
7419 return ret;
7420};
7421
7422/**
7423 * Compute a slug from the given `str`.
7424 *
7425 * @private
7426 * @param {string} str
7427 * @return {string}
7428 */
7429exports.slug = function(str) {
7430 return str
7431 .toLowerCase()
7432 .replace(/ +/g, '-')
7433 .replace(/[^-\w]/g, '');
7434};
7435
7436/**
7437 * Strip the function definition from `str`, and re-indent for pre whitespace.
7438 *
7439 * @param {string} str
7440 * @return {string}
7441 */
7442exports.clean = function(str) {
7443 str = str
7444 .replace(/\r\n?|[\n\u2028\u2029]/g, '\n')
7445 .replace(/^\uFEFF/, '')
7446 // (traditional)-> space/name parameters body (lambda)-> parameters body multi-statement/single keep body content
7447 .replace(
7448 /^function(?:\s*|\s+[^(]*)\([^)]*\)\s*\{((?:.|\n)*?)\s*\}$|^\([^)]*\)\s*=>\s*(?:\{((?:.|\n)*?)\s*\}|((?:.|\n)*))$/,
7449 '$1$2$3'
7450 );
7451
7452 var spaces = str.match(/^\n?( *)/)[1].length;
7453 var tabs = str.match(/^\n?(\t*)/)[1].length;
7454 var re = new RegExp(
7455 '^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs || spaces) + '}',
7456 'gm'
7457 );
7458
7459 str = str.replace(re, '');
7460
7461 return str.trim();
7462};
7463
7464/**
7465 * Parse the given `qs`.
7466 *
7467 * @private
7468 * @param {string} qs
7469 * @return {Object}
7470 */
7471exports.parseQuery = function(qs) {
7472 return qs
7473 .replace('?', '')
7474 .split('&')
7475 .reduce(function(obj, pair) {
7476 var i = pair.indexOf('=');
7477 var key = pair.slice(0, i);
7478 var val = pair.slice(++i);
7479
7480 // Due to how the URLSearchParams API treats spaces
7481 obj[key] = decodeURIComponent(val.replace(/\+/g, '%20'));
7482
7483 return obj;
7484 }, {});
7485};
7486
7487/**
7488 * Highlight the given string of `js`.
7489 *
7490 * @private
7491 * @param {string} js
7492 * @return {string}
7493 */
7494function highlight(js) {
7495 return js
7496 .replace(/</g, '&lt;')
7497 .replace(/>/g, '&gt;')
7498 .replace(/\/\/(.*)/gm, '<span class="comment">//$1</span>')
7499 .replace(/('.*?')/gm, '<span class="string">$1</span>')
7500 .replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>')
7501 .replace(/(\d+)/gm, '<span class="number">$1</span>')
7502 .replace(
7503 /\bnew[ \t]+(\w+)/gm,
7504 '<span class="keyword">new</span> <span class="init">$1</span>'
7505 )
7506 .replace(
7507 /\b(function|new|throw|return|var|if|else)\b/gm,
7508 '<span class="keyword">$1</span>'
7509 );
7510}
7511
7512/**
7513 * Highlight the contents of tag `name`.
7514 *
7515 * @private
7516 * @param {string} name
7517 */
7518exports.highlightTags = function(name) {
7519 var code = document.getElementById('mocha').getElementsByTagName(name);
7520 for (var i = 0, len = code.length; i < len; ++i) {
7521 code[i].innerHTML = highlight(code[i].innerHTML);
7522 }
7523};
7524
7525/**
7526 * If a value could have properties, and has none, this function is called,
7527 * which returns a string representation of the empty value.
7528 *
7529 * Functions w/ no properties return `'[Function]'`
7530 * Arrays w/ length === 0 return `'[]'`
7531 * Objects w/ no properties return `'{}'`
7532 * All else: return result of `value.toString()`
7533 *
7534 * @private
7535 * @param {*} value The value to inspect.
7536 * @param {string} typeHint The type of the value
7537 * @returns {string}
7538 */
7539function emptyRepresentation(value, typeHint) {
7540 switch (typeHint) {
7541 case 'function':
7542 return '[Function]';
7543 case 'object':
7544 return '{}';
7545 case 'array':
7546 return '[]';
7547 default:
7548 return value.toString();
7549 }
7550}
7551
7552/**
7553 * Takes some variable and asks `Object.prototype.toString()` what it thinks it
7554 * is.
7555 *
7556 * @private
7557 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString
7558 * @param {*} value The value to test.
7559 * @returns {string} Computed type
7560 * @example
7561 * type({}) // 'object'
7562 * type([]) // 'array'
7563 * type(1) // 'number'
7564 * type(false) // 'boolean'
7565 * type(Infinity) // 'number'
7566 * type(null) // 'null'
7567 * type(new Date()) // 'date'
7568 * type(/foo/) // 'regexp'
7569 * type('type') // 'string'
7570 * type(global) // 'global'
7571 * type(new String('foo') // 'object'
7572 */
7573var type = (exports.type = function type(value) {
7574 if (value === undefined) {
7575 return 'undefined';
7576 } else if (value === null) {
7577 return 'null';
7578 } else if (Buffer.isBuffer(value)) {
7579 return 'buffer';
7580 }
7581 return Object.prototype.toString
7582 .call(value)
7583 .replace(/^\[.+\s(.+?)]$/, '$1')
7584 .toLowerCase();
7585});
7586
7587/**
7588 * Stringify `value`. Different behavior depending on type of value:
7589 *
7590 * - If `value` is undefined or null, return `'[undefined]'` or `'[null]'`, respectively.
7591 * - If `value` is not an object, function or array, return result of `value.toString()` wrapped in double-quotes.
7592 * - If `value` is an *empty* object, function, or array, return result of function
7593 * {@link emptyRepresentation}.
7594 * - If `value` has properties, call {@link exports.canonicalize} on it, then return result of
7595 * JSON.stringify().
7596 *
7597 * @private
7598 * @see exports.type
7599 * @param {*} value
7600 * @return {string}
7601 */
7602exports.stringify = function(value) {
7603 var typeHint = type(value);
7604
7605 if (!~['object', 'array', 'function'].indexOf(typeHint)) {
7606 if (typeHint === 'buffer') {
7607 var json = Buffer.prototype.toJSON.call(value);
7608 // Based on the toJSON result
7609 return jsonStringify(
7610 json.data && json.type ? json.data : json,
7611 2
7612 ).replace(/,(\n|$)/g, '$1');
7613 }
7614
7615 // IE7/IE8 has a bizarre String constructor; needs to be coerced
7616 // into an array and back to obj.
7617 if (typeHint === 'string' && typeof value === 'object') {
7618 value = value.split('').reduce(function(acc, char, idx) {
7619 acc[idx] = char;
7620 return acc;
7621 }, {});
7622 typeHint = 'object';
7623 } else {
7624 return jsonStringify(value);
7625 }
7626 }
7627
7628 for (var prop in value) {
7629 if (Object.prototype.hasOwnProperty.call(value, prop)) {
7630 return jsonStringify(
7631 exports.canonicalize(value, null, typeHint),
7632 2
7633 ).replace(/,(\n|$)/g, '$1');
7634 }
7635 }
7636
7637 return emptyRepresentation(value, typeHint);
7638};
7639
7640/**
7641 * like JSON.stringify but more sense.
7642 *
7643 * @private
7644 * @param {Object} object
7645 * @param {number=} spaces
7646 * @param {number=} depth
7647 * @returns {*}
7648 */
7649function jsonStringify(object, spaces, depth) {
7650 if (typeof spaces === 'undefined') {
7651 // primitive types
7652 return _stringify(object);
7653 }
7654
7655 depth = depth || 1;
7656 var space = spaces * depth;
7657 var str = Array.isArray(object) ? '[' : '{';
7658 var end = Array.isArray(object) ? ']' : '}';
7659 var length =
7660 typeof object.length === 'number'
7661 ? object.length
7662 : Object.keys(object).length;
7663 // `.repeat()` polyfill
7664 function repeat(s, n) {
7665 return new Array(n).join(s);
7666 }
7667
7668 function _stringify(val) {
7669 switch (type(val)) {
7670 case 'null':
7671 case 'undefined':
7672 val = '[' + val + ']';
7673 break;
7674 case 'array':
7675 case 'object':
7676 val = jsonStringify(val, spaces, depth + 1);
7677 break;
7678 case 'boolean':
7679 case 'regexp':
7680 case 'symbol':
7681 case 'number':
7682 val =
7683 val === 0 && 1 / val === -Infinity // `-0`
7684 ? '-0'
7685 : val.toString();
7686 break;
7687 case 'date':
7688 var sDate = isNaN(val.getTime()) ? val.toString() : val.toISOString();
7689 val = '[Date: ' + sDate + ']';
7690 break;
7691 case 'buffer':
7692 var json = val.toJSON();
7693 // Based on the toJSON result
7694 json = json.data && json.type ? json.data : json;
7695 val = '[Buffer: ' + jsonStringify(json, 2, depth + 1) + ']';
7696 break;
7697 default:
7698 val =
7699 val === '[Function]' || val === '[Circular]'
7700 ? val
7701 : JSON.stringify(val); // string
7702 }
7703 return val;
7704 }
7705
7706 for (var i in object) {
7707 if (!Object.prototype.hasOwnProperty.call(object, i)) {
7708 continue; // not my business
7709 }
7710 --length;
7711 str +=
7712 '\n ' +
7713 repeat(' ', space) +
7714 (Array.isArray(object) ? '' : '"' + i + '": ') + // key
7715 _stringify(object[i]) + // value
7716 (length ? ',' : ''); // comma
7717 }
7718
7719 return (
7720 str +
7721 // [], {}
7722 (str.length !== 1 ? '\n' + repeat(' ', --space) + end : end)
7723 );
7724}
7725
7726/**
7727 * Return a new Thing that has the keys in sorted order. Recursive.
7728 *
7729 * If the Thing...
7730 * - has already been seen, return string `'[Circular]'`
7731 * - is `undefined`, return string `'[undefined]'`
7732 * - is `null`, return value `null`
7733 * - is some other primitive, return the value
7734 * - is not a primitive or an `Array`, `Object`, or `Function`, return the value of the Thing's `toString()` method
7735 * - is a non-empty `Array`, `Object`, or `Function`, return the result of calling this function again.
7736 * - is an empty `Array`, `Object`, or `Function`, return the result of calling `emptyRepresentation()`
7737 *
7738 * @private
7739 * @see {@link exports.stringify}
7740 * @param {*} value Thing to inspect. May or may not have properties.
7741 * @param {Array} [stack=[]] Stack of seen values
7742 * @param {string} [typeHint] Type hint
7743 * @return {(Object|Array|Function|string|undefined)}
7744 */
7745exports.canonicalize = function canonicalize(value, stack, typeHint) {
7746 var canonicalizedObj;
7747 /* eslint-disable no-unused-vars */
7748 var prop;
7749 /* eslint-enable no-unused-vars */
7750 typeHint = typeHint || type(value);
7751 function withStack(value, fn) {
7752 stack.push(value);
7753 fn();
7754 stack.pop();
7755 }
7756
7757 stack = stack || [];
7758
7759 if (stack.indexOf(value) !== -1) {
7760 return '[Circular]';
7761 }
7762
7763 switch (typeHint) {
7764 case 'undefined':
7765 case 'buffer':
7766 case 'null':
7767 canonicalizedObj = value;
7768 break;
7769 case 'array':
7770 withStack(value, function() {
7771 canonicalizedObj = value.map(function(item) {
7772 return exports.canonicalize(item, stack);
7773 });
7774 });
7775 break;
7776 case 'function':
7777 /* eslint-disable guard-for-in */
7778 for (prop in value) {
7779 canonicalizedObj = {};
7780 break;
7781 }
7782 /* eslint-enable guard-for-in */
7783 if (!canonicalizedObj) {
7784 canonicalizedObj = emptyRepresentation(value, typeHint);
7785 break;
7786 }
7787 /* falls through */
7788 case 'object':
7789 canonicalizedObj = canonicalizedObj || {};
7790 withStack(value, function() {
7791 Object.keys(value)
7792 .sort()
7793 .forEach(function(key) {
7794 canonicalizedObj[key] = exports.canonicalize(value[key], stack);
7795 });
7796 });
7797 break;
7798 case 'date':
7799 case 'number':
7800 case 'regexp':
7801 case 'boolean':
7802 case 'symbol':
7803 canonicalizedObj = value;
7804 break;
7805 default:
7806 canonicalizedObj = value + '';
7807 }
7808
7809 return canonicalizedObj;
7810};
7811
7812/**
7813 * Determines if pathname has a matching file extension.
7814 *
7815 * @private
7816 * @param {string} pathname - Pathname to check for match.
7817 * @param {string[]} exts - List of file extensions (sans period).
7818 * @return {boolean} whether file extension matches.
7819 * @example
7820 * hasMatchingExtname('foo.html', ['js', 'css']); // => false
7821 */
7822function hasMatchingExtname(pathname, exts) {
7823 var suffix = path.extname(pathname).slice(1);
7824 return exts.some(function(element) {
7825 return suffix === element;
7826 });
7827}
7828
7829/**
7830 * Determines if pathname would be a "hidden" file (or directory) on UN*X.
7831 *
7832 * @description
7833 * On UN*X, pathnames beginning with a full stop (aka dot) are hidden during
7834 * typical usage. Dotfiles, plain-text configuration files, are prime examples.
7835 *
7836 * @see {@link http://xahlee.info/UnixResource_dir/writ/unix_origin_of_dot_filename.html|Origin of Dot File Names}
7837 *
7838 * @private
7839 * @param {string} pathname - Pathname to check for match.
7840 * @return {boolean} whether pathname would be considered a hidden file.
7841 * @example
7842 * isHiddenOnUnix('.profile'); // => true
7843 */
7844function isHiddenOnUnix(pathname) {
7845 return path.basename(pathname)[0] === '.';
7846}
7847
7848/**
7849 * Lookup file names at the given `path`.
7850 *
7851 * @description
7852 * Filenames are returned in _traversal_ order by the OS/filesystem.
7853 * **Make no assumption that the names will be sorted in any fashion.**
7854 *
7855 * @public
7856 * @memberof Mocha.utils
7857 * @todo Fix extension handling
7858 * @param {string} filepath - Base path to start searching from.
7859 * @param {string[]} extensions - File extensions to look for.
7860 * @param {boolean} recursive - Whether to recurse into subdirectories.
7861 * @return {string[]} An array of paths.
7862 * @throws {Error} if no files match pattern.
7863 * @throws {TypeError} if `filepath` is directory and `extensions` not provided.
7864 */
7865exports.lookupFiles = function lookupFiles(filepath, extensions, recursive) {
7866 var files = [];
7867 var stat;
7868
7869 if (!fs.existsSync(filepath)) {
7870 if (fs.existsSync(filepath + '.js')) {
7871 filepath += '.js';
7872 } else {
7873 // Handle glob
7874 files = glob.sync(filepath);
7875 if (!files.length) {
7876 throw createNoFilesMatchPatternError(
7877 'Cannot find any files matching pattern ' + exports.dQuote(filepath),
7878 filepath
7879 );
7880 }
7881 return files;
7882 }
7883 }
7884
7885 // Handle file
7886 try {
7887 stat = fs.statSync(filepath);
7888 if (stat.isFile()) {
7889 return filepath;
7890 }
7891 } catch (err) {
7892 // ignore error
7893 return;
7894 }
7895
7896 // Handle directory
7897 fs.readdirSync(filepath).forEach(function(dirent) {
7898 var pathname = path.join(filepath, dirent);
7899 var stat;
7900
7901 try {
7902 stat = fs.statSync(pathname);
7903 if (stat.isDirectory()) {
7904 if (recursive) {
7905 files = files.concat(lookupFiles(pathname, extensions, recursive));
7906 }
7907 return;
7908 }
7909 } catch (err) {
7910 // ignore error
7911 return;
7912 }
7913 if (!extensions) {
7914 throw createMissingArgumentError(
7915 util.format(
7916 'Argument %s required when argument %s is a directory',
7917 exports.sQuote('extensions'),
7918 exports.sQuote('filepath')
7919 ),
7920 'extensions',
7921 'array'
7922 );
7923 }
7924
7925 if (
7926 !stat.isFile() ||
7927 !hasMatchingExtname(pathname, extensions) ||
7928 isHiddenOnUnix(pathname)
7929 ) {
7930 return;
7931 }
7932 files.push(pathname);
7933 });
7934
7935 return files;
7936};
7937
7938/**
7939 * process.emitWarning or a polyfill
7940 * @see https://nodejs.org/api/process.html#process_process_emitwarning_warning_options
7941 * @ignore
7942 */
7943function emitWarning(msg, type) {
7944 if (process.emitWarning) {
7945 process.emitWarning(msg, type);
7946 } else {
7947 process.nextTick(function() {
7948 console.warn(type + ': ' + msg);
7949 });
7950 }
7951}
7952
7953/**
7954 * Show a deprecation warning. Each distinct message is only displayed once.
7955 * Ignores empty messages.
7956 *
7957 * @param {string} [msg] - Warning to print
7958 * @private
7959 */
7960exports.deprecate = function deprecate(msg) {
7961 msg = String(msg);
7962 if (msg && !deprecate.cache[msg]) {
7963 deprecate.cache[msg] = true;
7964 emitWarning(msg, 'DeprecationWarning');
7965 }
7966};
7967exports.deprecate.cache = {};
7968
7969/**
7970 * Show a generic warning.
7971 * Ignores empty messages.
7972 *
7973 * @param {string} [msg] - Warning to print
7974 * @private
7975 */
7976exports.warn = function warn(msg) {
7977 if (msg) {
7978 emitWarning(msg);
7979 }
7980};
7981
7982/**
7983 * @summary
7984 * This Filter based on `mocha-clean` module.(see: `github.com/rstacruz/mocha-clean`)
7985 * @description
7986 * When invoking this function you get a filter function that get the Error.stack as an input,
7987 * and return a prettify output.
7988 * (i.e: strip Mocha and internal node functions from stack trace).
7989 * @returns {Function}
7990 */
7991exports.stackTraceFilter = function() {
7992 // TODO: Replace with `process.browser`
7993 var is = typeof document === 'undefined' ? {node: true} : {browser: true};
7994 var slash = path.sep;
7995 var cwd;
7996 if (is.node) {
7997 cwd = process.cwd() + slash;
7998 } else {
7999 cwd = (typeof location === 'undefined'
8000 ? window.location
8001 : location
8002 ).href.replace(/\/[^/]*$/, '/');
8003 slash = '/';
8004 }
8005
8006 function isMochaInternal(line) {
8007 return (
8008 ~line.indexOf('node_modules' + slash + 'mocha' + slash) ||
8009 ~line.indexOf(slash + 'mocha.js')
8010 );
8011 }
8012
8013 function isNodeInternal(line) {
8014 return (
8015 ~line.indexOf('(timers.js:') ||
8016 ~line.indexOf('(events.js:') ||
8017 ~line.indexOf('(node.js:') ||
8018 ~line.indexOf('(module.js:') ||
8019 ~line.indexOf('GeneratorFunctionPrototype.next (native)') ||
8020 false
8021 );
8022 }
8023
8024 return function(stack) {
8025 stack = stack.split('\n');
8026
8027 stack = stack.reduce(function(list, line) {
8028 if (isMochaInternal(line)) {
8029 return list;
8030 }
8031
8032 if (is.node && isNodeInternal(line)) {
8033 return list;
8034 }
8035
8036 // Clean up cwd(absolute)
8037 if (/:\d+:\d+\)?$/.test(line)) {
8038 line = line.replace('(' + cwd, '(');
8039 }
8040
8041 list.push(line);
8042 return list;
8043 }, []);
8044
8045 return stack.join('\n');
8046 };
8047};
8048
8049/**
8050 * Crude, but effective.
8051 * @public
8052 * @param {*} value
8053 * @returns {boolean} Whether or not `value` is a Promise
8054 */
8055exports.isPromise = function isPromise(value) {
8056 return (
8057 typeof value === 'object' &&
8058 value !== null &&
8059 typeof value.then === 'function'
8060 );
8061};
8062
8063/**
8064 * Clamps a numeric value to an inclusive range.
8065 *
8066 * @param {number} value - Value to be clamped.
8067 * @param {numer[]} range - Two element array specifying [min, max] range.
8068 * @returns {number} clamped value
8069 */
8070exports.clamp = function clamp(value, range) {
8071 return Math.min(Math.max(value, range[0]), range[1]);
8072};
8073
8074/**
8075 * Single quote text by combining with undirectional ASCII quotation marks.
8076 *
8077 * @description
8078 * Provides a simple means of markup for quoting text to be used in output.
8079 * Use this to quote names of variables, methods, and packages.
8080 *
8081 * <samp>package 'foo' cannot be found</samp>
8082 *
8083 * @private
8084 * @param {string} str - Value to be quoted.
8085 * @returns {string} quoted value
8086 * @example
8087 * sQuote('n') // => 'n'
8088 */
8089exports.sQuote = function(str) {
8090 return "'" + str + "'";
8091};
8092
8093/**
8094 * Double quote text by combining with undirectional ASCII quotation marks.
8095 *
8096 * @description
8097 * Provides a simple means of markup for quoting text to be used in output.
8098 * Use this to quote names of datatypes, classes, pathnames, and strings.
8099 *
8100 * <samp>argument 'value' must be "string" or "number"</samp>
8101 *
8102 * @private
8103 * @param {string} str - Value to be quoted.
8104 * @returns {string} quoted value
8105 * @example
8106 * dQuote('number') // => "number"
8107 */
8108exports.dQuote = function(str) {
8109 return '"' + str + '"';
8110};
8111
8112/**
8113 * Provides simplistic message translation for dealing with plurality.
8114 *
8115 * @description
8116 * Use this to create messages which need to be singular or plural.
8117 * Some languages have several plural forms, so _complete_ message clauses
8118 * are preferable to generating the message on the fly.
8119 *
8120 * @private
8121 * @param {number} n - Non-negative integer
8122 * @param {string} msg1 - Message to be used in English for `n = 1`
8123 * @param {string} msg2 - Message to be used in English for `n = 0, 2, 3, ...`
8124 * @returns {string} message corresponding to value of `n`
8125 * @example
8126 * var sprintf = require('util').format;
8127 * var pkgs = ['one', 'two'];
8128 * var msg = sprintf(
8129 * ngettext(
8130 * pkgs.length,
8131 * 'cannot load package: %s',
8132 * 'cannot load packages: %s'
8133 * ),
8134 * pkgs.map(sQuote).join(', ')
8135 * );
8136 * console.log(msg); // => cannot load packages: 'one', 'two'
8137 */
8138exports.ngettext = function(n, msg1, msg2) {
8139 if (typeof n === 'number' && n >= 0) {
8140 return n === 1 ? msg1 : msg2;
8141 }
8142};
8143
8144/**
8145 * It's a noop.
8146 * @public
8147 */
8148exports.noop = function() {};
8149
8150/**
8151 * Creates a map-like object.
8152 *
8153 * @description
8154 * A "map" is an object with no prototype, for our purposes. In some cases
8155 * this would be more appropriate than a `Map`, especially if your environment
8156 * doesn't support it. Recommended for use in Mocha's public APIs.
8157 *
8158 * @public
8159 * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map|MDN:Map}
8160 * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Custom_and_Null_objects|MDN:Object.create - Custom objects}
8161 * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign|MDN:Object.assign}
8162 * @param {...*} [obj] - Arguments to `Object.assign()`.
8163 * @returns {Object} An object with no prototype, having `...obj` properties
8164 */
8165exports.createMap = function(obj) {
8166 return assign.apply(
8167 null,
8168 [Object.create(null)].concat(Array.prototype.slice.call(arguments))
8169 );
8170};
8171
8172/**
8173 * Creates a read-only map-like object.
8174 *
8175 * @description
8176 * This differs from {@link module:utils.createMap createMap} only in that
8177 * the argument must be non-empty, because the result is frozen.
8178 *
8179 * @see {@link module:utils.createMap createMap}
8180 * @param {...*} [obj] - Arguments to `Object.assign()`.
8181 * @returns {Object} A frozen object with no prototype, having `...obj` properties
8182 * @throws {TypeError} if argument is not a non-empty object.
8183 */
8184exports.defineConstants = function(obj) {
8185 if (type(obj) !== 'object' || !Object.keys(obj).length) {
8186 throw new TypeError('Invalid argument; expected a non-empty object');
8187 }
8188 return Object.freeze(exports.createMap(obj));
8189};
8190
8191}).call(this,require('_process'),require("buffer").Buffer)
8192},{"./errors":6,"_process":69,"buffer":43,"debug":45,"fs":42,"glob":42,"he":54,"object.assign":65,"path":42,"util":89}],39:[function(require,module,exports){
8193'use strict'
8194
8195exports.byteLength = byteLength
8196exports.toByteArray = toByteArray
8197exports.fromByteArray = fromByteArray
8198
8199var lookup = []
8200var revLookup = []
8201var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
8202
8203var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
8204for (var i = 0, len = code.length; i < len; ++i) {
8205 lookup[i] = code[i]
8206 revLookup[code.charCodeAt(i)] = i
8207}
8208
8209// Support decoding URL-safe base64 strings, as Node.js does.
8210// See: https://en.wikipedia.org/wiki/Base64#URL_applications
8211revLookup['-'.charCodeAt(0)] = 62
8212revLookup['_'.charCodeAt(0)] = 63
8213
8214function getLens (b64) {
8215 var len = b64.length
8216
8217 if (len % 4 > 0) {
8218 throw new Error('Invalid string. Length must be a multiple of 4')
8219 }
8220
8221 // Trim off extra bytes after placeholder bytes are found
8222 // See: https://github.com/beatgammit/base64-js/issues/42
8223 var validLen = b64.indexOf('=')
8224 if (validLen === -1) validLen = len
8225
8226 var placeHoldersLen = validLen === len
8227 ? 0
8228 : 4 - (validLen % 4)
8229
8230 return [validLen, placeHoldersLen]
8231}
8232
8233// base64 is 4/3 + up to two characters of the original data
8234function byteLength (b64) {
8235 var lens = getLens(b64)
8236 var validLen = lens[0]
8237 var placeHoldersLen = lens[1]
8238 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
8239}
8240
8241function _byteLength (b64, validLen, placeHoldersLen) {
8242 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
8243}
8244
8245function toByteArray (b64) {
8246 var tmp
8247 var lens = getLens(b64)
8248 var validLen = lens[0]
8249 var placeHoldersLen = lens[1]
8250
8251 var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
8252
8253 var curByte = 0
8254
8255 // if there are placeholders, only get up to the last complete 4 chars
8256 var len = placeHoldersLen > 0
8257 ? validLen - 4
8258 : validLen
8259
8260 for (var i = 0; i < len; i += 4) {
8261 tmp =
8262 (revLookup[b64.charCodeAt(i)] << 18) |
8263 (revLookup[b64.charCodeAt(i + 1)] << 12) |
8264 (revLookup[b64.charCodeAt(i + 2)] << 6) |
8265 revLookup[b64.charCodeAt(i + 3)]
8266 arr[curByte++] = (tmp >> 16) & 0xFF
8267 arr[curByte++] = (tmp >> 8) & 0xFF
8268 arr[curByte++] = tmp & 0xFF
8269 }
8270
8271 if (placeHoldersLen === 2) {
8272 tmp =
8273 (revLookup[b64.charCodeAt(i)] << 2) |
8274 (revLookup[b64.charCodeAt(i + 1)] >> 4)
8275 arr[curByte++] = tmp & 0xFF
8276 }
8277
8278 if (placeHoldersLen === 1) {
8279 tmp =
8280 (revLookup[b64.charCodeAt(i)] << 10) |
8281 (revLookup[b64.charCodeAt(i + 1)] << 4) |
8282 (revLookup[b64.charCodeAt(i + 2)] >> 2)
8283 arr[curByte++] = (tmp >> 8) & 0xFF
8284 arr[curByte++] = tmp & 0xFF
8285 }
8286
8287 return arr
8288}
8289
8290function tripletToBase64 (num) {
8291 return lookup[num >> 18 & 0x3F] +
8292 lookup[num >> 12 & 0x3F] +
8293 lookup[num >> 6 & 0x3F] +
8294 lookup[num & 0x3F]
8295}
8296
8297function encodeChunk (uint8, start, end) {
8298 var tmp
8299 var output = []
8300 for (var i = start; i < end; i += 3) {
8301 tmp =
8302 ((uint8[i] << 16) & 0xFF0000) +
8303 ((uint8[i + 1] << 8) & 0xFF00) +
8304 (uint8[i + 2] & 0xFF)
8305 output.push(tripletToBase64(tmp))
8306 }
8307 return output.join('')
8308}
8309
8310function fromByteArray (uint8) {
8311 var tmp
8312 var len = uint8.length
8313 var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
8314 var parts = []
8315 var maxChunkLength = 16383 // must be multiple of 3
8316
8317 // go through the array every three bytes, we'll deal with trailing stuff later
8318 for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
8319 parts.push(encodeChunk(
8320 uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
8321 ))
8322 }
8323
8324 // pad the end with zeros, but make sure to not forget the extra bytes
8325 if (extraBytes === 1) {
8326 tmp = uint8[len - 1]
8327 parts.push(
8328 lookup[tmp >> 2] +
8329 lookup[(tmp << 4) & 0x3F] +
8330 '=='
8331 )
8332 } else if (extraBytes === 2) {
8333 tmp = (uint8[len - 2] << 8) + uint8[len - 1]
8334 parts.push(
8335 lookup[tmp >> 10] +
8336 lookup[(tmp >> 4) & 0x3F] +
8337 lookup[(tmp << 2) & 0x3F] +
8338 '='
8339 )
8340 }
8341
8342 return parts.join('')
8343}
8344
8345},{}],40:[function(require,module,exports){
8346
8347},{}],41:[function(require,module,exports){
8348(function (process){
8349var WritableStream = require('stream').Writable
8350var inherits = require('util').inherits
8351
8352module.exports = BrowserStdout
8353
8354
8355inherits(BrowserStdout, WritableStream)
8356
8357function BrowserStdout(opts) {
8358 if (!(this instanceof BrowserStdout)) return new BrowserStdout(opts)
8359
8360 opts = opts || {}
8361 WritableStream.call(this, opts)
8362 this.label = (opts.label !== undefined) ? opts.label : 'stdout'
8363}
8364
8365BrowserStdout.prototype._write = function(chunks, encoding, cb) {
8366 var output = chunks.toString ? chunks.toString() : chunks
8367 if (this.label === false) {
8368 console.log(output)
8369 } else {
8370 console.log(this.label+':', output)
8371 }
8372 process.nextTick(cb)
8373}
8374
8375}).call(this,require('_process'))
8376},{"_process":69,"stream":84,"util":89}],42:[function(require,module,exports){
8377arguments[4][40][0].apply(exports,arguments)
8378},{"dup":40}],43:[function(require,module,exports){
8379(function (Buffer){
8380/*!
8381 * The buffer module from node.js, for the browser.
8382 *
8383 * @author Feross Aboukhadijeh <https://feross.org>
8384 * @license MIT
8385 */
8386/* eslint-disable no-proto */
8387
8388'use strict'
8389
8390var base64 = require('base64-js')
8391var ieee754 = require('ieee754')
8392
8393exports.Buffer = Buffer
8394exports.SlowBuffer = SlowBuffer
8395exports.INSPECT_MAX_BYTES = 50
8396
8397var K_MAX_LENGTH = 0x7fffffff
8398exports.kMaxLength = K_MAX_LENGTH
8399
8400/**
8401 * If `Buffer.TYPED_ARRAY_SUPPORT`:
8402 * === true Use Uint8Array implementation (fastest)
8403 * === false Print warning and recommend using `buffer` v4.x which has an Object
8404 * implementation (most compatible, even IE6)
8405 *
8406 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
8407 * Opera 11.6+, iOS 4.2+.
8408 *
8409 * We report that the browser does not support typed arrays if the are not subclassable
8410 * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
8411 * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
8412 * for __proto__ and has a buggy typed array implementation.
8413 */
8414Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
8415
8416if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
8417 typeof console.error === 'function') {
8418 console.error(
8419 'This browser lacks typed array (Uint8Array) support which is required by ' +
8420 '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
8421 )
8422}
8423
8424function typedArraySupport () {
8425 // Can typed array instances can be augmented?
8426 try {
8427 var arr = new Uint8Array(1)
8428 arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } }
8429 return arr.foo() === 42
8430 } catch (e) {
8431 return false
8432 }
8433}
8434
8435Object.defineProperty(Buffer.prototype, 'parent', {
8436 enumerable: true,
8437 get: function () {
8438 if (!Buffer.isBuffer(this)) return undefined
8439 return this.buffer
8440 }
8441})
8442
8443Object.defineProperty(Buffer.prototype, 'offset', {
8444 enumerable: true,
8445 get: function () {
8446 if (!Buffer.isBuffer(this)) return undefined
8447 return this.byteOffset
8448 }
8449})
8450
8451function createBuffer (length) {
8452 if (length > K_MAX_LENGTH) {
8453 throw new RangeError('The value "' + length + '" is invalid for option "size"')
8454 }
8455 // Return an augmented `Uint8Array` instance
8456 var buf = new Uint8Array(length)
8457 buf.__proto__ = Buffer.prototype
8458 return buf
8459}
8460
8461/**
8462 * The Buffer constructor returns instances of `Uint8Array` that have their
8463 * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
8464 * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
8465 * and the `Uint8Array` methods. Square bracket notation works as expected -- it
8466 * returns a single octet.
8467 *
8468 * The `Uint8Array` prototype remains unmodified.
8469 */
8470
8471function Buffer (arg, encodingOrOffset, length) {
8472 // Common case.
8473 if (typeof arg === 'number') {
8474 if (typeof encodingOrOffset === 'string') {
8475 throw new TypeError(
8476 'The "string" argument must be of type string. Received type number'
8477 )
8478 }
8479 return allocUnsafe(arg)
8480 }
8481 return from(arg, encodingOrOffset, length)
8482}
8483
8484// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
8485if (typeof Symbol !== 'undefined' && Symbol.species != null &&
8486 Buffer[Symbol.species] === Buffer) {
8487 Object.defineProperty(Buffer, Symbol.species, {
8488 value: null,
8489 configurable: true,
8490 enumerable: false,
8491 writable: false
8492 })
8493}
8494
8495Buffer.poolSize = 8192 // not used by this implementation
8496
8497function from (value, encodingOrOffset, length) {
8498 if (typeof value === 'string') {
8499 return fromString(value, encodingOrOffset)
8500 }
8501
8502 if (ArrayBuffer.isView(value)) {
8503 return fromArrayLike(value)
8504 }
8505
8506 if (value == null) {
8507 throw TypeError(
8508 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
8509 'or Array-like Object. Received type ' + (typeof value)
8510 )
8511 }
8512
8513 if (isInstance(value, ArrayBuffer) ||
8514 (value && isInstance(value.buffer, ArrayBuffer))) {
8515 return fromArrayBuffer(value, encodingOrOffset, length)
8516 }
8517
8518 if (typeof value === 'number') {
8519 throw new TypeError(
8520 'The "value" argument must not be of type number. Received type number'
8521 )
8522 }
8523
8524 var valueOf = value.valueOf && value.valueOf()
8525 if (valueOf != null && valueOf !== value) {
8526 return Buffer.from(valueOf, encodingOrOffset, length)
8527 }
8528
8529 var b = fromObject(value)
8530 if (b) return b
8531
8532 if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
8533 typeof value[Symbol.toPrimitive] === 'function') {
8534 return Buffer.from(
8535 value[Symbol.toPrimitive]('string'), encodingOrOffset, length
8536 )
8537 }
8538
8539 throw new TypeError(
8540 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
8541 'or Array-like Object. Received type ' + (typeof value)
8542 )
8543}
8544
8545/**
8546 * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
8547 * if value is a number.
8548 * Buffer.from(str[, encoding])
8549 * Buffer.from(array)
8550 * Buffer.from(buffer)
8551 * Buffer.from(arrayBuffer[, byteOffset[, length]])
8552 **/
8553Buffer.from = function (value, encodingOrOffset, length) {
8554 return from(value, encodingOrOffset, length)
8555}
8556
8557// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
8558// https://github.com/feross/buffer/pull/148
8559Buffer.prototype.__proto__ = Uint8Array.prototype
8560Buffer.__proto__ = Uint8Array
8561
8562function assertSize (size) {
8563 if (typeof size !== 'number') {
8564 throw new TypeError('"size" argument must be of type number')
8565 } else if (size < 0) {
8566 throw new RangeError('The value "' + size + '" is invalid for option "size"')
8567 }
8568}
8569
8570function alloc (size, fill, encoding) {
8571 assertSize(size)
8572 if (size <= 0) {
8573 return createBuffer(size)
8574 }
8575 if (fill !== undefined) {
8576 // Only pay attention to encoding if it's a string. This
8577 // prevents accidentally sending in a number that would
8578 // be interpretted as a start offset.
8579 return typeof encoding === 'string'
8580 ? createBuffer(size).fill(fill, encoding)
8581 : createBuffer(size).fill(fill)
8582 }
8583 return createBuffer(size)
8584}
8585
8586/**
8587 * Creates a new filled Buffer instance.
8588 * alloc(size[, fill[, encoding]])
8589 **/
8590Buffer.alloc = function (size, fill, encoding) {
8591 return alloc(size, fill, encoding)
8592}
8593
8594function allocUnsafe (size) {
8595 assertSize(size)
8596 return createBuffer(size < 0 ? 0 : checked(size) | 0)
8597}
8598
8599/**
8600 * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
8601 * */
8602Buffer.allocUnsafe = function (size) {
8603 return allocUnsafe(size)
8604}
8605/**
8606 * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
8607 */
8608Buffer.allocUnsafeSlow = function (size) {
8609 return allocUnsafe(size)
8610}
8611
8612function fromString (string, encoding) {
8613 if (typeof encoding !== 'string' || encoding === '') {
8614 encoding = 'utf8'
8615 }
8616
8617 if (!Buffer.isEncoding(encoding)) {
8618 throw new TypeError('Unknown encoding: ' + encoding)
8619 }
8620
8621 var length = byteLength(string, encoding) | 0
8622 var buf = createBuffer(length)
8623
8624 var actual = buf.write(string, encoding)
8625
8626 if (actual !== length) {
8627 // Writing a hex string, for example, that contains invalid characters will
8628 // cause everything after the first invalid character to be ignored. (e.g.
8629 // 'abxxcd' will be treated as 'ab')
8630 buf = buf.slice(0, actual)
8631 }
8632
8633 return buf
8634}
8635
8636function fromArrayLike (array) {
8637 var length = array.length < 0 ? 0 : checked(array.length) | 0
8638 var buf = createBuffer(length)
8639 for (var i = 0; i < length; i += 1) {
8640 buf[i] = array[i] & 255
8641 }
8642 return buf
8643}
8644
8645function fromArrayBuffer (array, byteOffset, length) {
8646 if (byteOffset < 0 || array.byteLength < byteOffset) {
8647 throw new RangeError('"offset" is outside of buffer bounds')
8648 }
8649
8650 if (array.byteLength < byteOffset + (length || 0)) {
8651 throw new RangeError('"length" is outside of buffer bounds')
8652 }
8653
8654 var buf
8655 if (byteOffset === undefined && length === undefined) {
8656 buf = new Uint8Array(array)
8657 } else if (length === undefined) {
8658 buf = new Uint8Array(array, byteOffset)
8659 } else {
8660 buf = new Uint8Array(array, byteOffset, length)
8661 }
8662
8663 // Return an augmented `Uint8Array` instance
8664 buf.__proto__ = Buffer.prototype
8665 return buf
8666}
8667
8668function fromObject (obj) {
8669 if (Buffer.isBuffer(obj)) {
8670 var len = checked(obj.length) | 0
8671 var buf = createBuffer(len)
8672
8673 if (buf.length === 0) {
8674 return buf
8675 }
8676
8677 obj.copy(buf, 0, 0, len)
8678 return buf
8679 }
8680
8681 if (obj.length !== undefined) {
8682 if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
8683 return createBuffer(0)
8684 }
8685 return fromArrayLike(obj)
8686 }
8687
8688 if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
8689 return fromArrayLike(obj.data)
8690 }
8691}
8692
8693function checked (length) {
8694 // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
8695 // length is NaN (which is otherwise coerced to zero.)
8696 if (length >= K_MAX_LENGTH) {
8697 throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
8698 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
8699 }
8700 return length | 0
8701}
8702
8703function SlowBuffer (length) {
8704 if (+length != length) { // eslint-disable-line eqeqeq
8705 length = 0
8706 }
8707 return Buffer.alloc(+length)
8708}
8709
8710Buffer.isBuffer = function isBuffer (b) {
8711 return b != null && b._isBuffer === true &&
8712 b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
8713}
8714
8715Buffer.compare = function compare (a, b) {
8716 if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)
8717 if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)
8718 if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
8719 throw new TypeError(
8720 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
8721 )
8722 }
8723
8724 if (a === b) return 0
8725
8726 var x = a.length
8727 var y = b.length
8728
8729 for (var i = 0, len = Math.min(x, y); i < len; ++i) {
8730 if (a[i] !== b[i]) {
8731 x = a[i]
8732 y = b[i]
8733 break
8734 }
8735 }
8736
8737 if (x < y) return -1
8738 if (y < x) return 1
8739 return 0
8740}
8741
8742Buffer.isEncoding = function isEncoding (encoding) {
8743 switch (String(encoding).toLowerCase()) {
8744 case 'hex':
8745 case 'utf8':
8746 case 'utf-8':
8747 case 'ascii':
8748 case 'latin1':
8749 case 'binary':
8750 case 'base64':
8751 case 'ucs2':
8752 case 'ucs-2':
8753 case 'utf16le':
8754 case 'utf-16le':
8755 return true
8756 default:
8757 return false
8758 }
8759}
8760
8761Buffer.concat = function concat (list, length) {
8762 if (!Array.isArray(list)) {
8763 throw new TypeError('"list" argument must be an Array of Buffers')
8764 }
8765
8766 if (list.length === 0) {
8767 return Buffer.alloc(0)
8768 }
8769
8770 var i
8771 if (length === undefined) {
8772 length = 0
8773 for (i = 0; i < list.length; ++i) {
8774 length += list[i].length
8775 }
8776 }
8777
8778 var buffer = Buffer.allocUnsafe(length)
8779 var pos = 0
8780 for (i = 0; i < list.length; ++i) {
8781 var buf = list[i]
8782 if (isInstance(buf, Uint8Array)) {
8783 buf = Buffer.from(buf)
8784 }
8785 if (!Buffer.isBuffer(buf)) {
8786 throw new TypeError('"list" argument must be an Array of Buffers')
8787 }
8788 buf.copy(buffer, pos)
8789 pos += buf.length
8790 }
8791 return buffer
8792}
8793
8794function byteLength (string, encoding) {
8795 if (Buffer.isBuffer(string)) {
8796 return string.length
8797 }
8798 if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
8799 return string.byteLength
8800 }
8801 if (typeof string !== 'string') {
8802 throw new TypeError(
8803 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
8804 'Received type ' + typeof string
8805 )
8806 }
8807
8808 var len = string.length
8809 var mustMatch = (arguments.length > 2 && arguments[2] === true)
8810 if (!mustMatch && len === 0) return 0
8811
8812 // Use a for loop to avoid recursion
8813 var loweredCase = false
8814 for (;;) {
8815 switch (encoding) {
8816 case 'ascii':
8817 case 'latin1':
8818 case 'binary':
8819 return len
8820 case 'utf8':
8821 case 'utf-8':
8822 return utf8ToBytes(string).length
8823 case 'ucs2':
8824 case 'ucs-2':
8825 case 'utf16le':
8826 case 'utf-16le':
8827 return len * 2
8828 case 'hex':
8829 return len >>> 1
8830 case 'base64':
8831 return base64ToBytes(string).length
8832 default:
8833 if (loweredCase) {
8834 return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
8835 }
8836 encoding = ('' + encoding).toLowerCase()
8837 loweredCase = true
8838 }
8839 }
8840}
8841Buffer.byteLength = byteLength
8842
8843function slowToString (encoding, start, end) {
8844 var loweredCase = false
8845
8846 // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
8847 // property of a typed array.
8848
8849 // This behaves neither like String nor Uint8Array in that we set start/end
8850 // to their upper/lower bounds if the value passed is out of range.
8851 // undefined is handled specially as per ECMA-262 6th Edition,
8852 // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
8853 if (start === undefined || start < 0) {
8854 start = 0
8855 }
8856 // Return early if start > this.length. Done here to prevent potential uint32
8857 // coercion fail below.
8858 if (start > this.length) {
8859 return ''
8860 }
8861
8862 if (end === undefined || end > this.length) {
8863 end = this.length
8864 }
8865
8866 if (end <= 0) {
8867 return ''
8868 }
8869
8870 // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
8871 end >>>= 0
8872 start >>>= 0
8873
8874 if (end <= start) {
8875 return ''
8876 }
8877
8878 if (!encoding) encoding = 'utf8'
8879
8880 while (true) {
8881 switch (encoding) {
8882 case 'hex':
8883 return hexSlice(this, start, end)
8884
8885 case 'utf8':
8886 case 'utf-8':
8887 return utf8Slice(this, start, end)
8888
8889 case 'ascii':
8890 return asciiSlice(this, start, end)
8891
8892 case 'latin1':
8893 case 'binary':
8894 return latin1Slice(this, start, end)
8895
8896 case 'base64':
8897 return base64Slice(this, start, end)
8898
8899 case 'ucs2':
8900 case 'ucs-2':
8901 case 'utf16le':
8902 case 'utf-16le':
8903 return utf16leSlice(this, start, end)
8904
8905 default:
8906 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
8907 encoding = (encoding + '').toLowerCase()
8908 loweredCase = true
8909 }
8910 }
8911}
8912
8913// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
8914// to detect a Buffer instance. It's not possible to use `instanceof Buffer`
8915// reliably in a browserify context because there could be multiple different
8916// copies of the 'buffer' package in use. This method works even for Buffer
8917// instances that were created from another copy of the `buffer` package.
8918// See: https://github.com/feross/buffer/issues/154
8919Buffer.prototype._isBuffer = true
8920
8921function swap (b, n, m) {
8922 var i = b[n]
8923 b[n] = b[m]
8924 b[m] = i
8925}
8926
8927Buffer.prototype.swap16 = function swap16 () {
8928 var len = this.length
8929 if (len % 2 !== 0) {
8930 throw new RangeError('Buffer size must be a multiple of 16-bits')
8931 }
8932 for (var i = 0; i < len; i += 2) {
8933 swap(this, i, i + 1)
8934 }
8935 return this
8936}
8937
8938Buffer.prototype.swap32 = function swap32 () {
8939 var len = this.length
8940 if (len % 4 !== 0) {
8941 throw new RangeError('Buffer size must be a multiple of 32-bits')
8942 }
8943 for (var i = 0; i < len; i += 4) {
8944 swap(this, i, i + 3)
8945 swap(this, i + 1, i + 2)
8946 }
8947 return this
8948}
8949
8950Buffer.prototype.swap64 = function swap64 () {
8951 var len = this.length
8952 if (len % 8 !== 0) {
8953 throw new RangeError('Buffer size must be a multiple of 64-bits')
8954 }
8955 for (var i = 0; i < len; i += 8) {
8956 swap(this, i, i + 7)
8957 swap(this, i + 1, i + 6)
8958 swap(this, i + 2, i + 5)
8959 swap(this, i + 3, i + 4)
8960 }
8961 return this
8962}
8963
8964Buffer.prototype.toString = function toString () {
8965 var length = this.length
8966 if (length === 0) return ''
8967 if (arguments.length === 0) return utf8Slice(this, 0, length)
8968 return slowToString.apply(this, arguments)
8969}
8970
8971Buffer.prototype.toLocaleString = Buffer.prototype.toString
8972
8973Buffer.prototype.equals = function equals (b) {
8974 if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
8975 if (this === b) return true
8976 return Buffer.compare(this, b) === 0
8977}
8978
8979Buffer.prototype.inspect = function inspect () {
8980 var str = ''
8981 var max = exports.INSPECT_MAX_BYTES
8982 str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
8983 if (this.length > max) str += ' ... '
8984 return '<Buffer ' + str + '>'
8985}
8986
8987Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
8988 if (isInstance(target, Uint8Array)) {
8989 target = Buffer.from(target, target.offset, target.byteLength)
8990 }
8991 if (!Buffer.isBuffer(target)) {
8992 throw new TypeError(
8993 'The "target" argument must be one of type Buffer or Uint8Array. ' +
8994 'Received type ' + (typeof target)
8995 )
8996 }
8997
8998 if (start === undefined) {
8999 start = 0
9000 }
9001 if (end === undefined) {
9002 end = target ? target.length : 0
9003 }
9004 if (thisStart === undefined) {
9005 thisStart = 0
9006 }
9007 if (thisEnd === undefined) {
9008 thisEnd = this.length
9009 }
9010
9011 if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
9012 throw new RangeError('out of range index')
9013 }
9014
9015 if (thisStart >= thisEnd && start >= end) {
9016 return 0
9017 }
9018 if (thisStart >= thisEnd) {
9019 return -1
9020 }
9021 if (start >= end) {
9022 return 1
9023 }
9024
9025 start >>>= 0
9026 end >>>= 0
9027 thisStart >>>= 0
9028 thisEnd >>>= 0
9029
9030 if (this === target) return 0
9031
9032 var x = thisEnd - thisStart
9033 var y = end - start
9034 var len = Math.min(x, y)
9035
9036 var thisCopy = this.slice(thisStart, thisEnd)
9037 var targetCopy = target.slice(start, end)
9038
9039 for (var i = 0; i < len; ++i) {
9040 if (thisCopy[i] !== targetCopy[i]) {
9041 x = thisCopy[i]
9042 y = targetCopy[i]
9043 break
9044 }
9045 }
9046
9047 if (x < y) return -1
9048 if (y < x) return 1
9049 return 0
9050}
9051
9052// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
9053// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
9054//
9055// Arguments:
9056// - buffer - a Buffer to search
9057// - val - a string, Buffer, or number
9058// - byteOffset - an index into `buffer`; will be clamped to an int32
9059// - encoding - an optional encoding, relevant is val is a string
9060// - dir - true for indexOf, false for lastIndexOf
9061function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
9062 // Empty buffer means no match
9063 if (buffer.length === 0) return -1
9064
9065 // Normalize byteOffset
9066 if (typeof byteOffset === 'string') {
9067 encoding = byteOffset
9068 byteOffset = 0
9069 } else if (byteOffset > 0x7fffffff) {
9070 byteOffset = 0x7fffffff
9071 } else if (byteOffset < -0x80000000) {
9072 byteOffset = -0x80000000
9073 }
9074 byteOffset = +byteOffset // Coerce to Number.
9075 if (numberIsNaN(byteOffset)) {
9076 // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
9077 byteOffset = dir ? 0 : (buffer.length - 1)
9078 }
9079
9080 // Normalize byteOffset: negative offsets start from the end of the buffer
9081 if (byteOffset < 0) byteOffset = buffer.length + byteOffset
9082 if (byteOffset >= buffer.length) {
9083 if (dir) return -1
9084 else byteOffset = buffer.length - 1
9085 } else if (byteOffset < 0) {
9086 if (dir) byteOffset = 0
9087 else return -1
9088 }
9089
9090 // Normalize val
9091 if (typeof val === 'string') {
9092 val = Buffer.from(val, encoding)
9093 }
9094
9095 // Finally, search either indexOf (if dir is true) or lastIndexOf
9096 if (Buffer.isBuffer(val)) {
9097 // Special case: looking for empty string/buffer always fails
9098 if (val.length === 0) {
9099 return -1
9100 }
9101 return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
9102 } else if (typeof val === 'number') {
9103 val = val & 0xFF // Search for a byte value [0-255]
9104 if (typeof Uint8Array.prototype.indexOf === 'function') {
9105 if (dir) {
9106 return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
9107 } else {
9108 return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
9109 }
9110 }
9111 return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
9112 }
9113
9114 throw new TypeError('val must be string, number or Buffer')
9115}
9116
9117function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
9118 var indexSize = 1
9119 var arrLength = arr.length
9120 var valLength = val.length
9121
9122 if (encoding !== undefined) {
9123 encoding = String(encoding).toLowerCase()
9124 if (encoding === 'ucs2' || encoding === 'ucs-2' ||
9125 encoding === 'utf16le' || encoding === 'utf-16le') {
9126 if (arr.length < 2 || val.length < 2) {
9127 return -1
9128 }
9129 indexSize = 2
9130 arrLength /= 2
9131 valLength /= 2
9132 byteOffset /= 2
9133 }
9134 }
9135
9136 function read (buf, i) {
9137 if (indexSize === 1) {
9138 return buf[i]
9139 } else {
9140 return buf.readUInt16BE(i * indexSize)
9141 }
9142 }
9143
9144 var i
9145 if (dir) {
9146 var foundIndex = -1
9147 for (i = byteOffset; i < arrLength; i++) {
9148 if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
9149 if (foundIndex === -1) foundIndex = i
9150 if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
9151 } else {
9152 if (foundIndex !== -1) i -= i - foundIndex
9153 foundIndex = -1
9154 }
9155 }
9156 } else {
9157 if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
9158 for (i = byteOffset; i >= 0; i--) {
9159 var found = true
9160 for (var j = 0; j < valLength; j++) {
9161 if (read(arr, i + j) !== read(val, j)) {
9162 found = false
9163 break
9164 }
9165 }
9166 if (found) return i
9167 }
9168 }
9169
9170 return -1
9171}
9172
9173Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
9174 return this.indexOf(val, byteOffset, encoding) !== -1
9175}
9176
9177Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
9178 return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
9179}
9180
9181Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
9182 return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
9183}
9184
9185function hexWrite (buf, string, offset, length) {
9186 offset = Number(offset) || 0
9187 var remaining = buf.length - offset
9188 if (!length) {
9189 length = remaining
9190 } else {
9191 length = Number(length)
9192 if (length > remaining) {
9193 length = remaining
9194 }
9195 }
9196
9197 var strLen = string.length
9198
9199 if (length > strLen / 2) {
9200 length = strLen / 2
9201 }
9202 for (var i = 0; i < length; ++i) {
9203 var parsed = parseInt(string.substr(i * 2, 2), 16)
9204 if (numberIsNaN(parsed)) return i
9205 buf[offset + i] = parsed
9206 }
9207 return i
9208}
9209
9210function utf8Write (buf, string, offset, length) {
9211 return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
9212}
9213
9214function asciiWrite (buf, string, offset, length) {
9215 return blitBuffer(asciiToBytes(string), buf, offset, length)
9216}
9217
9218function latin1Write (buf, string, offset, length) {
9219 return asciiWrite(buf, string, offset, length)
9220}
9221
9222function base64Write (buf, string, offset, length) {
9223 return blitBuffer(base64ToBytes(string), buf, offset, length)
9224}
9225
9226function ucs2Write (buf, string, offset, length) {
9227 return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
9228}
9229
9230Buffer.prototype.write = function write (string, offset, length, encoding) {
9231 // Buffer#write(string)
9232 if (offset === undefined) {
9233 encoding = 'utf8'
9234 length = this.length
9235 offset = 0
9236 // Buffer#write(string, encoding)
9237 } else if (length === undefined && typeof offset === 'string') {
9238 encoding = offset
9239 length = this.length
9240 offset = 0
9241 // Buffer#write(string, offset[, length][, encoding])
9242 } else if (isFinite(offset)) {
9243 offset = offset >>> 0
9244 if (isFinite(length)) {
9245 length = length >>> 0
9246 if (encoding === undefined) encoding = 'utf8'
9247 } else {
9248 encoding = length
9249 length = undefined
9250 }
9251 } else {
9252 throw new Error(
9253 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
9254 )
9255 }
9256
9257 var remaining = this.length - offset
9258 if (length === undefined || length > remaining) length = remaining
9259
9260 if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
9261 throw new RangeError('Attempt to write outside buffer bounds')
9262 }
9263
9264 if (!encoding) encoding = 'utf8'
9265
9266 var loweredCase = false
9267 for (;;) {
9268 switch (encoding) {
9269 case 'hex':
9270 return hexWrite(this, string, offset, length)
9271
9272 case 'utf8':
9273 case 'utf-8':
9274 return utf8Write(this, string, offset, length)
9275
9276 case 'ascii':
9277 return asciiWrite(this, string, offset, length)
9278
9279 case 'latin1':
9280 case 'binary':
9281 return latin1Write(this, string, offset, length)
9282
9283 case 'base64':
9284 // Warning: maxLength not taken into account in base64Write
9285 return base64Write(this, string, offset, length)
9286
9287 case 'ucs2':
9288 case 'ucs-2':
9289 case 'utf16le':
9290 case 'utf-16le':
9291 return ucs2Write(this, string, offset, length)
9292
9293 default:
9294 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
9295 encoding = ('' + encoding).toLowerCase()
9296 loweredCase = true
9297 }
9298 }
9299}
9300
9301Buffer.prototype.toJSON = function toJSON () {
9302 return {
9303 type: 'Buffer',
9304 data: Array.prototype.slice.call(this._arr || this, 0)
9305 }
9306}
9307
9308function base64Slice (buf, start, end) {
9309 if (start === 0 && end === buf.length) {
9310 return base64.fromByteArray(buf)
9311 } else {
9312 return base64.fromByteArray(buf.slice(start, end))
9313 }
9314}
9315
9316function utf8Slice (buf, start, end) {
9317 end = Math.min(buf.length, end)
9318 var res = []
9319
9320 var i = start
9321 while (i < end) {
9322 var firstByte = buf[i]
9323 var codePoint = null
9324 var bytesPerSequence = (firstByte > 0xEF) ? 4
9325 : (firstByte > 0xDF) ? 3
9326 : (firstByte > 0xBF) ? 2
9327 : 1
9328
9329 if (i + bytesPerSequence <= end) {
9330 var secondByte, thirdByte, fourthByte, tempCodePoint
9331
9332 switch (bytesPerSequence) {
9333 case 1:
9334 if (firstByte < 0x80) {
9335 codePoint = firstByte
9336 }
9337 break
9338 case 2:
9339 secondByte = buf[i + 1]
9340 if ((secondByte & 0xC0) === 0x80) {
9341 tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
9342 if (tempCodePoint > 0x7F) {
9343 codePoint = tempCodePoint
9344 }
9345 }
9346 break
9347 case 3:
9348 secondByte = buf[i + 1]
9349 thirdByte = buf[i + 2]
9350 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
9351 tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
9352 if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
9353 codePoint = tempCodePoint
9354 }
9355 }
9356 break
9357 case 4:
9358 secondByte = buf[i + 1]
9359 thirdByte = buf[i + 2]
9360 fourthByte = buf[i + 3]
9361 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
9362 tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
9363 if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
9364 codePoint = tempCodePoint
9365 }
9366 }
9367 }
9368 }
9369
9370 if (codePoint === null) {
9371 // we did not generate a valid codePoint so insert a
9372 // replacement char (U+FFFD) and advance only 1 byte
9373 codePoint = 0xFFFD
9374 bytesPerSequence = 1
9375 } else if (codePoint > 0xFFFF) {
9376 // encode to utf16 (surrogate pair dance)
9377 codePoint -= 0x10000
9378 res.push(codePoint >>> 10 & 0x3FF | 0xD800)
9379 codePoint = 0xDC00 | codePoint & 0x3FF
9380 }
9381
9382 res.push(codePoint)
9383 i += bytesPerSequence
9384 }
9385
9386 return decodeCodePointsArray(res)
9387}
9388
9389// Based on http://stackoverflow.com/a/22747272/680742, the browser with
9390// the lowest limit is Chrome, with 0x10000 args.
9391// We go 1 magnitude less, for safety
9392var MAX_ARGUMENTS_LENGTH = 0x1000
9393
9394function decodeCodePointsArray (codePoints) {
9395 var len = codePoints.length
9396 if (len <= MAX_ARGUMENTS_LENGTH) {
9397 return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
9398 }
9399
9400 // Decode in chunks to avoid "call stack size exceeded".
9401 var res = ''
9402 var i = 0
9403 while (i < len) {
9404 res += String.fromCharCode.apply(
9405 String,
9406 codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
9407 )
9408 }
9409 return res
9410}
9411
9412function asciiSlice (buf, start, end) {
9413 var ret = ''
9414 end = Math.min(buf.length, end)
9415
9416 for (var i = start; i < end; ++i) {
9417 ret += String.fromCharCode(buf[i] & 0x7F)
9418 }
9419 return ret
9420}
9421
9422function latin1Slice (buf, start, end) {
9423 var ret = ''
9424 end = Math.min(buf.length, end)
9425
9426 for (var i = start; i < end; ++i) {
9427 ret += String.fromCharCode(buf[i])
9428 }
9429 return ret
9430}
9431
9432function hexSlice (buf, start, end) {
9433 var len = buf.length
9434
9435 if (!start || start < 0) start = 0
9436 if (!end || end < 0 || end > len) end = len
9437
9438 var out = ''
9439 for (var i = start; i < end; ++i) {
9440 out += toHex(buf[i])
9441 }
9442 return out
9443}
9444
9445function utf16leSlice (buf, start, end) {
9446 var bytes = buf.slice(start, end)
9447 var res = ''
9448 for (var i = 0; i < bytes.length; i += 2) {
9449 res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
9450 }
9451 return res
9452}
9453
9454Buffer.prototype.slice = function slice (start, end) {
9455 var len = this.length
9456 start = ~~start
9457 end = end === undefined ? len : ~~end
9458
9459 if (start < 0) {
9460 start += len
9461 if (start < 0) start = 0
9462 } else if (start > len) {
9463 start = len
9464 }
9465
9466 if (end < 0) {
9467 end += len
9468 if (end < 0) end = 0
9469 } else if (end > len) {
9470 end = len
9471 }
9472
9473 if (end < start) end = start
9474
9475 var newBuf = this.subarray(start, end)
9476 // Return an augmented `Uint8Array` instance
9477 newBuf.__proto__ = Buffer.prototype
9478 return newBuf
9479}
9480
9481/*
9482 * Need to make sure that buffer isn't trying to write out of bounds.
9483 */
9484function checkOffset (offset, ext, length) {
9485 if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
9486 if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
9487}
9488
9489Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
9490 offset = offset >>> 0
9491 byteLength = byteLength >>> 0
9492 if (!noAssert) checkOffset(offset, byteLength, this.length)
9493
9494 var val = this[offset]
9495 var mul = 1
9496 var i = 0
9497 while (++i < byteLength && (mul *= 0x100)) {
9498 val += this[offset + i] * mul
9499 }
9500
9501 return val
9502}
9503
9504Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
9505 offset = offset >>> 0
9506 byteLength = byteLength >>> 0
9507 if (!noAssert) {
9508 checkOffset(offset, byteLength, this.length)
9509 }
9510
9511 var val = this[offset + --byteLength]
9512 var mul = 1
9513 while (byteLength > 0 && (mul *= 0x100)) {
9514 val += this[offset + --byteLength] * mul
9515 }
9516
9517 return val
9518}
9519
9520Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
9521 offset = offset >>> 0
9522 if (!noAssert) checkOffset(offset, 1, this.length)
9523 return this[offset]
9524}
9525
9526Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
9527 offset = offset >>> 0
9528 if (!noAssert) checkOffset(offset, 2, this.length)
9529 return this[offset] | (this[offset + 1] << 8)
9530}
9531
9532Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
9533 offset = offset >>> 0
9534 if (!noAssert) checkOffset(offset, 2, this.length)
9535 return (this[offset] << 8) | this[offset + 1]
9536}
9537
9538Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
9539 offset = offset >>> 0
9540 if (!noAssert) checkOffset(offset, 4, this.length)
9541
9542 return ((this[offset]) |
9543 (this[offset + 1] << 8) |
9544 (this[offset + 2] << 16)) +
9545 (this[offset + 3] * 0x1000000)
9546}
9547
9548Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
9549 offset = offset >>> 0
9550 if (!noAssert) checkOffset(offset, 4, this.length)
9551
9552 return (this[offset] * 0x1000000) +
9553 ((this[offset + 1] << 16) |
9554 (this[offset + 2] << 8) |
9555 this[offset + 3])
9556}
9557
9558Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
9559 offset = offset >>> 0
9560 byteLength = byteLength >>> 0
9561 if (!noAssert) checkOffset(offset, byteLength, this.length)
9562
9563 var val = this[offset]
9564 var mul = 1
9565 var i = 0
9566 while (++i < byteLength && (mul *= 0x100)) {
9567 val += this[offset + i] * mul
9568 }
9569 mul *= 0x80
9570
9571 if (val >= mul) val -= Math.pow(2, 8 * byteLength)
9572
9573 return val
9574}
9575
9576Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
9577 offset = offset >>> 0
9578 byteLength = byteLength >>> 0
9579 if (!noAssert) checkOffset(offset, byteLength, this.length)
9580
9581 var i = byteLength
9582 var mul = 1
9583 var val = this[offset + --i]
9584 while (i > 0 && (mul *= 0x100)) {
9585 val += this[offset + --i] * mul
9586 }
9587 mul *= 0x80
9588
9589 if (val >= mul) val -= Math.pow(2, 8 * byteLength)
9590
9591 return val
9592}
9593
9594Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
9595 offset = offset >>> 0
9596 if (!noAssert) checkOffset(offset, 1, this.length)
9597 if (!(this[offset] & 0x80)) return (this[offset])
9598 return ((0xff - this[offset] + 1) * -1)
9599}
9600
9601Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
9602 offset = offset >>> 0
9603 if (!noAssert) checkOffset(offset, 2, this.length)
9604 var val = this[offset] | (this[offset + 1] << 8)
9605 return (val & 0x8000) ? val | 0xFFFF0000 : val
9606}
9607
9608Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
9609 offset = offset >>> 0
9610 if (!noAssert) checkOffset(offset, 2, this.length)
9611 var val = this[offset + 1] | (this[offset] << 8)
9612 return (val & 0x8000) ? val | 0xFFFF0000 : val
9613}
9614
9615Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
9616 offset = offset >>> 0
9617 if (!noAssert) checkOffset(offset, 4, this.length)
9618
9619 return (this[offset]) |
9620 (this[offset + 1] << 8) |
9621 (this[offset + 2] << 16) |
9622 (this[offset + 3] << 24)
9623}
9624
9625Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
9626 offset = offset >>> 0
9627 if (!noAssert) checkOffset(offset, 4, this.length)
9628
9629 return (this[offset] << 24) |
9630 (this[offset + 1] << 16) |
9631 (this[offset + 2] << 8) |
9632 (this[offset + 3])
9633}
9634
9635Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
9636 offset = offset >>> 0
9637 if (!noAssert) checkOffset(offset, 4, this.length)
9638 return ieee754.read(this, offset, true, 23, 4)
9639}
9640
9641Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
9642 offset = offset >>> 0
9643 if (!noAssert) checkOffset(offset, 4, this.length)
9644 return ieee754.read(this, offset, false, 23, 4)
9645}
9646
9647Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
9648 offset = offset >>> 0
9649 if (!noAssert) checkOffset(offset, 8, this.length)
9650 return ieee754.read(this, offset, true, 52, 8)
9651}
9652
9653Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
9654 offset = offset >>> 0
9655 if (!noAssert) checkOffset(offset, 8, this.length)
9656 return ieee754.read(this, offset, false, 52, 8)
9657}
9658
9659function checkInt (buf, value, offset, ext, max, min) {
9660 if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
9661 if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
9662 if (offset + ext > buf.length) throw new RangeError('Index out of range')
9663}
9664
9665Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
9666 value = +value
9667 offset = offset >>> 0
9668 byteLength = byteLength >>> 0
9669 if (!noAssert) {
9670 var maxBytes = Math.pow(2, 8 * byteLength) - 1
9671 checkInt(this, value, offset, byteLength, maxBytes, 0)
9672 }
9673
9674 var mul = 1
9675 var i = 0
9676 this[offset] = value & 0xFF
9677 while (++i < byteLength && (mul *= 0x100)) {
9678 this[offset + i] = (value / mul) & 0xFF
9679 }
9680
9681 return offset + byteLength
9682}
9683
9684Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
9685 value = +value
9686 offset = offset >>> 0
9687 byteLength = byteLength >>> 0
9688 if (!noAssert) {
9689 var maxBytes = Math.pow(2, 8 * byteLength) - 1
9690 checkInt(this, value, offset, byteLength, maxBytes, 0)
9691 }
9692
9693 var i = byteLength - 1
9694 var mul = 1
9695 this[offset + i] = value & 0xFF
9696 while (--i >= 0 && (mul *= 0x100)) {
9697 this[offset + i] = (value / mul) & 0xFF
9698 }
9699
9700 return offset + byteLength
9701}
9702
9703Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
9704 value = +value
9705 offset = offset >>> 0
9706 if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
9707 this[offset] = (value & 0xff)
9708 return offset + 1
9709}
9710
9711Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
9712 value = +value
9713 offset = offset >>> 0
9714 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
9715 this[offset] = (value & 0xff)
9716 this[offset + 1] = (value >>> 8)
9717 return offset + 2
9718}
9719
9720Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
9721 value = +value
9722 offset = offset >>> 0
9723 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
9724 this[offset] = (value >>> 8)
9725 this[offset + 1] = (value & 0xff)
9726 return offset + 2
9727}
9728
9729Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
9730 value = +value
9731 offset = offset >>> 0
9732 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
9733 this[offset + 3] = (value >>> 24)
9734 this[offset + 2] = (value >>> 16)
9735 this[offset + 1] = (value >>> 8)
9736 this[offset] = (value & 0xff)
9737 return offset + 4
9738}
9739
9740Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
9741 value = +value
9742 offset = offset >>> 0
9743 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
9744 this[offset] = (value >>> 24)
9745 this[offset + 1] = (value >>> 16)
9746 this[offset + 2] = (value >>> 8)
9747 this[offset + 3] = (value & 0xff)
9748 return offset + 4
9749}
9750
9751Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
9752 value = +value
9753 offset = offset >>> 0
9754 if (!noAssert) {
9755 var limit = Math.pow(2, (8 * byteLength) - 1)
9756
9757 checkInt(this, value, offset, byteLength, limit - 1, -limit)
9758 }
9759
9760 var i = 0
9761 var mul = 1
9762 var sub = 0
9763 this[offset] = value & 0xFF
9764 while (++i < byteLength && (mul *= 0x100)) {
9765 if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
9766 sub = 1
9767 }
9768 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
9769 }
9770
9771 return offset + byteLength
9772}
9773
9774Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
9775 value = +value
9776 offset = offset >>> 0
9777 if (!noAssert) {
9778 var limit = Math.pow(2, (8 * byteLength) - 1)
9779
9780 checkInt(this, value, offset, byteLength, limit - 1, -limit)
9781 }
9782
9783 var i = byteLength - 1
9784 var mul = 1
9785 var sub = 0
9786 this[offset + i] = value & 0xFF
9787 while (--i >= 0 && (mul *= 0x100)) {
9788 if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
9789 sub = 1
9790 }
9791 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
9792 }
9793
9794 return offset + byteLength
9795}
9796
9797Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
9798 value = +value
9799 offset = offset >>> 0
9800 if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
9801 if (value < 0) value = 0xff + value + 1
9802 this[offset] = (value & 0xff)
9803 return offset + 1
9804}
9805
9806Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
9807 value = +value
9808 offset = offset >>> 0
9809 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
9810 this[offset] = (value & 0xff)
9811 this[offset + 1] = (value >>> 8)
9812 return offset + 2
9813}
9814
9815Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
9816 value = +value
9817 offset = offset >>> 0
9818 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
9819 this[offset] = (value >>> 8)
9820 this[offset + 1] = (value & 0xff)
9821 return offset + 2
9822}
9823
9824Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
9825 value = +value
9826 offset = offset >>> 0
9827 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
9828 this[offset] = (value & 0xff)
9829 this[offset + 1] = (value >>> 8)
9830 this[offset + 2] = (value >>> 16)
9831 this[offset + 3] = (value >>> 24)
9832 return offset + 4
9833}
9834
9835Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
9836 value = +value
9837 offset = offset >>> 0
9838 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
9839 if (value < 0) value = 0xffffffff + value + 1
9840 this[offset] = (value >>> 24)
9841 this[offset + 1] = (value >>> 16)
9842 this[offset + 2] = (value >>> 8)
9843 this[offset + 3] = (value & 0xff)
9844 return offset + 4
9845}
9846
9847function checkIEEE754 (buf, value, offset, ext, max, min) {
9848 if (offset + ext > buf.length) throw new RangeError('Index out of range')
9849 if (offset < 0) throw new RangeError('Index out of range')
9850}
9851
9852function writeFloat (buf, value, offset, littleEndian, noAssert) {
9853 value = +value
9854 offset = offset >>> 0
9855 if (!noAssert) {
9856 checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
9857 }
9858 ieee754.write(buf, value, offset, littleEndian, 23, 4)
9859 return offset + 4
9860}
9861
9862Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
9863 return writeFloat(this, value, offset, true, noAssert)
9864}
9865
9866Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
9867 return writeFloat(this, value, offset, false, noAssert)
9868}
9869
9870function writeDouble (buf, value, offset, littleEndian, noAssert) {
9871 value = +value
9872 offset = offset >>> 0
9873 if (!noAssert) {
9874 checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
9875 }
9876 ieee754.write(buf, value, offset, littleEndian, 52, 8)
9877 return offset + 8
9878}
9879
9880Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
9881 return writeDouble(this, value, offset, true, noAssert)
9882}
9883
9884Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
9885 return writeDouble(this, value, offset, false, noAssert)
9886}
9887
9888// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
9889Buffer.prototype.copy = function copy (target, targetStart, start, end) {
9890 if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
9891 if (!start) start = 0
9892 if (!end && end !== 0) end = this.length
9893 if (targetStart >= target.length) targetStart = target.length
9894 if (!targetStart) targetStart = 0
9895 if (end > 0 && end < start) end = start
9896
9897 // Copy 0 bytes; we're done
9898 if (end === start) return 0
9899 if (target.length === 0 || this.length === 0) return 0
9900
9901 // Fatal error conditions
9902 if (targetStart < 0) {
9903 throw new RangeError('targetStart out of bounds')
9904 }
9905 if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
9906 if (end < 0) throw new RangeError('sourceEnd out of bounds')
9907
9908 // Are we oob?
9909 if (end > this.length) end = this.length
9910 if (target.length - targetStart < end - start) {
9911 end = target.length - targetStart + start
9912 }
9913
9914 var len = end - start
9915
9916 if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
9917 // Use built-in when available, missing from IE11
9918 this.copyWithin(targetStart, start, end)
9919 } else if (this === target && start < targetStart && targetStart < end) {
9920 // descending copy from end
9921 for (var i = len - 1; i >= 0; --i) {
9922 target[i + targetStart] = this[i + start]
9923 }
9924 } else {
9925 Uint8Array.prototype.set.call(
9926 target,
9927 this.subarray(start, end),
9928 targetStart
9929 )
9930 }
9931
9932 return len
9933}
9934
9935// Usage:
9936// buffer.fill(number[, offset[, end]])
9937// buffer.fill(buffer[, offset[, end]])
9938// buffer.fill(string[, offset[, end]][, encoding])
9939Buffer.prototype.fill = function fill (val, start, end, encoding) {
9940 // Handle string cases:
9941 if (typeof val === 'string') {
9942 if (typeof start === 'string') {
9943 encoding = start
9944 start = 0
9945 end = this.length
9946 } else if (typeof end === 'string') {
9947 encoding = end
9948 end = this.length
9949 }
9950 if (encoding !== undefined && typeof encoding !== 'string') {
9951 throw new TypeError('encoding must be a string')
9952 }
9953 if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
9954 throw new TypeError('Unknown encoding: ' + encoding)
9955 }
9956 if (val.length === 1) {
9957 var code = val.charCodeAt(0)
9958 if ((encoding === 'utf8' && code < 128) ||
9959 encoding === 'latin1') {
9960 // Fast path: If `val` fits into a single byte, use that numeric value.
9961 val = code
9962 }
9963 }
9964 } else if (typeof val === 'number') {
9965 val = val & 255
9966 }
9967
9968 // Invalid ranges are not set to a default, so can range check early.
9969 if (start < 0 || this.length < start || this.length < end) {
9970 throw new RangeError('Out of range index')
9971 }
9972
9973 if (end <= start) {
9974 return this
9975 }
9976
9977 start = start >>> 0
9978 end = end === undefined ? this.length : end >>> 0
9979
9980 if (!val) val = 0
9981
9982 var i
9983 if (typeof val === 'number') {
9984 for (i = start; i < end; ++i) {
9985 this[i] = val
9986 }
9987 } else {
9988 var bytes = Buffer.isBuffer(val)
9989 ? val
9990 : Buffer.from(val, encoding)
9991 var len = bytes.length
9992 if (len === 0) {
9993 throw new TypeError('The value "' + val +
9994 '" is invalid for argument "value"')
9995 }
9996 for (i = 0; i < end - start; ++i) {
9997 this[i + start] = bytes[i % len]
9998 }
9999 }
10000
10001 return this
10002}
10003
10004// HELPER FUNCTIONS
10005// ================
10006
10007var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
10008
10009function base64clean (str) {
10010 // Node takes equal signs as end of the Base64 encoding
10011 str = str.split('=')[0]
10012 // Node strips out invalid characters like \n and \t from the string, base64-js does not
10013 str = str.trim().replace(INVALID_BASE64_RE, '')
10014 // Node converts strings with length < 2 to ''
10015 if (str.length < 2) return ''
10016 // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
10017 while (str.length % 4 !== 0) {
10018 str = str + '='
10019 }
10020 return str
10021}
10022
10023function toHex (n) {
10024 if (n < 16) return '0' + n.toString(16)
10025 return n.toString(16)
10026}
10027
10028function utf8ToBytes (string, units) {
10029 units = units || Infinity
10030 var codePoint
10031 var length = string.length
10032 var leadSurrogate = null
10033 var bytes = []
10034
10035 for (var i = 0; i < length; ++i) {
10036 codePoint = string.charCodeAt(i)
10037
10038 // is surrogate component
10039 if (codePoint > 0xD7FF && codePoint < 0xE000) {
10040 // last char was a lead
10041 if (!leadSurrogate) {
10042 // no lead yet
10043 if (codePoint > 0xDBFF) {
10044 // unexpected trail
10045 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
10046 continue
10047 } else if (i + 1 === length) {
10048 // unpaired lead
10049 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
10050 continue
10051 }
10052
10053 // valid lead
10054 leadSurrogate = codePoint
10055
10056 continue
10057 }
10058
10059 // 2 leads in a row
10060 if (codePoint < 0xDC00) {
10061 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
10062 leadSurrogate = codePoint
10063 continue
10064 }
10065
10066 // valid surrogate pair
10067 codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
10068 } else if (leadSurrogate) {
10069 // valid bmp char, but last char was a lead
10070 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
10071 }
10072
10073 leadSurrogate = null
10074
10075 // encode utf8
10076 if (codePoint < 0x80) {
10077 if ((units -= 1) < 0) break
10078 bytes.push(codePoint)
10079 } else if (codePoint < 0x800) {
10080 if ((units -= 2) < 0) break
10081 bytes.push(
10082 codePoint >> 0x6 | 0xC0,
10083 codePoint & 0x3F | 0x80
10084 )
10085 } else if (codePoint < 0x10000) {
10086 if ((units -= 3) < 0) break
10087 bytes.push(
10088 codePoint >> 0xC | 0xE0,
10089 codePoint >> 0x6 & 0x3F | 0x80,
10090 codePoint & 0x3F | 0x80
10091 )
10092 } else if (codePoint < 0x110000) {
10093 if ((units -= 4) < 0) break
10094 bytes.push(
10095 codePoint >> 0x12 | 0xF0,
10096 codePoint >> 0xC & 0x3F | 0x80,
10097 codePoint >> 0x6 & 0x3F | 0x80,
10098 codePoint & 0x3F | 0x80
10099 )
10100 } else {
10101 throw new Error('Invalid code point')
10102 }
10103 }
10104
10105 return bytes
10106}
10107
10108function asciiToBytes (str) {
10109 var byteArray = []
10110 for (var i = 0; i < str.length; ++i) {
10111 // Node's code seems to be doing this and not & 0x7F..
10112 byteArray.push(str.charCodeAt(i) & 0xFF)
10113 }
10114 return byteArray
10115}
10116
10117function utf16leToBytes (str, units) {
10118 var c, hi, lo
10119 var byteArray = []
10120 for (var i = 0; i < str.length; ++i) {
10121 if ((units -= 2) < 0) break
10122
10123 c = str.charCodeAt(i)
10124 hi = c >> 8
10125 lo = c % 256
10126 byteArray.push(lo)
10127 byteArray.push(hi)
10128 }
10129
10130 return byteArray
10131}
10132
10133function base64ToBytes (str) {
10134 return base64.toByteArray(base64clean(str))
10135}
10136
10137function blitBuffer (src, dst, offset, length) {
10138 for (var i = 0; i < length; ++i) {
10139 if ((i + offset >= dst.length) || (i >= src.length)) break
10140 dst[i + offset] = src[i]
10141 }
10142 return i
10143}
10144
10145// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
10146// the `instanceof` check but they should be treated as of that type.
10147// See: https://github.com/feross/buffer/issues/166
10148function isInstance (obj, type) {
10149 return obj instanceof type ||
10150 (obj != null && obj.constructor != null && obj.constructor.name != null &&
10151 obj.constructor.name === type.name)
10152}
10153function numberIsNaN (obj) {
10154 // For IE11 support
10155 return obj !== obj // eslint-disable-line no-self-compare
10156}
10157
10158}).call(this,require("buffer").Buffer)
10159},{"base64-js":39,"buffer":43,"ieee754":55}],44:[function(require,module,exports){
10160(function (Buffer){
10161// Copyright Joyent, Inc. and other Node contributors.
10162//
10163// Permission is hereby granted, free of charge, to any person obtaining a
10164// copy of this software and associated documentation files (the
10165// "Software"), to deal in the Software without restriction, including
10166// without limitation the rights to use, copy, modify, merge, publish,
10167// distribute, sublicense, and/or sell copies of the Software, and to permit
10168// persons to whom the Software is furnished to do so, subject to the
10169// following conditions:
10170//
10171// The above copyright notice and this permission notice shall be included
10172// in all copies or substantial portions of the Software.
10173//
10174// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10175// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10176// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
10177// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
10178// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
10179// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
10180// USE OR OTHER DEALINGS IN THE SOFTWARE.
10181
10182// NOTE: These type checking functions intentionally don't use `instanceof`
10183// because it is fragile and can be easily faked with `Object.create()`.
10184
10185function isArray(arg) {
10186 if (Array.isArray) {
10187 return Array.isArray(arg);
10188 }
10189 return objectToString(arg) === '[object Array]';
10190}
10191exports.isArray = isArray;
10192
10193function isBoolean(arg) {
10194 return typeof arg === 'boolean';
10195}
10196exports.isBoolean = isBoolean;
10197
10198function isNull(arg) {
10199 return arg === null;
10200}
10201exports.isNull = isNull;
10202
10203function isNullOrUndefined(arg) {
10204 return arg == null;
10205}
10206exports.isNullOrUndefined = isNullOrUndefined;
10207
10208function isNumber(arg) {
10209 return typeof arg === 'number';
10210}
10211exports.isNumber = isNumber;
10212
10213function isString(arg) {
10214 return typeof arg === 'string';
10215}
10216exports.isString = isString;
10217
10218function isSymbol(arg) {
10219 return typeof arg === 'symbol';
10220}
10221exports.isSymbol = isSymbol;
10222
10223function isUndefined(arg) {
10224 return arg === void 0;
10225}
10226exports.isUndefined = isUndefined;
10227
10228function isRegExp(re) {
10229 return objectToString(re) === '[object RegExp]';
10230}
10231exports.isRegExp = isRegExp;
10232
10233function isObject(arg) {
10234 return typeof arg === 'object' && arg !== null;
10235}
10236exports.isObject = isObject;
10237
10238function isDate(d) {
10239 return objectToString(d) === '[object Date]';
10240}
10241exports.isDate = isDate;
10242
10243function isError(e) {
10244 return (objectToString(e) === '[object Error]' || e instanceof Error);
10245}
10246exports.isError = isError;
10247
10248function isFunction(arg) {
10249 return typeof arg === 'function';
10250}
10251exports.isFunction = isFunction;
10252
10253function isPrimitive(arg) {
10254 return arg === null ||
10255 typeof arg === 'boolean' ||
10256 typeof arg === 'number' ||
10257 typeof arg === 'string' ||
10258 typeof arg === 'symbol' || // ES6 symbol
10259 typeof arg === 'undefined';
10260}
10261exports.isPrimitive = isPrimitive;
10262
10263exports.isBuffer = Buffer.isBuffer;
10264
10265function objectToString(o) {
10266 return Object.prototype.toString.call(o);
10267}
10268
10269}).call(this,{"isBuffer":require("../../is-buffer/index.js")})
10270},{"../../is-buffer/index.js":57}],45:[function(require,module,exports){
10271(function (process){
10272"use strict";
10273
10274function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
10275
10276/* eslint-env browser */
10277
10278/**
10279 * This is the web browser implementation of `debug()`.
10280 */
10281exports.log = log;
10282exports.formatArgs = formatArgs;
10283exports.save = save;
10284exports.load = load;
10285exports.useColors = useColors;
10286exports.storage = localstorage();
10287/**
10288 * Colors.
10289 */
10290
10291exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
10292/**
10293 * Currently only WebKit-based Web Inspectors, Firefox >= v31,
10294 * and the Firebug extension (any Firefox version) are known
10295 * to support "%c" CSS customizations.
10296 *
10297 * TODO: add a `localStorage` variable to explicitly enable/disable colors
10298 */
10299// eslint-disable-next-line complexity
10300
10301function useColors() {
10302 // NB: In an Electron preload script, document will be defined but not fully
10303 // initialized. Since we know we're in Chrome, we'll just detect this case
10304 // explicitly
10305 if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
10306 return true;
10307 } // Internet Explorer and Edge do not support colors.
10308
10309
10310 if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
10311 return false;
10312 } // Is webkit? http://stackoverflow.com/a/16459606/376773
10313 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
10314
10315
10316 return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
10317 typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
10318 // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
10319 typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
10320 typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
10321}
10322/**
10323 * Colorize log arguments if enabled.
10324 *
10325 * @api public
10326 */
10327
10328
10329function formatArgs(args) {
10330 args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
10331
10332 if (!this.useColors) {
10333 return;
10334 }
10335
10336 var c = 'color: ' + this.color;
10337 args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
10338 // arguments passed either before or after the %c, so we need to
10339 // figure out the correct index to insert the CSS into
10340
10341 var index = 0;
10342 var lastC = 0;
10343 args[0].replace(/%[a-zA-Z%]/g, function (match) {
10344 if (match === '%%') {
10345 return;
10346 }
10347
10348 index++;
10349
10350 if (match === '%c') {
10351 // We only are interested in the *last* %c
10352 // (the user may have provided their own)
10353 lastC = index;
10354 }
10355 });
10356 args.splice(lastC, 0, c);
10357}
10358/**
10359 * Invokes `console.log()` when available.
10360 * No-op when `console.log` is not a "function".
10361 *
10362 * @api public
10363 */
10364
10365
10366function log() {
10367 var _console;
10368
10369 // This hackery is required for IE8/9, where
10370 // the `console.log` function doesn't have 'apply'
10371 return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
10372}
10373/**
10374 * Save `namespaces`.
10375 *
10376 * @param {String} namespaces
10377 * @api private
10378 */
10379
10380
10381function save(namespaces) {
10382 try {
10383 if (namespaces) {
10384 exports.storage.setItem('debug', namespaces);
10385 } else {
10386 exports.storage.removeItem('debug');
10387 }
10388 } catch (error) {// Swallow
10389 // XXX (@Qix-) should we be logging these?
10390 }
10391}
10392/**
10393 * Load `namespaces`.
10394 *
10395 * @return {String} returns the previously persisted debug modes
10396 * @api private
10397 */
10398
10399
10400function load() {
10401 var r;
10402
10403 try {
10404 r = exports.storage.getItem('debug');
10405 } catch (error) {} // Swallow
10406 // XXX (@Qix-) should we be logging these?
10407 // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
10408
10409
10410 if (!r && typeof process !== 'undefined' && 'env' in process) {
10411 r = process.env.DEBUG;
10412 }
10413
10414 return r;
10415}
10416/**
10417 * Localstorage attempts to return the localstorage.
10418 *
10419 * This is necessary because safari throws
10420 * when a user disables cookies/localstorage
10421 * and you attempt to access it.
10422 *
10423 * @return {LocalStorage}
10424 * @api private
10425 */
10426
10427
10428function localstorage() {
10429 try {
10430 // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
10431 // The Browser also has localStorage in the global context.
10432 return localStorage;
10433 } catch (error) {// Swallow
10434 // XXX (@Qix-) should we be logging these?
10435 }
10436}
10437
10438module.exports = require('./common')(exports);
10439var formatters = module.exports.formatters;
10440/**
10441 * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
10442 */
10443
10444formatters.j = function (v) {
10445 try {
10446 return JSON.stringify(v);
10447 } catch (error) {
10448 return '[UnexpectedJSONParseError]: ' + error.message;
10449 }
10450};
10451
10452
10453}).call(this,require('_process'))
10454},{"./common":46,"_process":69}],46:[function(require,module,exports){
10455"use strict";
10456
10457/**
10458 * This is the common logic for both the Node.js and web browser
10459 * implementations of `debug()`.
10460 */
10461function setup(env) {
10462 createDebug.debug = createDebug;
10463 createDebug.default = createDebug;
10464 createDebug.coerce = coerce;
10465 createDebug.disable = disable;
10466 createDebug.enable = enable;
10467 createDebug.enabled = enabled;
10468 createDebug.humanize = require('ms');
10469 Object.keys(env).forEach(function (key) {
10470 createDebug[key] = env[key];
10471 });
10472 /**
10473 * Active `debug` instances.
10474 */
10475
10476 createDebug.instances = [];
10477 /**
10478 * The currently active debug mode names, and names to skip.
10479 */
10480
10481 createDebug.names = [];
10482 createDebug.skips = [];
10483 /**
10484 * Map of special "%n" handling functions, for the debug "format" argument.
10485 *
10486 * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
10487 */
10488
10489 createDebug.formatters = {};
10490 /**
10491 * Selects a color for a debug namespace
10492 * @param {String} namespace The namespace string for the for the debug instance to be colored
10493 * @return {Number|String} An ANSI color code for the given namespace
10494 * @api private
10495 */
10496
10497 function selectColor(namespace) {
10498 var hash = 0;
10499
10500 for (var i = 0; i < namespace.length; i++) {
10501 hash = (hash << 5) - hash + namespace.charCodeAt(i);
10502 hash |= 0; // Convert to 32bit integer
10503 }
10504
10505 return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
10506 }
10507
10508 createDebug.selectColor = selectColor;
10509 /**
10510 * Create a debugger with the given `namespace`.
10511 *
10512 * @param {String} namespace
10513 * @return {Function}
10514 * @api public
10515 */
10516
10517 function createDebug(namespace) {
10518 var prevTime;
10519
10520 function debug() {
10521 // Disabled?
10522 if (!debug.enabled) {
10523 return;
10524 }
10525
10526 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
10527 args[_key] = arguments[_key];
10528 }
10529
10530 var self = debug; // Set `diff` timestamp
10531
10532 var curr = Number(new Date());
10533 var ms = curr - (prevTime || curr);
10534 self.diff = ms;
10535 self.prev = prevTime;
10536 self.curr = curr;
10537 prevTime = curr;
10538 args[0] = createDebug.coerce(args[0]);
10539
10540 if (typeof args[0] !== 'string') {
10541 // Anything else let's inspect with %O
10542 args.unshift('%O');
10543 } // Apply any `formatters` transformations
10544
10545
10546 var index = 0;
10547 args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
10548 // If we encounter an escaped % then don't increase the array index
10549 if (match === '%%') {
10550 return match;
10551 }
10552
10553 index++;
10554 var formatter = createDebug.formatters[format];
10555
10556 if (typeof formatter === 'function') {
10557 var val = args[index];
10558 match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
10559
10560 args.splice(index, 1);
10561 index--;
10562 }
10563
10564 return match;
10565 }); // Apply env-specific formatting (colors, etc.)
10566
10567 createDebug.formatArgs.call(self, args);
10568 var logFn = self.log || createDebug.log;
10569 logFn.apply(self, args);
10570 }
10571
10572 debug.namespace = namespace;
10573 debug.enabled = createDebug.enabled(namespace);
10574 debug.useColors = createDebug.useColors();
10575 debug.color = selectColor(namespace);
10576 debug.destroy = destroy;
10577 debug.extend = extend; // Debug.formatArgs = formatArgs;
10578 // debug.rawLog = rawLog;
10579 // env-specific initialization logic for debug instances
10580
10581 if (typeof createDebug.init === 'function') {
10582 createDebug.init(debug);
10583 }
10584
10585 createDebug.instances.push(debug);
10586 return debug;
10587 }
10588
10589 function destroy() {
10590 var index = createDebug.instances.indexOf(this);
10591
10592 if (index !== -1) {
10593 createDebug.instances.splice(index, 1);
10594 return true;
10595 }
10596
10597 return false;
10598 }
10599
10600 function extend(namespace, delimiter) {
10601 return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
10602 }
10603 /**
10604 * Enables a debug mode by namespaces. This can include modes
10605 * separated by a colon and wildcards.
10606 *
10607 * @param {String} namespaces
10608 * @api public
10609 */
10610
10611
10612 function enable(namespaces) {
10613 createDebug.save(namespaces);
10614 createDebug.names = [];
10615 createDebug.skips = [];
10616 var i;
10617 var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
10618 var len = split.length;
10619
10620 for (i = 0; i < len; i++) {
10621 if (!split[i]) {
10622 // ignore empty strings
10623 continue;
10624 }
10625
10626 namespaces = split[i].replace(/\*/g, '.*?');
10627
10628 if (namespaces[0] === '-') {
10629 createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
10630 } else {
10631 createDebug.names.push(new RegExp('^' + namespaces + '$'));
10632 }
10633 }
10634
10635 for (i = 0; i < createDebug.instances.length; i++) {
10636 var instance = createDebug.instances[i];
10637 instance.enabled = createDebug.enabled(instance.namespace);
10638 }
10639 }
10640 /**
10641 * Disable debug output.
10642 *
10643 * @api public
10644 */
10645
10646
10647 function disable() {
10648 createDebug.enable('');
10649 }
10650 /**
10651 * Returns true if the given mode name is enabled, false otherwise.
10652 *
10653 * @param {String} name
10654 * @return {Boolean}
10655 * @api public
10656 */
10657
10658
10659 function enabled(name) {
10660 if (name[name.length - 1] === '*') {
10661 return true;
10662 }
10663
10664 var i;
10665 var len;
10666
10667 for (i = 0, len = createDebug.skips.length; i < len; i++) {
10668 if (createDebug.skips[i].test(name)) {
10669 return false;
10670 }
10671 }
10672
10673 for (i = 0, len = createDebug.names.length; i < len; i++) {
10674 if (createDebug.names[i].test(name)) {
10675 return true;
10676 }
10677 }
10678
10679 return false;
10680 }
10681 /**
10682 * Coerce `val`.
10683 *
10684 * @param {Mixed} val
10685 * @return {Mixed}
10686 * @api private
10687 */
10688
10689
10690 function coerce(val) {
10691 if (val instanceof Error) {
10692 return val.stack || val.message;
10693 }
10694
10695 return val;
10696 }
10697
10698 createDebug.enable(createDebug.load());
10699 return createDebug;
10700}
10701
10702module.exports = setup;
10703
10704
10705},{"ms":60}],47:[function(require,module,exports){
10706'use strict';
10707
10708var keys = require('object-keys');
10709var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
10710
10711var toStr = Object.prototype.toString;
10712var concat = Array.prototype.concat;
10713var origDefineProperty = Object.defineProperty;
10714
10715var isFunction = function (fn) {
10716 return typeof fn === 'function' && toStr.call(fn) === '[object Function]';
10717};
10718
10719var arePropertyDescriptorsSupported = function () {
10720 var obj = {};
10721 try {
10722 origDefineProperty(obj, 'x', { enumerable: false, value: obj });
10723 // eslint-disable-next-line no-unused-vars, no-restricted-syntax
10724 for (var _ in obj) { // jscs:ignore disallowUnusedVariables
10725 return false;
10726 }
10727 return obj.x === obj;
10728 } catch (e) { /* this is IE 8. */
10729 return false;
10730 }
10731};
10732var supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported();
10733
10734var defineProperty = function (object, name, value, predicate) {
10735 if (name in object && (!isFunction(predicate) || !predicate())) {
10736 return;
10737 }
10738 if (supportsDescriptors) {
10739 origDefineProperty(object, name, {
10740 configurable: true,
10741 enumerable: false,
10742 value: value,
10743 writable: true
10744 });
10745 } else {
10746 object[name] = value;
10747 }
10748};
10749
10750var defineProperties = function (object, map) {
10751 var predicates = arguments.length > 2 ? arguments[2] : {};
10752 var props = keys(map);
10753 if (hasSymbols) {
10754 props = concat.call(props, Object.getOwnPropertySymbols(map));
10755 }
10756 for (var i = 0; i < props.length; i += 1) {
10757 defineProperty(object, props[i], map[props[i]], predicates[props[i]]);
10758 }
10759};
10760
10761defineProperties.supportsDescriptors = !!supportsDescriptors;
10762
10763module.exports = defineProperties;
10764
10765},{"object-keys":62}],48:[function(require,module,exports){
10766/*!
10767
10768 diff v3.5.0
10769
10770Software License Agreement (BSD License)
10771
10772Copyright (c) 2009-2015, Kevin Decker <kpdecker@gmail.com>
10773
10774All rights reserved.
10775
10776Redistribution and use of this software in source and binary forms, with or without modification,
10777are permitted provided that the following conditions are met:
10778
10779* Redistributions of source code must retain the above
10780 copyright notice, this list of conditions and the
10781 following disclaimer.
10782
10783* Redistributions in binary form must reproduce the above
10784 copyright notice, this list of conditions and the
10785 following disclaimer in the documentation and/or other
10786 materials provided with the distribution.
10787
10788* Neither the name of Kevin Decker nor the names of its
10789 contributors may be used to endorse or promote products
10790 derived from this software without specific prior
10791 written permission.
10792
10793THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
10794IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
10795FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
10796CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
10797DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10798DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
10799IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
10800OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10801@license
10802*/
10803(function webpackUniversalModuleDefinition(root, factory) {
10804 if(typeof exports === 'object' && typeof module === 'object')
10805 module.exports = factory();
10806 else if(false)
10807 define([], factory);
10808 else if(typeof exports === 'object')
10809 exports["JsDiff"] = factory();
10810 else
10811 root["JsDiff"] = factory();
10812})(this, function() {
10813return /******/ (function(modules) { // webpackBootstrap
10814/******/ // The module cache
10815/******/ var installedModules = {};
10816
10817/******/ // The require function
10818/******/ function __webpack_require__(moduleId) {
10819
10820/******/ // Check if module is in cache
10821/******/ if(installedModules[moduleId])
10822/******/ return installedModules[moduleId].exports;
10823
10824/******/ // Create a new module (and put it into the cache)
10825/******/ var module = installedModules[moduleId] = {
10826/******/ exports: {},
10827/******/ id: moduleId,
10828/******/ loaded: false
10829/******/ };
10830
10831/******/ // Execute the module function
10832/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
10833
10834/******/ // Flag the module as loaded
10835/******/ module.loaded = true;
10836
10837/******/ // Return the exports of the module
10838/******/ return module.exports;
10839/******/ }
10840
10841
10842/******/ // expose the modules object (__webpack_modules__)
10843/******/ __webpack_require__.m = modules;
10844
10845/******/ // expose the module cache
10846/******/ __webpack_require__.c = installedModules;
10847
10848/******/ // __webpack_public_path__
10849/******/ __webpack_require__.p = "";
10850
10851/******/ // Load entry module and return exports
10852/******/ return __webpack_require__(0);
10853/******/ })
10854/************************************************************************/
10855/******/ ([
10856/* 0 */
10857/***/ (function(module, exports, __webpack_require__) {
10858
10859 /*istanbul ignore start*/'use strict';
10860
10861 exports.__esModule = true;
10862 exports.canonicalize = exports.convertChangesToXML = exports.convertChangesToDMP = exports.merge = exports.parsePatch = exports.applyPatches = exports.applyPatch = exports.createPatch = exports.createTwoFilesPatch = exports.structuredPatch = exports.diffArrays = exports.diffJson = exports.diffCss = exports.diffSentences = exports.diffTrimmedLines = exports.diffLines = exports.diffWordsWithSpace = exports.diffWords = exports.diffChars = exports.Diff = undefined;
10863
10864 /*istanbul ignore end*/var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
10865
10866 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
10867
10868 /*istanbul ignore end*/var /*istanbul ignore start*/_character = __webpack_require__(2) /*istanbul ignore end*/;
10869
10870 var /*istanbul ignore start*/_word = __webpack_require__(3) /*istanbul ignore end*/;
10871
10872 var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
10873
10874 var /*istanbul ignore start*/_sentence = __webpack_require__(6) /*istanbul ignore end*/;
10875
10876 var /*istanbul ignore start*/_css = __webpack_require__(7) /*istanbul ignore end*/;
10877
10878 var /*istanbul ignore start*/_json = __webpack_require__(8) /*istanbul ignore end*/;
10879
10880 var /*istanbul ignore start*/_array = __webpack_require__(9) /*istanbul ignore end*/;
10881
10882 var /*istanbul ignore start*/_apply = __webpack_require__(10) /*istanbul ignore end*/;
10883
10884 var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
10885
10886 var /*istanbul ignore start*/_merge = __webpack_require__(13) /*istanbul ignore end*/;
10887
10888 var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/;
10889
10890 var /*istanbul ignore start*/_dmp = __webpack_require__(16) /*istanbul ignore end*/;
10891
10892 var /*istanbul ignore start*/_xml = __webpack_require__(17) /*istanbul ignore end*/;
10893
10894 /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
10895
10896 /* See LICENSE file for terms of use */
10897
10898 /*
10899 * Text diff implementation.
10900 *
10901 * This library supports the following APIS:
10902 * JsDiff.diffChars: Character by character diff
10903 * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
10904 * JsDiff.diffLines: Line based diff
10905 *
10906 * JsDiff.diffCss: Diff targeted at CSS content
10907 *
10908 * These methods are based on the implementation proposed in
10909 * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
10910 * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
10911 */
10912 exports. /*istanbul ignore end*/Diff = _base2['default'];
10913 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffChars = _character.diffChars;
10914 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWords = _word.diffWords;
10915 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = _word.diffWordsWithSpace;
10916 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffLines = _line.diffLines;
10917 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = _line.diffTrimmedLines;
10918 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffSentences = _sentence.diffSentences;
10919 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffCss = _css.diffCss;
10920 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffJson = _json.diffJson;
10921 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffArrays = _array.diffArrays;
10922 /*istanbul ignore start*/exports. /*istanbul ignore end*/structuredPatch = _create.structuredPatch;
10923 /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = _create.createTwoFilesPatch;
10924 /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = _create.createPatch;
10925 /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatch = _apply.applyPatch;
10926 /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = _apply.applyPatches;
10927 /*istanbul ignore start*/exports. /*istanbul ignore end*/parsePatch = _parse.parsePatch;
10928 /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = _merge.merge;
10929 /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToDMP = _dmp.convertChangesToDMP;
10930 /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToXML = _xml.convertChangesToXML;
10931 /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = _json.canonicalize;
10932
10933
10934
10935/***/ }),
10936/* 1 */
10937/***/ (function(module, exports) {
10938
10939 /*istanbul ignore start*/'use strict';
10940
10941 exports.__esModule = true;
10942 exports['default'] = /*istanbul ignore end*/Diff;
10943 function Diff() {}
10944
10945 Diff.prototype = {
10946 /*istanbul ignore start*/ /*istanbul ignore end*/diff: function diff(oldString, newString) {
10947 /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
10948
10949 var callback = options.callback;
10950 if (typeof options === 'function') {
10951 callback = options;
10952 options = {};
10953 }
10954 this.options = options;
10955
10956 var self = this;
10957
10958 function done(value) {
10959 if (callback) {
10960 setTimeout(function () {
10961 callback(undefined, value);
10962 }, 0);
10963 return true;
10964 } else {
10965 return value;
10966 }
10967 }
10968
10969 // Allow subclasses to massage the input prior to running
10970 oldString = this.castInput(oldString);
10971 newString = this.castInput(newString);
10972
10973 oldString = this.removeEmpty(this.tokenize(oldString));
10974 newString = this.removeEmpty(this.tokenize(newString));
10975
10976 var newLen = newString.length,
10977 oldLen = oldString.length;
10978 var editLength = 1;
10979 var maxEditLength = newLen + oldLen;
10980 var bestPath = [{ newPos: -1, components: [] }];
10981
10982 // Seed editLength = 0, i.e. the content starts with the same values
10983 var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
10984 if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
10985 // Identity per the equality and tokenizer
10986 return done([{ value: this.join(newString), count: newString.length }]);
10987 }
10988
10989 // Main worker method. checks all permutations of a given edit length for acceptance.
10990 function execEditLength() {
10991 for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
10992 var basePath = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
10993 var addPath = bestPath[diagonalPath - 1],
10994 removePath = bestPath[diagonalPath + 1],
10995 _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
10996 if (addPath) {
10997 // No one else is going to attempt to use this value, clear it
10998 bestPath[diagonalPath - 1] = undefined;
10999 }
11000
11001 var canAdd = addPath && addPath.newPos + 1 < newLen,
11002 canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
11003 if (!canAdd && !canRemove) {
11004 // If this path is a terminal then prune
11005 bestPath[diagonalPath] = undefined;
11006 continue;
11007 }
11008
11009 // Select the diagonal that we want to branch from. We select the prior
11010 // path whose position in the new string is the farthest from the origin
11011 // and does not pass the bounds of the diff graph
11012 if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
11013 basePath = clonePath(removePath);
11014 self.pushComponent(basePath.components, undefined, true);
11015 } else {
11016 basePath = addPath; // No need to clone, we've pulled it from the list
11017 basePath.newPos++;
11018 self.pushComponent(basePath.components, true, undefined);
11019 }
11020
11021 _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
11022
11023 // If we have hit the end of both strings, then we are done
11024 if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
11025 return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
11026 } else {
11027 // Otherwise track this path as a potential candidate and continue.
11028 bestPath[diagonalPath] = basePath;
11029 }
11030 }
11031
11032 editLength++;
11033 }
11034
11035 // Performs the length of edit iteration. Is a bit fugly as this has to support the
11036 // sync and async mode which is never fun. Loops over execEditLength until a value
11037 // is produced.
11038 if (callback) {
11039 (function exec() {
11040 setTimeout(function () {
11041 // This should not happen, but we want to be safe.
11042 /* istanbul ignore next */
11043 if (editLength > maxEditLength) {
11044 return callback();
11045 }
11046
11047 if (!execEditLength()) {
11048 exec();
11049 }
11050 }, 0);
11051 })();
11052 } else {
11053 while (editLength <= maxEditLength) {
11054 var ret = execEditLength();
11055 if (ret) {
11056 return ret;
11057 }
11058 }
11059 }
11060 },
11061 /*istanbul ignore start*/ /*istanbul ignore end*/pushComponent: function pushComponent(components, added, removed) {
11062 var last = components[components.length - 1];
11063 if (last && last.added === added && last.removed === removed) {
11064 // We need to clone here as the component clone operation is just
11065 // as shallow array clone
11066 components[components.length - 1] = { count: last.count + 1, added: added, removed: removed };
11067 } else {
11068 components.push({ count: 1, added: added, removed: removed });
11069 }
11070 },
11071 /*istanbul ignore start*/ /*istanbul ignore end*/extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
11072 var newLen = newString.length,
11073 oldLen = oldString.length,
11074 newPos = basePath.newPos,
11075 oldPos = newPos - diagonalPath,
11076 commonCount = 0;
11077 while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
11078 newPos++;
11079 oldPos++;
11080 commonCount++;
11081 }
11082
11083 if (commonCount) {
11084 basePath.components.push({ count: commonCount });
11085 }
11086
11087 basePath.newPos = newPos;
11088 return oldPos;
11089 },
11090 /*istanbul ignore start*/ /*istanbul ignore end*/equals: function equals(left, right) {
11091 if (this.options.comparator) {
11092 return this.options.comparator(left, right);
11093 } else {
11094 return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
11095 }
11096 },
11097 /*istanbul ignore start*/ /*istanbul ignore end*/removeEmpty: function removeEmpty(array) {
11098 var ret = [];
11099 for (var i = 0; i < array.length; i++) {
11100 if (array[i]) {
11101 ret.push(array[i]);
11102 }
11103 }
11104 return ret;
11105 },
11106 /*istanbul ignore start*/ /*istanbul ignore end*/castInput: function castInput(value) {
11107 return value;
11108 },
11109 /*istanbul ignore start*/ /*istanbul ignore end*/tokenize: function tokenize(value) {
11110 return value.split('');
11111 },
11112 /*istanbul ignore start*/ /*istanbul ignore end*/join: function join(chars) {
11113 return chars.join('');
11114 }
11115 };
11116
11117 function buildValues(diff, components, newString, oldString, useLongestToken) {
11118 var componentPos = 0,
11119 componentLen = components.length,
11120 newPos = 0,
11121 oldPos = 0;
11122
11123 for (; componentPos < componentLen; componentPos++) {
11124 var component = components[componentPos];
11125 if (!component.removed) {
11126 if (!component.added && useLongestToken) {
11127 var value = newString.slice(newPos, newPos + component.count);
11128 value = value.map(function (value, i) {
11129 var oldValue = oldString[oldPos + i];
11130 return oldValue.length > value.length ? oldValue : value;
11131 });
11132
11133 component.value = diff.join(value);
11134 } else {
11135 component.value = diff.join(newString.slice(newPos, newPos + component.count));
11136 }
11137 newPos += component.count;
11138
11139 // Common case
11140 if (!component.added) {
11141 oldPos += component.count;
11142 }
11143 } else {
11144 component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
11145 oldPos += component.count;
11146
11147 // Reverse add and remove so removes are output first to match common convention
11148 // The diffing algorithm is tied to add then remove output and this is the simplest
11149 // route to get the desired output with minimal overhead.
11150 if (componentPos && components[componentPos - 1].added) {
11151 var tmp = components[componentPos - 1];
11152 components[componentPos - 1] = components[componentPos];
11153 components[componentPos] = tmp;
11154 }
11155 }
11156 }
11157
11158 // Special case handle for when one terminal is ignored (i.e. whitespace).
11159 // For this case we merge the terminal into the prior string and drop the change.
11160 // This is only available for string mode.
11161 var lastComponent = components[componentLen - 1];
11162 if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
11163 components[componentLen - 2].value += lastComponent.value;
11164 components.pop();
11165 }
11166
11167 return components;
11168 }
11169
11170 function clonePath(path) {
11171 return { newPos: path.newPos, components: path.components.slice(0) };
11172 }
11173
11174
11175
11176/***/ }),
11177/* 2 */
11178/***/ (function(module, exports, __webpack_require__) {
11179
11180 /*istanbul ignore start*/'use strict';
11181
11182 exports.__esModule = true;
11183 exports.characterDiff = undefined;
11184 exports. /*istanbul ignore end*/diffChars = diffChars;
11185
11186 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11187
11188 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11189
11190 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11191
11192 /*istanbul ignore end*/var characterDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/characterDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11193 function diffChars(oldStr, newStr, options) {
11194 return characterDiff.diff(oldStr, newStr, options);
11195 }
11196
11197
11198
11199/***/ }),
11200/* 3 */
11201/***/ (function(module, exports, __webpack_require__) {
11202
11203 /*istanbul ignore start*/'use strict';
11204
11205 exports.__esModule = true;
11206 exports.wordDiff = undefined;
11207 exports. /*istanbul ignore end*/diffWords = diffWords;
11208 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = diffWordsWithSpace;
11209
11210 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11211
11212 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11213
11214 /*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/;
11215
11216 /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11217
11218 /*istanbul ignore end*/ // Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode
11219 //
11220 // Ranges and exceptions:
11221 // Latin-1 Supplement, 0080–00FF
11222 // - U+00D7 × Multiplication sign
11223 // - U+00F7 ÷ Division sign
11224 // Latin Extended-A, 0100–017F
11225 // Latin Extended-B, 0180–024F
11226 // IPA Extensions, 0250–02AF
11227 // Spacing Modifier Letters, 02B0–02FF
11228 // - U+02C7 ˇ &#711; Caron
11229 // - U+02D8 ˘ &#728; Breve
11230 // - U+02D9 ˙ &#729; Dot Above
11231 // - U+02DA ˚ &#730; Ring Above
11232 // - U+02DB ˛ &#731; Ogonek
11233 // - U+02DC ˜ &#732; Small Tilde
11234 // - U+02DD ˝ &#733; Double Acute Accent
11235 // Latin Extended Additional, 1E00–1EFF
11236 var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
11237
11238 var reWhitespace = /\S/;
11239
11240 var wordDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/wordDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11241 wordDiff.equals = function (left, right) {
11242 if (this.options.ignoreCase) {
11243 left = left.toLowerCase();
11244 right = right.toLowerCase();
11245 }
11246 return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
11247 };
11248 wordDiff.tokenize = function (value) {
11249 var tokens = value.split(/(\s+|\b)/);
11250
11251 // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.
11252 for (var i = 0; i < tokens.length - 1; i++) {
11253 // If we have an empty string in the next field and we have only word chars before and after, merge
11254 if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
11255 tokens[i] += tokens[i + 2];
11256 tokens.splice(i + 1, 2);
11257 i--;
11258 }
11259 }
11260
11261 return tokens;
11262 };
11263
11264 function diffWords(oldStr, newStr, options) {
11265 options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(options, { ignoreWhitespace: true });
11266 return wordDiff.diff(oldStr, newStr, options);
11267 }
11268
11269 function diffWordsWithSpace(oldStr, newStr, options) {
11270 return wordDiff.diff(oldStr, newStr, options);
11271 }
11272
11273
11274
11275/***/ }),
11276/* 4 */
11277/***/ (function(module, exports) {
11278
11279 /*istanbul ignore start*/'use strict';
11280
11281 exports.__esModule = true;
11282 exports. /*istanbul ignore end*/generateOptions = generateOptions;
11283 function generateOptions(options, defaults) {
11284 if (typeof options === 'function') {
11285 defaults.callback = options;
11286 } else if (options) {
11287 for (var name in options) {
11288 /* istanbul ignore else */
11289 if (options.hasOwnProperty(name)) {
11290 defaults[name] = options[name];
11291 }
11292 }
11293 }
11294 return defaults;
11295 }
11296
11297
11298
11299/***/ }),
11300/* 5 */
11301/***/ (function(module, exports, __webpack_require__) {
11302
11303 /*istanbul ignore start*/'use strict';
11304
11305 exports.__esModule = true;
11306 exports.lineDiff = undefined;
11307 exports. /*istanbul ignore end*/diffLines = diffLines;
11308 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = diffTrimmedLines;
11309
11310 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11311
11312 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11313
11314 /*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/;
11315
11316 /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11317
11318 /*istanbul ignore end*/var lineDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/lineDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11319 lineDiff.tokenize = function (value) {
11320 var retLines = [],
11321 linesAndNewlines = value.split(/(\n|\r\n)/);
11322
11323 // Ignore the final empty token that occurs if the string ends with a new line
11324 if (!linesAndNewlines[linesAndNewlines.length - 1]) {
11325 linesAndNewlines.pop();
11326 }
11327
11328 // Merge the content and line separators into single tokens
11329 for (var i = 0; i < linesAndNewlines.length; i++) {
11330 var line = linesAndNewlines[i];
11331
11332 if (i % 2 && !this.options.newlineIsToken) {
11333 retLines[retLines.length - 1] += line;
11334 } else {
11335 if (this.options.ignoreWhitespace) {
11336 line = line.trim();
11337 }
11338 retLines.push(line);
11339 }
11340 }
11341
11342 return retLines;
11343 };
11344
11345 function diffLines(oldStr, newStr, callback) {
11346 return lineDiff.diff(oldStr, newStr, callback);
11347 }
11348 function diffTrimmedLines(oldStr, newStr, callback) {
11349 var options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(callback, { ignoreWhitespace: true });
11350 return lineDiff.diff(oldStr, newStr, options);
11351 }
11352
11353
11354
11355/***/ }),
11356/* 6 */
11357/***/ (function(module, exports, __webpack_require__) {
11358
11359 /*istanbul ignore start*/'use strict';
11360
11361 exports.__esModule = true;
11362 exports.sentenceDiff = undefined;
11363 exports. /*istanbul ignore end*/diffSentences = diffSentences;
11364
11365 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11366
11367 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11368
11369 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11370
11371 /*istanbul ignore end*/var sentenceDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/sentenceDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11372 sentenceDiff.tokenize = function (value) {
11373 return value.split(/(\S.+?[.!?])(?=\s+|$)/);
11374 };
11375
11376 function diffSentences(oldStr, newStr, callback) {
11377 return sentenceDiff.diff(oldStr, newStr, callback);
11378 }
11379
11380
11381
11382/***/ }),
11383/* 7 */
11384/***/ (function(module, exports, __webpack_require__) {
11385
11386 /*istanbul ignore start*/'use strict';
11387
11388 exports.__esModule = true;
11389 exports.cssDiff = undefined;
11390 exports. /*istanbul ignore end*/diffCss = diffCss;
11391
11392 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11393
11394 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11395
11396 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11397
11398 /*istanbul ignore end*/var cssDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/cssDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11399 cssDiff.tokenize = function (value) {
11400 return value.split(/([{}:;,]|\s+)/);
11401 };
11402
11403 function diffCss(oldStr, newStr, callback) {
11404 return cssDiff.diff(oldStr, newStr, callback);
11405 }
11406
11407
11408
11409/***/ }),
11410/* 8 */
11411/***/ (function(module, exports, __webpack_require__) {
11412
11413 /*istanbul ignore start*/'use strict';
11414
11415 exports.__esModule = true;
11416 exports.jsonDiff = undefined;
11417
11418 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; };
11419
11420 exports. /*istanbul ignore end*/diffJson = diffJson;
11421 /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = canonicalize;
11422
11423 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11424
11425 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11426
11427 /*istanbul ignore end*/var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
11428
11429 /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11430
11431 /*istanbul ignore end*/var objectPrototypeToString = Object.prototype.toString;
11432
11433 var jsonDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/jsonDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11434 // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
11435 // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
11436 jsonDiff.useLongestToken = true;
11437
11438 jsonDiff.tokenize = /*istanbul ignore start*/_line.lineDiff /*istanbul ignore end*/.tokenize;
11439 jsonDiff.castInput = function (value) {
11440 /*istanbul ignore start*/var _options = /*istanbul ignore end*/this.options,
11441 undefinedReplacement = _options.undefinedReplacement,
11442 _options$stringifyRep = _options.stringifyReplacer,
11443 stringifyReplacer = _options$stringifyRep === undefined ? function (k, v) /*istanbul ignore start*/{
11444 return (/*istanbul ignore end*/typeof v === 'undefined' ? undefinedReplacement : v
11445 );
11446 } : _options$stringifyRep;
11447
11448
11449 return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' ');
11450 };
11451 jsonDiff.equals = function (left, right) {
11452 return (/*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'))
11453 );
11454 };
11455
11456 function diffJson(oldObj, newObj, options) {
11457 return jsonDiff.diff(oldObj, newObj, options);
11458 }
11459
11460 // This function handles the presence of circular references by bailing out when encountering an
11461 // object that is already on the "stack" of items being processed. Accepts an optional replacer
11462 function canonicalize(obj, stack, replacementStack, replacer, key) {
11463 stack = stack || [];
11464 replacementStack = replacementStack || [];
11465
11466 if (replacer) {
11467 obj = replacer(key, obj);
11468 }
11469
11470 var i = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
11471
11472 for (i = 0; i < stack.length; i += 1) {
11473 if (stack[i] === obj) {
11474 return replacementStack[i];
11475 }
11476 }
11477
11478 var canonicalizedObj = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
11479
11480 if ('[object Array]' === objectPrototypeToString.call(obj)) {
11481 stack.push(obj);
11482 canonicalizedObj = new Array(obj.length);
11483 replacementStack.push(canonicalizedObj);
11484 for (i = 0; i < obj.length; i += 1) {
11485 canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
11486 }
11487 stack.pop();
11488 replacementStack.pop();
11489 return canonicalizedObj;
11490 }
11491
11492 if (obj && obj.toJSON) {
11493 obj = obj.toJSON();
11494 }
11495
11496 if ( /*istanbul ignore start*/(typeof /*istanbul ignore end*/obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && obj !== null) {
11497 stack.push(obj);
11498 canonicalizedObj = {};
11499 replacementStack.push(canonicalizedObj);
11500 var sortedKeys = [],
11501 _key = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
11502 for (_key in obj) {
11503 /* istanbul ignore else */
11504 if (obj.hasOwnProperty(_key)) {
11505 sortedKeys.push(_key);
11506 }
11507 }
11508 sortedKeys.sort();
11509 for (i = 0; i < sortedKeys.length; i += 1) {
11510 _key = sortedKeys[i];
11511 canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
11512 }
11513 stack.pop();
11514 replacementStack.pop();
11515 } else {
11516 canonicalizedObj = obj;
11517 }
11518 return canonicalizedObj;
11519 }
11520
11521
11522
11523/***/ }),
11524/* 9 */
11525/***/ (function(module, exports, __webpack_require__) {
11526
11527 /*istanbul ignore start*/'use strict';
11528
11529 exports.__esModule = true;
11530 exports.arrayDiff = undefined;
11531 exports. /*istanbul ignore end*/diffArrays = diffArrays;
11532
11533 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11534
11535 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11536
11537 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11538
11539 /*istanbul ignore end*/var arrayDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11540 arrayDiff.tokenize = function (value) {
11541 return value.slice();
11542 };
11543 arrayDiff.join = arrayDiff.removeEmpty = function (value) {
11544 return value;
11545 };
11546
11547 function diffArrays(oldArr, newArr, callback) {
11548 return arrayDiff.diff(oldArr, newArr, callback);
11549 }
11550
11551
11552
11553/***/ }),
11554/* 10 */
11555/***/ (function(module, exports, __webpack_require__) {
11556
11557 /*istanbul ignore start*/'use strict';
11558
11559 exports.__esModule = true;
11560 exports. /*istanbul ignore end*/applyPatch = applyPatch;
11561 /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = applyPatches;
11562
11563 var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
11564
11565 var /*istanbul ignore start*/_distanceIterator = __webpack_require__(12) /*istanbul ignore end*/;
11566
11567 /*istanbul ignore start*/var _distanceIterator2 = _interopRequireDefault(_distanceIterator);
11568
11569 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11570
11571 /*istanbul ignore end*/function applyPatch(source, uniDiff) {
11572 /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
11573
11574 if (typeof uniDiff === 'string') {
11575 uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);
11576 }
11577
11578 if (Array.isArray(uniDiff)) {
11579 if (uniDiff.length > 1) {
11580 throw new Error('applyPatch only works with a single input.');
11581 }
11582
11583 uniDiff = uniDiff[0];
11584 }
11585
11586 // Apply the diff to the input
11587 var lines = source.split(/\r\n|[\n\v\f\r\x85]/),
11588 delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [],
11589 hunks = uniDiff.hunks,
11590 compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) /*istanbul ignore start*/{
11591 return (/*istanbul ignore end*/line === patchContent
11592 );
11593 },
11594 errorCount = 0,
11595 fuzzFactor = options.fuzzFactor || 0,
11596 minLine = 0,
11597 offset = 0,
11598 removeEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
11599 addEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
11600
11601 /**
11602 * Checks if the hunk exactly fits on the provided location
11603 */
11604 function hunkFits(hunk, toPos) {
11605 for (var j = 0; j < hunk.lines.length; j++) {
11606 var line = hunk.lines[j],
11607 operation = line.length > 0 ? line[0] : ' ',
11608 content = line.length > 0 ? line.substr(1) : line;
11609
11610 if (operation === ' ' || operation === '-') {
11611 // Context sanity check
11612 if (!compareLine(toPos + 1, lines[toPos], operation, content)) {
11613 errorCount++;
11614
11615 if (errorCount > fuzzFactor) {
11616 return false;
11617 }
11618 }
11619 toPos++;
11620 }
11621 }
11622
11623 return true;
11624 }
11625
11626 // Search best fit offsets for each hunk based on the previous ones
11627 for (var i = 0; i < hunks.length; i++) {
11628 var hunk = hunks[i],
11629 maxLine = lines.length - hunk.oldLines,
11630 localOffset = 0,
11631 toPos = offset + hunk.oldStart - 1;
11632
11633 var iterator = /*istanbul ignore start*/(0, _distanceIterator2['default']) /*istanbul ignore end*/(toPos, minLine, maxLine);
11634
11635 for (; localOffset !== undefined; localOffset = iterator()) {
11636 if (hunkFits(hunk, toPos + localOffset)) {
11637 hunk.offset = offset += localOffset;
11638 break;
11639 }
11640 }
11641
11642 if (localOffset === undefined) {
11643 return false;
11644 }
11645
11646 // Set lower text limit to end of the current hunk, so next ones don't try
11647 // to fit over already patched text
11648 minLine = hunk.offset + hunk.oldStart + hunk.oldLines;
11649 }
11650
11651 // Apply patch hunks
11652 var diffOffset = 0;
11653 for (var _i = 0; _i < hunks.length; _i++) {
11654 var _hunk = hunks[_i],
11655 _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1;
11656 diffOffset += _hunk.newLines - _hunk.oldLines;
11657
11658 if (_toPos < 0) {
11659 // Creating a new file
11660 _toPos = 0;
11661 }
11662
11663 for (var j = 0; j < _hunk.lines.length; j++) {
11664 var line = _hunk.lines[j],
11665 operation = line.length > 0 ? line[0] : ' ',
11666 content = line.length > 0 ? line.substr(1) : line,
11667 delimiter = _hunk.linedelimiters[j];
11668
11669 if (operation === ' ') {
11670 _toPos++;
11671 } else if (operation === '-') {
11672 lines.splice(_toPos, 1);
11673 delimiters.splice(_toPos, 1);
11674 /* istanbul ignore else */
11675 } else if (operation === '+') {
11676 lines.splice(_toPos, 0, content);
11677 delimiters.splice(_toPos, 0, delimiter);
11678 _toPos++;
11679 } else if (operation === '\\') {
11680 var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null;
11681 if (previousOperation === '+') {
11682 removeEOFNL = true;
11683 } else if (previousOperation === '-') {
11684 addEOFNL = true;
11685 }
11686 }
11687 }
11688 }
11689
11690 // Handle EOFNL insertion/removal
11691 if (removeEOFNL) {
11692 while (!lines[lines.length - 1]) {
11693 lines.pop();
11694 delimiters.pop();
11695 }
11696 } else if (addEOFNL) {
11697 lines.push('');
11698 delimiters.push('\n');
11699 }
11700 for (var _k = 0; _k < lines.length - 1; _k++) {
11701 lines[_k] = lines[_k] + delimiters[_k];
11702 }
11703 return lines.join('');
11704 }
11705
11706 // Wrapper that supports multiple file patches via callbacks.
11707 function applyPatches(uniDiff, options) {
11708 if (typeof uniDiff === 'string') {
11709 uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);
11710 }
11711
11712 var currentIndex = 0;
11713 function processIndex() {
11714 var index = uniDiff[currentIndex++];
11715 if (!index) {
11716 return options.complete();
11717 }
11718
11719 options.loadFile(index, function (err, data) {
11720 if (err) {
11721 return options.complete(err);
11722 }
11723
11724 var updatedContent = applyPatch(data, index, options);
11725 options.patched(index, updatedContent, function (err) {
11726 if (err) {
11727 return options.complete(err);
11728 }
11729
11730 processIndex();
11731 });
11732 });
11733 }
11734 processIndex();
11735 }
11736
11737
11738
11739/***/ }),
11740/* 11 */
11741/***/ (function(module, exports) {
11742
11743 /*istanbul ignore start*/'use strict';
11744
11745 exports.__esModule = true;
11746 exports. /*istanbul ignore end*/parsePatch = parsePatch;
11747 function parsePatch(uniDiff) {
11748 /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
11749
11750 var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/),
11751 delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [],
11752 list = [],
11753 i = 0;
11754
11755 function parseIndex() {
11756 var index = {};
11757 list.push(index);
11758
11759 // Parse diff metadata
11760 while (i < diffstr.length) {
11761 var line = diffstr[i];
11762
11763 // File header found, end parsing diff metadata
11764 if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) {
11765 break;
11766 }
11767
11768 // Diff index
11769 var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
11770 if (header) {
11771 index.index = header[1];
11772 }
11773
11774 i++;
11775 }
11776
11777 // Parse file headers if they are defined. Unified diff requires them, but
11778 // there's no technical issues to have an isolated hunk without file header
11779 parseFileHeader(index);
11780 parseFileHeader(index);
11781
11782 // Parse hunks
11783 index.hunks = [];
11784
11785 while (i < diffstr.length) {
11786 var _line = diffstr[i];
11787
11788 if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) {
11789 break;
11790 } else if (/^@@/.test(_line)) {
11791 index.hunks.push(parseHunk());
11792 } else if (_line && options.strict) {
11793 // Ignore unexpected content unless in strict mode
11794 throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line));
11795 } else {
11796 i++;
11797 }
11798 }
11799 }
11800
11801 // Parses the --- and +++ headers, if none are found, no lines
11802 // are consumed.
11803 function parseFileHeader(index) {
11804 var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]);
11805 if (fileHeader) {
11806 var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
11807 var data = fileHeader[2].split('\t', 2);
11808 var fileName = data[0].replace(/\\\\/g, '\\');
11809 if (/^".*"$/.test(fileName)) {
11810 fileName = fileName.substr(1, fileName.length - 2);
11811 }
11812 index[keyPrefix + 'FileName'] = fileName;
11813 index[keyPrefix + 'Header'] = (data[1] || '').trim();
11814
11815 i++;
11816 }
11817 }
11818
11819 // Parses a hunk
11820 // This assumes that we are at the start of a hunk.
11821 function parseHunk() {
11822 var chunkHeaderIndex = i,
11823 chunkHeaderLine = diffstr[i++],
11824 chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
11825
11826 var hunk = {
11827 oldStart: +chunkHeader[1],
11828 oldLines: +chunkHeader[2] || 1,
11829 newStart: +chunkHeader[3],
11830 newLines: +chunkHeader[4] || 1,
11831 lines: [],
11832 linedelimiters: []
11833 };
11834
11835 var addCount = 0,
11836 removeCount = 0;
11837 for (; i < diffstr.length; i++) {
11838 // Lines starting with '---' could be mistaken for the "remove line" operation
11839 // But they could be the header for the next file. Therefore prune such cases out.
11840 if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) {
11841 break;
11842 }
11843 var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0];
11844
11845 if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
11846 hunk.lines.push(diffstr[i]);
11847 hunk.linedelimiters.push(delimiters[i] || '\n');
11848
11849 if (operation === '+') {
11850 addCount++;
11851 } else if (operation === '-') {
11852 removeCount++;
11853 } else if (operation === ' ') {
11854 addCount++;
11855 removeCount++;
11856 }
11857 } else {
11858 break;
11859 }
11860 }
11861
11862 // Handle the empty block count case
11863 if (!addCount && hunk.newLines === 1) {
11864 hunk.newLines = 0;
11865 }
11866 if (!removeCount && hunk.oldLines === 1) {
11867 hunk.oldLines = 0;
11868 }
11869
11870 // Perform optional sanity checking
11871 if (options.strict) {
11872 if (addCount !== hunk.newLines) {
11873 throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
11874 }
11875 if (removeCount !== hunk.oldLines) {
11876 throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
11877 }
11878 }
11879
11880 return hunk;
11881 }
11882
11883 while (i < diffstr.length) {
11884 parseIndex();
11885 }
11886
11887 return list;
11888 }
11889
11890
11891
11892/***/ }),
11893/* 12 */
11894/***/ (function(module, exports) {
11895
11896 /*istanbul ignore start*/"use strict";
11897
11898 exports.__esModule = true;
11899
11900 exports["default"] = /*istanbul ignore end*/function (start, minLine, maxLine) {
11901 var wantForward = true,
11902 backwardExhausted = false,
11903 forwardExhausted = false,
11904 localOffset = 1;
11905
11906 return function iterator() {
11907 if (wantForward && !forwardExhausted) {
11908 if (backwardExhausted) {
11909 localOffset++;
11910 } else {
11911 wantForward = false;
11912 }
11913
11914 // Check if trying to fit beyond text length, and if not, check it fits
11915 // after offset location (or desired location on first iteration)
11916 if (start + localOffset <= maxLine) {
11917 return localOffset;
11918 }
11919
11920 forwardExhausted = true;
11921 }
11922
11923 if (!backwardExhausted) {
11924 if (!forwardExhausted) {
11925 wantForward = true;
11926 }
11927
11928 // Check if trying to fit before text beginning, and if not, check it fits
11929 // before offset location
11930 if (minLine <= start - localOffset) {
11931 return -localOffset++;
11932 }
11933
11934 backwardExhausted = true;
11935 return iterator();
11936 }
11937
11938 // We tried to fit hunk before text beginning and beyond text length, then
11939 // hunk can't fit on the text. Return undefined
11940 };
11941 };
11942
11943
11944
11945/***/ }),
11946/* 13 */
11947/***/ (function(module, exports, __webpack_require__) {
11948
11949 /*istanbul ignore start*/'use strict';
11950
11951 exports.__esModule = true;
11952 exports. /*istanbul ignore end*/calcLineCount = calcLineCount;
11953 /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = merge;
11954
11955 var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/;
11956
11957 var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
11958
11959 var /*istanbul ignore start*/_array = __webpack_require__(15) /*istanbul ignore end*/;
11960
11961 /*istanbul ignore start*/function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
11962
11963 /*istanbul ignore end*/function calcLineCount(hunk) {
11964 /*istanbul ignore start*/var _calcOldNewLineCount = /*istanbul ignore end*/calcOldNewLineCount(hunk.lines),
11965 oldLines = _calcOldNewLineCount.oldLines,
11966 newLines = _calcOldNewLineCount.newLines;
11967
11968 if (oldLines !== undefined) {
11969 hunk.oldLines = oldLines;
11970 } else {
11971 delete hunk.oldLines;
11972 }
11973
11974 if (newLines !== undefined) {
11975 hunk.newLines = newLines;
11976 } else {
11977 delete hunk.newLines;
11978 }
11979 }
11980
11981 function merge(mine, theirs, base) {
11982 mine = loadPatch(mine, base);
11983 theirs = loadPatch(theirs, base);
11984
11985 var ret = {};
11986
11987 // For index we just let it pass through as it doesn't have any necessary meaning.
11988 // Leaving sanity checks on this to the API consumer that may know more about the
11989 // meaning in their own context.
11990 if (mine.index || theirs.index) {
11991 ret.index = mine.index || theirs.index;
11992 }
11993
11994 if (mine.newFileName || theirs.newFileName) {
11995 if (!fileNameChanged(mine)) {
11996 // No header or no change in ours, use theirs (and ours if theirs does not exist)
11997 ret.oldFileName = theirs.oldFileName || mine.oldFileName;
11998 ret.newFileName = theirs.newFileName || mine.newFileName;
11999 ret.oldHeader = theirs.oldHeader || mine.oldHeader;
12000 ret.newHeader = theirs.newHeader || mine.newHeader;
12001 } else if (!fileNameChanged(theirs)) {
12002 // No header or no change in theirs, use ours
12003 ret.oldFileName = mine.oldFileName;
12004 ret.newFileName = mine.newFileName;
12005 ret.oldHeader = mine.oldHeader;
12006 ret.newHeader = mine.newHeader;
12007 } else {
12008 // Both changed... figure it out
12009 ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName);
12010 ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName);
12011 ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader);
12012 ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader);
12013 }
12014 }
12015
12016 ret.hunks = [];
12017
12018 var mineIndex = 0,
12019 theirsIndex = 0,
12020 mineOffset = 0,
12021 theirsOffset = 0;
12022
12023 while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) {
12024 var mineCurrent = mine.hunks[mineIndex] || { oldStart: Infinity },
12025 theirsCurrent = theirs.hunks[theirsIndex] || { oldStart: Infinity };
12026
12027 if (hunkBefore(mineCurrent, theirsCurrent)) {
12028 // This patch does not overlap with any of the others, yay.
12029 ret.hunks.push(cloneHunk(mineCurrent, mineOffset));
12030 mineIndex++;
12031 theirsOffset += mineCurrent.newLines - mineCurrent.oldLines;
12032 } else if (hunkBefore(theirsCurrent, mineCurrent)) {
12033 // This patch does not overlap with any of the others, yay.
12034 ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset));
12035 theirsIndex++;
12036 mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines;
12037 } else {
12038 // Overlap, merge as best we can
12039 var mergedHunk = {
12040 oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart),
12041 oldLines: 0,
12042 newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset),
12043 newLines: 0,
12044 lines: []
12045 };
12046 mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines);
12047 theirsIndex++;
12048 mineIndex++;
12049
12050 ret.hunks.push(mergedHunk);
12051 }
12052 }
12053
12054 return ret;
12055 }
12056
12057 function loadPatch(param, base) {
12058 if (typeof param === 'string') {
12059 if (/^@@/m.test(param) || /^Index:/m.test(param)) {
12060 return (/*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(param)[0]
12061 );
12062 }
12063
12064 if (!base) {
12065 throw new Error('Must provide a base reference or pass in a patch');
12066 }
12067 return (/*istanbul ignore start*/(0, _create.structuredPatch) /*istanbul ignore end*/(undefined, undefined, base, param)
12068 );
12069 }
12070
12071 return param;
12072 }
12073
12074 function fileNameChanged(patch) {
12075 return patch.newFileName && patch.newFileName !== patch.oldFileName;
12076 }
12077
12078 function selectField(index, mine, theirs) {
12079 if (mine === theirs) {
12080 return mine;
12081 } else {
12082 index.conflict = true;
12083 return { mine: mine, theirs: theirs };
12084 }
12085 }
12086
12087 function hunkBefore(test, check) {
12088 return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart;
12089 }
12090
12091 function cloneHunk(hunk, offset) {
12092 return {
12093 oldStart: hunk.oldStart, oldLines: hunk.oldLines,
12094 newStart: hunk.newStart + offset, newLines: hunk.newLines,
12095 lines: hunk.lines
12096 };
12097 }
12098
12099 function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) {
12100 // This will generally result in a conflicted hunk, but there are cases where the context
12101 // is the only overlap where we can successfully merge the content here.
12102 var mine = { offset: mineOffset, lines: mineLines, index: 0 },
12103 their = { offset: theirOffset, lines: theirLines, index: 0 };
12104
12105 // Handle any leading content
12106 insertLeading(hunk, mine, their);
12107 insertLeading(hunk, their, mine);
12108
12109 // Now in the overlap content. Scan through and select the best changes from each.
12110 while (mine.index < mine.lines.length && their.index < their.lines.length) {
12111 var mineCurrent = mine.lines[mine.index],
12112 theirCurrent = their.lines[their.index];
12113
12114 if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) {
12115 // Both modified ...
12116 mutualChange(hunk, mine, their);
12117 } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') {
12118 /*istanbul ignore start*/var _hunk$lines;
12119
12120 /*istanbul ignore end*/ // Mine inserted
12121 /*istanbul ignore start*/(_hunk$lines = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/collectChange(mine)));
12122 } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') {
12123 /*istanbul ignore start*/var _hunk$lines2;
12124
12125 /*istanbul ignore end*/ // Theirs inserted
12126 /*istanbul ignore start*/(_hunk$lines2 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines2 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/collectChange(their)));
12127 } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') {
12128 // Mine removed or edited
12129 removal(hunk, mine, their);
12130 } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') {
12131 // Their removed or edited
12132 removal(hunk, their, mine, true);
12133 } else if (mineCurrent === theirCurrent) {
12134 // Context identity
12135 hunk.lines.push(mineCurrent);
12136 mine.index++;
12137 their.index++;
12138 } else {
12139 // Context mismatch
12140 conflict(hunk, collectChange(mine), collectChange(their));
12141 }
12142 }
12143
12144 // Now push anything that may be remaining
12145 insertTrailing(hunk, mine);
12146 insertTrailing(hunk, their);
12147
12148 calcLineCount(hunk);
12149 }
12150
12151 function mutualChange(hunk, mine, their) {
12152 var myChanges = collectChange(mine),
12153 theirChanges = collectChange(their);
12154
12155 if (allRemoves(myChanges) && allRemoves(theirChanges)) {
12156 // Special case for remove changes that are supersets of one another
12157 if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) {
12158 /*istanbul ignore start*/var _hunk$lines3;
12159
12160 /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines3 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines3 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/myChanges));
12161 return;
12162 } else if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) {
12163 /*istanbul ignore start*/var _hunk$lines4;
12164
12165 /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines4 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines4 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/theirChanges));
12166 return;
12167 }
12168 } else if ( /*istanbul ignore start*/(0, _array.arrayEqual) /*istanbul ignore end*/(myChanges, theirChanges)) {
12169 /*istanbul ignore start*/var _hunk$lines5;
12170
12171 /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines5 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines5 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/myChanges));
12172 return;
12173 }
12174
12175 conflict(hunk, myChanges, theirChanges);
12176 }
12177
12178 function removal(hunk, mine, their, swap) {
12179 var myChanges = collectChange(mine),
12180 theirChanges = collectContext(their, myChanges);
12181 if (theirChanges.merged) {
12182 /*istanbul ignore start*/var _hunk$lines6;
12183
12184 /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines6 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines6 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/theirChanges.merged));
12185 } else {
12186 conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges);
12187 }
12188 }
12189
12190 function conflict(hunk, mine, their) {
12191 hunk.conflict = true;
12192 hunk.lines.push({
12193 conflict: true,
12194 mine: mine,
12195 theirs: their
12196 });
12197 }
12198
12199 function insertLeading(hunk, insert, their) {
12200 while (insert.offset < their.offset && insert.index < insert.lines.length) {
12201 var line = insert.lines[insert.index++];
12202 hunk.lines.push(line);
12203 insert.offset++;
12204 }
12205 }
12206 function insertTrailing(hunk, insert) {
12207 while (insert.index < insert.lines.length) {
12208 var line = insert.lines[insert.index++];
12209 hunk.lines.push(line);
12210 }
12211 }
12212
12213 function collectChange(state) {
12214 var ret = [],
12215 operation = state.lines[state.index][0];
12216 while (state.index < state.lines.length) {
12217 var line = state.lines[state.index];
12218
12219 // Group additions that are immediately after subtractions and treat them as one "atomic" modify change.
12220 if (operation === '-' && line[0] === '+') {
12221 operation = '+';
12222 }
12223
12224 if (operation === line[0]) {
12225 ret.push(line);
12226 state.index++;
12227 } else {
12228 break;
12229 }
12230 }
12231
12232 return ret;
12233 }
12234 function collectContext(state, matchChanges) {
12235 var changes = [],
12236 merged = [],
12237 matchIndex = 0,
12238 contextChanges = false,
12239 conflicted = false;
12240 while (matchIndex < matchChanges.length && state.index < state.lines.length) {
12241 var change = state.lines[state.index],
12242 match = matchChanges[matchIndex];
12243
12244 // Once we've hit our add, then we are done
12245 if (match[0] === '+') {
12246 break;
12247 }
12248
12249 contextChanges = contextChanges || change[0] !== ' ';
12250
12251 merged.push(match);
12252 matchIndex++;
12253
12254 // Consume any additions in the other block as a conflict to attempt
12255 // to pull in the remaining context after this
12256 if (change[0] === '+') {
12257 conflicted = true;
12258
12259 while (change[0] === '+') {
12260 changes.push(change);
12261 change = state.lines[++state.index];
12262 }
12263 }
12264
12265 if (match.substr(1) === change.substr(1)) {
12266 changes.push(change);
12267 state.index++;
12268 } else {
12269 conflicted = true;
12270 }
12271 }
12272
12273 if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) {
12274 conflicted = true;
12275 }
12276
12277 if (conflicted) {
12278 return changes;
12279 }
12280
12281 while (matchIndex < matchChanges.length) {
12282 merged.push(matchChanges[matchIndex++]);
12283 }
12284
12285 return {
12286 merged: merged,
12287 changes: changes
12288 };
12289 }
12290
12291 function allRemoves(changes) {
12292 return changes.reduce(function (prev, change) {
12293 return prev && change[0] === '-';
12294 }, true);
12295 }
12296 function skipRemoveSuperset(state, removeChanges, delta) {
12297 for (var i = 0; i < delta; i++) {
12298 var changeContent = removeChanges[removeChanges.length - delta + i].substr(1);
12299 if (state.lines[state.index + i] !== ' ' + changeContent) {
12300 return false;
12301 }
12302 }
12303
12304 state.index += delta;
12305 return true;
12306 }
12307
12308 function calcOldNewLineCount(lines) {
12309 var oldLines = 0;
12310 var newLines = 0;
12311
12312 lines.forEach(function (line) {
12313 if (typeof line !== 'string') {
12314 var myCount = calcOldNewLineCount(line.mine);
12315 var theirCount = calcOldNewLineCount(line.theirs);
12316
12317 if (oldLines !== undefined) {
12318 if (myCount.oldLines === theirCount.oldLines) {
12319 oldLines += myCount.oldLines;
12320 } else {
12321 oldLines = undefined;
12322 }
12323 }
12324
12325 if (newLines !== undefined) {
12326 if (myCount.newLines === theirCount.newLines) {
12327 newLines += myCount.newLines;
12328 } else {
12329 newLines = undefined;
12330 }
12331 }
12332 } else {
12333 if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) {
12334 newLines++;
12335 }
12336 if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) {
12337 oldLines++;
12338 }
12339 }
12340 });
12341
12342 return { oldLines: oldLines, newLines: newLines };
12343 }
12344
12345
12346
12347/***/ }),
12348/* 14 */
12349/***/ (function(module, exports, __webpack_require__) {
12350
12351 /*istanbul ignore start*/'use strict';
12352
12353 exports.__esModule = true;
12354 exports. /*istanbul ignore end*/structuredPatch = structuredPatch;
12355 /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = createTwoFilesPatch;
12356 /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = createPatch;
12357
12358 var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
12359
12360 /*istanbul ignore start*/function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
12361
12362 /*istanbul ignore end*/function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
12363 if (!options) {
12364 options = {};
12365 }
12366 if (typeof options.context === 'undefined') {
12367 options.context = 4;
12368 }
12369
12370 var diff = /*istanbul ignore start*/(0, _line.diffLines) /*istanbul ignore end*/(oldStr, newStr, options);
12371 diff.push({ value: '', lines: [] }); // Append an empty value to make cleanup easier
12372
12373 function contextLines(lines) {
12374 return lines.map(function (entry) {
12375 return ' ' + entry;
12376 });
12377 }
12378
12379 var hunks = [];
12380 var oldRangeStart = 0,
12381 newRangeStart = 0,
12382 curRange = [],
12383 oldLine = 1,
12384 newLine = 1;
12385
12386 /*istanbul ignore start*/var _loop = function _loop( /*istanbul ignore end*/i) {
12387 var current = diff[i],
12388 lines = current.lines || current.value.replace(/\n$/, '').split('\n');
12389 current.lines = lines;
12390
12391 if (current.added || current.removed) {
12392 /*istanbul ignore start*/var _curRange;
12393
12394 /*istanbul ignore end*/ // If we have previous context, start with that
12395 if (!oldRangeStart) {
12396 var prev = diff[i - 1];
12397 oldRangeStart = oldLine;
12398 newRangeStart = newLine;
12399
12400 if (prev) {
12401 curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
12402 oldRangeStart -= curRange.length;
12403 newRangeStart -= curRange.length;
12404 }
12405 }
12406
12407 // Output our changes
12408 /*istanbul ignore start*/(_curRange = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/lines.map(function (entry) {
12409 return (current.added ? '+' : '-') + entry;
12410 })));
12411
12412 // Track the updated file position
12413 if (current.added) {
12414 newLine += lines.length;
12415 } else {
12416 oldLine += lines.length;
12417 }
12418 } else {
12419 // Identical context lines. Track line changes
12420 if (oldRangeStart) {
12421 // Close out any changes that have been output (or join overlapping)
12422 if (lines.length <= options.context * 2 && i < diff.length - 2) {
12423 /*istanbul ignore start*/var _curRange2;
12424
12425 /*istanbul ignore end*/ // Overlapping
12426 /*istanbul ignore start*/(_curRange2 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange2 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/contextLines(lines)));
12427 } else {
12428 /*istanbul ignore start*/var _curRange3;
12429
12430 /*istanbul ignore end*/ // end the range and output
12431 var contextSize = Math.min(lines.length, options.context);
12432 /*istanbul ignore start*/(_curRange3 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange3 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/contextLines(lines.slice(0, contextSize))));
12433
12434 var hunk = {
12435 oldStart: oldRangeStart,
12436 oldLines: oldLine - oldRangeStart + contextSize,
12437 newStart: newRangeStart,
12438 newLines: newLine - newRangeStart + contextSize,
12439 lines: curRange
12440 };
12441 if (i >= diff.length - 2 && lines.length <= options.context) {
12442 // EOF is inside this hunk
12443 var oldEOFNewline = /\n$/.test(oldStr);
12444 var newEOFNewline = /\n$/.test(newStr);
12445 if (lines.length == 0 && !oldEOFNewline) {
12446 // special case: old has no eol and no trailing context; no-nl can end up before adds
12447 curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file');
12448 } else if (!oldEOFNewline || !newEOFNewline) {
12449 curRange.push('\\ No newline at end of file');
12450 }
12451 }
12452 hunks.push(hunk);
12453
12454 oldRangeStart = 0;
12455 newRangeStart = 0;
12456 curRange = [];
12457 }
12458 }
12459 oldLine += lines.length;
12460 newLine += lines.length;
12461 }
12462 };
12463
12464 for (var i = 0; i < diff.length; i++) {
12465 /*istanbul ignore start*/_loop( /*istanbul ignore end*/i);
12466 }
12467
12468 return {
12469 oldFileName: oldFileName, newFileName: newFileName,
12470 oldHeader: oldHeader, newHeader: newHeader,
12471 hunks: hunks
12472 };
12473 }
12474
12475 function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
12476 var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
12477
12478 var ret = [];
12479 if (oldFileName == newFileName) {
12480 ret.push('Index: ' + oldFileName);
12481 }
12482 ret.push('===================================================================');
12483 ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader));
12484 ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
12485
12486 for (var i = 0; i < diff.hunks.length; i++) {
12487 var hunk = diff.hunks[i];
12488 ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
12489 ret.push.apply(ret, hunk.lines);
12490 }
12491
12492 return ret.join('\n') + '\n';
12493 }
12494
12495 function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
12496 return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
12497 }
12498
12499
12500
12501/***/ }),
12502/* 15 */
12503/***/ (function(module, exports) {
12504
12505 /*istanbul ignore start*/"use strict";
12506
12507 exports.__esModule = true;
12508 exports. /*istanbul ignore end*/arrayEqual = arrayEqual;
12509 /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayStartsWith = arrayStartsWith;
12510 function arrayEqual(a, b) {
12511 if (a.length !== b.length) {
12512 return false;
12513 }
12514
12515 return arrayStartsWith(a, b);
12516 }
12517
12518 function arrayStartsWith(array, start) {
12519 if (start.length > array.length) {
12520 return false;
12521 }
12522
12523 for (var i = 0; i < start.length; i++) {
12524 if (start[i] !== array[i]) {
12525 return false;
12526 }
12527 }
12528
12529 return true;
12530 }
12531
12532
12533
12534/***/ }),
12535/* 16 */
12536/***/ (function(module, exports) {
12537
12538 /*istanbul ignore start*/"use strict";
12539
12540 exports.__esModule = true;
12541 exports. /*istanbul ignore end*/convertChangesToDMP = convertChangesToDMP;
12542 // See: http://code.google.com/p/google-diff-match-patch/wiki/API
12543 function convertChangesToDMP(changes) {
12544 var ret = [],
12545 change = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
12546 operation = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
12547 for (var i = 0; i < changes.length; i++) {
12548 change = changes[i];
12549 if (change.added) {
12550 operation = 1;
12551 } else if (change.removed) {
12552 operation = -1;
12553 } else {
12554 operation = 0;
12555 }
12556
12557 ret.push([operation, change.value]);
12558 }
12559 return ret;
12560 }
12561
12562
12563
12564/***/ }),
12565/* 17 */
12566/***/ (function(module, exports) {
12567
12568 /*istanbul ignore start*/'use strict';
12569
12570 exports.__esModule = true;
12571 exports. /*istanbul ignore end*/convertChangesToXML = convertChangesToXML;
12572 function convertChangesToXML(changes) {
12573 var ret = [];
12574 for (var i = 0; i < changes.length; i++) {
12575 var change = changes[i];
12576 if (change.added) {
12577 ret.push('<ins>');
12578 } else if (change.removed) {
12579 ret.push('<del>');
12580 }
12581
12582 ret.push(escapeHTML(change.value));
12583
12584 if (change.added) {
12585 ret.push('</ins>');
12586 } else if (change.removed) {
12587 ret.push('</del>');
12588 }
12589 }
12590 return ret.join('');
12591 }
12592
12593 function escapeHTML(s) {
12594 var n = s;
12595 n = n.replace(/&/g, '&amp;');
12596 n = n.replace(/</g, '&lt;');
12597 n = n.replace(/>/g, '&gt;');
12598 n = n.replace(/"/g, '&quot;');
12599
12600 return n;
12601 }
12602
12603
12604
12605/***/ })
12606/******/ ])
12607});
12608;
12609},{}],49:[function(require,module,exports){
12610'use strict';
12611
12612var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
12613
12614module.exports = function (str) {
12615 if (typeof str !== 'string') {
12616 throw new TypeError('Expected a string');
12617 }
12618
12619 return str.replace(matchOperatorsRe, '\\$&');
12620};
12621
12622},{}],50:[function(require,module,exports){
12623// Copyright Joyent, Inc. and other Node contributors.
12624//
12625// Permission is hereby granted, free of charge, to any person obtaining a
12626// copy of this software and associated documentation files (the
12627// "Software"), to deal in the Software without restriction, including
12628// without limitation the rights to use, copy, modify, merge, publish,
12629// distribute, sublicense, and/or sell copies of the Software, and to permit
12630// persons to whom the Software is furnished to do so, subject to the
12631// following conditions:
12632//
12633// The above copyright notice and this permission notice shall be included
12634// in all copies or substantial portions of the Software.
12635//
12636// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
12637// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
12638// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
12639// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
12640// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
12641// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
12642// USE OR OTHER DEALINGS IN THE SOFTWARE.
12643
12644var objectCreate = Object.create || objectCreatePolyfill
12645var objectKeys = Object.keys || objectKeysPolyfill
12646var bind = Function.prototype.bind || functionBindPolyfill
12647
12648function EventEmitter() {
12649 if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) {
12650 this._events = objectCreate(null);
12651 this._eventsCount = 0;
12652 }
12653
12654 this._maxListeners = this._maxListeners || undefined;
12655}
12656module.exports = EventEmitter;
12657
12658// Backwards-compat with node 0.10.x
12659EventEmitter.EventEmitter = EventEmitter;
12660
12661EventEmitter.prototype._events = undefined;
12662EventEmitter.prototype._maxListeners = undefined;
12663
12664// By default EventEmitters will print a warning if more than 10 listeners are
12665// added to it. This is a useful default which helps finding memory leaks.
12666var defaultMaxListeners = 10;
12667
12668var hasDefineProperty;
12669try {
12670 var o = {};
12671 if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 });
12672 hasDefineProperty = o.x === 0;
12673} catch (err) { hasDefineProperty = false }
12674if (hasDefineProperty) {
12675 Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
12676 enumerable: true,
12677 get: function() {
12678 return defaultMaxListeners;
12679 },
12680 set: function(arg) {
12681 // check whether the input is a positive number (whose value is zero or
12682 // greater and not a NaN).
12683 if (typeof arg !== 'number' || arg < 0 || arg !== arg)
12684 throw new TypeError('"defaultMaxListeners" must be a positive number');
12685 defaultMaxListeners = arg;
12686 }
12687 });
12688} else {
12689 EventEmitter.defaultMaxListeners = defaultMaxListeners;
12690}
12691
12692// Obviously not all Emitters should be limited to 10. This function allows
12693// that to be increased. Set to zero for unlimited.
12694EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
12695 if (typeof n !== 'number' || n < 0 || isNaN(n))
12696 throw new TypeError('"n" argument must be a positive number');
12697 this._maxListeners = n;
12698 return this;
12699};
12700
12701function $getMaxListeners(that) {
12702 if (that._maxListeners === undefined)
12703 return EventEmitter.defaultMaxListeners;
12704 return that._maxListeners;
12705}
12706
12707EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
12708 return $getMaxListeners(this);
12709};
12710
12711// These standalone emit* functions are used to optimize calling of event
12712// handlers for fast cases because emit() itself often has a variable number of
12713// arguments and can be deoptimized because of that. These functions always have
12714// the same number of arguments and thus do not get deoptimized, so the code
12715// inside them can execute faster.
12716function emitNone(handler, isFn, self) {
12717 if (isFn)
12718 handler.call(self);
12719 else {
12720 var len = handler.length;
12721 var listeners = arrayClone(handler, len);
12722 for (var i = 0; i < len; ++i)
12723 listeners[i].call(self);
12724 }
12725}
12726function emitOne(handler, isFn, self, arg1) {
12727 if (isFn)
12728 handler.call(self, arg1);
12729 else {
12730 var len = handler.length;
12731 var listeners = arrayClone(handler, len);
12732 for (var i = 0; i < len; ++i)
12733 listeners[i].call(self, arg1);
12734 }
12735}
12736function emitTwo(handler, isFn, self, arg1, arg2) {
12737 if (isFn)
12738 handler.call(self, arg1, arg2);
12739 else {
12740 var len = handler.length;
12741 var listeners = arrayClone(handler, len);
12742 for (var i = 0; i < len; ++i)
12743 listeners[i].call(self, arg1, arg2);
12744 }
12745}
12746function emitThree(handler, isFn, self, arg1, arg2, arg3) {
12747 if (isFn)
12748 handler.call(self, arg1, arg2, arg3);
12749 else {
12750 var len = handler.length;
12751 var listeners = arrayClone(handler, len);
12752 for (var i = 0; i < len; ++i)
12753 listeners[i].call(self, arg1, arg2, arg3);
12754 }
12755}
12756
12757function emitMany(handler, isFn, self, args) {
12758 if (isFn)
12759 handler.apply(self, args);
12760 else {
12761 var len = handler.length;
12762 var listeners = arrayClone(handler, len);
12763 for (var i = 0; i < len; ++i)
12764 listeners[i].apply(self, args);
12765 }
12766}
12767
12768EventEmitter.prototype.emit = function emit(type) {
12769 var er, handler, len, args, i, events;
12770 var doError = (type === 'error');
12771
12772 events = this._events;
12773 if (events)
12774 doError = (doError && events.error == null);
12775 else if (!doError)
12776 return false;
12777
12778 // If there is no 'error' event listener then throw.
12779 if (doError) {
12780 if (arguments.length > 1)
12781 er = arguments[1];
12782 if (er instanceof Error) {
12783 throw er; // Unhandled 'error' event
12784 } else {
12785 // At least give some kind of context to the user
12786 var err = new Error('Unhandled "error" event. (' + er + ')');
12787 err.context = er;
12788 throw err;
12789 }
12790 return false;
12791 }
12792
12793 handler = events[type];
12794
12795 if (!handler)
12796 return false;
12797
12798 var isFn = typeof handler === 'function';
12799 len = arguments.length;
12800 switch (len) {
12801 // fast cases
12802 case 1:
12803 emitNone(handler, isFn, this);
12804 break;
12805 case 2:
12806 emitOne(handler, isFn, this, arguments[1]);
12807 break;
12808 case 3:
12809 emitTwo(handler, isFn, this, arguments[1], arguments[2]);
12810 break;
12811 case 4:
12812 emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
12813 break;
12814 // slower
12815 default:
12816 args = new Array(len - 1);
12817 for (i = 1; i < len; i++)
12818 args[i - 1] = arguments[i];
12819 emitMany(handler, isFn, this, args);
12820 }
12821
12822 return true;
12823};
12824
12825function _addListener(target, type, listener, prepend) {
12826 var m;
12827 var events;
12828 var existing;
12829
12830 if (typeof listener !== 'function')
12831 throw new TypeError('"listener" argument must be a function');
12832
12833 events = target._events;
12834 if (!events) {
12835 events = target._events = objectCreate(null);
12836 target._eventsCount = 0;
12837 } else {
12838 // To avoid recursion in the case that type === "newListener"! Before
12839 // adding it to the listeners, first emit "newListener".
12840 if (events.newListener) {
12841 target.emit('newListener', type,
12842 listener.listener ? listener.listener : listener);
12843
12844 // Re-assign `events` because a newListener handler could have caused the
12845 // this._events to be assigned to a new object
12846 events = target._events;
12847 }
12848 existing = events[type];
12849 }
12850
12851 if (!existing) {
12852 // Optimize the case of one listener. Don't need the extra array object.
12853 existing = events[type] = listener;
12854 ++target._eventsCount;
12855 } else {
12856 if (typeof existing === 'function') {
12857 // Adding the second element, need to change to array.
12858 existing = events[type] =
12859 prepend ? [listener, existing] : [existing, listener];
12860 } else {
12861 // If we've already got an array, just append.
12862 if (prepend) {
12863 existing.unshift(listener);
12864 } else {
12865 existing.push(listener);
12866 }
12867 }
12868
12869 // Check for listener leak
12870 if (!existing.warned) {
12871 m = $getMaxListeners(target);
12872 if (m && m > 0 && existing.length > m) {
12873 existing.warned = true;
12874 var w = new Error('Possible EventEmitter memory leak detected. ' +
12875 existing.length + ' "' + String(type) + '" listeners ' +
12876 'added. Use emitter.setMaxListeners() to ' +
12877 'increase limit.');
12878 w.name = 'MaxListenersExceededWarning';
12879 w.emitter = target;
12880 w.type = type;
12881 w.count = existing.length;
12882 if (typeof console === 'object' && console.warn) {
12883 console.warn('%s: %s', w.name, w.message);
12884 }
12885 }
12886 }
12887 }
12888
12889 return target;
12890}
12891
12892EventEmitter.prototype.addListener = function addListener(type, listener) {
12893 return _addListener(this, type, listener, false);
12894};
12895
12896EventEmitter.prototype.on = EventEmitter.prototype.addListener;
12897
12898EventEmitter.prototype.prependListener =
12899 function prependListener(type, listener) {
12900 return _addListener(this, type, listener, true);
12901 };
12902
12903function onceWrapper() {
12904 if (!this.fired) {
12905 this.target.removeListener(this.type, this.wrapFn);
12906 this.fired = true;
12907 switch (arguments.length) {
12908 case 0:
12909 return this.listener.call(this.target);
12910 case 1:
12911 return this.listener.call(this.target, arguments[0]);
12912 case 2:
12913 return this.listener.call(this.target, arguments[0], arguments[1]);
12914 case 3:
12915 return this.listener.call(this.target, arguments[0], arguments[1],
12916 arguments[2]);
12917 default:
12918 var args = new Array(arguments.length);
12919 for (var i = 0; i < args.length; ++i)
12920 args[i] = arguments[i];
12921 this.listener.apply(this.target, args);
12922 }
12923 }
12924}
12925
12926function _onceWrap(target, type, listener) {
12927 var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
12928 var wrapped = bind.call(onceWrapper, state);
12929 wrapped.listener = listener;
12930 state.wrapFn = wrapped;
12931 return wrapped;
12932}
12933
12934EventEmitter.prototype.once = function once(type, listener) {
12935 if (typeof listener !== 'function')
12936 throw new TypeError('"listener" argument must be a function');
12937 this.on(type, _onceWrap(this, type, listener));
12938 return this;
12939};
12940
12941EventEmitter.prototype.prependOnceListener =
12942 function prependOnceListener(type, listener) {
12943 if (typeof listener !== 'function')
12944 throw new TypeError('"listener" argument must be a function');
12945 this.prependListener(type, _onceWrap(this, type, listener));
12946 return this;
12947 };
12948
12949// Emits a 'removeListener' event if and only if the listener was removed.
12950EventEmitter.prototype.removeListener =
12951 function removeListener(type, listener) {
12952 var list, events, position, i, originalListener;
12953
12954 if (typeof listener !== 'function')
12955 throw new TypeError('"listener" argument must be a function');
12956
12957 events = this._events;
12958 if (!events)
12959 return this;
12960
12961 list = events[type];
12962 if (!list)
12963 return this;
12964
12965 if (list === listener || list.listener === listener) {
12966 if (--this._eventsCount === 0)
12967 this._events = objectCreate(null);
12968 else {
12969 delete events[type];
12970 if (events.removeListener)
12971 this.emit('removeListener', type, list.listener || listener);
12972 }
12973 } else if (typeof list !== 'function') {
12974 position = -1;
12975
12976 for (i = list.length - 1; i >= 0; i--) {
12977 if (list[i] === listener || list[i].listener === listener) {
12978 originalListener = list[i].listener;
12979 position = i;
12980 break;
12981 }
12982 }
12983
12984 if (position < 0)
12985 return this;
12986
12987 if (position === 0)
12988 list.shift();
12989 else
12990 spliceOne(list, position);
12991
12992 if (list.length === 1)
12993 events[type] = list[0];
12994
12995 if (events.removeListener)
12996 this.emit('removeListener', type, originalListener || listener);
12997 }
12998
12999 return this;
13000 };
13001
13002EventEmitter.prototype.removeAllListeners =
13003 function removeAllListeners(type) {
13004 var listeners, events, i;
13005
13006 events = this._events;
13007 if (!events)
13008 return this;
13009
13010 // not listening for removeListener, no need to emit
13011 if (!events.removeListener) {
13012 if (arguments.length === 0) {
13013 this._events = objectCreate(null);
13014 this._eventsCount = 0;
13015 } else if (events[type]) {
13016 if (--this._eventsCount === 0)
13017 this._events = objectCreate(null);
13018 else
13019 delete events[type];
13020 }
13021 return this;
13022 }
13023
13024 // emit removeListener for all listeners on all events
13025 if (arguments.length === 0) {
13026 var keys = objectKeys(events);
13027 var key;
13028 for (i = 0; i < keys.length; ++i) {
13029 key = keys[i];
13030 if (key === 'removeListener') continue;
13031 this.removeAllListeners(key);
13032 }
13033 this.removeAllListeners('removeListener');
13034 this._events = objectCreate(null);
13035 this._eventsCount = 0;
13036 return this;
13037 }
13038
13039 listeners = events[type];
13040
13041 if (typeof listeners === 'function') {
13042 this.removeListener(type, listeners);
13043 } else if (listeners) {
13044 // LIFO order
13045 for (i = listeners.length - 1; i >= 0; i--) {
13046 this.removeListener(type, listeners[i]);
13047 }
13048 }
13049
13050 return this;
13051 };
13052
13053function _listeners(target, type, unwrap) {
13054 var events = target._events;
13055
13056 if (!events)
13057 return [];
13058
13059 var evlistener = events[type];
13060 if (!evlistener)
13061 return [];
13062
13063 if (typeof evlistener === 'function')
13064 return unwrap ? [evlistener.listener || evlistener] : [evlistener];
13065
13066 return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
13067}
13068
13069EventEmitter.prototype.listeners = function listeners(type) {
13070 return _listeners(this, type, true);
13071};
13072
13073EventEmitter.prototype.rawListeners = function rawListeners(type) {
13074 return _listeners(this, type, false);
13075};
13076
13077EventEmitter.listenerCount = function(emitter, type) {
13078 if (typeof emitter.listenerCount === 'function') {
13079 return emitter.listenerCount(type);
13080 } else {
13081 return listenerCount.call(emitter, type);
13082 }
13083};
13084
13085EventEmitter.prototype.listenerCount = listenerCount;
13086function listenerCount(type) {
13087 var events = this._events;
13088
13089 if (events) {
13090 var evlistener = events[type];
13091
13092 if (typeof evlistener === 'function') {
13093 return 1;
13094 } else if (evlistener) {
13095 return evlistener.length;
13096 }
13097 }
13098
13099 return 0;
13100}
13101
13102EventEmitter.prototype.eventNames = function eventNames() {
13103 return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
13104};
13105
13106// About 1.5x faster than the two-arg version of Array#splice().
13107function spliceOne(list, index) {
13108 for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)
13109 list[i] = list[k];
13110 list.pop();
13111}
13112
13113function arrayClone(arr, n) {
13114 var copy = new Array(n);
13115 for (var i = 0; i < n; ++i)
13116 copy[i] = arr[i];
13117 return copy;
13118}
13119
13120function unwrapListeners(arr) {
13121 var ret = new Array(arr.length);
13122 for (var i = 0; i < ret.length; ++i) {
13123 ret[i] = arr[i].listener || arr[i];
13124 }
13125 return ret;
13126}
13127
13128function objectCreatePolyfill(proto) {
13129 var F = function() {};
13130 F.prototype = proto;
13131 return new F;
13132}
13133function objectKeysPolyfill(obj) {
13134 var keys = [];
13135 for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) {
13136 keys.push(k);
13137 }
13138 return k;
13139}
13140function functionBindPolyfill(context) {
13141 var fn = this;
13142 return function () {
13143 return fn.apply(context, arguments);
13144 };
13145}
13146
13147},{}],51:[function(require,module,exports){
13148'use strict';
13149
13150/* eslint no-invalid-this: 1 */
13151
13152var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
13153var slice = Array.prototype.slice;
13154var toStr = Object.prototype.toString;
13155var funcType = '[object Function]';
13156
13157module.exports = function bind(that) {
13158 var target = this;
13159 if (typeof target !== 'function' || toStr.call(target) !== funcType) {
13160 throw new TypeError(ERROR_MESSAGE + target);
13161 }
13162 var args = slice.call(arguments, 1);
13163
13164 var bound;
13165 var binder = function () {
13166 if (this instanceof bound) {
13167 var result = target.apply(
13168 this,
13169 args.concat(slice.call(arguments))
13170 );
13171 if (Object(result) === result) {
13172 return result;
13173 }
13174 return this;
13175 } else {
13176 return target.apply(
13177 that,
13178 args.concat(slice.call(arguments))
13179 );
13180 }
13181 };
13182
13183 var boundLength = Math.max(0, target.length - args.length);
13184 var boundArgs = [];
13185 for (var i = 0; i < boundLength; i++) {
13186 boundArgs.push('$' + i);
13187 }
13188
13189 bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
13190
13191 if (target.prototype) {
13192 var Empty = function Empty() {};
13193 Empty.prototype = target.prototype;
13194 bound.prototype = new Empty();
13195 Empty.prototype = null;
13196 }
13197
13198 return bound;
13199};
13200
13201},{}],52:[function(require,module,exports){
13202'use strict';
13203
13204var implementation = require('./implementation');
13205
13206module.exports = Function.prototype.bind || implementation;
13207
13208},{"./implementation":51}],53:[function(require,module,exports){
13209'use strict';
13210
13211/* eslint complexity: [2, 17], max-statements: [2, 33] */
13212module.exports = function hasSymbols() {
13213 if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
13214 if (typeof Symbol.iterator === 'symbol') { return true; }
13215
13216 var obj = {};
13217 var sym = Symbol('test');
13218 var symObj = Object(sym);
13219 if (typeof sym === 'string') { return false; }
13220
13221 if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
13222 if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
13223
13224 // temp disabled per https://github.com/ljharb/object.assign/issues/17
13225 // if (sym instanceof Symbol) { return false; }
13226 // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
13227 // if (!(symObj instanceof Symbol)) { return false; }
13228
13229 // if (typeof Symbol.prototype.toString !== 'function') { return false; }
13230 // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
13231
13232 var symVal = 42;
13233 obj[sym] = symVal;
13234 for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax
13235 if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
13236
13237 if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
13238
13239 var syms = Object.getOwnPropertySymbols(obj);
13240 if (syms.length !== 1 || syms[0] !== sym) { return false; }
13241
13242 if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
13243
13244 if (typeof Object.getOwnPropertyDescriptor === 'function') {
13245 var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
13246 if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
13247 }
13248
13249 return true;
13250};
13251
13252},{}],54:[function(require,module,exports){
13253(function (global){
13254/*! https://mths.be/he v1.2.0 by @mathias | MIT license */
13255;(function(root) {
13256
13257 // Detect free variables `exports`.
13258 var freeExports = typeof exports == 'object' && exports;
13259
13260 // Detect free variable `module`.
13261 var freeModule = typeof module == 'object' && module &&
13262 module.exports == freeExports && module;
13263
13264 // Detect free variable `global`, from Node.js or Browserified code,
13265 // and use it as `root`.
13266 var freeGlobal = typeof global == 'object' && global;
13267 if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
13268 root = freeGlobal;
13269 }
13270
13271 /*--------------------------------------------------------------------------*/
13272
13273 // All astral symbols.
13274 var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
13275 // All ASCII symbols (not just printable ASCII) except those listed in the
13276 // first column of the overrides table.
13277 // https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides
13278 var regexAsciiWhitelist = /[\x01-\x7F]/g;
13279 // All BMP symbols that are not ASCII newlines, printable ASCII symbols, or
13280 // code points listed in the first column of the overrides table on
13281 // https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides.
13282 var regexBmpWhitelist = /[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g;
13283
13284 var regexEncodeNonAscii = /<\u20D2|=\u20E5|>\u20D2|\u205F\u200A|\u219D\u0338|\u2202\u0338|\u2220\u20D2|\u2229\uFE00|\u222A\uFE00|\u223C\u20D2|\u223D\u0331|\u223E\u0333|\u2242\u0338|\u224B\u0338|\u224D\u20D2|\u224E\u0338|\u224F\u0338|\u2250\u0338|\u2261\u20E5|\u2264\u20D2|\u2265\u20D2|\u2266\u0338|\u2267\u0338|\u2268\uFE00|\u2269\uFE00|\u226A\u0338|\u226A\u20D2|\u226B\u0338|\u226B\u20D2|\u227F\u0338|\u2282\u20D2|\u2283\u20D2|\u228A\uFE00|\u228B\uFE00|\u228F\u0338|\u2290\u0338|\u2293\uFE00|\u2294\uFE00|\u22B4\u20D2|\u22B5\u20D2|\u22D8\u0338|\u22D9\u0338|\u22DA\uFE00|\u22DB\uFE00|\u22F5\u0338|\u22F9\u0338|\u2933\u0338|\u29CF\u0338|\u29D0\u0338|\u2A6D\u0338|\u2A70\u0338|\u2A7D\u0338|\u2A7E\u0338|\u2AA1\u0338|\u2AA2\u0338|\u2AAC\uFE00|\u2AAD\uFE00|\u2AAF\u0338|\u2AB0\u0338|\u2AC5\u0338|\u2AC6\u0338|\u2ACB\uFE00|\u2ACC\uFE00|\u2AFD\u20E5|[\xA0-\u0113\u0116-\u0122\u0124-\u012B\u012E-\u014D\u0150-\u017E\u0192\u01B5\u01F5\u0237\u02C6\u02C7\u02D8-\u02DD\u0311\u0391-\u03A1\u03A3-\u03A9\u03B1-\u03C9\u03D1\u03D2\u03D5\u03D6\u03DC\u03DD\u03F0\u03F1\u03F5\u03F6\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E\u045F\u2002-\u2005\u2007-\u2010\u2013-\u2016\u2018-\u201A\u201C-\u201E\u2020-\u2022\u2025\u2026\u2030-\u2035\u2039\u203A\u203E\u2041\u2043\u2044\u204F\u2057\u205F-\u2063\u20AC\u20DB\u20DC\u2102\u2105\u210A-\u2113\u2115-\u211E\u2122\u2124\u2127-\u2129\u212C\u212D\u212F-\u2131\u2133-\u2138\u2145-\u2148\u2153-\u215E\u2190-\u219B\u219D-\u21A7\u21A9-\u21AE\u21B0-\u21B3\u21B5-\u21B7\u21BA-\u21DB\u21DD\u21E4\u21E5\u21F5\u21FD-\u2205\u2207-\u2209\u220B\u220C\u220F-\u2214\u2216-\u2218\u221A\u221D-\u2238\u223A-\u2257\u2259\u225A\u225C\u225F-\u2262\u2264-\u228B\u228D-\u229B\u229D-\u22A5\u22A7-\u22B0\u22B2-\u22BB\u22BD-\u22DB\u22DE-\u22E3\u22E6-\u22F7\u22F9-\u22FE\u2305\u2306\u2308-\u2310\u2312\u2313\u2315\u2316\u231C-\u231F\u2322\u2323\u232D\u232E\u2336\u233D\u233F\u237C\u23B0\u23B1\u23B4-\u23B6\u23DC-\u23DF\u23E2\u23E7\u2423\u24C8\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u2550-\u256C\u2580\u2584\u2588\u2591-\u2593\u25A1\u25AA\u25AB\u25AD\u25AE\u25B1\u25B3-\u25B5\u25B8\u25B9\u25BD-\u25BF\u25C2\u25C3\u25CA\u25CB\u25EC\u25EF\u25F8-\u25FC\u2605\u2606\u260E\u2640\u2642\u2660\u2663\u2665\u2666\u266A\u266D-\u266F\u2713\u2717\u2720\u2736\u2758\u2772\u2773\u27C8\u27C9\u27E6-\u27ED\u27F5-\u27FA\u27FC\u27FF\u2902-\u2905\u290C-\u2913\u2916\u2919-\u2920\u2923-\u292A\u2933\u2935-\u2939\u293C\u293D\u2945\u2948-\u294B\u294E-\u2976\u2978\u2979\u297B-\u297F\u2985\u2986\u298B-\u2996\u299A\u299C\u299D\u29A4-\u29B7\u29B9\u29BB\u29BC\u29BE-\u29C5\u29C9\u29CD-\u29D0\u29DC-\u29DE\u29E3-\u29E5\u29EB\u29F4\u29F6\u2A00-\u2A02\u2A04\u2A06\u2A0C\u2A0D\u2A10-\u2A17\u2A22-\u2A27\u2A29\u2A2A\u2A2D-\u2A31\u2A33-\u2A3C\u2A3F\u2A40\u2A42-\u2A4D\u2A50\u2A53-\u2A58\u2A5A-\u2A5D\u2A5F\u2A66\u2A6A\u2A6D-\u2A75\u2A77-\u2A9A\u2A9D-\u2AA2\u2AA4-\u2AB0\u2AB3-\u2AC8\u2ACB\u2ACC\u2ACF-\u2ADB\u2AE4\u2AE6-\u2AE9\u2AEB-\u2AF3\u2AFD\uFB00-\uFB04]|\uD835[\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDD6B]/g;
13285 var encodeMap = {'\xAD':'shy','\u200C':'zwnj','\u200D':'zwj','\u200E':'lrm','\u2063':'ic','\u2062':'it','\u2061':'af','\u200F':'rlm','\u200B':'ZeroWidthSpace','\u2060':'NoBreak','\u0311':'DownBreve','\u20DB':'tdot','\u20DC':'DotDot','\t':'Tab','\n':'NewLine','\u2008':'puncsp','\u205F':'MediumSpace','\u2009':'thinsp','\u200A':'hairsp','\u2004':'emsp13','\u2002':'ensp','\u2005':'emsp14','\u2003':'emsp','\u2007':'numsp','\xA0':'nbsp','\u205F\u200A':'ThickSpace','\u203E':'oline','_':'lowbar','\u2010':'dash','\u2013':'ndash','\u2014':'mdash','\u2015':'horbar',',':'comma',';':'semi','\u204F':'bsemi',':':'colon','\u2A74':'Colone','!':'excl','\xA1':'iexcl','?':'quest','\xBF':'iquest','.':'period','\u2025':'nldr','\u2026':'mldr','\xB7':'middot','\'':'apos','\u2018':'lsquo','\u2019':'rsquo','\u201A':'sbquo','\u2039':'lsaquo','\u203A':'rsaquo','"':'quot','\u201C':'ldquo','\u201D':'rdquo','\u201E':'bdquo','\xAB':'laquo','\xBB':'raquo','(':'lpar',')':'rpar','[':'lsqb',']':'rsqb','{':'lcub','}':'rcub','\u2308':'lceil','\u2309':'rceil','\u230A':'lfloor','\u230B':'rfloor','\u2985':'lopar','\u2986':'ropar','\u298B':'lbrke','\u298C':'rbrke','\u298D':'lbrkslu','\u298E':'rbrksld','\u298F':'lbrksld','\u2990':'rbrkslu','\u2991':'langd','\u2992':'rangd','\u2993':'lparlt','\u2994':'rpargt','\u2995':'gtlPar','\u2996':'ltrPar','\u27E6':'lobrk','\u27E7':'robrk','\u27E8':'lang','\u27E9':'rang','\u27EA':'Lang','\u27EB':'Rang','\u27EC':'loang','\u27ED':'roang','\u2772':'lbbrk','\u2773':'rbbrk','\u2016':'Vert','\xA7':'sect','\xB6':'para','@':'commat','*':'ast','/':'sol','undefined':null,'&':'amp','#':'num','%':'percnt','\u2030':'permil','\u2031':'pertenk','\u2020':'dagger','\u2021':'Dagger','\u2022':'bull','\u2043':'hybull','\u2032':'prime','\u2033':'Prime','\u2034':'tprime','\u2057':'qprime','\u2035':'bprime','\u2041':'caret','`':'grave','\xB4':'acute','\u02DC':'tilde','^':'Hat','\xAF':'macr','\u02D8':'breve','\u02D9':'dot','\xA8':'die','\u02DA':'ring','\u02DD':'dblac','\xB8':'cedil','\u02DB':'ogon','\u02C6':'circ','\u02C7':'caron','\xB0':'deg','\xA9':'copy','\xAE':'reg','\u2117':'copysr','\u2118':'wp','\u211E':'rx','\u2127':'mho','\u2129':'iiota','\u2190':'larr','\u219A':'nlarr','\u2192':'rarr','\u219B':'nrarr','\u2191':'uarr','\u2193':'darr','\u2194':'harr','\u21AE':'nharr','\u2195':'varr','\u2196':'nwarr','\u2197':'nearr','\u2198':'searr','\u2199':'swarr','\u219D':'rarrw','\u219D\u0338':'nrarrw','\u219E':'Larr','\u219F':'Uarr','\u21A0':'Rarr','\u21A1':'Darr','\u21A2':'larrtl','\u21A3':'rarrtl','\u21A4':'mapstoleft','\u21A5':'mapstoup','\u21A6':'map','\u21A7':'mapstodown','\u21A9':'larrhk','\u21AA':'rarrhk','\u21AB':'larrlp','\u21AC':'rarrlp','\u21AD':'harrw','\u21B0':'lsh','\u21B1':'rsh','\u21B2':'ldsh','\u21B3':'rdsh','\u21B5':'crarr','\u21B6':'cularr','\u21B7':'curarr','\u21BA':'olarr','\u21BB':'orarr','\u21BC':'lharu','\u21BD':'lhard','\u21BE':'uharr','\u21BF':'uharl','\u21C0':'rharu','\u21C1':'rhard','\u21C2':'dharr','\u21C3':'dharl','\u21C4':'rlarr','\u21C5':'udarr','\u21C6':'lrarr','\u21C7':'llarr','\u21C8':'uuarr','\u21C9':'rrarr','\u21CA':'ddarr','\u21CB':'lrhar','\u21CC':'rlhar','\u21D0':'lArr','\u21CD':'nlArr','\u21D1':'uArr','\u21D2':'rArr','\u21CF':'nrArr','\u21D3':'dArr','\u21D4':'iff','\u21CE':'nhArr','\u21D5':'vArr','\u21D6':'nwArr','\u21D7':'neArr','\u21D8':'seArr','\u21D9':'swArr','\u21DA':'lAarr','\u21DB':'rAarr','\u21DD':'zigrarr','\u21E4':'larrb','\u21E5':'rarrb','\u21F5':'duarr','\u21FD':'loarr','\u21FE':'roarr','\u21FF':'hoarr','\u2200':'forall','\u2201':'comp','\u2202':'part','\u2202\u0338':'npart','\u2203':'exist','\u2204':'nexist','\u2205':'empty','\u2207':'Del','\u2208':'in','\u2209':'notin','\u220B':'ni','\u220C':'notni','\u03F6':'bepsi','\u220F':'prod','\u2210':'coprod','\u2211':'sum','+':'plus','\xB1':'pm','\xF7':'div','\xD7':'times','<':'lt','\u226E':'nlt','<\u20D2':'nvlt','=':'equals','\u2260':'ne','=\u20E5':'bne','\u2A75':'Equal','>':'gt','\u226F':'ngt','>\u20D2':'nvgt','\xAC':'not','|':'vert','\xA6':'brvbar','\u2212':'minus','\u2213':'mp','\u2214':'plusdo','\u2044':'frasl','\u2216':'setmn','\u2217':'lowast','\u2218':'compfn','\u221A':'Sqrt','\u221D':'prop','\u221E':'infin','\u221F':'angrt','\u2220':'ang','\u2220\u20D2':'nang','\u2221':'angmsd','\u2222':'angsph','\u2223':'mid','\u2224':'nmid','\u2225':'par','\u2226':'npar','\u2227':'and','\u2228':'or','\u2229':'cap','\u2229\uFE00':'caps','\u222A':'cup','\u222A\uFE00':'cups','\u222B':'int','\u222C':'Int','\u222D':'tint','\u2A0C':'qint','\u222E':'oint','\u222F':'Conint','\u2230':'Cconint','\u2231':'cwint','\u2232':'cwconint','\u2233':'awconint','\u2234':'there4','\u2235':'becaus','\u2236':'ratio','\u2237':'Colon','\u2238':'minusd','\u223A':'mDDot','\u223B':'homtht','\u223C':'sim','\u2241':'nsim','\u223C\u20D2':'nvsim','\u223D':'bsim','\u223D\u0331':'race','\u223E':'ac','\u223E\u0333':'acE','\u223F':'acd','\u2240':'wr','\u2242':'esim','\u2242\u0338':'nesim','\u2243':'sime','\u2244':'nsime','\u2245':'cong','\u2247':'ncong','\u2246':'simne','\u2248':'ap','\u2249':'nap','\u224A':'ape','\u224B':'apid','\u224B\u0338':'napid','\u224C':'bcong','\u224D':'CupCap','\u226D':'NotCupCap','\u224D\u20D2':'nvap','\u224E':'bump','\u224E\u0338':'nbump','\u224F':'bumpe','\u224F\u0338':'nbumpe','\u2250':'doteq','\u2250\u0338':'nedot','\u2251':'eDot','\u2252':'efDot','\u2253':'erDot','\u2254':'colone','\u2255':'ecolon','\u2256':'ecir','\u2257':'cire','\u2259':'wedgeq','\u225A':'veeeq','\u225C':'trie','\u225F':'equest','\u2261':'equiv','\u2262':'nequiv','\u2261\u20E5':'bnequiv','\u2264':'le','\u2270':'nle','\u2264\u20D2':'nvle','\u2265':'ge','\u2271':'nge','\u2265\u20D2':'nvge','\u2266':'lE','\u2266\u0338':'nlE','\u2267':'gE','\u2267\u0338':'ngE','\u2268\uFE00':'lvnE','\u2268':'lnE','\u2269':'gnE','\u2269\uFE00':'gvnE','\u226A':'ll','\u226A\u0338':'nLtv','\u226A\u20D2':'nLt','\u226B':'gg','\u226B\u0338':'nGtv','\u226B\u20D2':'nGt','\u226C':'twixt','\u2272':'lsim','\u2274':'nlsim','\u2273':'gsim','\u2275':'ngsim','\u2276':'lg','\u2278':'ntlg','\u2277':'gl','\u2279':'ntgl','\u227A':'pr','\u2280':'npr','\u227B':'sc','\u2281':'nsc','\u227C':'prcue','\u22E0':'nprcue','\u227D':'sccue','\u22E1':'nsccue','\u227E':'prsim','\u227F':'scsim','\u227F\u0338':'NotSucceedsTilde','\u2282':'sub','\u2284':'nsub','\u2282\u20D2':'vnsub','\u2283':'sup','\u2285':'nsup','\u2283\u20D2':'vnsup','\u2286':'sube','\u2288':'nsube','\u2287':'supe','\u2289':'nsupe','\u228A\uFE00':'vsubne','\u228A':'subne','\u228B\uFE00':'vsupne','\u228B':'supne','\u228D':'cupdot','\u228E':'uplus','\u228F':'sqsub','\u228F\u0338':'NotSquareSubset','\u2290':'sqsup','\u2290\u0338':'NotSquareSuperset','\u2291':'sqsube','\u22E2':'nsqsube','\u2292':'sqsupe','\u22E3':'nsqsupe','\u2293':'sqcap','\u2293\uFE00':'sqcaps','\u2294':'sqcup','\u2294\uFE00':'sqcups','\u2295':'oplus','\u2296':'ominus','\u2297':'otimes','\u2298':'osol','\u2299':'odot','\u229A':'ocir','\u229B':'oast','\u229D':'odash','\u229E':'plusb','\u229F':'minusb','\u22A0':'timesb','\u22A1':'sdotb','\u22A2':'vdash','\u22AC':'nvdash','\u22A3':'dashv','\u22A4':'top','\u22A5':'bot','\u22A7':'models','\u22A8':'vDash','\u22AD':'nvDash','\u22A9':'Vdash','\u22AE':'nVdash','\u22AA':'Vvdash','\u22AB':'VDash','\u22AF':'nVDash','\u22B0':'prurel','\u22B2':'vltri','\u22EA':'nltri','\u22B3':'vrtri','\u22EB':'nrtri','\u22B4':'ltrie','\u22EC':'nltrie','\u22B4\u20D2':'nvltrie','\u22B5':'rtrie','\u22ED':'nrtrie','\u22B5\u20D2':'nvrtrie','\u22B6':'origof','\u22B7':'imof','\u22B8':'mumap','\u22B9':'hercon','\u22BA':'intcal','\u22BB':'veebar','\u22BD':'barvee','\u22BE':'angrtvb','\u22BF':'lrtri','\u22C0':'Wedge','\u22C1':'Vee','\u22C2':'xcap','\u22C3':'xcup','\u22C4':'diam','\u22C5':'sdot','\u22C6':'Star','\u22C7':'divonx','\u22C8':'bowtie','\u22C9':'ltimes','\u22CA':'rtimes','\u22CB':'lthree','\u22CC':'rthree','\u22CD':'bsime','\u22CE':'cuvee','\u22CF':'cuwed','\u22D0':'Sub','\u22D1':'Sup','\u22D2':'Cap','\u22D3':'Cup','\u22D4':'fork','\u22D5':'epar','\u22D6':'ltdot','\u22D7':'gtdot','\u22D8':'Ll','\u22D8\u0338':'nLl','\u22D9':'Gg','\u22D9\u0338':'nGg','\u22DA\uFE00':'lesg','\u22DA':'leg','\u22DB':'gel','\u22DB\uFE00':'gesl','\u22DE':'cuepr','\u22DF':'cuesc','\u22E6':'lnsim','\u22E7':'gnsim','\u22E8':'prnsim','\u22E9':'scnsim','\u22EE':'vellip','\u22EF':'ctdot','\u22F0':'utdot','\u22F1':'dtdot','\u22F2':'disin','\u22F3':'isinsv','\u22F4':'isins','\u22F5':'isindot','\u22F5\u0338':'notindot','\u22F6':'notinvc','\u22F7':'notinvb','\u22F9':'isinE','\u22F9\u0338':'notinE','\u22FA':'nisd','\u22FB':'xnis','\u22FC':'nis','\u22FD':'notnivc','\u22FE':'notnivb','\u2305':'barwed','\u2306':'Barwed','\u230C':'drcrop','\u230D':'dlcrop','\u230E':'urcrop','\u230F':'ulcrop','\u2310':'bnot','\u2312':'profline','\u2313':'profsurf','\u2315':'telrec','\u2316':'target','\u231C':'ulcorn','\u231D':'urcorn','\u231E':'dlcorn','\u231F':'drcorn','\u2322':'frown','\u2323':'smile','\u232D':'cylcty','\u232E':'profalar','\u2336':'topbot','\u233D':'ovbar','\u233F':'solbar','\u237C':'angzarr','\u23B0':'lmoust','\u23B1':'rmoust','\u23B4':'tbrk','\u23B5':'bbrk','\u23B6':'bbrktbrk','\u23DC':'OverParenthesis','\u23DD':'UnderParenthesis','\u23DE':'OverBrace','\u23DF':'UnderBrace','\u23E2':'trpezium','\u23E7':'elinters','\u2423':'blank','\u2500':'boxh','\u2502':'boxv','\u250C':'boxdr','\u2510':'boxdl','\u2514':'boxur','\u2518':'boxul','\u251C':'boxvr','\u2524':'boxvl','\u252C':'boxhd','\u2534':'boxhu','\u253C':'boxvh','\u2550':'boxH','\u2551':'boxV','\u2552':'boxdR','\u2553':'boxDr','\u2554':'boxDR','\u2555':'boxdL','\u2556':'boxDl','\u2557':'boxDL','\u2558':'boxuR','\u2559':'boxUr','\u255A':'boxUR','\u255B':'boxuL','\u255C':'boxUl','\u255D':'boxUL','\u255E':'boxvR','\u255F':'boxVr','\u2560':'boxVR','\u2561':'boxvL','\u2562':'boxVl','\u2563':'boxVL','\u2564':'boxHd','\u2565':'boxhD','\u2566':'boxHD','\u2567':'boxHu','\u2568':'boxhU','\u2569':'boxHU','\u256A':'boxvH','\u256B':'boxVh','\u256C':'boxVH','\u2580':'uhblk','\u2584':'lhblk','\u2588':'block','\u2591':'blk14','\u2592':'blk12','\u2593':'blk34','\u25A1':'squ','\u25AA':'squf','\u25AB':'EmptyVerySmallSquare','\u25AD':'rect','\u25AE':'marker','\u25B1':'fltns','\u25B3':'xutri','\u25B4':'utrif','\u25B5':'utri','\u25B8':'rtrif','\u25B9':'rtri','\u25BD':'xdtri','\u25BE':'dtrif','\u25BF':'dtri','\u25C2':'ltrif','\u25C3':'ltri','\u25CA':'loz','\u25CB':'cir','\u25EC':'tridot','\u25EF':'xcirc','\u25F8':'ultri','\u25F9':'urtri','\u25FA':'lltri','\u25FB':'EmptySmallSquare','\u25FC':'FilledSmallSquare','\u2605':'starf','\u2606':'star','\u260E':'phone','\u2640':'female','\u2642':'male','\u2660':'spades','\u2663':'clubs','\u2665':'hearts','\u2666':'diams','\u266A':'sung','\u2713':'check','\u2717':'cross','\u2720':'malt','\u2736':'sext','\u2758':'VerticalSeparator','\u27C8':'bsolhsub','\u27C9':'suphsol','\u27F5':'xlarr','\u27F6':'xrarr','\u27F7':'xharr','\u27F8':'xlArr','\u27F9':'xrArr','\u27FA':'xhArr','\u27FC':'xmap','\u27FF':'dzigrarr','\u2902':'nvlArr','\u2903':'nvrArr','\u2904':'nvHarr','\u2905':'Map','\u290C':'lbarr','\u290D':'rbarr','\u290E':'lBarr','\u290F':'rBarr','\u2910':'RBarr','\u2911':'DDotrahd','\u2912':'UpArrowBar','\u2913':'DownArrowBar','\u2916':'Rarrtl','\u2919':'latail','\u291A':'ratail','\u291B':'lAtail','\u291C':'rAtail','\u291D':'larrfs','\u291E':'rarrfs','\u291F':'larrbfs','\u2920':'rarrbfs','\u2923':'nwarhk','\u2924':'nearhk','\u2925':'searhk','\u2926':'swarhk','\u2927':'nwnear','\u2928':'toea','\u2929':'tosa','\u292A':'swnwar','\u2933':'rarrc','\u2933\u0338':'nrarrc','\u2935':'cudarrr','\u2936':'ldca','\u2937':'rdca','\u2938':'cudarrl','\u2939':'larrpl','\u293C':'curarrm','\u293D':'cularrp','\u2945':'rarrpl','\u2948':'harrcir','\u2949':'Uarrocir','\u294A':'lurdshar','\u294B':'ldrushar','\u294E':'LeftRightVector','\u294F':'RightUpDownVector','\u2950':'DownLeftRightVector','\u2951':'LeftUpDownVector','\u2952':'LeftVectorBar','\u2953':'RightVectorBar','\u2954':'RightUpVectorBar','\u2955':'RightDownVectorBar','\u2956':'DownLeftVectorBar','\u2957':'DownRightVectorBar','\u2958':'LeftUpVectorBar','\u2959':'LeftDownVectorBar','\u295A':'LeftTeeVector','\u295B':'RightTeeVector','\u295C':'RightUpTeeVector','\u295D':'RightDownTeeVector','\u295E':'DownLeftTeeVector','\u295F':'DownRightTeeVector','\u2960':'LeftUpTeeVector','\u2961':'LeftDownTeeVector','\u2962':'lHar','\u2963':'uHar','\u2964':'rHar','\u2965':'dHar','\u2966':'luruhar','\u2967':'ldrdhar','\u2968':'ruluhar','\u2969':'rdldhar','\u296A':'lharul','\u296B':'llhard','\u296C':'rharul','\u296D':'lrhard','\u296E':'udhar','\u296F':'duhar','\u2970':'RoundImplies','\u2971':'erarr','\u2972':'simrarr','\u2973':'larrsim','\u2974':'rarrsim','\u2975':'rarrap','\u2976':'ltlarr','\u2978':'gtrarr','\u2979':'subrarr','\u297B':'suplarr','\u297C':'lfisht','\u297D':'rfisht','\u297E':'ufisht','\u297F':'dfisht','\u299A':'vzigzag','\u299C':'vangrt','\u299D':'angrtvbd','\u29A4':'ange','\u29A5':'range','\u29A6':'dwangle','\u29A7':'uwangle','\u29A8':'angmsdaa','\u29A9':'angmsdab','\u29AA':'angmsdac','\u29AB':'angmsdad','\u29AC':'angmsdae','\u29AD':'angmsdaf','\u29AE':'angmsdag','\u29AF':'angmsdah','\u29B0':'bemptyv','\u29B1':'demptyv','\u29B2':'cemptyv','\u29B3':'raemptyv','\u29B4':'laemptyv','\u29B5':'ohbar','\u29B6':'omid','\u29B7':'opar','\u29B9':'operp','\u29BB':'olcross','\u29BC':'odsold','\u29BE':'olcir','\u29BF':'ofcir','\u29C0':'olt','\u29C1':'ogt','\u29C2':'cirscir','\u29C3':'cirE','\u29C4':'solb','\u29C5':'bsolb','\u29C9':'boxbox','\u29CD':'trisb','\u29CE':'rtriltri','\u29CF':'LeftTriangleBar','\u29CF\u0338':'NotLeftTriangleBar','\u29D0':'RightTriangleBar','\u29D0\u0338':'NotRightTriangleBar','\u29DC':'iinfin','\u29DD':'infintie','\u29DE':'nvinfin','\u29E3':'eparsl','\u29E4':'smeparsl','\u29E5':'eqvparsl','\u29EB':'lozf','\u29F4':'RuleDelayed','\u29F6':'dsol','\u2A00':'xodot','\u2A01':'xoplus','\u2A02':'xotime','\u2A04':'xuplus','\u2A06':'xsqcup','\u2A0D':'fpartint','\u2A10':'cirfnint','\u2A11':'awint','\u2A12':'rppolint','\u2A13':'scpolint','\u2A14':'npolint','\u2A15':'pointint','\u2A16':'quatint','\u2A17':'intlarhk','\u2A22':'pluscir','\u2A23':'plusacir','\u2A24':'simplus','\u2A25':'plusdu','\u2A26':'plussim','\u2A27':'plustwo','\u2A29':'mcomma','\u2A2A':'minusdu','\u2A2D':'loplus','\u2A2E':'roplus','\u2A2F':'Cross','\u2A30':'timesd','\u2A31':'timesbar','\u2A33':'smashp','\u2A34':'lotimes','\u2A35':'rotimes','\u2A36':'otimesas','\u2A37':'Otimes','\u2A38':'odiv','\u2A39':'triplus','\u2A3A':'triminus','\u2A3B':'tritime','\u2A3C':'iprod','\u2A3F':'amalg','\u2A40':'capdot','\u2A42':'ncup','\u2A43':'ncap','\u2A44':'capand','\u2A45':'cupor','\u2A46':'cupcap','\u2A47':'capcup','\u2A48':'cupbrcap','\u2A49':'capbrcup','\u2A4A':'cupcup','\u2A4B':'capcap','\u2A4C':'ccups','\u2A4D':'ccaps','\u2A50':'ccupssm','\u2A53':'And','\u2A54':'Or','\u2A55':'andand','\u2A56':'oror','\u2A57':'orslope','\u2A58':'andslope','\u2A5A':'andv','\u2A5B':'orv','\u2A5C':'andd','\u2A5D':'ord','\u2A5F':'wedbar','\u2A66':'sdote','\u2A6A':'simdot','\u2A6D':'congdot','\u2A6D\u0338':'ncongdot','\u2A6E':'easter','\u2A6F':'apacir','\u2A70':'apE','\u2A70\u0338':'napE','\u2A71':'eplus','\u2A72':'pluse','\u2A73':'Esim','\u2A77':'eDDot','\u2A78':'equivDD','\u2A79':'ltcir','\u2A7A':'gtcir','\u2A7B':'ltquest','\u2A7C':'gtquest','\u2A7D':'les','\u2A7D\u0338':'nles','\u2A7E':'ges','\u2A7E\u0338':'nges','\u2A7F':'lesdot','\u2A80':'gesdot','\u2A81':'lesdoto','\u2A82':'gesdoto','\u2A83':'lesdotor','\u2A84':'gesdotol','\u2A85':'lap','\u2A86':'gap','\u2A87':'lne','\u2A88':'gne','\u2A89':'lnap','\u2A8A':'gnap','\u2A8B':'lEg','\u2A8C':'gEl','\u2A8D':'lsime','\u2A8E':'gsime','\u2A8F':'lsimg','\u2A90':'gsiml','\u2A91':'lgE','\u2A92':'glE','\u2A93':'lesges','\u2A94':'gesles','\u2A95':'els','\u2A96':'egs','\u2A97':'elsdot','\u2A98':'egsdot','\u2A99':'el','\u2A9A':'eg','\u2A9D':'siml','\u2A9E':'simg','\u2A9F':'simlE','\u2AA0':'simgE','\u2AA1':'LessLess','\u2AA1\u0338':'NotNestedLessLess','\u2AA2':'GreaterGreater','\u2AA2\u0338':'NotNestedGreaterGreater','\u2AA4':'glj','\u2AA5':'gla','\u2AA6':'ltcc','\u2AA7':'gtcc','\u2AA8':'lescc','\u2AA9':'gescc','\u2AAA':'smt','\u2AAB':'lat','\u2AAC':'smte','\u2AAC\uFE00':'smtes','\u2AAD':'late','\u2AAD\uFE00':'lates','\u2AAE':'bumpE','\u2AAF':'pre','\u2AAF\u0338':'npre','\u2AB0':'sce','\u2AB0\u0338':'nsce','\u2AB3':'prE','\u2AB4':'scE','\u2AB5':'prnE','\u2AB6':'scnE','\u2AB7':'prap','\u2AB8':'scap','\u2AB9':'prnap','\u2ABA':'scnap','\u2ABB':'Pr','\u2ABC':'Sc','\u2ABD':'subdot','\u2ABE':'supdot','\u2ABF':'subplus','\u2AC0':'supplus','\u2AC1':'submult','\u2AC2':'supmult','\u2AC3':'subedot','\u2AC4':'supedot','\u2AC5':'subE','\u2AC5\u0338':'nsubE','\u2AC6':'supE','\u2AC6\u0338':'nsupE','\u2AC7':'subsim','\u2AC8':'supsim','\u2ACB\uFE00':'vsubnE','\u2ACB':'subnE','\u2ACC\uFE00':'vsupnE','\u2ACC':'supnE','\u2ACF':'csub','\u2AD0':'csup','\u2AD1':'csube','\u2AD2':'csupe','\u2AD3':'subsup','\u2AD4':'supsub','\u2AD5':'subsub','\u2AD6':'supsup','\u2AD7':'suphsub','\u2AD8':'supdsub','\u2AD9':'forkv','\u2ADA':'topfork','\u2ADB':'mlcp','\u2AE4':'Dashv','\u2AE6':'Vdashl','\u2AE7':'Barv','\u2AE8':'vBar','\u2AE9':'vBarv','\u2AEB':'Vbar','\u2AEC':'Not','\u2AED':'bNot','\u2AEE':'rnmid','\u2AEF':'cirmid','\u2AF0':'midcir','\u2AF1':'topcir','\u2AF2':'nhpar','\u2AF3':'parsim','\u2AFD':'parsl','\u2AFD\u20E5':'nparsl','\u266D':'flat','\u266E':'natur','\u266F':'sharp','\xA4':'curren','\xA2':'cent','$':'dollar','\xA3':'pound','\xA5':'yen','\u20AC':'euro','\xB9':'sup1','\xBD':'half','\u2153':'frac13','\xBC':'frac14','\u2155':'frac15','\u2159':'frac16','\u215B':'frac18','\xB2':'sup2','\u2154':'frac23','\u2156':'frac25','\xB3':'sup3','\xBE':'frac34','\u2157':'frac35','\u215C':'frac38','\u2158':'frac45','\u215A':'frac56','\u215D':'frac58','\u215E':'frac78','\uD835\uDCB6':'ascr','\uD835\uDD52':'aopf','\uD835\uDD1E':'afr','\uD835\uDD38':'Aopf','\uD835\uDD04':'Afr','\uD835\uDC9C':'Ascr','\xAA':'ordf','\xE1':'aacute','\xC1':'Aacute','\xE0':'agrave','\xC0':'Agrave','\u0103':'abreve','\u0102':'Abreve','\xE2':'acirc','\xC2':'Acirc','\xE5':'aring','\xC5':'angst','\xE4':'auml','\xC4':'Auml','\xE3':'atilde','\xC3':'Atilde','\u0105':'aogon','\u0104':'Aogon','\u0101':'amacr','\u0100':'Amacr','\xE6':'aelig','\xC6':'AElig','\uD835\uDCB7':'bscr','\uD835\uDD53':'bopf','\uD835\uDD1F':'bfr','\uD835\uDD39':'Bopf','\u212C':'Bscr','\uD835\uDD05':'Bfr','\uD835\uDD20':'cfr','\uD835\uDCB8':'cscr','\uD835\uDD54':'copf','\u212D':'Cfr','\uD835\uDC9E':'Cscr','\u2102':'Copf','\u0107':'cacute','\u0106':'Cacute','\u0109':'ccirc','\u0108':'Ccirc','\u010D':'ccaron','\u010C':'Ccaron','\u010B':'cdot','\u010A':'Cdot','\xE7':'ccedil','\xC7':'Ccedil','\u2105':'incare','\uD835\uDD21':'dfr','\u2146':'dd','\uD835\uDD55':'dopf','\uD835\uDCB9':'dscr','\uD835\uDC9F':'Dscr','\uD835\uDD07':'Dfr','\u2145':'DD','\uD835\uDD3B':'Dopf','\u010F':'dcaron','\u010E':'Dcaron','\u0111':'dstrok','\u0110':'Dstrok','\xF0':'eth','\xD0':'ETH','\u2147':'ee','\u212F':'escr','\uD835\uDD22':'efr','\uD835\uDD56':'eopf','\u2130':'Escr','\uD835\uDD08':'Efr','\uD835\uDD3C':'Eopf','\xE9':'eacute','\xC9':'Eacute','\xE8':'egrave','\xC8':'Egrave','\xEA':'ecirc','\xCA':'Ecirc','\u011B':'ecaron','\u011A':'Ecaron','\xEB':'euml','\xCB':'Euml','\u0117':'edot','\u0116':'Edot','\u0119':'eogon','\u0118':'Eogon','\u0113':'emacr','\u0112':'Emacr','\uD835\uDD23':'ffr','\uD835\uDD57':'fopf','\uD835\uDCBB':'fscr','\uD835\uDD09':'Ffr','\uD835\uDD3D':'Fopf','\u2131':'Fscr','\uFB00':'fflig','\uFB03':'ffilig','\uFB04':'ffllig','\uFB01':'filig','fj':'fjlig','\uFB02':'fllig','\u0192':'fnof','\u210A':'gscr','\uD835\uDD58':'gopf','\uD835\uDD24':'gfr','\uD835\uDCA2':'Gscr','\uD835\uDD3E':'Gopf','\uD835\uDD0A':'Gfr','\u01F5':'gacute','\u011F':'gbreve','\u011E':'Gbreve','\u011D':'gcirc','\u011C':'Gcirc','\u0121':'gdot','\u0120':'Gdot','\u0122':'Gcedil','\uD835\uDD25':'hfr','\u210E':'planckh','\uD835\uDCBD':'hscr','\uD835\uDD59':'hopf','\u210B':'Hscr','\u210C':'Hfr','\u210D':'Hopf','\u0125':'hcirc','\u0124':'Hcirc','\u210F':'hbar','\u0127':'hstrok','\u0126':'Hstrok','\uD835\uDD5A':'iopf','\uD835\uDD26':'ifr','\uD835\uDCBE':'iscr','\u2148':'ii','\uD835\uDD40':'Iopf','\u2110':'Iscr','\u2111':'Im','\xED':'iacute','\xCD':'Iacute','\xEC':'igrave','\xCC':'Igrave','\xEE':'icirc','\xCE':'Icirc','\xEF':'iuml','\xCF':'Iuml','\u0129':'itilde','\u0128':'Itilde','\u0130':'Idot','\u012F':'iogon','\u012E':'Iogon','\u012B':'imacr','\u012A':'Imacr','\u0133':'ijlig','\u0132':'IJlig','\u0131':'imath','\uD835\uDCBF':'jscr','\uD835\uDD5B':'jopf','\uD835\uDD27':'jfr','\uD835\uDCA5':'Jscr','\uD835\uDD0D':'Jfr','\uD835\uDD41':'Jopf','\u0135':'jcirc','\u0134':'Jcirc','\u0237':'jmath','\uD835\uDD5C':'kopf','\uD835\uDCC0':'kscr','\uD835\uDD28':'kfr','\uD835\uDCA6':'Kscr','\uD835\uDD42':'Kopf','\uD835\uDD0E':'Kfr','\u0137':'kcedil','\u0136':'Kcedil','\uD835\uDD29':'lfr','\uD835\uDCC1':'lscr','\u2113':'ell','\uD835\uDD5D':'lopf','\u2112':'Lscr','\uD835\uDD0F':'Lfr','\uD835\uDD43':'Lopf','\u013A':'lacute','\u0139':'Lacute','\u013E':'lcaron','\u013D':'Lcaron','\u013C':'lcedil','\u013B':'Lcedil','\u0142':'lstrok','\u0141':'Lstrok','\u0140':'lmidot','\u013F':'Lmidot','\uD835\uDD2A':'mfr','\uD835\uDD5E':'mopf','\uD835\uDCC2':'mscr','\uD835\uDD10':'Mfr','\uD835\uDD44':'Mopf','\u2133':'Mscr','\uD835\uDD2B':'nfr','\uD835\uDD5F':'nopf','\uD835\uDCC3':'nscr','\u2115':'Nopf','\uD835\uDCA9':'Nscr','\uD835\uDD11':'Nfr','\u0144':'nacute','\u0143':'Nacute','\u0148':'ncaron','\u0147':'Ncaron','\xF1':'ntilde','\xD1':'Ntilde','\u0146':'ncedil','\u0145':'Ncedil','\u2116':'numero','\u014B':'eng','\u014A':'ENG','\uD835\uDD60':'oopf','\uD835\uDD2C':'ofr','\u2134':'oscr','\uD835\uDCAA':'Oscr','\uD835\uDD12':'Ofr','\uD835\uDD46':'Oopf','\xBA':'ordm','\xF3':'oacute','\xD3':'Oacute','\xF2':'ograve','\xD2':'Ograve','\xF4':'ocirc','\xD4':'Ocirc','\xF6':'ouml','\xD6':'Ouml','\u0151':'odblac','\u0150':'Odblac','\xF5':'otilde','\xD5':'Otilde','\xF8':'oslash','\xD8':'Oslash','\u014D':'omacr','\u014C':'Omacr','\u0153':'oelig','\u0152':'OElig','\uD835\uDD2D':'pfr','\uD835\uDCC5':'pscr','\uD835\uDD61':'popf','\u2119':'Popf','\uD835\uDD13':'Pfr','\uD835\uDCAB':'Pscr','\uD835\uDD62':'qopf','\uD835\uDD2E':'qfr','\uD835\uDCC6':'qscr','\uD835\uDCAC':'Qscr','\uD835\uDD14':'Qfr','\u211A':'Qopf','\u0138':'kgreen','\uD835\uDD2F':'rfr','\uD835\uDD63':'ropf','\uD835\uDCC7':'rscr','\u211B':'Rscr','\u211C':'Re','\u211D':'Ropf','\u0155':'racute','\u0154':'Racute','\u0159':'rcaron','\u0158':'Rcaron','\u0157':'rcedil','\u0156':'Rcedil','\uD835\uDD64':'sopf','\uD835\uDCC8':'sscr','\uD835\uDD30':'sfr','\uD835\uDD4A':'Sopf','\uD835\uDD16':'Sfr','\uD835\uDCAE':'Sscr','\u24C8':'oS','\u015B':'sacute','\u015A':'Sacute','\u015D':'scirc','\u015C':'Scirc','\u0161':'scaron','\u0160':'Scaron','\u015F':'scedil','\u015E':'Scedil','\xDF':'szlig','\uD835\uDD31':'tfr','\uD835\uDCC9':'tscr','\uD835\uDD65':'topf','\uD835\uDCAF':'Tscr','\uD835\uDD17':'Tfr','\uD835\uDD4B':'Topf','\u0165':'tcaron','\u0164':'Tcaron','\u0163':'tcedil','\u0162':'Tcedil','\u2122':'trade','\u0167':'tstrok','\u0166':'Tstrok','\uD835\uDCCA':'uscr','\uD835\uDD66':'uopf','\uD835\uDD32':'ufr','\uD835\uDD4C':'Uopf','\uD835\uDD18':'Ufr','\uD835\uDCB0':'Uscr','\xFA':'uacute','\xDA':'Uacute','\xF9':'ugrave','\xD9':'Ugrave','\u016D':'ubreve','\u016C':'Ubreve','\xFB':'ucirc','\xDB':'Ucirc','\u016F':'uring','\u016E':'Uring','\xFC':'uuml','\xDC':'Uuml','\u0171':'udblac','\u0170':'Udblac','\u0169':'utilde','\u0168':'Utilde','\u0173':'uogon','\u0172':'Uogon','\u016B':'umacr','\u016A':'Umacr','\uD835\uDD33':'vfr','\uD835\uDD67':'vopf','\uD835\uDCCB':'vscr','\uD835\uDD19':'Vfr','\uD835\uDD4D':'Vopf','\uD835\uDCB1':'Vscr','\uD835\uDD68':'wopf','\uD835\uDCCC':'wscr','\uD835\uDD34':'wfr','\uD835\uDCB2':'Wscr','\uD835\uDD4E':'Wopf','\uD835\uDD1A':'Wfr','\u0175':'wcirc','\u0174':'Wcirc','\uD835\uDD35':'xfr','\uD835\uDCCD':'xscr','\uD835\uDD69':'xopf','\uD835\uDD4F':'Xopf','\uD835\uDD1B':'Xfr','\uD835\uDCB3':'Xscr','\uD835\uDD36':'yfr','\uD835\uDCCE':'yscr','\uD835\uDD6A':'yopf','\uD835\uDCB4':'Yscr','\uD835\uDD1C':'Yfr','\uD835\uDD50':'Yopf','\xFD':'yacute','\xDD':'Yacute','\u0177':'ycirc','\u0176':'Ycirc','\xFF':'yuml','\u0178':'Yuml','\uD835\uDCCF':'zscr','\uD835\uDD37':'zfr','\uD835\uDD6B':'zopf','\u2128':'Zfr','\u2124':'Zopf','\uD835\uDCB5':'Zscr','\u017A':'zacute','\u0179':'Zacute','\u017E':'zcaron','\u017D':'Zcaron','\u017C':'zdot','\u017B':'Zdot','\u01B5':'imped','\xFE':'thorn','\xDE':'THORN','\u0149':'napos','\u03B1':'alpha','\u0391':'Alpha','\u03B2':'beta','\u0392':'Beta','\u03B3':'gamma','\u0393':'Gamma','\u03B4':'delta','\u0394':'Delta','\u03B5':'epsi','\u03F5':'epsiv','\u0395':'Epsilon','\u03DD':'gammad','\u03DC':'Gammad','\u03B6':'zeta','\u0396':'Zeta','\u03B7':'eta','\u0397':'Eta','\u03B8':'theta','\u03D1':'thetav','\u0398':'Theta','\u03B9':'iota','\u0399':'Iota','\u03BA':'kappa','\u03F0':'kappav','\u039A':'Kappa','\u03BB':'lambda','\u039B':'Lambda','\u03BC':'mu','\xB5':'micro','\u039C':'Mu','\u03BD':'nu','\u039D':'Nu','\u03BE':'xi','\u039E':'Xi','\u03BF':'omicron','\u039F':'Omicron','\u03C0':'pi','\u03D6':'piv','\u03A0':'Pi','\u03C1':'rho','\u03F1':'rhov','\u03A1':'Rho','\u03C3':'sigma','\u03A3':'Sigma','\u03C2':'sigmaf','\u03C4':'tau','\u03A4':'Tau','\u03C5':'upsi','\u03A5':'Upsilon','\u03D2':'Upsi','\u03C6':'phi','\u03D5':'phiv','\u03A6':'Phi','\u03C7':'chi','\u03A7':'Chi','\u03C8':'psi','\u03A8':'Psi','\u03C9':'omega','\u03A9':'ohm','\u0430':'acy','\u0410':'Acy','\u0431':'bcy','\u0411':'Bcy','\u0432':'vcy','\u0412':'Vcy','\u0433':'gcy','\u0413':'Gcy','\u0453':'gjcy','\u0403':'GJcy','\u0434':'dcy','\u0414':'Dcy','\u0452':'djcy','\u0402':'DJcy','\u0435':'iecy','\u0415':'IEcy','\u0451':'iocy','\u0401':'IOcy','\u0454':'jukcy','\u0404':'Jukcy','\u0436':'zhcy','\u0416':'ZHcy','\u0437':'zcy','\u0417':'Zcy','\u0455':'dscy','\u0405':'DScy','\u0438':'icy','\u0418':'Icy','\u0456':'iukcy','\u0406':'Iukcy','\u0457':'yicy','\u0407':'YIcy','\u0439':'jcy','\u0419':'Jcy','\u0458':'jsercy','\u0408':'Jsercy','\u043A':'kcy','\u041A':'Kcy','\u045C':'kjcy','\u040C':'KJcy','\u043B':'lcy','\u041B':'Lcy','\u0459':'ljcy','\u0409':'LJcy','\u043C':'mcy','\u041C':'Mcy','\u043D':'ncy','\u041D':'Ncy','\u045A':'njcy','\u040A':'NJcy','\u043E':'ocy','\u041E':'Ocy','\u043F':'pcy','\u041F':'Pcy','\u0440':'rcy','\u0420':'Rcy','\u0441':'scy','\u0421':'Scy','\u0442':'tcy','\u0422':'Tcy','\u045B':'tshcy','\u040B':'TSHcy','\u0443':'ucy','\u0423':'Ucy','\u045E':'ubrcy','\u040E':'Ubrcy','\u0444':'fcy','\u0424':'Fcy','\u0445':'khcy','\u0425':'KHcy','\u0446':'tscy','\u0426':'TScy','\u0447':'chcy','\u0427':'CHcy','\u045F':'dzcy','\u040F':'DZcy','\u0448':'shcy','\u0428':'SHcy','\u0449':'shchcy','\u0429':'SHCHcy','\u044A':'hardcy','\u042A':'HARDcy','\u044B':'ycy','\u042B':'Ycy','\u044C':'softcy','\u042C':'SOFTcy','\u044D':'ecy','\u042D':'Ecy','\u044E':'yucy','\u042E':'YUcy','\u044F':'yacy','\u042F':'YAcy','\u2135':'aleph','\u2136':'beth','\u2137':'gimel','\u2138':'daleth'};
13286
13287 var regexEscape = /["&'<>`]/g;
13288 var escapeMap = {
13289 '"': '&quot;',
13290 '&': '&amp;',
13291 '\'': '&#x27;',
13292 '<': '&lt;',
13293 // See https://mathiasbynens.be/notes/ambiguous-ampersands: in HTML, the
13294 // following is not strictly necessary unless it’s part of a tag or an
13295 // unquoted attribute value. We’re only escaping it to support those
13296 // situations, and for XML support.
13297 '>': '&gt;',
13298 // In Internet Explorer ≤ 8, the backtick character can be used
13299 // to break out of (un)quoted attribute values or HTML comments.
13300 // See http://html5sec.org/#102, http://html5sec.org/#108, and
13301 // http://html5sec.org/#133.
13302 '`': '&#x60;'
13303 };
13304
13305 var regexInvalidEntity = /&#(?:[xX][^a-fA-F0-9]|[^0-9xX])/;
13306 var regexInvalidRawCodePoint = /[\0-\x08\x0B\x0E-\x1F\x7F-\x9F\uFDD0-\uFDEF\uFFFE\uFFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDFFE\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
13307 var regexDecode = /&(CounterClockwiseContourIntegral|DoubleLongLeftRightArrow|ClockwiseContourIntegral|NotNestedGreaterGreater|NotSquareSupersetEqual|DiacriticalDoubleAcute|NotRightTriangleEqual|NotSucceedsSlantEqual|NotPrecedesSlantEqual|CloseCurlyDoubleQuote|NegativeVeryThinSpace|DoubleContourIntegral|FilledVerySmallSquare|CapitalDifferentialD|OpenCurlyDoubleQuote|EmptyVerySmallSquare|NestedGreaterGreater|DoubleLongRightArrow|NotLeftTriangleEqual|NotGreaterSlantEqual|ReverseUpEquilibrium|DoubleLeftRightArrow|NotSquareSubsetEqual|NotDoubleVerticalBar|RightArrowLeftArrow|NotGreaterFullEqual|NotRightTriangleBar|SquareSupersetEqual|DownLeftRightVector|DoubleLongLeftArrow|leftrightsquigarrow|LeftArrowRightArrow|NegativeMediumSpace|blacktriangleright|RightDownVectorBar|PrecedesSlantEqual|RightDoubleBracket|SucceedsSlantEqual|NotLeftTriangleBar|RightTriangleEqual|SquareIntersection|RightDownTeeVector|ReverseEquilibrium|NegativeThickSpace|longleftrightarrow|Longleftrightarrow|LongLeftRightArrow|DownRightTeeVector|DownRightVectorBar|GreaterSlantEqual|SquareSubsetEqual|LeftDownVectorBar|LeftDoubleBracket|VerticalSeparator|rightleftharpoons|NotGreaterGreater|NotSquareSuperset|blacktriangleleft|blacktriangledown|NegativeThinSpace|LeftDownTeeVector|NotLessSlantEqual|leftrightharpoons|DoubleUpDownArrow|DoubleVerticalBar|LeftTriangleEqual|FilledSmallSquare|twoheadrightarrow|NotNestedLessLess|DownLeftTeeVector|DownLeftVectorBar|RightAngleBracket|NotTildeFullEqual|NotReverseElement|RightUpDownVector|DiacriticalTilde|NotSucceedsTilde|circlearrowright|NotPrecedesEqual|rightharpoondown|DoubleRightArrow|NotSucceedsEqual|NonBreakingSpace|NotRightTriangle|LessEqualGreater|RightUpTeeVector|LeftAngleBracket|GreaterFullEqual|DownArrowUpArrow|RightUpVectorBar|twoheadleftarrow|GreaterEqualLess|downharpoonright|RightTriangleBar|ntrianglerighteq|NotSupersetEqual|LeftUpDownVector|DiacriticalAcute|rightrightarrows|vartriangleright|UpArrowDownArrow|DiacriticalGrave|UnderParenthesis|EmptySmallSquare|LeftUpVectorBar|leftrightarrows|DownRightVector|downharpoonleft|trianglerighteq|ShortRightArrow|OverParenthesis|DoubleLeftArrow|DoubleDownArrow|NotSquareSubset|bigtriangledown|ntrianglelefteq|UpperRightArrow|curvearrowright|vartriangleleft|NotLeftTriangle|nleftrightarrow|LowerRightArrow|NotHumpDownHump|NotGreaterTilde|rightthreetimes|LeftUpTeeVector|NotGreaterEqual|straightepsilon|LeftTriangleBar|rightsquigarrow|ContourIntegral|rightleftarrows|CloseCurlyQuote|RightDownVector|LeftRightVector|nLeftrightarrow|leftharpoondown|circlearrowleft|SquareSuperset|OpenCurlyQuote|hookrightarrow|HorizontalLine|DiacriticalDot|NotLessGreater|ntriangleright|DoubleRightTee|InvisibleComma|InvisibleTimes|LowerLeftArrow|DownLeftVector|NotSubsetEqual|curvearrowleft|trianglelefteq|NotVerticalBar|TildeFullEqual|downdownarrows|NotGreaterLess|RightTeeVector|ZeroWidthSpace|looparrowright|LongRightArrow|doublebarwedge|ShortLeftArrow|ShortDownArrow|RightVectorBar|GreaterGreater|ReverseElement|rightharpoonup|LessSlantEqual|leftthreetimes|upharpoonright|rightarrowtail|LeftDownVector|Longrightarrow|NestedLessLess|UpperLeftArrow|nshortparallel|leftleftarrows|leftrightarrow|Leftrightarrow|LeftRightArrow|longrightarrow|upharpoonleft|RightArrowBar|ApplyFunction|LeftTeeVector|leftarrowtail|NotEqualTilde|varsubsetneqq|varsupsetneqq|RightTeeArrow|SucceedsEqual|SucceedsTilde|LeftVectorBar|SupersetEqual|hookleftarrow|DifferentialD|VerticalTilde|VeryThinSpace|blacktriangle|bigtriangleup|LessFullEqual|divideontimes|leftharpoonup|UpEquilibrium|ntriangleleft|RightTriangle|measuredangle|shortparallel|longleftarrow|Longleftarrow|LongLeftArrow|DoubleLeftTee|Poincareplane|PrecedesEqual|triangleright|DoubleUpArrow|RightUpVector|fallingdotseq|looparrowleft|PrecedesTilde|NotTildeEqual|NotTildeTilde|smallsetminus|Proportional|triangleleft|triangledown|UnderBracket|NotHumpEqual|exponentiale|ExponentialE|NotLessTilde|HilbertSpace|RightCeiling|blacklozenge|varsupsetneq|HumpDownHump|GreaterEqual|VerticalLine|LeftTeeArrow|NotLessEqual|DownTeeArrow|LeftTriangle|varsubsetneq|Intersection|NotCongruent|DownArrowBar|LeftUpVector|LeftArrowBar|risingdotseq|GreaterTilde|RoundImplies|SquareSubset|ShortUpArrow|NotSuperset|quaternions|precnapprox|backepsilon|preccurlyeq|OverBracket|blacksquare|MediumSpace|VerticalBar|circledcirc|circleddash|CircleMinus|CircleTimes|LessGreater|curlyeqprec|curlyeqsucc|diamondsuit|UpDownArrow|Updownarrow|RuleDelayed|Rrightarrow|updownarrow|RightVector|nRightarrow|nrightarrow|eqslantless|LeftCeiling|Equilibrium|SmallCircle|expectation|NotSucceeds|thickapprox|GreaterLess|SquareUnion|NotPrecedes|NotLessLess|straightphi|succnapprox|succcurlyeq|SubsetEqual|sqsupseteq|Proportion|Laplacetrf|ImaginaryI|supsetneqq|NotGreater|gtreqqless|NotElement|ThickSpace|TildeEqual|TildeTilde|Fouriertrf|rmoustache|EqualTilde|eqslantgtr|UnderBrace|LeftVector|UpArrowBar|nLeftarrow|nsubseteqq|subsetneqq|nsupseteqq|nleftarrow|succapprox|lessapprox|UpTeeArrow|upuparrows|curlywedge|lesseqqgtr|varepsilon|varnothing|RightFloor|complement|CirclePlus|sqsubseteq|Lleftarrow|circledast|RightArrow|Rightarrow|rightarrow|lmoustache|Bernoullis|precapprox|mapstoleft|mapstodown|longmapsto|dotsquare|downarrow|DoubleDot|nsubseteq|supsetneq|leftarrow|nsupseteq|subsetneq|ThinSpace|ngeqslant|subseteqq|HumpEqual|NotSubset|triangleq|NotCupCap|lesseqgtr|heartsuit|TripleDot|Leftarrow|Coproduct|Congruent|varpropto|complexes|gvertneqq|LeftArrow|LessTilde|supseteqq|MinusPlus|CircleDot|nleqslant|NotExists|gtreqless|nparallel|UnionPlus|LeftFloor|checkmark|CenterDot|centerdot|Mellintrf|gtrapprox|bigotimes|OverBrace|spadesuit|therefore|pitchfork|rationals|PlusMinus|Backslash|Therefore|DownBreve|backsimeq|backprime|DownArrow|nshortmid|Downarrow|lvertneqq|eqvparsl|imagline|imagpart|infintie|integers|Integral|intercal|LessLess|Uarrocir|intlarhk|sqsupset|angmsdaf|sqsubset|llcorner|vartheta|cupbrcap|lnapprox|Superset|SuchThat|succnsim|succneqq|angmsdag|biguplus|curlyvee|trpezium|Succeeds|NotTilde|bigwedge|angmsdah|angrtvbd|triminus|cwconint|fpartint|lrcorner|smeparsl|subseteq|urcorner|lurdshar|laemptyv|DDotrahd|approxeq|ldrushar|awconint|mapstoup|backcong|shortmid|triangle|geqslant|gesdotol|timesbar|circledR|circledS|setminus|multimap|naturals|scpolint|ncongdot|RightTee|boxminus|gnapprox|boxtimes|andslope|thicksim|angmsdaa|varsigma|cirfnint|rtriltri|angmsdab|rppolint|angmsdac|barwedge|drbkarow|clubsuit|thetasym|bsolhsub|capbrcup|dzigrarr|doteqdot|DotEqual|dotminus|UnderBar|NotEqual|realpart|otimesas|ulcorner|hksearow|hkswarow|parallel|PartialD|elinters|emptyset|plusacir|bbrktbrk|angmsdad|pointint|bigoplus|angmsdae|Precedes|bigsqcup|varkappa|notindot|supseteq|precneqq|precnsim|profalar|profline|profsurf|leqslant|lesdotor|raemptyv|subplus|notnivb|notnivc|subrarr|zigrarr|vzigzag|submult|subedot|Element|between|cirscir|larrbfs|larrsim|lotimes|lbrksld|lbrkslu|lozenge|ldrdhar|dbkarow|bigcirc|epsilon|simrarr|simplus|ltquest|Epsilon|luruhar|gtquest|maltese|npolint|eqcolon|npreceq|bigodot|ddagger|gtrless|bnequiv|harrcir|ddotseq|equivDD|backsim|demptyv|nsqsube|nsqsupe|Upsilon|nsubset|upsilon|minusdu|nsucceq|swarrow|nsupset|coloneq|searrow|boxplus|napprox|natural|asympeq|alefsym|congdot|nearrow|bigstar|diamond|supplus|tritime|LeftTee|nvinfin|triplus|NewLine|nvltrie|nvrtrie|nwarrow|nexists|Diamond|ruluhar|Implies|supmult|angzarr|suplarr|suphsub|questeq|because|digamma|Because|olcross|bemptyv|omicron|Omicron|rotimes|NoBreak|intprod|angrtvb|orderof|uwangle|suphsol|lesdoto|orslope|DownTee|realine|cudarrl|rdldhar|OverBar|supedot|lessdot|supdsub|topfork|succsim|rbrkslu|rbrksld|pertenk|cudarrr|isindot|planckh|lessgtr|pluscir|gesdoto|plussim|plustwo|lesssim|cularrp|rarrsim|Cayleys|notinva|notinvb|notinvc|UpArrow|Uparrow|uparrow|NotLess|dwangle|precsim|Product|curarrm|Cconint|dotplus|rarrbfs|ccupssm|Cedilla|cemptyv|notniva|quatint|frac35|frac38|frac45|frac56|frac58|frac78|tridot|xoplus|gacute|gammad|Gammad|lfisht|lfloor|bigcup|sqsupe|gbreve|Gbreve|lharul|sqsube|sqcups|Gcedil|apacir|llhard|lmidot|Lmidot|lmoust|andand|sqcaps|approx|Abreve|spades|circeq|tprime|divide|topcir|Assign|topbot|gesdot|divonx|xuplus|timesd|gesles|atilde|solbar|SOFTcy|loplus|timesb|lowast|lowbar|dlcorn|dlcrop|softcy|dollar|lparlt|thksim|lrhard|Atilde|lsaquo|smashp|bigvee|thinsp|wreath|bkarow|lsquor|lstrok|Lstrok|lthree|ltimes|ltlarr|DotDot|simdot|ltrPar|weierp|xsqcup|angmsd|sigmav|sigmaf|zeetrf|Zcaron|zcaron|mapsto|vsupne|thetav|cirmid|marker|mcomma|Zacute|vsubnE|there4|gtlPar|vsubne|bottom|gtrarr|SHCHcy|shchcy|midast|midcir|middot|minusb|minusd|gtrdot|bowtie|sfrown|mnplus|models|colone|seswar|Colone|mstpos|searhk|gtrsim|nacute|Nacute|boxbox|telrec|hairsp|Tcedil|nbumpe|scnsim|ncaron|Ncaron|ncedil|Ncedil|hamilt|Scedil|nearhk|hardcy|HARDcy|tcedil|Tcaron|commat|nequiv|nesear|tcaron|target|hearts|nexist|varrho|scedil|Scaron|scaron|hellip|Sacute|sacute|hercon|swnwar|compfn|rtimes|rthree|rsquor|rsaquo|zacute|wedgeq|homtht|barvee|barwed|Barwed|rpargt|horbar|conint|swarhk|roplus|nltrie|hslash|hstrok|Hstrok|rmoust|Conint|bprime|hybull|hyphen|iacute|Iacute|supsup|supsub|supsim|varphi|coprod|brvbar|agrave|Supset|supset|igrave|Igrave|notinE|Agrave|iiiint|iinfin|copysr|wedbar|Verbar|vangrt|becaus|incare|verbar|inodot|bullet|drcorn|intcal|drcrop|cularr|vellip|Utilde|bumpeq|cupcap|dstrok|Dstrok|CupCap|cupcup|cupdot|eacute|Eacute|supdot|iquest|easter|ecaron|Ecaron|ecolon|isinsv|utilde|itilde|Itilde|curarr|succeq|Bumpeq|cacute|ulcrop|nparsl|Cacute|nprcue|egrave|Egrave|nrarrc|nrarrw|subsup|subsub|nrtrie|jsercy|nsccue|Jsercy|kappav|kcedil|Kcedil|subsim|ulcorn|nsimeq|egsdot|veebar|kgreen|capand|elsdot|Subset|subset|curren|aacute|lacute|Lacute|emptyv|ntilde|Ntilde|lagran|lambda|Lambda|capcap|Ugrave|langle|subdot|emsp13|numero|emsp14|nvdash|nvDash|nVdash|nVDash|ugrave|ufisht|nvHarr|larrfs|nvlArr|larrhk|larrlp|larrpl|nvrArr|Udblac|nwarhk|larrtl|nwnear|oacute|Oacute|latail|lAtail|sstarf|lbrace|odblac|Odblac|lbrack|udblac|odsold|eparsl|lcaron|Lcaron|ograve|Ograve|lcedil|Lcedil|Aacute|ssmile|ssetmn|squarf|ldquor|capcup|ominus|cylcty|rharul|eqcirc|dagger|rfloor|rfisht|Dagger|daleth|equals|origof|capdot|equest|dcaron|Dcaron|rdquor|oslash|Oslash|otilde|Otilde|otimes|Otimes|urcrop|Ubreve|ubreve|Yacute|Uacute|uacute|Rcedil|rcedil|urcorn|parsim|Rcaron|Vdashl|rcaron|Tstrok|percnt|period|permil|Exists|yacute|rbrack|rbrace|phmmat|ccaron|Ccaron|planck|ccedil|plankv|tstrok|female|plusdo|plusdu|ffilig|plusmn|ffllig|Ccedil|rAtail|dfisht|bernou|ratail|Rarrtl|rarrtl|angsph|rarrpl|rarrlp|rarrhk|xwedge|xotime|forall|ForAll|Vvdash|vsupnE|preceq|bigcap|frac12|frac13|frac14|primes|rarrfs|prnsim|frac15|Square|frac16|square|lesdot|frac18|frac23|propto|prurel|rarrap|rangle|puncsp|frac25|Racute|qprime|racute|lesges|frac34|abreve|AElig|eqsim|utdot|setmn|urtri|Equal|Uring|seArr|uring|searr|dashv|Dashv|mumap|nabla|iogon|Iogon|sdote|sdotb|scsim|napid|napos|equiv|natur|Acirc|dblac|erarr|nbump|iprod|erDot|ucirc|awint|esdot|angrt|ncong|isinE|scnap|Scirc|scirc|ndash|isins|Ubrcy|nearr|neArr|isinv|nedot|ubrcy|acute|Ycirc|iukcy|Iukcy|xutri|nesim|caret|jcirc|Jcirc|caron|twixt|ddarr|sccue|exist|jmath|sbquo|ngeqq|angst|ccaps|lceil|ngsim|UpTee|delta|Delta|rtrif|nharr|nhArr|nhpar|rtrie|jukcy|Jukcy|kappa|rsquo|Kappa|nlarr|nlArr|TSHcy|rrarr|aogon|Aogon|fflig|xrarr|tshcy|ccirc|nleqq|filig|upsih|nless|dharl|nlsim|fjlig|ropar|nltri|dharr|robrk|roarr|fllig|fltns|roang|rnmid|subnE|subne|lAarr|trisb|Ccirc|acirc|ccups|blank|VDash|forkv|Vdash|langd|cedil|blk12|blk14|laquo|strns|diams|notin|vDash|larrb|blk34|block|disin|uplus|vdash|vBarv|aelig|starf|Wedge|check|xrArr|lates|lbarr|lBarr|notni|lbbrk|bcong|frasl|lbrke|frown|vrtri|vprop|vnsup|gamma|Gamma|wedge|xodot|bdquo|srarr|doteq|ldquo|boxdl|boxdL|gcirc|Gcirc|boxDl|boxDL|boxdr|boxdR|boxDr|TRADE|trade|rlhar|boxDR|vnsub|npart|vltri|rlarr|boxhd|boxhD|nprec|gescc|nrarr|nrArr|boxHd|boxHD|boxhu|boxhU|nrtri|boxHu|clubs|boxHU|times|colon|Colon|gimel|xlArr|Tilde|nsime|tilde|nsmid|nspar|THORN|thorn|xlarr|nsube|nsubE|thkap|xhArr|comma|nsucc|boxul|boxuL|nsupe|nsupE|gneqq|gnsim|boxUl|boxUL|grave|boxur|boxuR|boxUr|boxUR|lescc|angle|bepsi|boxvh|varpi|boxvH|numsp|Theta|gsime|gsiml|theta|boxVh|boxVH|boxvl|gtcir|gtdot|boxvL|boxVl|boxVL|crarr|cross|Cross|nvsim|boxvr|nwarr|nwArr|sqsup|dtdot|Uogon|lhard|lharu|dtrif|ocirc|Ocirc|lhblk|duarr|odash|sqsub|Hacek|sqcup|llarr|duhar|oelig|OElig|ofcir|boxvR|uogon|lltri|boxVr|csube|uuarr|ohbar|csupe|ctdot|olarr|olcir|harrw|oline|sqcap|omacr|Omacr|omega|Omega|boxVR|aleph|lneqq|lnsim|loang|loarr|rharu|lobrk|hcirc|operp|oplus|rhard|Hcirc|orarr|Union|order|ecirc|Ecirc|cuepr|szlig|cuesc|breve|reals|eDDot|Breve|hoarr|lopar|utrif|rdquo|Umacr|umacr|efDot|swArr|ultri|alpha|rceil|ovbar|swarr|Wcirc|wcirc|smtes|smile|bsemi|lrarr|aring|parsl|lrhar|bsime|uhblk|lrtri|cupor|Aring|uharr|uharl|slarr|rbrke|bsolb|lsime|rbbrk|RBarr|lsimg|phone|rBarr|rbarr|icirc|lsquo|Icirc|emacr|Emacr|ratio|simne|plusb|simlE|simgE|simeq|pluse|ltcir|ltdot|empty|xharr|xdtri|iexcl|Alpha|ltrie|rarrw|pound|ltrif|xcirc|bumpe|prcue|bumpE|asymp|amacr|cuvee|Sigma|sigma|iiint|udhar|iiota|ijlig|IJlig|supnE|imacr|Imacr|prime|Prime|image|prnap|eogon|Eogon|rarrc|mdash|mDDot|cuwed|imath|supne|imped|Amacr|udarr|prsim|micro|rarrb|cwint|raquo|infin|eplus|range|rangd|Ucirc|radic|minus|amalg|veeeq|rAarr|epsiv|ycirc|quest|sharp|quot|zwnj|Qscr|race|qscr|Qopf|qopf|qint|rang|Rang|Zscr|zscr|Zopf|zopf|rarr|rArr|Rarr|Pscr|pscr|prop|prod|prnE|prec|ZHcy|zhcy|prap|Zeta|zeta|Popf|popf|Zdot|plus|zdot|Yuml|yuml|phiv|YUcy|yucy|Yscr|yscr|perp|Yopf|yopf|part|para|YIcy|Ouml|rcub|yicy|YAcy|rdca|ouml|osol|Oscr|rdsh|yacy|real|oscr|xvee|andd|rect|andv|Xscr|oror|ordm|ordf|xscr|ange|aopf|Aopf|rHar|Xopf|opar|Oopf|xopf|xnis|rhov|oopf|omid|xmap|oint|apid|apos|ogon|ascr|Ascr|odot|odiv|xcup|xcap|ocir|oast|nvlt|nvle|nvgt|nvge|nvap|Wscr|wscr|auml|ntlg|ntgl|nsup|nsub|nsim|Nscr|nscr|nsce|Wopf|ring|npre|wopf|npar|Auml|Barv|bbrk|Nopf|nopf|nmid|nLtv|beta|ropf|Ropf|Beta|beth|nles|rpar|nleq|bnot|bNot|nldr|NJcy|rscr|Rscr|Vscr|vscr|rsqb|njcy|bopf|nisd|Bopf|rtri|Vopf|nGtv|ngtr|vopf|boxh|boxH|boxv|nges|ngeq|boxV|bscr|scap|Bscr|bsim|Vert|vert|bsol|bull|bump|caps|cdot|ncup|scnE|ncap|nbsp|napE|Cdot|cent|sdot|Vbar|nang|vBar|chcy|Mscr|mscr|sect|semi|CHcy|Mopf|mopf|sext|circ|cire|mldr|mlcp|cirE|comp|shcy|SHcy|vArr|varr|cong|copf|Copf|copy|COPY|malt|male|macr|lvnE|cscr|ltri|sime|ltcc|simg|Cscr|siml|csub|Uuml|lsqb|lsim|uuml|csup|Lscr|lscr|utri|smid|lpar|cups|smte|lozf|darr|Lopf|Uscr|solb|lopf|sopf|Sopf|lneq|uscr|spar|dArr|lnap|Darr|dash|Sqrt|LJcy|ljcy|lHar|dHar|Upsi|upsi|diam|lesg|djcy|DJcy|leqq|dopf|Dopf|dscr|Dscr|dscy|ldsh|ldca|squf|DScy|sscr|Sscr|dsol|lcub|late|star|Star|Uopf|Larr|lArr|larr|uopf|dtri|dzcy|sube|subE|Lang|lang|Kscr|kscr|Kopf|kopf|KJcy|kjcy|KHcy|khcy|DZcy|ecir|edot|eDot|Jscr|jscr|succ|Jopf|jopf|Edot|uHar|emsp|ensp|Iuml|iuml|eopf|isin|Iscr|iscr|Eopf|epar|sung|epsi|escr|sup1|sup2|sup3|Iota|iota|supe|supE|Iopf|iopf|IOcy|iocy|Escr|esim|Esim|imof|Uarr|QUOT|uArr|uarr|euml|IEcy|iecy|Idot|Euml|euro|excl|Hscr|hscr|Hopf|hopf|TScy|tscy|Tscr|hbar|tscr|flat|tbrk|fnof|hArr|harr|half|fopf|Fopf|tdot|gvnE|fork|trie|gtcc|fscr|Fscr|gdot|gsim|Gscr|gscr|Gopf|gopf|gneq|Gdot|tosa|gnap|Topf|topf|geqq|toea|GJcy|gjcy|tint|gesl|mid|Sfr|ggg|top|ges|gla|glE|glj|geq|gne|gEl|gel|gnE|Gcy|gcy|gap|Tfr|tfr|Tcy|tcy|Hat|Tau|Ffr|tau|Tab|hfr|Hfr|ffr|Fcy|fcy|icy|Icy|iff|ETH|eth|ifr|Ifr|Eta|eta|int|Int|Sup|sup|ucy|Ucy|Sum|sum|jcy|ENG|ufr|Ufr|eng|Jcy|jfr|els|ell|egs|Efr|efr|Jfr|uml|kcy|Kcy|Ecy|ecy|kfr|Kfr|lap|Sub|sub|lat|lcy|Lcy|leg|Dot|dot|lEg|leq|les|squ|div|die|lfr|Lfr|lgE|Dfr|dfr|Del|deg|Dcy|dcy|lne|lnE|sol|loz|smt|Cup|lrm|cup|lsh|Lsh|sim|shy|map|Map|mcy|Mcy|mfr|Mfr|mho|gfr|Gfr|sfr|cir|Chi|chi|nap|Cfr|vcy|Vcy|cfr|Scy|scy|ncy|Ncy|vee|Vee|Cap|cap|nfr|scE|sce|Nfr|nge|ngE|nGg|vfr|Vfr|ngt|bot|nGt|nis|niv|Rsh|rsh|nle|nlE|bne|Bfr|bfr|nLl|nlt|nLt|Bcy|bcy|not|Not|rlm|wfr|Wfr|npr|nsc|num|ocy|ast|Ocy|ofr|xfr|Xfr|Ofr|ogt|ohm|apE|olt|Rho|ape|rho|Rfr|rfr|ord|REG|ang|reg|orv|And|and|AMP|Rcy|amp|Afr|ycy|Ycy|yen|yfr|Yfr|rcy|par|pcy|Pcy|pfr|Pfr|phi|Phi|afr|Acy|acy|zcy|Zcy|piv|acE|acd|zfr|Zfr|pre|prE|psi|Psi|qfr|Qfr|zwj|Or|ge|Gg|gt|gg|el|oS|lt|Lt|LT|Re|lg|gl|eg|ne|Im|it|le|DD|wp|wr|nu|Nu|dd|lE|Sc|sc|pi|Pi|ee|af|ll|Ll|rx|gE|xi|pm|Xi|ic|pr|Pr|in|ni|mp|mu|ac|Mu|or|ap|Gt|GT|ii);|&(Aacute|Agrave|Atilde|Ccedil|Eacute|Egrave|Iacute|Igrave|Ntilde|Oacute|Ograve|Oslash|Otilde|Uacute|Ugrave|Yacute|aacute|agrave|atilde|brvbar|ccedil|curren|divide|eacute|egrave|frac12|frac14|frac34|iacute|igrave|iquest|middot|ntilde|oacute|ograve|oslash|otilde|plusmn|uacute|ugrave|yacute|AElig|Acirc|Aring|Ecirc|Icirc|Ocirc|THORN|Ucirc|acirc|acute|aelig|aring|cedil|ecirc|icirc|iexcl|laquo|micro|ocirc|pound|raquo|szlig|thorn|times|ucirc|Auml|COPY|Euml|Iuml|Ouml|QUOT|Uuml|auml|cent|copy|euml|iuml|macr|nbsp|ordf|ordm|ouml|para|quot|sect|sup1|sup2|sup3|uuml|yuml|AMP|ETH|REG|amp|deg|eth|not|reg|shy|uml|yen|GT|LT|gt|lt)(?!;)([=a-zA-Z0-9]?)|&#([0-9]+)(;?)|&#[xX]([a-fA-F0-9]+)(;?)|&([0-9a-zA-Z]+)/g;
13308 var decodeMap = {'aacute':'\xE1','Aacute':'\xC1','abreve':'\u0103','Abreve':'\u0102','ac':'\u223E','acd':'\u223F','acE':'\u223E\u0333','acirc':'\xE2','Acirc':'\xC2','acute':'\xB4','acy':'\u0430','Acy':'\u0410','aelig':'\xE6','AElig':'\xC6','af':'\u2061','afr':'\uD835\uDD1E','Afr':'\uD835\uDD04','agrave':'\xE0','Agrave':'\xC0','alefsym':'\u2135','aleph':'\u2135','alpha':'\u03B1','Alpha':'\u0391','amacr':'\u0101','Amacr':'\u0100','amalg':'\u2A3F','amp':'&','AMP':'&','and':'\u2227','And':'\u2A53','andand':'\u2A55','andd':'\u2A5C','andslope':'\u2A58','andv':'\u2A5A','ang':'\u2220','ange':'\u29A4','angle':'\u2220','angmsd':'\u2221','angmsdaa':'\u29A8','angmsdab':'\u29A9','angmsdac':'\u29AA','angmsdad':'\u29AB','angmsdae':'\u29AC','angmsdaf':'\u29AD','angmsdag':'\u29AE','angmsdah':'\u29AF','angrt':'\u221F','angrtvb':'\u22BE','angrtvbd':'\u299D','angsph':'\u2222','angst':'\xC5','angzarr':'\u237C','aogon':'\u0105','Aogon':'\u0104','aopf':'\uD835\uDD52','Aopf':'\uD835\uDD38','ap':'\u2248','apacir':'\u2A6F','ape':'\u224A','apE':'\u2A70','apid':'\u224B','apos':'\'','ApplyFunction':'\u2061','approx':'\u2248','approxeq':'\u224A','aring':'\xE5','Aring':'\xC5','ascr':'\uD835\uDCB6','Ascr':'\uD835\uDC9C','Assign':'\u2254','ast':'*','asymp':'\u2248','asympeq':'\u224D','atilde':'\xE3','Atilde':'\xC3','auml':'\xE4','Auml':'\xC4','awconint':'\u2233','awint':'\u2A11','backcong':'\u224C','backepsilon':'\u03F6','backprime':'\u2035','backsim':'\u223D','backsimeq':'\u22CD','Backslash':'\u2216','Barv':'\u2AE7','barvee':'\u22BD','barwed':'\u2305','Barwed':'\u2306','barwedge':'\u2305','bbrk':'\u23B5','bbrktbrk':'\u23B6','bcong':'\u224C','bcy':'\u0431','Bcy':'\u0411','bdquo':'\u201E','becaus':'\u2235','because':'\u2235','Because':'\u2235','bemptyv':'\u29B0','bepsi':'\u03F6','bernou':'\u212C','Bernoullis':'\u212C','beta':'\u03B2','Beta':'\u0392','beth':'\u2136','between':'\u226C','bfr':'\uD835\uDD1F','Bfr':'\uD835\uDD05','bigcap':'\u22C2','bigcirc':'\u25EF','bigcup':'\u22C3','bigodot':'\u2A00','bigoplus':'\u2A01','bigotimes':'\u2A02','bigsqcup':'\u2A06','bigstar':'\u2605','bigtriangledown':'\u25BD','bigtriangleup':'\u25B3','biguplus':'\u2A04','bigvee':'\u22C1','bigwedge':'\u22C0','bkarow':'\u290D','blacklozenge':'\u29EB','blacksquare':'\u25AA','blacktriangle':'\u25B4','blacktriangledown':'\u25BE','blacktriangleleft':'\u25C2','blacktriangleright':'\u25B8','blank':'\u2423','blk12':'\u2592','blk14':'\u2591','blk34':'\u2593','block':'\u2588','bne':'=\u20E5','bnequiv':'\u2261\u20E5','bnot':'\u2310','bNot':'\u2AED','bopf':'\uD835\uDD53','Bopf':'\uD835\uDD39','bot':'\u22A5','bottom':'\u22A5','bowtie':'\u22C8','boxbox':'\u29C9','boxdl':'\u2510','boxdL':'\u2555','boxDl':'\u2556','boxDL':'\u2557','boxdr':'\u250C','boxdR':'\u2552','boxDr':'\u2553','boxDR':'\u2554','boxh':'\u2500','boxH':'\u2550','boxhd':'\u252C','boxhD':'\u2565','boxHd':'\u2564','boxHD':'\u2566','boxhu':'\u2534','boxhU':'\u2568','boxHu':'\u2567','boxHU':'\u2569','boxminus':'\u229F','boxplus':'\u229E','boxtimes':'\u22A0','boxul':'\u2518','boxuL':'\u255B','boxUl':'\u255C','boxUL':'\u255D','boxur':'\u2514','boxuR':'\u2558','boxUr':'\u2559','boxUR':'\u255A','boxv':'\u2502','boxV':'\u2551','boxvh':'\u253C','boxvH':'\u256A','boxVh':'\u256B','boxVH':'\u256C','boxvl':'\u2524','boxvL':'\u2561','boxVl':'\u2562','boxVL':'\u2563','boxvr':'\u251C','boxvR':'\u255E','boxVr':'\u255F','boxVR':'\u2560','bprime':'\u2035','breve':'\u02D8','Breve':'\u02D8','brvbar':'\xA6','bscr':'\uD835\uDCB7','Bscr':'\u212C','bsemi':'\u204F','bsim':'\u223D','bsime':'\u22CD','bsol':'\\','bsolb':'\u29C5','bsolhsub':'\u27C8','bull':'\u2022','bullet':'\u2022','bump':'\u224E','bumpe':'\u224F','bumpE':'\u2AAE','bumpeq':'\u224F','Bumpeq':'\u224E','cacute':'\u0107','Cacute':'\u0106','cap':'\u2229','Cap':'\u22D2','capand':'\u2A44','capbrcup':'\u2A49','capcap':'\u2A4B','capcup':'\u2A47','capdot':'\u2A40','CapitalDifferentialD':'\u2145','caps':'\u2229\uFE00','caret':'\u2041','caron':'\u02C7','Cayleys':'\u212D','ccaps':'\u2A4D','ccaron':'\u010D','Ccaron':'\u010C','ccedil':'\xE7','Ccedil':'\xC7','ccirc':'\u0109','Ccirc':'\u0108','Cconint':'\u2230','ccups':'\u2A4C','ccupssm':'\u2A50','cdot':'\u010B','Cdot':'\u010A','cedil':'\xB8','Cedilla':'\xB8','cemptyv':'\u29B2','cent':'\xA2','centerdot':'\xB7','CenterDot':'\xB7','cfr':'\uD835\uDD20','Cfr':'\u212D','chcy':'\u0447','CHcy':'\u0427','check':'\u2713','checkmark':'\u2713','chi':'\u03C7','Chi':'\u03A7','cir':'\u25CB','circ':'\u02C6','circeq':'\u2257','circlearrowleft':'\u21BA','circlearrowright':'\u21BB','circledast':'\u229B','circledcirc':'\u229A','circleddash':'\u229D','CircleDot':'\u2299','circledR':'\xAE','circledS':'\u24C8','CircleMinus':'\u2296','CirclePlus':'\u2295','CircleTimes':'\u2297','cire':'\u2257','cirE':'\u29C3','cirfnint':'\u2A10','cirmid':'\u2AEF','cirscir':'\u29C2','ClockwiseContourIntegral':'\u2232','CloseCurlyDoubleQuote':'\u201D','CloseCurlyQuote':'\u2019','clubs':'\u2663','clubsuit':'\u2663','colon':':','Colon':'\u2237','colone':'\u2254','Colone':'\u2A74','coloneq':'\u2254','comma':',','commat':'@','comp':'\u2201','compfn':'\u2218','complement':'\u2201','complexes':'\u2102','cong':'\u2245','congdot':'\u2A6D','Congruent':'\u2261','conint':'\u222E','Conint':'\u222F','ContourIntegral':'\u222E','copf':'\uD835\uDD54','Copf':'\u2102','coprod':'\u2210','Coproduct':'\u2210','copy':'\xA9','COPY':'\xA9','copysr':'\u2117','CounterClockwiseContourIntegral':'\u2233','crarr':'\u21B5','cross':'\u2717','Cross':'\u2A2F','cscr':'\uD835\uDCB8','Cscr':'\uD835\uDC9E','csub':'\u2ACF','csube':'\u2AD1','csup':'\u2AD0','csupe':'\u2AD2','ctdot':'\u22EF','cudarrl':'\u2938','cudarrr':'\u2935','cuepr':'\u22DE','cuesc':'\u22DF','cularr':'\u21B6','cularrp':'\u293D','cup':'\u222A','Cup':'\u22D3','cupbrcap':'\u2A48','cupcap':'\u2A46','CupCap':'\u224D','cupcup':'\u2A4A','cupdot':'\u228D','cupor':'\u2A45','cups':'\u222A\uFE00','curarr':'\u21B7','curarrm':'\u293C','curlyeqprec':'\u22DE','curlyeqsucc':'\u22DF','curlyvee':'\u22CE','curlywedge':'\u22CF','curren':'\xA4','curvearrowleft':'\u21B6','curvearrowright':'\u21B7','cuvee':'\u22CE','cuwed':'\u22CF','cwconint':'\u2232','cwint':'\u2231','cylcty':'\u232D','dagger':'\u2020','Dagger':'\u2021','daleth':'\u2138','darr':'\u2193','dArr':'\u21D3','Darr':'\u21A1','dash':'\u2010','dashv':'\u22A3','Dashv':'\u2AE4','dbkarow':'\u290F','dblac':'\u02DD','dcaron':'\u010F','Dcaron':'\u010E','dcy':'\u0434','Dcy':'\u0414','dd':'\u2146','DD':'\u2145','ddagger':'\u2021','ddarr':'\u21CA','DDotrahd':'\u2911','ddotseq':'\u2A77','deg':'\xB0','Del':'\u2207','delta':'\u03B4','Delta':'\u0394','demptyv':'\u29B1','dfisht':'\u297F','dfr':'\uD835\uDD21','Dfr':'\uD835\uDD07','dHar':'\u2965','dharl':'\u21C3','dharr':'\u21C2','DiacriticalAcute':'\xB4','DiacriticalDot':'\u02D9','DiacriticalDoubleAcute':'\u02DD','DiacriticalGrave':'`','DiacriticalTilde':'\u02DC','diam':'\u22C4','diamond':'\u22C4','Diamond':'\u22C4','diamondsuit':'\u2666','diams':'\u2666','die':'\xA8','DifferentialD':'\u2146','digamma':'\u03DD','disin':'\u22F2','div':'\xF7','divide':'\xF7','divideontimes':'\u22C7','divonx':'\u22C7','djcy':'\u0452','DJcy':'\u0402','dlcorn':'\u231E','dlcrop':'\u230D','dollar':'$','dopf':'\uD835\uDD55','Dopf':'\uD835\uDD3B','dot':'\u02D9','Dot':'\xA8','DotDot':'\u20DC','doteq':'\u2250','doteqdot':'\u2251','DotEqual':'\u2250','dotminus':'\u2238','dotplus':'\u2214','dotsquare':'\u22A1','doublebarwedge':'\u2306','DoubleContourIntegral':'\u222F','DoubleDot':'\xA8','DoubleDownArrow':'\u21D3','DoubleLeftArrow':'\u21D0','DoubleLeftRightArrow':'\u21D4','DoubleLeftTee':'\u2AE4','DoubleLongLeftArrow':'\u27F8','DoubleLongLeftRightArrow':'\u27FA','DoubleLongRightArrow':'\u27F9','DoubleRightArrow':'\u21D2','DoubleRightTee':'\u22A8','DoubleUpArrow':'\u21D1','DoubleUpDownArrow':'\u21D5','DoubleVerticalBar':'\u2225','downarrow':'\u2193','Downarrow':'\u21D3','DownArrow':'\u2193','DownArrowBar':'\u2913','DownArrowUpArrow':'\u21F5','DownBreve':'\u0311','downdownarrows':'\u21CA','downharpoonleft':'\u21C3','downharpoonright':'\u21C2','DownLeftRightVector':'\u2950','DownLeftTeeVector':'\u295E','DownLeftVector':'\u21BD','DownLeftVectorBar':'\u2956','DownRightTeeVector':'\u295F','DownRightVector':'\u21C1','DownRightVectorBar':'\u2957','DownTee':'\u22A4','DownTeeArrow':'\u21A7','drbkarow':'\u2910','drcorn':'\u231F','drcrop':'\u230C','dscr':'\uD835\uDCB9','Dscr':'\uD835\uDC9F','dscy':'\u0455','DScy':'\u0405','dsol':'\u29F6','dstrok':'\u0111','Dstrok':'\u0110','dtdot':'\u22F1','dtri':'\u25BF','dtrif':'\u25BE','duarr':'\u21F5','duhar':'\u296F','dwangle':'\u29A6','dzcy':'\u045F','DZcy':'\u040F','dzigrarr':'\u27FF','eacute':'\xE9','Eacute':'\xC9','easter':'\u2A6E','ecaron':'\u011B','Ecaron':'\u011A','ecir':'\u2256','ecirc':'\xEA','Ecirc':'\xCA','ecolon':'\u2255','ecy':'\u044D','Ecy':'\u042D','eDDot':'\u2A77','edot':'\u0117','eDot':'\u2251','Edot':'\u0116','ee':'\u2147','efDot':'\u2252','efr':'\uD835\uDD22','Efr':'\uD835\uDD08','eg':'\u2A9A','egrave':'\xE8','Egrave':'\xC8','egs':'\u2A96','egsdot':'\u2A98','el':'\u2A99','Element':'\u2208','elinters':'\u23E7','ell':'\u2113','els':'\u2A95','elsdot':'\u2A97','emacr':'\u0113','Emacr':'\u0112','empty':'\u2205','emptyset':'\u2205','EmptySmallSquare':'\u25FB','emptyv':'\u2205','EmptyVerySmallSquare':'\u25AB','emsp':'\u2003','emsp13':'\u2004','emsp14':'\u2005','eng':'\u014B','ENG':'\u014A','ensp':'\u2002','eogon':'\u0119','Eogon':'\u0118','eopf':'\uD835\uDD56','Eopf':'\uD835\uDD3C','epar':'\u22D5','eparsl':'\u29E3','eplus':'\u2A71','epsi':'\u03B5','epsilon':'\u03B5','Epsilon':'\u0395','epsiv':'\u03F5','eqcirc':'\u2256','eqcolon':'\u2255','eqsim':'\u2242','eqslantgtr':'\u2A96','eqslantless':'\u2A95','Equal':'\u2A75','equals':'=','EqualTilde':'\u2242','equest':'\u225F','Equilibrium':'\u21CC','equiv':'\u2261','equivDD':'\u2A78','eqvparsl':'\u29E5','erarr':'\u2971','erDot':'\u2253','escr':'\u212F','Escr':'\u2130','esdot':'\u2250','esim':'\u2242','Esim':'\u2A73','eta':'\u03B7','Eta':'\u0397','eth':'\xF0','ETH':'\xD0','euml':'\xEB','Euml':'\xCB','euro':'\u20AC','excl':'!','exist':'\u2203','Exists':'\u2203','expectation':'\u2130','exponentiale':'\u2147','ExponentialE':'\u2147','fallingdotseq':'\u2252','fcy':'\u0444','Fcy':'\u0424','female':'\u2640','ffilig':'\uFB03','fflig':'\uFB00','ffllig':'\uFB04','ffr':'\uD835\uDD23','Ffr':'\uD835\uDD09','filig':'\uFB01','FilledSmallSquare':'\u25FC','FilledVerySmallSquare':'\u25AA','fjlig':'fj','flat':'\u266D','fllig':'\uFB02','fltns':'\u25B1','fnof':'\u0192','fopf':'\uD835\uDD57','Fopf':'\uD835\uDD3D','forall':'\u2200','ForAll':'\u2200','fork':'\u22D4','forkv':'\u2AD9','Fouriertrf':'\u2131','fpartint':'\u2A0D','frac12':'\xBD','frac13':'\u2153','frac14':'\xBC','frac15':'\u2155','frac16':'\u2159','frac18':'\u215B','frac23':'\u2154','frac25':'\u2156','frac34':'\xBE','frac35':'\u2157','frac38':'\u215C','frac45':'\u2158','frac56':'\u215A','frac58':'\u215D','frac78':'\u215E','frasl':'\u2044','frown':'\u2322','fscr':'\uD835\uDCBB','Fscr':'\u2131','gacute':'\u01F5','gamma':'\u03B3','Gamma':'\u0393','gammad':'\u03DD','Gammad':'\u03DC','gap':'\u2A86','gbreve':'\u011F','Gbreve':'\u011E','Gcedil':'\u0122','gcirc':'\u011D','Gcirc':'\u011C','gcy':'\u0433','Gcy':'\u0413','gdot':'\u0121','Gdot':'\u0120','ge':'\u2265','gE':'\u2267','gel':'\u22DB','gEl':'\u2A8C','geq':'\u2265','geqq':'\u2267','geqslant':'\u2A7E','ges':'\u2A7E','gescc':'\u2AA9','gesdot':'\u2A80','gesdoto':'\u2A82','gesdotol':'\u2A84','gesl':'\u22DB\uFE00','gesles':'\u2A94','gfr':'\uD835\uDD24','Gfr':'\uD835\uDD0A','gg':'\u226B','Gg':'\u22D9','ggg':'\u22D9','gimel':'\u2137','gjcy':'\u0453','GJcy':'\u0403','gl':'\u2277','gla':'\u2AA5','glE':'\u2A92','glj':'\u2AA4','gnap':'\u2A8A','gnapprox':'\u2A8A','gne':'\u2A88','gnE':'\u2269','gneq':'\u2A88','gneqq':'\u2269','gnsim':'\u22E7','gopf':'\uD835\uDD58','Gopf':'\uD835\uDD3E','grave':'`','GreaterEqual':'\u2265','GreaterEqualLess':'\u22DB','GreaterFullEqual':'\u2267','GreaterGreater':'\u2AA2','GreaterLess':'\u2277','GreaterSlantEqual':'\u2A7E','GreaterTilde':'\u2273','gscr':'\u210A','Gscr':'\uD835\uDCA2','gsim':'\u2273','gsime':'\u2A8E','gsiml':'\u2A90','gt':'>','Gt':'\u226B','GT':'>','gtcc':'\u2AA7','gtcir':'\u2A7A','gtdot':'\u22D7','gtlPar':'\u2995','gtquest':'\u2A7C','gtrapprox':'\u2A86','gtrarr':'\u2978','gtrdot':'\u22D7','gtreqless':'\u22DB','gtreqqless':'\u2A8C','gtrless':'\u2277','gtrsim':'\u2273','gvertneqq':'\u2269\uFE00','gvnE':'\u2269\uFE00','Hacek':'\u02C7','hairsp':'\u200A','half':'\xBD','hamilt':'\u210B','hardcy':'\u044A','HARDcy':'\u042A','harr':'\u2194','hArr':'\u21D4','harrcir':'\u2948','harrw':'\u21AD','Hat':'^','hbar':'\u210F','hcirc':'\u0125','Hcirc':'\u0124','hearts':'\u2665','heartsuit':'\u2665','hellip':'\u2026','hercon':'\u22B9','hfr':'\uD835\uDD25','Hfr':'\u210C','HilbertSpace':'\u210B','hksearow':'\u2925','hkswarow':'\u2926','hoarr':'\u21FF','homtht':'\u223B','hookleftarrow':'\u21A9','hookrightarrow':'\u21AA','hopf':'\uD835\uDD59','Hopf':'\u210D','horbar':'\u2015','HorizontalLine':'\u2500','hscr':'\uD835\uDCBD','Hscr':'\u210B','hslash':'\u210F','hstrok':'\u0127','Hstrok':'\u0126','HumpDownHump':'\u224E','HumpEqual':'\u224F','hybull':'\u2043','hyphen':'\u2010','iacute':'\xED','Iacute':'\xCD','ic':'\u2063','icirc':'\xEE','Icirc':'\xCE','icy':'\u0438','Icy':'\u0418','Idot':'\u0130','iecy':'\u0435','IEcy':'\u0415','iexcl':'\xA1','iff':'\u21D4','ifr':'\uD835\uDD26','Ifr':'\u2111','igrave':'\xEC','Igrave':'\xCC','ii':'\u2148','iiiint':'\u2A0C','iiint':'\u222D','iinfin':'\u29DC','iiota':'\u2129','ijlig':'\u0133','IJlig':'\u0132','Im':'\u2111','imacr':'\u012B','Imacr':'\u012A','image':'\u2111','ImaginaryI':'\u2148','imagline':'\u2110','imagpart':'\u2111','imath':'\u0131','imof':'\u22B7','imped':'\u01B5','Implies':'\u21D2','in':'\u2208','incare':'\u2105','infin':'\u221E','infintie':'\u29DD','inodot':'\u0131','int':'\u222B','Int':'\u222C','intcal':'\u22BA','integers':'\u2124','Integral':'\u222B','intercal':'\u22BA','Intersection':'\u22C2','intlarhk':'\u2A17','intprod':'\u2A3C','InvisibleComma':'\u2063','InvisibleTimes':'\u2062','iocy':'\u0451','IOcy':'\u0401','iogon':'\u012F','Iogon':'\u012E','iopf':'\uD835\uDD5A','Iopf':'\uD835\uDD40','iota':'\u03B9','Iota':'\u0399','iprod':'\u2A3C','iquest':'\xBF','iscr':'\uD835\uDCBE','Iscr':'\u2110','isin':'\u2208','isindot':'\u22F5','isinE':'\u22F9','isins':'\u22F4','isinsv':'\u22F3','isinv':'\u2208','it':'\u2062','itilde':'\u0129','Itilde':'\u0128','iukcy':'\u0456','Iukcy':'\u0406','iuml':'\xEF','Iuml':'\xCF','jcirc':'\u0135','Jcirc':'\u0134','jcy':'\u0439','Jcy':'\u0419','jfr':'\uD835\uDD27','Jfr':'\uD835\uDD0D','jmath':'\u0237','jopf':'\uD835\uDD5B','Jopf':'\uD835\uDD41','jscr':'\uD835\uDCBF','Jscr':'\uD835\uDCA5','jsercy':'\u0458','Jsercy':'\u0408','jukcy':'\u0454','Jukcy':'\u0404','kappa':'\u03BA','Kappa':'\u039A','kappav':'\u03F0','kcedil':'\u0137','Kcedil':'\u0136','kcy':'\u043A','Kcy':'\u041A','kfr':'\uD835\uDD28','Kfr':'\uD835\uDD0E','kgreen':'\u0138','khcy':'\u0445','KHcy':'\u0425','kjcy':'\u045C','KJcy':'\u040C','kopf':'\uD835\uDD5C','Kopf':'\uD835\uDD42','kscr':'\uD835\uDCC0','Kscr':'\uD835\uDCA6','lAarr':'\u21DA','lacute':'\u013A','Lacute':'\u0139','laemptyv':'\u29B4','lagran':'\u2112','lambda':'\u03BB','Lambda':'\u039B','lang':'\u27E8','Lang':'\u27EA','langd':'\u2991','langle':'\u27E8','lap':'\u2A85','Laplacetrf':'\u2112','laquo':'\xAB','larr':'\u2190','lArr':'\u21D0','Larr':'\u219E','larrb':'\u21E4','larrbfs':'\u291F','larrfs':'\u291D','larrhk':'\u21A9','larrlp':'\u21AB','larrpl':'\u2939','larrsim':'\u2973','larrtl':'\u21A2','lat':'\u2AAB','latail':'\u2919','lAtail':'\u291B','late':'\u2AAD','lates':'\u2AAD\uFE00','lbarr':'\u290C','lBarr':'\u290E','lbbrk':'\u2772','lbrace':'{','lbrack':'[','lbrke':'\u298B','lbrksld':'\u298F','lbrkslu':'\u298D','lcaron':'\u013E','Lcaron':'\u013D','lcedil':'\u013C','Lcedil':'\u013B','lceil':'\u2308','lcub':'{','lcy':'\u043B','Lcy':'\u041B','ldca':'\u2936','ldquo':'\u201C','ldquor':'\u201E','ldrdhar':'\u2967','ldrushar':'\u294B','ldsh':'\u21B2','le':'\u2264','lE':'\u2266','LeftAngleBracket':'\u27E8','leftarrow':'\u2190','Leftarrow':'\u21D0','LeftArrow':'\u2190','LeftArrowBar':'\u21E4','LeftArrowRightArrow':'\u21C6','leftarrowtail':'\u21A2','LeftCeiling':'\u2308','LeftDoubleBracket':'\u27E6','LeftDownTeeVector':'\u2961','LeftDownVector':'\u21C3','LeftDownVectorBar':'\u2959','LeftFloor':'\u230A','leftharpoondown':'\u21BD','leftharpoonup':'\u21BC','leftleftarrows':'\u21C7','leftrightarrow':'\u2194','Leftrightarrow':'\u21D4','LeftRightArrow':'\u2194','leftrightarrows':'\u21C6','leftrightharpoons':'\u21CB','leftrightsquigarrow':'\u21AD','LeftRightVector':'\u294E','LeftTee':'\u22A3','LeftTeeArrow':'\u21A4','LeftTeeVector':'\u295A','leftthreetimes':'\u22CB','LeftTriangle':'\u22B2','LeftTriangleBar':'\u29CF','LeftTriangleEqual':'\u22B4','LeftUpDownVector':'\u2951','LeftUpTeeVector':'\u2960','LeftUpVector':'\u21BF','LeftUpVectorBar':'\u2958','LeftVector':'\u21BC','LeftVectorBar':'\u2952','leg':'\u22DA','lEg':'\u2A8B','leq':'\u2264','leqq':'\u2266','leqslant':'\u2A7D','les':'\u2A7D','lescc':'\u2AA8','lesdot':'\u2A7F','lesdoto':'\u2A81','lesdotor':'\u2A83','lesg':'\u22DA\uFE00','lesges':'\u2A93','lessapprox':'\u2A85','lessdot':'\u22D6','lesseqgtr':'\u22DA','lesseqqgtr':'\u2A8B','LessEqualGreater':'\u22DA','LessFullEqual':'\u2266','LessGreater':'\u2276','lessgtr':'\u2276','LessLess':'\u2AA1','lesssim':'\u2272','LessSlantEqual':'\u2A7D','LessTilde':'\u2272','lfisht':'\u297C','lfloor':'\u230A','lfr':'\uD835\uDD29','Lfr':'\uD835\uDD0F','lg':'\u2276','lgE':'\u2A91','lHar':'\u2962','lhard':'\u21BD','lharu':'\u21BC','lharul':'\u296A','lhblk':'\u2584','ljcy':'\u0459','LJcy':'\u0409','ll':'\u226A','Ll':'\u22D8','llarr':'\u21C7','llcorner':'\u231E','Lleftarrow':'\u21DA','llhard':'\u296B','lltri':'\u25FA','lmidot':'\u0140','Lmidot':'\u013F','lmoust':'\u23B0','lmoustache':'\u23B0','lnap':'\u2A89','lnapprox':'\u2A89','lne':'\u2A87','lnE':'\u2268','lneq':'\u2A87','lneqq':'\u2268','lnsim':'\u22E6','loang':'\u27EC','loarr':'\u21FD','lobrk':'\u27E6','longleftarrow':'\u27F5','Longleftarrow':'\u27F8','LongLeftArrow':'\u27F5','longleftrightarrow':'\u27F7','Longleftrightarrow':'\u27FA','LongLeftRightArrow':'\u27F7','longmapsto':'\u27FC','longrightarrow':'\u27F6','Longrightarrow':'\u27F9','LongRightArrow':'\u27F6','looparrowleft':'\u21AB','looparrowright':'\u21AC','lopar':'\u2985','lopf':'\uD835\uDD5D','Lopf':'\uD835\uDD43','loplus':'\u2A2D','lotimes':'\u2A34','lowast':'\u2217','lowbar':'_','LowerLeftArrow':'\u2199','LowerRightArrow':'\u2198','loz':'\u25CA','lozenge':'\u25CA','lozf':'\u29EB','lpar':'(','lparlt':'\u2993','lrarr':'\u21C6','lrcorner':'\u231F','lrhar':'\u21CB','lrhard':'\u296D','lrm':'\u200E','lrtri':'\u22BF','lsaquo':'\u2039','lscr':'\uD835\uDCC1','Lscr':'\u2112','lsh':'\u21B0','Lsh':'\u21B0','lsim':'\u2272','lsime':'\u2A8D','lsimg':'\u2A8F','lsqb':'[','lsquo':'\u2018','lsquor':'\u201A','lstrok':'\u0142','Lstrok':'\u0141','lt':'<','Lt':'\u226A','LT':'<','ltcc':'\u2AA6','ltcir':'\u2A79','ltdot':'\u22D6','lthree':'\u22CB','ltimes':'\u22C9','ltlarr':'\u2976','ltquest':'\u2A7B','ltri':'\u25C3','ltrie':'\u22B4','ltrif':'\u25C2','ltrPar':'\u2996','lurdshar':'\u294A','luruhar':'\u2966','lvertneqq':'\u2268\uFE00','lvnE':'\u2268\uFE00','macr':'\xAF','male':'\u2642','malt':'\u2720','maltese':'\u2720','map':'\u21A6','Map':'\u2905','mapsto':'\u21A6','mapstodown':'\u21A7','mapstoleft':'\u21A4','mapstoup':'\u21A5','marker':'\u25AE','mcomma':'\u2A29','mcy':'\u043C','Mcy':'\u041C','mdash':'\u2014','mDDot':'\u223A','measuredangle':'\u2221','MediumSpace':'\u205F','Mellintrf':'\u2133','mfr':'\uD835\uDD2A','Mfr':'\uD835\uDD10','mho':'\u2127','micro':'\xB5','mid':'\u2223','midast':'*','midcir':'\u2AF0','middot':'\xB7','minus':'\u2212','minusb':'\u229F','minusd':'\u2238','minusdu':'\u2A2A','MinusPlus':'\u2213','mlcp':'\u2ADB','mldr':'\u2026','mnplus':'\u2213','models':'\u22A7','mopf':'\uD835\uDD5E','Mopf':'\uD835\uDD44','mp':'\u2213','mscr':'\uD835\uDCC2','Mscr':'\u2133','mstpos':'\u223E','mu':'\u03BC','Mu':'\u039C','multimap':'\u22B8','mumap':'\u22B8','nabla':'\u2207','nacute':'\u0144','Nacute':'\u0143','nang':'\u2220\u20D2','nap':'\u2249','napE':'\u2A70\u0338','napid':'\u224B\u0338','napos':'\u0149','napprox':'\u2249','natur':'\u266E','natural':'\u266E','naturals':'\u2115','nbsp':'\xA0','nbump':'\u224E\u0338','nbumpe':'\u224F\u0338','ncap':'\u2A43','ncaron':'\u0148','Ncaron':'\u0147','ncedil':'\u0146','Ncedil':'\u0145','ncong':'\u2247','ncongdot':'\u2A6D\u0338','ncup':'\u2A42','ncy':'\u043D','Ncy':'\u041D','ndash':'\u2013','ne':'\u2260','nearhk':'\u2924','nearr':'\u2197','neArr':'\u21D7','nearrow':'\u2197','nedot':'\u2250\u0338','NegativeMediumSpace':'\u200B','NegativeThickSpace':'\u200B','NegativeThinSpace':'\u200B','NegativeVeryThinSpace':'\u200B','nequiv':'\u2262','nesear':'\u2928','nesim':'\u2242\u0338','NestedGreaterGreater':'\u226B','NestedLessLess':'\u226A','NewLine':'\n','nexist':'\u2204','nexists':'\u2204','nfr':'\uD835\uDD2B','Nfr':'\uD835\uDD11','nge':'\u2271','ngE':'\u2267\u0338','ngeq':'\u2271','ngeqq':'\u2267\u0338','ngeqslant':'\u2A7E\u0338','nges':'\u2A7E\u0338','nGg':'\u22D9\u0338','ngsim':'\u2275','ngt':'\u226F','nGt':'\u226B\u20D2','ngtr':'\u226F','nGtv':'\u226B\u0338','nharr':'\u21AE','nhArr':'\u21CE','nhpar':'\u2AF2','ni':'\u220B','nis':'\u22FC','nisd':'\u22FA','niv':'\u220B','njcy':'\u045A','NJcy':'\u040A','nlarr':'\u219A','nlArr':'\u21CD','nldr':'\u2025','nle':'\u2270','nlE':'\u2266\u0338','nleftarrow':'\u219A','nLeftarrow':'\u21CD','nleftrightarrow':'\u21AE','nLeftrightarrow':'\u21CE','nleq':'\u2270','nleqq':'\u2266\u0338','nleqslant':'\u2A7D\u0338','nles':'\u2A7D\u0338','nless':'\u226E','nLl':'\u22D8\u0338','nlsim':'\u2274','nlt':'\u226E','nLt':'\u226A\u20D2','nltri':'\u22EA','nltrie':'\u22EC','nLtv':'\u226A\u0338','nmid':'\u2224','NoBreak':'\u2060','NonBreakingSpace':'\xA0','nopf':'\uD835\uDD5F','Nopf':'\u2115','not':'\xAC','Not':'\u2AEC','NotCongruent':'\u2262','NotCupCap':'\u226D','NotDoubleVerticalBar':'\u2226','NotElement':'\u2209','NotEqual':'\u2260','NotEqualTilde':'\u2242\u0338','NotExists':'\u2204','NotGreater':'\u226F','NotGreaterEqual':'\u2271','NotGreaterFullEqual':'\u2267\u0338','NotGreaterGreater':'\u226B\u0338','NotGreaterLess':'\u2279','NotGreaterSlantEqual':'\u2A7E\u0338','NotGreaterTilde':'\u2275','NotHumpDownHump':'\u224E\u0338','NotHumpEqual':'\u224F\u0338','notin':'\u2209','notindot':'\u22F5\u0338','notinE':'\u22F9\u0338','notinva':'\u2209','notinvb':'\u22F7','notinvc':'\u22F6','NotLeftTriangle':'\u22EA','NotLeftTriangleBar':'\u29CF\u0338','NotLeftTriangleEqual':'\u22EC','NotLess':'\u226E','NotLessEqual':'\u2270','NotLessGreater':'\u2278','NotLessLess':'\u226A\u0338','NotLessSlantEqual':'\u2A7D\u0338','NotLessTilde':'\u2274','NotNestedGreaterGreater':'\u2AA2\u0338','NotNestedLessLess':'\u2AA1\u0338','notni':'\u220C','notniva':'\u220C','notnivb':'\u22FE','notnivc':'\u22FD','NotPrecedes':'\u2280','NotPrecedesEqual':'\u2AAF\u0338','NotPrecedesSlantEqual':'\u22E0','NotReverseElement':'\u220C','NotRightTriangle':'\u22EB','NotRightTriangleBar':'\u29D0\u0338','NotRightTriangleEqual':'\u22ED','NotSquareSubset':'\u228F\u0338','NotSquareSubsetEqual':'\u22E2','NotSquareSuperset':'\u2290\u0338','NotSquareSupersetEqual':'\u22E3','NotSubset':'\u2282\u20D2','NotSubsetEqual':'\u2288','NotSucceeds':'\u2281','NotSucceedsEqual':'\u2AB0\u0338','NotSucceedsSlantEqual':'\u22E1','NotSucceedsTilde':'\u227F\u0338','NotSuperset':'\u2283\u20D2','NotSupersetEqual':'\u2289','NotTilde':'\u2241','NotTildeEqual':'\u2244','NotTildeFullEqual':'\u2247','NotTildeTilde':'\u2249','NotVerticalBar':'\u2224','npar':'\u2226','nparallel':'\u2226','nparsl':'\u2AFD\u20E5','npart':'\u2202\u0338','npolint':'\u2A14','npr':'\u2280','nprcue':'\u22E0','npre':'\u2AAF\u0338','nprec':'\u2280','npreceq':'\u2AAF\u0338','nrarr':'\u219B','nrArr':'\u21CF','nrarrc':'\u2933\u0338','nrarrw':'\u219D\u0338','nrightarrow':'\u219B','nRightarrow':'\u21CF','nrtri':'\u22EB','nrtrie':'\u22ED','nsc':'\u2281','nsccue':'\u22E1','nsce':'\u2AB0\u0338','nscr':'\uD835\uDCC3','Nscr':'\uD835\uDCA9','nshortmid':'\u2224','nshortparallel':'\u2226','nsim':'\u2241','nsime':'\u2244','nsimeq':'\u2244','nsmid':'\u2224','nspar':'\u2226','nsqsube':'\u22E2','nsqsupe':'\u22E3','nsub':'\u2284','nsube':'\u2288','nsubE':'\u2AC5\u0338','nsubset':'\u2282\u20D2','nsubseteq':'\u2288','nsubseteqq':'\u2AC5\u0338','nsucc':'\u2281','nsucceq':'\u2AB0\u0338','nsup':'\u2285','nsupe':'\u2289','nsupE':'\u2AC6\u0338','nsupset':'\u2283\u20D2','nsupseteq':'\u2289','nsupseteqq':'\u2AC6\u0338','ntgl':'\u2279','ntilde':'\xF1','Ntilde':'\xD1','ntlg':'\u2278','ntriangleleft':'\u22EA','ntrianglelefteq':'\u22EC','ntriangleright':'\u22EB','ntrianglerighteq':'\u22ED','nu':'\u03BD','Nu':'\u039D','num':'#','numero':'\u2116','numsp':'\u2007','nvap':'\u224D\u20D2','nvdash':'\u22AC','nvDash':'\u22AD','nVdash':'\u22AE','nVDash':'\u22AF','nvge':'\u2265\u20D2','nvgt':'>\u20D2','nvHarr':'\u2904','nvinfin':'\u29DE','nvlArr':'\u2902','nvle':'\u2264\u20D2','nvlt':'<\u20D2','nvltrie':'\u22B4\u20D2','nvrArr':'\u2903','nvrtrie':'\u22B5\u20D2','nvsim':'\u223C\u20D2','nwarhk':'\u2923','nwarr':'\u2196','nwArr':'\u21D6','nwarrow':'\u2196','nwnear':'\u2927','oacute':'\xF3','Oacute':'\xD3','oast':'\u229B','ocir':'\u229A','ocirc':'\xF4','Ocirc':'\xD4','ocy':'\u043E','Ocy':'\u041E','odash':'\u229D','odblac':'\u0151','Odblac':'\u0150','odiv':'\u2A38','odot':'\u2299','odsold':'\u29BC','oelig':'\u0153','OElig':'\u0152','ofcir':'\u29BF','ofr':'\uD835\uDD2C','Ofr':'\uD835\uDD12','ogon':'\u02DB','ograve':'\xF2','Ograve':'\xD2','ogt':'\u29C1','ohbar':'\u29B5','ohm':'\u03A9','oint':'\u222E','olarr':'\u21BA','olcir':'\u29BE','olcross':'\u29BB','oline':'\u203E','olt':'\u29C0','omacr':'\u014D','Omacr':'\u014C','omega':'\u03C9','Omega':'\u03A9','omicron':'\u03BF','Omicron':'\u039F','omid':'\u29B6','ominus':'\u2296','oopf':'\uD835\uDD60','Oopf':'\uD835\uDD46','opar':'\u29B7','OpenCurlyDoubleQuote':'\u201C','OpenCurlyQuote':'\u2018','operp':'\u29B9','oplus':'\u2295','or':'\u2228','Or':'\u2A54','orarr':'\u21BB','ord':'\u2A5D','order':'\u2134','orderof':'\u2134','ordf':'\xAA','ordm':'\xBA','origof':'\u22B6','oror':'\u2A56','orslope':'\u2A57','orv':'\u2A5B','oS':'\u24C8','oscr':'\u2134','Oscr':'\uD835\uDCAA','oslash':'\xF8','Oslash':'\xD8','osol':'\u2298','otilde':'\xF5','Otilde':'\xD5','otimes':'\u2297','Otimes':'\u2A37','otimesas':'\u2A36','ouml':'\xF6','Ouml':'\xD6','ovbar':'\u233D','OverBar':'\u203E','OverBrace':'\u23DE','OverBracket':'\u23B4','OverParenthesis':'\u23DC','par':'\u2225','para':'\xB6','parallel':'\u2225','parsim':'\u2AF3','parsl':'\u2AFD','part':'\u2202','PartialD':'\u2202','pcy':'\u043F','Pcy':'\u041F','percnt':'%','period':'.','permil':'\u2030','perp':'\u22A5','pertenk':'\u2031','pfr':'\uD835\uDD2D','Pfr':'\uD835\uDD13','phi':'\u03C6','Phi':'\u03A6','phiv':'\u03D5','phmmat':'\u2133','phone':'\u260E','pi':'\u03C0','Pi':'\u03A0','pitchfork':'\u22D4','piv':'\u03D6','planck':'\u210F','planckh':'\u210E','plankv':'\u210F','plus':'+','plusacir':'\u2A23','plusb':'\u229E','pluscir':'\u2A22','plusdo':'\u2214','plusdu':'\u2A25','pluse':'\u2A72','PlusMinus':'\xB1','plusmn':'\xB1','plussim':'\u2A26','plustwo':'\u2A27','pm':'\xB1','Poincareplane':'\u210C','pointint':'\u2A15','popf':'\uD835\uDD61','Popf':'\u2119','pound':'\xA3','pr':'\u227A','Pr':'\u2ABB','prap':'\u2AB7','prcue':'\u227C','pre':'\u2AAF','prE':'\u2AB3','prec':'\u227A','precapprox':'\u2AB7','preccurlyeq':'\u227C','Precedes':'\u227A','PrecedesEqual':'\u2AAF','PrecedesSlantEqual':'\u227C','PrecedesTilde':'\u227E','preceq':'\u2AAF','precnapprox':'\u2AB9','precneqq':'\u2AB5','precnsim':'\u22E8','precsim':'\u227E','prime':'\u2032','Prime':'\u2033','primes':'\u2119','prnap':'\u2AB9','prnE':'\u2AB5','prnsim':'\u22E8','prod':'\u220F','Product':'\u220F','profalar':'\u232E','profline':'\u2312','profsurf':'\u2313','prop':'\u221D','Proportion':'\u2237','Proportional':'\u221D','propto':'\u221D','prsim':'\u227E','prurel':'\u22B0','pscr':'\uD835\uDCC5','Pscr':'\uD835\uDCAB','psi':'\u03C8','Psi':'\u03A8','puncsp':'\u2008','qfr':'\uD835\uDD2E','Qfr':'\uD835\uDD14','qint':'\u2A0C','qopf':'\uD835\uDD62','Qopf':'\u211A','qprime':'\u2057','qscr':'\uD835\uDCC6','Qscr':'\uD835\uDCAC','quaternions':'\u210D','quatint':'\u2A16','quest':'?','questeq':'\u225F','quot':'"','QUOT':'"','rAarr':'\u21DB','race':'\u223D\u0331','racute':'\u0155','Racute':'\u0154','radic':'\u221A','raemptyv':'\u29B3','rang':'\u27E9','Rang':'\u27EB','rangd':'\u2992','range':'\u29A5','rangle':'\u27E9','raquo':'\xBB','rarr':'\u2192','rArr':'\u21D2','Rarr':'\u21A0','rarrap':'\u2975','rarrb':'\u21E5','rarrbfs':'\u2920','rarrc':'\u2933','rarrfs':'\u291E','rarrhk':'\u21AA','rarrlp':'\u21AC','rarrpl':'\u2945','rarrsim':'\u2974','rarrtl':'\u21A3','Rarrtl':'\u2916','rarrw':'\u219D','ratail':'\u291A','rAtail':'\u291C','ratio':'\u2236','rationals':'\u211A','rbarr':'\u290D','rBarr':'\u290F','RBarr':'\u2910','rbbrk':'\u2773','rbrace':'}','rbrack':']','rbrke':'\u298C','rbrksld':'\u298E','rbrkslu':'\u2990','rcaron':'\u0159','Rcaron':'\u0158','rcedil':'\u0157','Rcedil':'\u0156','rceil':'\u2309','rcub':'}','rcy':'\u0440','Rcy':'\u0420','rdca':'\u2937','rdldhar':'\u2969','rdquo':'\u201D','rdquor':'\u201D','rdsh':'\u21B3','Re':'\u211C','real':'\u211C','realine':'\u211B','realpart':'\u211C','reals':'\u211D','rect':'\u25AD','reg':'\xAE','REG':'\xAE','ReverseElement':'\u220B','ReverseEquilibrium':'\u21CB','ReverseUpEquilibrium':'\u296F','rfisht':'\u297D','rfloor':'\u230B','rfr':'\uD835\uDD2F','Rfr':'\u211C','rHar':'\u2964','rhard':'\u21C1','rharu':'\u21C0','rharul':'\u296C','rho':'\u03C1','Rho':'\u03A1','rhov':'\u03F1','RightAngleBracket':'\u27E9','rightarrow':'\u2192','Rightarrow':'\u21D2','RightArrow':'\u2192','RightArrowBar':'\u21E5','RightArrowLeftArrow':'\u21C4','rightarrowtail':'\u21A3','RightCeiling':'\u2309','RightDoubleBracket':'\u27E7','RightDownTeeVector':'\u295D','RightDownVector':'\u21C2','RightDownVectorBar':'\u2955','RightFloor':'\u230B','rightharpoondown':'\u21C1','rightharpoonup':'\u21C0','rightleftarrows':'\u21C4','rightleftharpoons':'\u21CC','rightrightarrows':'\u21C9','rightsquigarrow':'\u219D','RightTee':'\u22A2','RightTeeArrow':'\u21A6','RightTeeVector':'\u295B','rightthreetimes':'\u22CC','RightTriangle':'\u22B3','RightTriangleBar':'\u29D0','RightTriangleEqual':'\u22B5','RightUpDownVector':'\u294F','RightUpTeeVector':'\u295C','RightUpVector':'\u21BE','RightUpVectorBar':'\u2954','RightVector':'\u21C0','RightVectorBar':'\u2953','ring':'\u02DA','risingdotseq':'\u2253','rlarr':'\u21C4','rlhar':'\u21CC','rlm':'\u200F','rmoust':'\u23B1','rmoustache':'\u23B1','rnmid':'\u2AEE','roang':'\u27ED','roarr':'\u21FE','robrk':'\u27E7','ropar':'\u2986','ropf':'\uD835\uDD63','Ropf':'\u211D','roplus':'\u2A2E','rotimes':'\u2A35','RoundImplies':'\u2970','rpar':')','rpargt':'\u2994','rppolint':'\u2A12','rrarr':'\u21C9','Rrightarrow':'\u21DB','rsaquo':'\u203A','rscr':'\uD835\uDCC7','Rscr':'\u211B','rsh':'\u21B1','Rsh':'\u21B1','rsqb':']','rsquo':'\u2019','rsquor':'\u2019','rthree':'\u22CC','rtimes':'\u22CA','rtri':'\u25B9','rtrie':'\u22B5','rtrif':'\u25B8','rtriltri':'\u29CE','RuleDelayed':'\u29F4','ruluhar':'\u2968','rx':'\u211E','sacute':'\u015B','Sacute':'\u015A','sbquo':'\u201A','sc':'\u227B','Sc':'\u2ABC','scap':'\u2AB8','scaron':'\u0161','Scaron':'\u0160','sccue':'\u227D','sce':'\u2AB0','scE':'\u2AB4','scedil':'\u015F','Scedil':'\u015E','scirc':'\u015D','Scirc':'\u015C','scnap':'\u2ABA','scnE':'\u2AB6','scnsim':'\u22E9','scpolint':'\u2A13','scsim':'\u227F','scy':'\u0441','Scy':'\u0421','sdot':'\u22C5','sdotb':'\u22A1','sdote':'\u2A66','searhk':'\u2925','searr':'\u2198','seArr':'\u21D8','searrow':'\u2198','sect':'\xA7','semi':';','seswar':'\u2929','setminus':'\u2216','setmn':'\u2216','sext':'\u2736','sfr':'\uD835\uDD30','Sfr':'\uD835\uDD16','sfrown':'\u2322','sharp':'\u266F','shchcy':'\u0449','SHCHcy':'\u0429','shcy':'\u0448','SHcy':'\u0428','ShortDownArrow':'\u2193','ShortLeftArrow':'\u2190','shortmid':'\u2223','shortparallel':'\u2225','ShortRightArrow':'\u2192','ShortUpArrow':'\u2191','shy':'\xAD','sigma':'\u03C3','Sigma':'\u03A3','sigmaf':'\u03C2','sigmav':'\u03C2','sim':'\u223C','simdot':'\u2A6A','sime':'\u2243','simeq':'\u2243','simg':'\u2A9E','simgE':'\u2AA0','siml':'\u2A9D','simlE':'\u2A9F','simne':'\u2246','simplus':'\u2A24','simrarr':'\u2972','slarr':'\u2190','SmallCircle':'\u2218','smallsetminus':'\u2216','smashp':'\u2A33','smeparsl':'\u29E4','smid':'\u2223','smile':'\u2323','smt':'\u2AAA','smte':'\u2AAC','smtes':'\u2AAC\uFE00','softcy':'\u044C','SOFTcy':'\u042C','sol':'/','solb':'\u29C4','solbar':'\u233F','sopf':'\uD835\uDD64','Sopf':'\uD835\uDD4A','spades':'\u2660','spadesuit':'\u2660','spar':'\u2225','sqcap':'\u2293','sqcaps':'\u2293\uFE00','sqcup':'\u2294','sqcups':'\u2294\uFE00','Sqrt':'\u221A','sqsub':'\u228F','sqsube':'\u2291','sqsubset':'\u228F','sqsubseteq':'\u2291','sqsup':'\u2290','sqsupe':'\u2292','sqsupset':'\u2290','sqsupseteq':'\u2292','squ':'\u25A1','square':'\u25A1','Square':'\u25A1','SquareIntersection':'\u2293','SquareSubset':'\u228F','SquareSubsetEqual':'\u2291','SquareSuperset':'\u2290','SquareSupersetEqual':'\u2292','SquareUnion':'\u2294','squarf':'\u25AA','squf':'\u25AA','srarr':'\u2192','sscr':'\uD835\uDCC8','Sscr':'\uD835\uDCAE','ssetmn':'\u2216','ssmile':'\u2323','sstarf':'\u22C6','star':'\u2606','Star':'\u22C6','starf':'\u2605','straightepsilon':'\u03F5','straightphi':'\u03D5','strns':'\xAF','sub':'\u2282','Sub':'\u22D0','subdot':'\u2ABD','sube':'\u2286','subE':'\u2AC5','subedot':'\u2AC3','submult':'\u2AC1','subne':'\u228A','subnE':'\u2ACB','subplus':'\u2ABF','subrarr':'\u2979','subset':'\u2282','Subset':'\u22D0','subseteq':'\u2286','subseteqq':'\u2AC5','SubsetEqual':'\u2286','subsetneq':'\u228A','subsetneqq':'\u2ACB','subsim':'\u2AC7','subsub':'\u2AD5','subsup':'\u2AD3','succ':'\u227B','succapprox':'\u2AB8','succcurlyeq':'\u227D','Succeeds':'\u227B','SucceedsEqual':'\u2AB0','SucceedsSlantEqual':'\u227D','SucceedsTilde':'\u227F','succeq':'\u2AB0','succnapprox':'\u2ABA','succneqq':'\u2AB6','succnsim':'\u22E9','succsim':'\u227F','SuchThat':'\u220B','sum':'\u2211','Sum':'\u2211','sung':'\u266A','sup':'\u2283','Sup':'\u22D1','sup1':'\xB9','sup2':'\xB2','sup3':'\xB3','supdot':'\u2ABE','supdsub':'\u2AD8','supe':'\u2287','supE':'\u2AC6','supedot':'\u2AC4','Superset':'\u2283','SupersetEqual':'\u2287','suphsol':'\u27C9','suphsub':'\u2AD7','suplarr':'\u297B','supmult':'\u2AC2','supne':'\u228B','supnE':'\u2ACC','supplus':'\u2AC0','supset':'\u2283','Supset':'\u22D1','supseteq':'\u2287','supseteqq':'\u2AC6','supsetneq':'\u228B','supsetneqq':'\u2ACC','supsim':'\u2AC8','supsub':'\u2AD4','supsup':'\u2AD6','swarhk':'\u2926','swarr':'\u2199','swArr':'\u21D9','swarrow':'\u2199','swnwar':'\u292A','szlig':'\xDF','Tab':'\t','target':'\u2316','tau':'\u03C4','Tau':'\u03A4','tbrk':'\u23B4','tcaron':'\u0165','Tcaron':'\u0164','tcedil':'\u0163','Tcedil':'\u0162','tcy':'\u0442','Tcy':'\u0422','tdot':'\u20DB','telrec':'\u2315','tfr':'\uD835\uDD31','Tfr':'\uD835\uDD17','there4':'\u2234','therefore':'\u2234','Therefore':'\u2234','theta':'\u03B8','Theta':'\u0398','thetasym':'\u03D1','thetav':'\u03D1','thickapprox':'\u2248','thicksim':'\u223C','ThickSpace':'\u205F\u200A','thinsp':'\u2009','ThinSpace':'\u2009','thkap':'\u2248','thksim':'\u223C','thorn':'\xFE','THORN':'\xDE','tilde':'\u02DC','Tilde':'\u223C','TildeEqual':'\u2243','TildeFullEqual':'\u2245','TildeTilde':'\u2248','times':'\xD7','timesb':'\u22A0','timesbar':'\u2A31','timesd':'\u2A30','tint':'\u222D','toea':'\u2928','top':'\u22A4','topbot':'\u2336','topcir':'\u2AF1','topf':'\uD835\uDD65','Topf':'\uD835\uDD4B','topfork':'\u2ADA','tosa':'\u2929','tprime':'\u2034','trade':'\u2122','TRADE':'\u2122','triangle':'\u25B5','triangledown':'\u25BF','triangleleft':'\u25C3','trianglelefteq':'\u22B4','triangleq':'\u225C','triangleright':'\u25B9','trianglerighteq':'\u22B5','tridot':'\u25EC','trie':'\u225C','triminus':'\u2A3A','TripleDot':'\u20DB','triplus':'\u2A39','trisb':'\u29CD','tritime':'\u2A3B','trpezium':'\u23E2','tscr':'\uD835\uDCC9','Tscr':'\uD835\uDCAF','tscy':'\u0446','TScy':'\u0426','tshcy':'\u045B','TSHcy':'\u040B','tstrok':'\u0167','Tstrok':'\u0166','twixt':'\u226C','twoheadleftarrow':'\u219E','twoheadrightarrow':'\u21A0','uacute':'\xFA','Uacute':'\xDA','uarr':'\u2191','uArr':'\u21D1','Uarr':'\u219F','Uarrocir':'\u2949','ubrcy':'\u045E','Ubrcy':'\u040E','ubreve':'\u016D','Ubreve':'\u016C','ucirc':'\xFB','Ucirc':'\xDB','ucy':'\u0443','Ucy':'\u0423','udarr':'\u21C5','udblac':'\u0171','Udblac':'\u0170','udhar':'\u296E','ufisht':'\u297E','ufr':'\uD835\uDD32','Ufr':'\uD835\uDD18','ugrave':'\xF9','Ugrave':'\xD9','uHar':'\u2963','uharl':'\u21BF','uharr':'\u21BE','uhblk':'\u2580','ulcorn':'\u231C','ulcorner':'\u231C','ulcrop':'\u230F','ultri':'\u25F8','umacr':'\u016B','Umacr':'\u016A','uml':'\xA8','UnderBar':'_','UnderBrace':'\u23DF','UnderBracket':'\u23B5','UnderParenthesis':'\u23DD','Union':'\u22C3','UnionPlus':'\u228E','uogon':'\u0173','Uogon':'\u0172','uopf':'\uD835\uDD66','Uopf':'\uD835\uDD4C','uparrow':'\u2191','Uparrow':'\u21D1','UpArrow':'\u2191','UpArrowBar':'\u2912','UpArrowDownArrow':'\u21C5','updownarrow':'\u2195','Updownarrow':'\u21D5','UpDownArrow':'\u2195','UpEquilibrium':'\u296E','upharpoonleft':'\u21BF','upharpoonright':'\u21BE','uplus':'\u228E','UpperLeftArrow':'\u2196','UpperRightArrow':'\u2197','upsi':'\u03C5','Upsi':'\u03D2','upsih':'\u03D2','upsilon':'\u03C5','Upsilon':'\u03A5','UpTee':'\u22A5','UpTeeArrow':'\u21A5','upuparrows':'\u21C8','urcorn':'\u231D','urcorner':'\u231D','urcrop':'\u230E','uring':'\u016F','Uring':'\u016E','urtri':'\u25F9','uscr':'\uD835\uDCCA','Uscr':'\uD835\uDCB0','utdot':'\u22F0','utilde':'\u0169','Utilde':'\u0168','utri':'\u25B5','utrif':'\u25B4','uuarr':'\u21C8','uuml':'\xFC','Uuml':'\xDC','uwangle':'\u29A7','vangrt':'\u299C','varepsilon':'\u03F5','varkappa':'\u03F0','varnothing':'\u2205','varphi':'\u03D5','varpi':'\u03D6','varpropto':'\u221D','varr':'\u2195','vArr':'\u21D5','varrho':'\u03F1','varsigma':'\u03C2','varsubsetneq':'\u228A\uFE00','varsubsetneqq':'\u2ACB\uFE00','varsupsetneq':'\u228B\uFE00','varsupsetneqq':'\u2ACC\uFE00','vartheta':'\u03D1','vartriangleleft':'\u22B2','vartriangleright':'\u22B3','vBar':'\u2AE8','Vbar':'\u2AEB','vBarv':'\u2AE9','vcy':'\u0432','Vcy':'\u0412','vdash':'\u22A2','vDash':'\u22A8','Vdash':'\u22A9','VDash':'\u22AB','Vdashl':'\u2AE6','vee':'\u2228','Vee':'\u22C1','veebar':'\u22BB','veeeq':'\u225A','vellip':'\u22EE','verbar':'|','Verbar':'\u2016','vert':'|','Vert':'\u2016','VerticalBar':'\u2223','VerticalLine':'|','VerticalSeparator':'\u2758','VerticalTilde':'\u2240','VeryThinSpace':'\u200A','vfr':'\uD835\uDD33','Vfr':'\uD835\uDD19','vltri':'\u22B2','vnsub':'\u2282\u20D2','vnsup':'\u2283\u20D2','vopf':'\uD835\uDD67','Vopf':'\uD835\uDD4D','vprop':'\u221D','vrtri':'\u22B3','vscr':'\uD835\uDCCB','Vscr':'\uD835\uDCB1','vsubne':'\u228A\uFE00','vsubnE':'\u2ACB\uFE00','vsupne':'\u228B\uFE00','vsupnE':'\u2ACC\uFE00','Vvdash':'\u22AA','vzigzag':'\u299A','wcirc':'\u0175','Wcirc':'\u0174','wedbar':'\u2A5F','wedge':'\u2227','Wedge':'\u22C0','wedgeq':'\u2259','weierp':'\u2118','wfr':'\uD835\uDD34','Wfr':'\uD835\uDD1A','wopf':'\uD835\uDD68','Wopf':'\uD835\uDD4E','wp':'\u2118','wr':'\u2240','wreath':'\u2240','wscr':'\uD835\uDCCC','Wscr':'\uD835\uDCB2','xcap':'\u22C2','xcirc':'\u25EF','xcup':'\u22C3','xdtri':'\u25BD','xfr':'\uD835\uDD35','Xfr':'\uD835\uDD1B','xharr':'\u27F7','xhArr':'\u27FA','xi':'\u03BE','Xi':'\u039E','xlarr':'\u27F5','xlArr':'\u27F8','xmap':'\u27FC','xnis':'\u22FB','xodot':'\u2A00','xopf':'\uD835\uDD69','Xopf':'\uD835\uDD4F','xoplus':'\u2A01','xotime':'\u2A02','xrarr':'\u27F6','xrArr':'\u27F9','xscr':'\uD835\uDCCD','Xscr':'\uD835\uDCB3','xsqcup':'\u2A06','xuplus':'\u2A04','xutri':'\u25B3','xvee':'\u22C1','xwedge':'\u22C0','yacute':'\xFD','Yacute':'\xDD','yacy':'\u044F','YAcy':'\u042F','ycirc':'\u0177','Ycirc':'\u0176','ycy':'\u044B','Ycy':'\u042B','yen':'\xA5','yfr':'\uD835\uDD36','Yfr':'\uD835\uDD1C','yicy':'\u0457','YIcy':'\u0407','yopf':'\uD835\uDD6A','Yopf':'\uD835\uDD50','yscr':'\uD835\uDCCE','Yscr':'\uD835\uDCB4','yucy':'\u044E','YUcy':'\u042E','yuml':'\xFF','Yuml':'\u0178','zacute':'\u017A','Zacute':'\u0179','zcaron':'\u017E','Zcaron':'\u017D','zcy':'\u0437','Zcy':'\u0417','zdot':'\u017C','Zdot':'\u017B','zeetrf':'\u2128','ZeroWidthSpace':'\u200B','zeta':'\u03B6','Zeta':'\u0396','zfr':'\uD835\uDD37','Zfr':'\u2128','zhcy':'\u0436','ZHcy':'\u0416','zigrarr':'\u21DD','zopf':'\uD835\uDD6B','Zopf':'\u2124','zscr':'\uD835\uDCCF','Zscr':'\uD835\uDCB5','zwj':'\u200D','zwnj':'\u200C'};
13309 var decodeMapLegacy = {'aacute':'\xE1','Aacute':'\xC1','acirc':'\xE2','Acirc':'\xC2','acute':'\xB4','aelig':'\xE6','AElig':'\xC6','agrave':'\xE0','Agrave':'\xC0','amp':'&','AMP':'&','aring':'\xE5','Aring':'\xC5','atilde':'\xE3','Atilde':'\xC3','auml':'\xE4','Auml':'\xC4','brvbar':'\xA6','ccedil':'\xE7','Ccedil':'\xC7','cedil':'\xB8','cent':'\xA2','copy':'\xA9','COPY':'\xA9','curren':'\xA4','deg':'\xB0','divide':'\xF7','eacute':'\xE9','Eacute':'\xC9','ecirc':'\xEA','Ecirc':'\xCA','egrave':'\xE8','Egrave':'\xC8','eth':'\xF0','ETH':'\xD0','euml':'\xEB','Euml':'\xCB','frac12':'\xBD','frac14':'\xBC','frac34':'\xBE','gt':'>','GT':'>','iacute':'\xED','Iacute':'\xCD','icirc':'\xEE','Icirc':'\xCE','iexcl':'\xA1','igrave':'\xEC','Igrave':'\xCC','iquest':'\xBF','iuml':'\xEF','Iuml':'\xCF','laquo':'\xAB','lt':'<','LT':'<','macr':'\xAF','micro':'\xB5','middot':'\xB7','nbsp':'\xA0','not':'\xAC','ntilde':'\xF1','Ntilde':'\xD1','oacute':'\xF3','Oacute':'\xD3','ocirc':'\xF4','Ocirc':'\xD4','ograve':'\xF2','Ograve':'\xD2','ordf':'\xAA','ordm':'\xBA','oslash':'\xF8','Oslash':'\xD8','otilde':'\xF5','Otilde':'\xD5','ouml':'\xF6','Ouml':'\xD6','para':'\xB6','plusmn':'\xB1','pound':'\xA3','quot':'"','QUOT':'"','raquo':'\xBB','reg':'\xAE','REG':'\xAE','sect':'\xA7','shy':'\xAD','sup1':'\xB9','sup2':'\xB2','sup3':'\xB3','szlig':'\xDF','thorn':'\xFE','THORN':'\xDE','times':'\xD7','uacute':'\xFA','Uacute':'\xDA','ucirc':'\xFB','Ucirc':'\xDB','ugrave':'\xF9','Ugrave':'\xD9','uml':'\xA8','uuml':'\xFC','Uuml':'\xDC','yacute':'\xFD','Yacute':'\xDD','yen':'\xA5','yuml':'\xFF'};
13310 var decodeMapNumeric = {'0':'\uFFFD','128':'\u20AC','130':'\u201A','131':'\u0192','132':'\u201E','133':'\u2026','134':'\u2020','135':'\u2021','136':'\u02C6','137':'\u2030','138':'\u0160','139':'\u2039','140':'\u0152','142':'\u017D','145':'\u2018','146':'\u2019','147':'\u201C','148':'\u201D','149':'\u2022','150':'\u2013','151':'\u2014','152':'\u02DC','153':'\u2122','154':'\u0161','155':'\u203A','156':'\u0153','158':'\u017E','159':'\u0178'};
13311 var invalidReferenceCodePoints = [1,2,3,4,5,6,7,8,11,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,64976,64977,64978,64979,64980,64981,64982,64983,64984,64985,64986,64987,64988,64989,64990,64991,64992,64993,64994,64995,64996,64997,64998,64999,65000,65001,65002,65003,65004,65005,65006,65007,65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111];
13312
13313 /*--------------------------------------------------------------------------*/
13314
13315 var stringFromCharCode = String.fromCharCode;
13316
13317 var object = {};
13318 var hasOwnProperty = object.hasOwnProperty;
13319 var has = function(object, propertyName) {
13320 return hasOwnProperty.call(object, propertyName);
13321 };
13322
13323 var contains = function(array, value) {
13324 var index = -1;
13325 var length = array.length;
13326 while (++index < length) {
13327 if (array[index] == value) {
13328 return true;
13329 }
13330 }
13331 return false;
13332 };
13333
13334 var merge = function(options, defaults) {
13335 if (!options) {
13336 return defaults;
13337 }
13338 var result = {};
13339 var key;
13340 for (key in defaults) {
13341 // A `hasOwnProperty` check is not needed here, since only recognized
13342 // option names are used anyway. Any others are ignored.
13343 result[key] = has(options, key) ? options[key] : defaults[key];
13344 }
13345 return result;
13346 };
13347
13348 // Modified version of `ucs2encode`; see https://mths.be/punycode.
13349 var codePointToSymbol = function(codePoint, strict) {
13350 var output = '';
13351 if ((codePoint >= 0xD800 && codePoint <= 0xDFFF) || codePoint > 0x10FFFF) {
13352 // See issue #4:
13353 // “Otherwise, if the number is in the range 0xD800 to 0xDFFF or is
13354 // greater than 0x10FFFF, then this is a parse error. Return a U+FFFD
13355 // REPLACEMENT CHARACTER.”
13356 if (strict) {
13357 parseError('character reference outside the permissible Unicode range');
13358 }
13359 return '\uFFFD';
13360 }
13361 if (has(decodeMapNumeric, codePoint)) {
13362 if (strict) {
13363 parseError('disallowed character reference');
13364 }
13365 return decodeMapNumeric[codePoint];
13366 }
13367 if (strict && contains(invalidReferenceCodePoints, codePoint)) {
13368 parseError('disallowed character reference');
13369 }
13370 if (codePoint > 0xFFFF) {
13371 codePoint -= 0x10000;
13372 output += stringFromCharCode(codePoint >>> 10 & 0x3FF | 0xD800);
13373 codePoint = 0xDC00 | codePoint & 0x3FF;
13374 }
13375 output += stringFromCharCode(codePoint);
13376 return output;
13377 };
13378
13379 var hexEscape = function(codePoint) {
13380 return '&#x' + codePoint.toString(16).toUpperCase() + ';';
13381 };
13382
13383 var decEscape = function(codePoint) {
13384 return '&#' + codePoint + ';';
13385 };
13386
13387 var parseError = function(message) {
13388 throw Error('Parse error: ' + message);
13389 };
13390
13391 /*--------------------------------------------------------------------------*/
13392
13393 var encode = function(string, options) {
13394 options = merge(options, encode.options);
13395 var strict = options.strict;
13396 if (strict && regexInvalidRawCodePoint.test(string)) {
13397 parseError('forbidden code point');
13398 }
13399 var encodeEverything = options.encodeEverything;
13400 var useNamedReferences = options.useNamedReferences;
13401 var allowUnsafeSymbols = options.allowUnsafeSymbols;
13402 var escapeCodePoint = options.decimal ? decEscape : hexEscape;
13403
13404 var escapeBmpSymbol = function(symbol) {
13405 return escapeCodePoint(symbol.charCodeAt(0));
13406 };
13407
13408 if (encodeEverything) {
13409 // Encode ASCII symbols.
13410 string = string.replace(regexAsciiWhitelist, function(symbol) {
13411 // Use named references if requested & possible.
13412 if (useNamedReferences && has(encodeMap, symbol)) {
13413 return '&' + encodeMap[symbol] + ';';
13414 }
13415 return escapeBmpSymbol(symbol);
13416 });
13417 // Shorten a few escapes that represent two symbols, of which at least one
13418 // is within the ASCII range.
13419 if (useNamedReferences) {
13420 string = string
13421 .replace(/&gt;\u20D2/g, '&nvgt;')
13422 .replace(/&lt;\u20D2/g, '&nvlt;')
13423 .replace(/&#x66;&#x6A;/g, '&fjlig;');
13424 }
13425 // Encode non-ASCII symbols.
13426 if (useNamedReferences) {
13427 // Encode non-ASCII symbols that can be replaced with a named reference.
13428 string = string.replace(regexEncodeNonAscii, function(string) {
13429 // Note: there is no need to check `has(encodeMap, string)` here.
13430 return '&' + encodeMap[string] + ';';
13431 });
13432 }
13433 // Note: any remaining non-ASCII symbols are handled outside of the `if`.
13434 } else if (useNamedReferences) {
13435 // Apply named character references.
13436 // Encode `<>"'&` using named character references.
13437 if (!allowUnsafeSymbols) {
13438 string = string.replace(regexEscape, function(string) {
13439 return '&' + encodeMap[string] + ';'; // no need to check `has()` here
13440 });
13441 }
13442 // Shorten escapes that represent two symbols, of which at least one is
13443 // `<>"'&`.
13444 string = string
13445 .replace(/&gt;\u20D2/g, '&nvgt;')
13446 .replace(/&lt;\u20D2/g, '&nvlt;');
13447 // Encode non-ASCII symbols that can be replaced with a named reference.
13448 string = string.replace(regexEncodeNonAscii, function(string) {
13449 // Note: there is no need to check `has(encodeMap, string)` here.
13450 return '&' + encodeMap[string] + ';';
13451 });
13452 } else if (!allowUnsafeSymbols) {
13453 // Encode `<>"'&` using hexadecimal escapes, now that they’re not handled
13454 // using named character references.
13455 string = string.replace(regexEscape, escapeBmpSymbol);
13456 }
13457 return string
13458 // Encode astral symbols.
13459 .replace(regexAstralSymbols, function($0) {
13460 // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
13461 var high = $0.charCodeAt(0);
13462 var low = $0.charCodeAt(1);
13463 var codePoint = (high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000;
13464 return escapeCodePoint(codePoint);
13465 })
13466 // Encode any remaining BMP symbols that are not printable ASCII symbols
13467 // using a hexadecimal escape.
13468 .replace(regexBmpWhitelist, escapeBmpSymbol);
13469 };
13470 // Expose default options (so they can be overridden globally).
13471 encode.options = {
13472 'allowUnsafeSymbols': false,
13473 'encodeEverything': false,
13474 'strict': false,
13475 'useNamedReferences': false,
13476 'decimal' : false
13477 };
13478
13479 var decode = function(html, options) {
13480 options = merge(options, decode.options);
13481 var strict = options.strict;
13482 if (strict && regexInvalidEntity.test(html)) {
13483 parseError('malformed character reference');
13484 }
13485 return html.replace(regexDecode, function($0, $1, $2, $3, $4, $5, $6, $7, $8) {
13486 var codePoint;
13487 var semicolon;
13488 var decDigits;
13489 var hexDigits;
13490 var reference;
13491 var next;
13492
13493 if ($1) {
13494 reference = $1;
13495 // Note: there is no need to check `has(decodeMap, reference)`.
13496 return decodeMap[reference];
13497 }
13498
13499 if ($2) {
13500 // Decode named character references without trailing `;`, e.g. `&amp`.
13501 // This is only a parse error if it gets converted to `&`, or if it is
13502 // followed by `=` in an attribute context.
13503 reference = $2;
13504 next = $3;
13505 if (next && options.isAttributeValue) {
13506 if (strict && next == '=') {
13507 parseError('`&` did not start a character reference');
13508 }
13509 return $0;
13510 } else {
13511 if (strict) {
13512 parseError(
13513 'named character reference was not terminated by a semicolon'
13514 );
13515 }
13516 // Note: there is no need to check `has(decodeMapLegacy, reference)`.
13517 return decodeMapLegacy[reference] + (next || '');
13518 }
13519 }
13520
13521 if ($4) {
13522 // Decode decimal escapes, e.g. `&#119558;`.
13523 decDigits = $4;
13524 semicolon = $5;
13525 if (strict && !semicolon) {
13526 parseError('character reference was not terminated by a semicolon');
13527 }
13528 codePoint = parseInt(decDigits, 10);
13529 return codePointToSymbol(codePoint, strict);
13530 }
13531
13532 if ($6) {
13533 // Decode hexadecimal escapes, e.g. `&#x1D306;`.
13534 hexDigits = $6;
13535 semicolon = $7;
13536 if (strict && !semicolon) {
13537 parseError('character reference was not terminated by a semicolon');
13538 }
13539 codePoint = parseInt(hexDigits, 16);
13540 return codePointToSymbol(codePoint, strict);
13541 }
13542
13543 // If we’re still here, `if ($7)` is implied; it’s an ambiguous
13544 // ampersand for sure. https://mths.be/notes/ambiguous-ampersands
13545 if (strict) {
13546 parseError(
13547 'named character reference was not terminated by a semicolon'
13548 );
13549 }
13550 return $0;
13551 });
13552 };
13553 // Expose default options (so they can be overridden globally).
13554 decode.options = {
13555 'isAttributeValue': false,
13556 'strict': false
13557 };
13558
13559 var escape = function(string) {
13560 return string.replace(regexEscape, function($0) {
13561 // Note: there is no need to check `has(escapeMap, $0)` here.
13562 return escapeMap[$0];
13563 });
13564 };
13565
13566 /*--------------------------------------------------------------------------*/
13567
13568 var he = {
13569 'version': '1.2.0',
13570 'encode': encode,
13571 'decode': decode,
13572 'escape': escape,
13573 'unescape': decode
13574 };
13575
13576 // Some AMD build optimizers, like r.js, check for specific condition patterns
13577 // like the following:
13578 if (
13579 false
13580 ) {
13581 define(function() {
13582 return he;
13583 });
13584 } else if (freeExports && !freeExports.nodeType) {
13585 if (freeModule) { // in Node.js, io.js, or RingoJS v0.8.0+
13586 freeModule.exports = he;
13587 } else { // in Narwhal or RingoJS v0.7.0-
13588 for (var key in he) {
13589 has(he, key) && (freeExports[key] = he[key]);
13590 }
13591 }
13592 } else { // in Rhino or a web browser
13593 root.he = he;
13594 }
13595
13596}(this));
13597
13598}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
13599},{}],55:[function(require,module,exports){
13600exports.read = function (buffer, offset, isLE, mLen, nBytes) {
13601 var e, m
13602 var eLen = (nBytes * 8) - mLen - 1
13603 var eMax = (1 << eLen) - 1
13604 var eBias = eMax >> 1
13605 var nBits = -7
13606 var i = isLE ? (nBytes - 1) : 0
13607 var d = isLE ? -1 : 1
13608 var s = buffer[offset + i]
13609
13610 i += d
13611
13612 e = s & ((1 << (-nBits)) - 1)
13613 s >>= (-nBits)
13614 nBits += eLen
13615 for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
13616
13617 m = e & ((1 << (-nBits)) - 1)
13618 e >>= (-nBits)
13619 nBits += mLen
13620 for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
13621
13622 if (e === 0) {
13623 e = 1 - eBias
13624 } else if (e === eMax) {
13625 return m ? NaN : ((s ? -1 : 1) * Infinity)
13626 } else {
13627 m = m + Math.pow(2, mLen)
13628 e = e - eBias
13629 }
13630 return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
13631}
13632
13633exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
13634 var e, m, c
13635 var eLen = (nBytes * 8) - mLen - 1
13636 var eMax = (1 << eLen) - 1
13637 var eBias = eMax >> 1
13638 var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
13639 var i = isLE ? 0 : (nBytes - 1)
13640 var d = isLE ? 1 : -1
13641 var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
13642
13643 value = Math.abs(value)
13644
13645 if (isNaN(value) || value === Infinity) {
13646 m = isNaN(value) ? 1 : 0
13647 e = eMax
13648 } else {
13649 e = Math.floor(Math.log(value) / Math.LN2)
13650 if (value * (c = Math.pow(2, -e)) < 1) {
13651 e--
13652 c *= 2
13653 }
13654 if (e + eBias >= 1) {
13655 value += rt / c
13656 } else {
13657 value += rt * Math.pow(2, 1 - eBias)
13658 }
13659 if (value * c >= 2) {
13660 e++
13661 c /= 2
13662 }
13663
13664 if (e + eBias >= eMax) {
13665 m = 0
13666 e = eMax
13667 } else if (e + eBias >= 1) {
13668 m = ((value * c) - 1) * Math.pow(2, mLen)
13669 e = e + eBias
13670 } else {
13671 m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
13672 e = 0
13673 }
13674 }
13675
13676 for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
13677
13678 e = (e << mLen) | m
13679 eLen += mLen
13680 for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
13681
13682 buffer[offset + i - d] |= s * 128
13683}
13684
13685},{}],56:[function(require,module,exports){
13686if (typeof Object.create === 'function') {
13687 // implementation from standard node.js 'util' module
13688 module.exports = function inherits(ctor, superCtor) {
13689 ctor.super_ = superCtor
13690 ctor.prototype = Object.create(superCtor.prototype, {
13691 constructor: {
13692 value: ctor,
13693 enumerable: false,
13694 writable: true,
13695 configurable: true
13696 }
13697 });
13698 };
13699} else {
13700 // old school shim for old browsers
13701 module.exports = function inherits(ctor, superCtor) {
13702 ctor.super_ = superCtor
13703 var TempCtor = function () {}
13704 TempCtor.prototype = superCtor.prototype
13705 ctor.prototype = new TempCtor()
13706 ctor.prototype.constructor = ctor
13707 }
13708}
13709
13710},{}],57:[function(require,module,exports){
13711/*!
13712 * Determine if an object is a Buffer
13713 *
13714 * @author Feross Aboukhadijeh <https://feross.org>
13715 * @license MIT
13716 */
13717
13718// The _isBuffer check is for Safari 5-7 support, because it's missing
13719// Object.prototype.constructor. Remove this eventually
13720module.exports = function (obj) {
13721 return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
13722}
13723
13724function isBuffer (obj) {
13725 return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
13726}
13727
13728// For Node v0.10 support. Remove this eventually.
13729function isSlowBuffer (obj) {
13730 return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
13731}
13732
13733},{}],58:[function(require,module,exports){
13734var toString = {}.toString;
13735
13736module.exports = Array.isArray || function (arr) {
13737 return toString.call(arr) == '[object Array]';
13738};
13739
13740},{}],59:[function(require,module,exports){
13741(function (process){
13742var path = require('path');
13743var fs = require('fs');
13744var _0777 = parseInt('0777', 8);
13745
13746module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
13747
13748function mkdirP (p, opts, f, made) {
13749 if (typeof opts === 'function') {
13750 f = opts;
13751 opts = {};
13752 }
13753 else if (!opts || typeof opts !== 'object') {
13754 opts = { mode: opts };
13755 }
13756
13757 var mode = opts.mode;
13758 var xfs = opts.fs || fs;
13759
13760 if (mode === undefined) {
13761 mode = _0777 & (~process.umask());
13762 }
13763 if (!made) made = null;
13764
13765 var cb = f || function () {};
13766 p = path.resolve(p);
13767
13768 xfs.mkdir(p, mode, function (er) {
13769 if (!er) {
13770 made = made || p;
13771 return cb(null, made);
13772 }
13773 switch (er.code) {
13774 case 'ENOENT':
13775 mkdirP(path.dirname(p), opts, function (er, made) {
13776 if (er) cb(er, made);
13777 else mkdirP(p, opts, cb, made);
13778 });
13779 break;
13780
13781 // In the case of any other error, just see if there's a dir
13782 // there already. If so, then hooray! If not, then something
13783 // is borked.
13784 default:
13785 xfs.stat(p, function (er2, stat) {
13786 // if the stat fails, then that's super weird.
13787 // let the original error be the failure reason.
13788 if (er2 || !stat.isDirectory()) cb(er, made)
13789 else cb(null, made);
13790 });
13791 break;
13792 }
13793 });
13794}
13795
13796mkdirP.sync = function sync (p, opts, made) {
13797 if (!opts || typeof opts !== 'object') {
13798 opts = { mode: opts };
13799 }
13800
13801 var mode = opts.mode;
13802 var xfs = opts.fs || fs;
13803
13804 if (mode === undefined) {
13805 mode = _0777 & (~process.umask());
13806 }
13807 if (!made) made = null;
13808
13809 p = path.resolve(p);
13810
13811 try {
13812 xfs.mkdirSync(p, mode);
13813 made = made || p;
13814 }
13815 catch (err0) {
13816 switch (err0.code) {
13817 case 'ENOENT' :
13818 made = sync(path.dirname(p), opts, made);
13819 sync(p, opts, made);
13820 break;
13821
13822 // In the case of any other error, just see if there's a dir
13823 // there already. If so, then hooray! If not, then something
13824 // is borked.
13825 default:
13826 var stat;
13827 try {
13828 stat = xfs.statSync(p);
13829 }
13830 catch (err1) {
13831 throw err0;
13832 }
13833 if (!stat.isDirectory()) throw err0;
13834 break;
13835 }
13836 }
13837
13838 return made;
13839};
13840
13841}).call(this,require('_process'))
13842},{"_process":69,"fs":42,"path":42}],60:[function(require,module,exports){
13843/**
13844 * Helpers.
13845 */
13846
13847var s = 1000;
13848var m = s * 60;
13849var h = m * 60;
13850var d = h * 24;
13851var w = d * 7;
13852var y = d * 365.25;
13853
13854/**
13855 * Parse or format the given `val`.
13856 *
13857 * Options:
13858 *
13859 * - `long` verbose formatting [false]
13860 *
13861 * @param {String|Number} val
13862 * @param {Object} [options]
13863 * @throws {Error} throw an error if val is not a non-empty string or a number
13864 * @return {String|Number}
13865 * @api public
13866 */
13867
13868module.exports = function(val, options) {
13869 options = options || {};
13870 var type = typeof val;
13871 if (type === 'string' && val.length > 0) {
13872 return parse(val);
13873 } else if (type === 'number' && isNaN(val) === false) {
13874 return options.long ? fmtLong(val) : fmtShort(val);
13875 }
13876 throw new Error(
13877 'val is not a non-empty string or a valid number. val=' +
13878 JSON.stringify(val)
13879 );
13880};
13881
13882/**
13883 * Parse the given `str` and return milliseconds.
13884 *
13885 * @param {String} str
13886 * @return {Number}
13887 * @api private
13888 */
13889
13890function parse(str) {
13891 str = String(str);
13892 if (str.length > 100) {
13893 return;
13894 }
13895 var match = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
13896 str
13897 );
13898 if (!match) {
13899 return;
13900 }
13901 var n = parseFloat(match[1]);
13902 var type = (match[2] || 'ms').toLowerCase();
13903 switch (type) {
13904 case 'years':
13905 case 'year':
13906 case 'yrs':
13907 case 'yr':
13908 case 'y':
13909 return n * y;
13910 case 'weeks':
13911 case 'week':
13912 case 'w':
13913 return n * w;
13914 case 'days':
13915 case 'day':
13916 case 'd':
13917 return n * d;
13918 case 'hours':
13919 case 'hour':
13920 case 'hrs':
13921 case 'hr':
13922 case 'h':
13923 return n * h;
13924 case 'minutes':
13925 case 'minute':
13926 case 'mins':
13927 case 'min':
13928 case 'm':
13929 return n * m;
13930 case 'seconds':
13931 case 'second':
13932 case 'secs':
13933 case 'sec':
13934 case 's':
13935 return n * s;
13936 case 'milliseconds':
13937 case 'millisecond':
13938 case 'msecs':
13939 case 'msec':
13940 case 'ms':
13941 return n;
13942 default:
13943 return undefined;
13944 }
13945}
13946
13947/**
13948 * Short format for `ms`.
13949 *
13950 * @param {Number} ms
13951 * @return {String}
13952 * @api private
13953 */
13954
13955function fmtShort(ms) {
13956 var msAbs = Math.abs(ms);
13957 if (msAbs >= d) {
13958 return Math.round(ms / d) + 'd';
13959 }
13960 if (msAbs >= h) {
13961 return Math.round(ms / h) + 'h';
13962 }
13963 if (msAbs >= m) {
13964 return Math.round(ms / m) + 'm';
13965 }
13966 if (msAbs >= s) {
13967 return Math.round(ms / s) + 's';
13968 }
13969 return ms + 'ms';
13970}
13971
13972/**
13973 * Long format for `ms`.
13974 *
13975 * @param {Number} ms
13976 * @return {String}
13977 * @api private
13978 */
13979
13980function fmtLong(ms) {
13981 var msAbs = Math.abs(ms);
13982 if (msAbs >= d) {
13983 return plural(ms, msAbs, d, 'day');
13984 }
13985 if (msAbs >= h) {
13986 return plural(ms, msAbs, h, 'hour');
13987 }
13988 if (msAbs >= m) {
13989 return plural(ms, msAbs, m, 'minute');
13990 }
13991 if (msAbs >= s) {
13992 return plural(ms, msAbs, s, 'second');
13993 }
13994 return ms + ' ms';
13995}
13996
13997/**
13998 * Pluralization helper.
13999 */
14000
14001function plural(ms, msAbs, n, name) {
14002 var isPlural = msAbs >= n * 1.5;
14003 return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
14004}
14005
14006},{}],61:[function(require,module,exports){
14007'use strict';
14008
14009var keysShim;
14010if (!Object.keys) {
14011 // modified from https://github.com/es-shims/es5-shim
14012 var has = Object.prototype.hasOwnProperty;
14013 var toStr = Object.prototype.toString;
14014 var isArgs = require('./isArguments'); // eslint-disable-line global-require
14015 var isEnumerable = Object.prototype.propertyIsEnumerable;
14016 var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
14017 var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
14018 var dontEnums = [
14019 'toString',
14020 'toLocaleString',
14021 'valueOf',
14022 'hasOwnProperty',
14023 'isPrototypeOf',
14024 'propertyIsEnumerable',
14025 'constructor'
14026 ];
14027 var equalsConstructorPrototype = function (o) {
14028 var ctor = o.constructor;
14029 return ctor && ctor.prototype === o;
14030 };
14031 var excludedKeys = {
14032 $applicationCache: true,
14033 $console: true,
14034 $external: true,
14035 $frame: true,
14036 $frameElement: true,
14037 $frames: true,
14038 $innerHeight: true,
14039 $innerWidth: true,
14040 $outerHeight: true,
14041 $outerWidth: true,
14042 $pageXOffset: true,
14043 $pageYOffset: true,
14044 $parent: true,
14045 $scrollLeft: true,
14046 $scrollTop: true,
14047 $scrollX: true,
14048 $scrollY: true,
14049 $self: true,
14050 $webkitIndexedDB: true,
14051 $webkitStorageInfo: true,
14052 $window: true
14053 };
14054 var hasAutomationEqualityBug = (function () {
14055 /* global window */
14056 if (typeof window === 'undefined') { return false; }
14057 for (var k in window) {
14058 try {
14059 if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
14060 try {
14061 equalsConstructorPrototype(window[k]);
14062 } catch (e) {
14063 return true;
14064 }
14065 }
14066 } catch (e) {
14067 return true;
14068 }
14069 }
14070 return false;
14071 }());
14072 var equalsConstructorPrototypeIfNotBuggy = function (o) {
14073 /* global window */
14074 if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
14075 return equalsConstructorPrototype(o);
14076 }
14077 try {
14078 return equalsConstructorPrototype(o);
14079 } catch (e) {
14080 return false;
14081 }
14082 };
14083
14084 keysShim = function keys(object) {
14085 var isObject = object !== null && typeof object === 'object';
14086 var isFunction = toStr.call(object) === '[object Function]';
14087 var isArguments = isArgs(object);
14088 var isString = isObject && toStr.call(object) === '[object String]';
14089 var theKeys = [];
14090
14091 if (!isObject && !isFunction && !isArguments) {
14092 throw new TypeError('Object.keys called on a non-object');
14093 }
14094
14095 var skipProto = hasProtoEnumBug && isFunction;
14096 if (isString && object.length > 0 && !has.call(object, 0)) {
14097 for (var i = 0; i < object.length; ++i) {
14098 theKeys.push(String(i));
14099 }
14100 }
14101
14102 if (isArguments && object.length > 0) {
14103 for (var j = 0; j < object.length; ++j) {
14104 theKeys.push(String(j));
14105 }
14106 } else {
14107 for (var name in object) {
14108 if (!(skipProto && name === 'prototype') && has.call(object, name)) {
14109 theKeys.push(String(name));
14110 }
14111 }
14112 }
14113
14114 if (hasDontEnumBug) {
14115 var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
14116
14117 for (var k = 0; k < dontEnums.length; ++k) {
14118 if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
14119 theKeys.push(dontEnums[k]);
14120 }
14121 }
14122 }
14123 return theKeys;
14124 };
14125}
14126module.exports = keysShim;
14127
14128},{"./isArguments":63}],62:[function(require,module,exports){
14129'use strict';
14130
14131var slice = Array.prototype.slice;
14132var isArgs = require('./isArguments');
14133
14134var origKeys = Object.keys;
14135var keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation');
14136
14137var originalKeys = Object.keys;
14138
14139keysShim.shim = function shimObjectKeys() {
14140 if (Object.keys) {
14141 var keysWorksWithArguments = (function () {
14142 // Safari 5.0 bug
14143 var args = Object.keys(arguments);
14144 return args && args.length === arguments.length;
14145 }(1, 2));
14146 if (!keysWorksWithArguments) {
14147 Object.keys = function keys(object) { // eslint-disable-line func-name-matching
14148 if (isArgs(object)) {
14149 return originalKeys(slice.call(object));
14150 }
14151 return originalKeys(object);
14152 };
14153 }
14154 } else {
14155 Object.keys = keysShim;
14156 }
14157 return Object.keys || keysShim;
14158};
14159
14160module.exports = keysShim;
14161
14162},{"./implementation":61,"./isArguments":63}],63:[function(require,module,exports){
14163'use strict';
14164
14165var toStr = Object.prototype.toString;
14166
14167module.exports = function isArguments(value) {
14168 var str = toStr.call(value);
14169 var isArgs = str === '[object Arguments]';
14170 if (!isArgs) {
14171 isArgs = str !== '[object Array]' &&
14172 value !== null &&
14173 typeof value === 'object' &&
14174 typeof value.length === 'number' &&
14175 value.length >= 0 &&
14176 toStr.call(value.callee) === '[object Function]';
14177 }
14178 return isArgs;
14179};
14180
14181},{}],64:[function(require,module,exports){
14182'use strict';
14183
14184// modified from https://github.com/es-shims/es6-shim
14185var keys = require('object-keys');
14186var bind = require('function-bind');
14187var canBeObject = function (obj) {
14188 return typeof obj !== 'undefined' && obj !== null;
14189};
14190var hasSymbols = require('has-symbols/shams')();
14191var toObject = Object;
14192var push = bind.call(Function.call, Array.prototype.push);
14193var propIsEnumerable = bind.call(Function.call, Object.prototype.propertyIsEnumerable);
14194var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;
14195
14196module.exports = function assign(target, source1) {
14197 if (!canBeObject(target)) { throw new TypeError('target must be an object'); }
14198 var objTarget = toObject(target);
14199 var s, source, i, props, syms, value, key;
14200 for (s = 1; s < arguments.length; ++s) {
14201 source = toObject(arguments[s]);
14202 props = keys(source);
14203 var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);
14204 if (getSymbols) {
14205 syms = getSymbols(source);
14206 for (i = 0; i < syms.length; ++i) {
14207 key = syms[i];
14208 if (propIsEnumerable(source, key)) {
14209 push(props, key);
14210 }
14211 }
14212 }
14213 for (i = 0; i < props.length; ++i) {
14214 key = props[i];
14215 value = source[key];
14216 if (propIsEnumerable(source, key)) {
14217 objTarget[key] = value;
14218 }
14219 }
14220 }
14221 return objTarget;
14222};
14223
14224},{"function-bind":52,"has-symbols/shams":53,"object-keys":62}],65:[function(require,module,exports){
14225'use strict';
14226
14227var defineProperties = require('define-properties');
14228
14229var implementation = require('./implementation');
14230var getPolyfill = require('./polyfill');
14231var shim = require('./shim');
14232
14233var polyfill = getPolyfill();
14234
14235defineProperties(polyfill, {
14236 getPolyfill: getPolyfill,
14237 implementation: implementation,
14238 shim: shim
14239});
14240
14241module.exports = polyfill;
14242
14243},{"./implementation":64,"./polyfill":66,"./shim":67,"define-properties":47}],66:[function(require,module,exports){
14244'use strict';
14245
14246var implementation = require('./implementation');
14247
14248var lacksProperEnumerationOrder = function () {
14249 if (!Object.assign) {
14250 return false;
14251 }
14252 // v8, specifically in node 4.x, has a bug with incorrect property enumeration order
14253 // note: this does not detect the bug unless there's 20 characters
14254 var str = 'abcdefghijklmnopqrst';
14255 var letters = str.split('');
14256 var map = {};
14257 for (var i = 0; i < letters.length; ++i) {
14258 map[letters[i]] = letters[i];
14259 }
14260 var obj = Object.assign({}, map);
14261 var actual = '';
14262 for (var k in obj) {
14263 actual += k;
14264 }
14265 return str !== actual;
14266};
14267
14268var assignHasPendingExceptions = function () {
14269 if (!Object.assign || !Object.preventExtensions) {
14270 return false;
14271 }
14272 // Firefox 37 still has "pending exception" logic in its Object.assign implementation,
14273 // which is 72% slower than our shim, and Firefox 40's native implementation.
14274 var thrower = Object.preventExtensions({ 1: 2 });
14275 try {
14276 Object.assign(thrower, 'xy');
14277 } catch (e) {
14278 return thrower[1] === 'y';
14279 }
14280 return false;
14281};
14282
14283module.exports = function getPolyfill() {
14284 if (!Object.assign) {
14285 return implementation;
14286 }
14287 if (lacksProperEnumerationOrder()) {
14288 return implementation;
14289 }
14290 if (assignHasPendingExceptions()) {
14291 return implementation;
14292 }
14293 return Object.assign;
14294};
14295
14296},{"./implementation":64}],67:[function(require,module,exports){
14297'use strict';
14298
14299var define = require('define-properties');
14300var getPolyfill = require('./polyfill');
14301
14302module.exports = function shimAssign() {
14303 var polyfill = getPolyfill();
14304 define(
14305 Object,
14306 { assign: polyfill },
14307 { assign: function () { return Object.assign !== polyfill; } }
14308 );
14309 return polyfill;
14310};
14311
14312},{"./polyfill":66,"define-properties":47}],68:[function(require,module,exports){
14313(function (process){
14314'use strict';
14315
14316if (!process.version ||
14317 process.version.indexOf('v0.') === 0 ||
14318 process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
14319 module.exports = { nextTick: nextTick };
14320} else {
14321 module.exports = process
14322}
14323
14324function nextTick(fn, arg1, arg2, arg3) {
14325 if (typeof fn !== 'function') {
14326 throw new TypeError('"callback" argument must be a function');
14327 }
14328 var len = arguments.length;
14329 var args, i;
14330 switch (len) {
14331 case 0:
14332 case 1:
14333 return process.nextTick(fn);
14334 case 2:
14335 return process.nextTick(function afterTickOne() {
14336 fn.call(null, arg1);
14337 });
14338 case 3:
14339 return process.nextTick(function afterTickTwo() {
14340 fn.call(null, arg1, arg2);
14341 });
14342 case 4:
14343 return process.nextTick(function afterTickThree() {
14344 fn.call(null, arg1, arg2, arg3);
14345 });
14346 default:
14347 args = new Array(len - 1);
14348 i = 0;
14349 while (i < args.length) {
14350 args[i++] = arguments[i];
14351 }
14352 return process.nextTick(function afterTick() {
14353 fn.apply(null, args);
14354 });
14355 }
14356}
14357
14358
14359}).call(this,require('_process'))
14360},{"_process":69}],69:[function(require,module,exports){
14361// shim for using process in browser
14362var process = module.exports = {};
14363
14364// cached from whatever global is present so that test runners that stub it
14365// don't break things. But we need to wrap it in a try catch in case it is
14366// wrapped in strict mode code which doesn't define any globals. It's inside a
14367// function because try/catches deoptimize in certain engines.
14368
14369var cachedSetTimeout;
14370var cachedClearTimeout;
14371
14372function defaultSetTimout() {
14373 throw new Error('setTimeout has not been defined');
14374}
14375function defaultClearTimeout () {
14376 throw new Error('clearTimeout has not been defined');
14377}
14378(function () {
14379 try {
14380 if (typeof setTimeout === 'function') {
14381 cachedSetTimeout = setTimeout;
14382 } else {
14383 cachedSetTimeout = defaultSetTimout;
14384 }
14385 } catch (e) {
14386 cachedSetTimeout = defaultSetTimout;
14387 }
14388 try {
14389 if (typeof clearTimeout === 'function') {
14390 cachedClearTimeout = clearTimeout;
14391 } else {
14392 cachedClearTimeout = defaultClearTimeout;
14393 }
14394 } catch (e) {
14395 cachedClearTimeout = defaultClearTimeout;
14396 }
14397} ())
14398function runTimeout(fun) {
14399 if (cachedSetTimeout === setTimeout) {
14400 //normal enviroments in sane situations
14401 return setTimeout(fun, 0);
14402 }
14403 // if setTimeout wasn't available but was latter defined
14404 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
14405 cachedSetTimeout = setTimeout;
14406 return setTimeout(fun, 0);
14407 }
14408 try {
14409 // when when somebody has screwed with setTimeout but no I.E. maddness
14410 return cachedSetTimeout(fun, 0);
14411 } catch(e){
14412 try {
14413 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
14414 return cachedSetTimeout.call(null, fun, 0);
14415 } catch(e){
14416 // 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
14417 return cachedSetTimeout.call(this, fun, 0);
14418 }
14419 }
14420
14421
14422}
14423function runClearTimeout(marker) {
14424 if (cachedClearTimeout === clearTimeout) {
14425 //normal enviroments in sane situations
14426 return clearTimeout(marker);
14427 }
14428 // if clearTimeout wasn't available but was latter defined
14429 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
14430 cachedClearTimeout = clearTimeout;
14431 return clearTimeout(marker);
14432 }
14433 try {
14434 // when when somebody has screwed with setTimeout but no I.E. maddness
14435 return cachedClearTimeout(marker);
14436 } catch (e){
14437 try {
14438 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
14439 return cachedClearTimeout.call(null, marker);
14440 } catch (e){
14441 // 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.
14442 // Some versions of I.E. have different rules for clearTimeout vs setTimeout
14443 return cachedClearTimeout.call(this, marker);
14444 }
14445 }
14446
14447
14448
14449}
14450var queue = [];
14451var draining = false;
14452var currentQueue;
14453var queueIndex = -1;
14454
14455function cleanUpNextTick() {
14456 if (!draining || !currentQueue) {
14457 return;
14458 }
14459 draining = false;
14460 if (currentQueue.length) {
14461 queue = currentQueue.concat(queue);
14462 } else {
14463 queueIndex = -1;
14464 }
14465 if (queue.length) {
14466 drainQueue();
14467 }
14468}
14469
14470function drainQueue() {
14471 if (draining) {
14472 return;
14473 }
14474 var timeout = runTimeout(cleanUpNextTick);
14475 draining = true;
14476
14477 var len = queue.length;
14478 while(len) {
14479 currentQueue = queue;
14480 queue = [];
14481 while (++queueIndex < len) {
14482 if (currentQueue) {
14483 currentQueue[queueIndex].run();
14484 }
14485 }
14486 queueIndex = -1;
14487 len = queue.length;
14488 }
14489 currentQueue = null;
14490 draining = false;
14491 runClearTimeout(timeout);
14492}
14493
14494process.nextTick = function (fun) {
14495 var args = new Array(arguments.length - 1);
14496 if (arguments.length > 1) {
14497 for (var i = 1; i < arguments.length; i++) {
14498 args[i - 1] = arguments[i];
14499 }
14500 }
14501 queue.push(new Item(fun, args));
14502 if (queue.length === 1 && !draining) {
14503 runTimeout(drainQueue);
14504 }
14505};
14506
14507// v8 likes predictible objects
14508function Item(fun, array) {
14509 this.fun = fun;
14510 this.array = array;
14511}
14512Item.prototype.run = function () {
14513 this.fun.apply(null, this.array);
14514};
14515process.title = 'browser';
14516process.browser = true;
14517process.env = {};
14518process.argv = [];
14519process.version = ''; // empty string to avoid regexp issues
14520process.versions = {};
14521
14522function noop() {}
14523
14524process.on = noop;
14525process.addListener = noop;
14526process.once = noop;
14527process.off = noop;
14528process.removeListener = noop;
14529process.removeAllListeners = noop;
14530process.emit = noop;
14531process.prependListener = noop;
14532process.prependOnceListener = noop;
14533
14534process.listeners = function (name) { return [] }
14535
14536process.binding = function (name) {
14537 throw new Error('process.binding is not supported');
14538};
14539
14540process.cwd = function () { return '/' };
14541process.chdir = function (dir) {
14542 throw new Error('process.chdir is not supported');
14543};
14544process.umask = function() { return 0; };
14545
14546},{}],70:[function(require,module,exports){
14547module.exports = require('./lib/_stream_duplex.js');
14548
14549},{"./lib/_stream_duplex.js":71}],71:[function(require,module,exports){
14550// Copyright Joyent, Inc. and other Node contributors.
14551//
14552// Permission is hereby granted, free of charge, to any person obtaining a
14553// copy of this software and associated documentation files (the
14554// "Software"), to deal in the Software without restriction, including
14555// without limitation the rights to use, copy, modify, merge, publish,
14556// distribute, sublicense, and/or sell copies of the Software, and to permit
14557// persons to whom the Software is furnished to do so, subject to the
14558// following conditions:
14559//
14560// The above copyright notice and this permission notice shall be included
14561// in all copies or substantial portions of the Software.
14562//
14563// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14564// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14565// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
14566// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
14567// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
14568// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
14569// USE OR OTHER DEALINGS IN THE SOFTWARE.
14570
14571// a duplex stream is just a stream that is both readable and writable.
14572// Since JS doesn't have multiple prototypal inheritance, this class
14573// prototypally inherits from Readable, and then parasitically from
14574// Writable.
14575
14576'use strict';
14577
14578/*<replacement>*/
14579
14580var pna = require('process-nextick-args');
14581/*</replacement>*/
14582
14583/*<replacement>*/
14584var objectKeys = Object.keys || function (obj) {
14585 var keys = [];
14586 for (var key in obj) {
14587 keys.push(key);
14588 }return keys;
14589};
14590/*</replacement>*/
14591
14592module.exports = Duplex;
14593
14594/*<replacement>*/
14595var util = require('core-util-is');
14596util.inherits = require('inherits');
14597/*</replacement>*/
14598
14599var Readable = require('./_stream_readable');
14600var Writable = require('./_stream_writable');
14601
14602util.inherits(Duplex, Readable);
14603
14604{
14605 // avoid scope creep, the keys array can then be collected
14606 var keys = objectKeys(Writable.prototype);
14607 for (var v = 0; v < keys.length; v++) {
14608 var method = keys[v];
14609 if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
14610 }
14611}
14612
14613function Duplex(options) {
14614 if (!(this instanceof Duplex)) return new Duplex(options);
14615
14616 Readable.call(this, options);
14617 Writable.call(this, options);
14618
14619 if (options && options.readable === false) this.readable = false;
14620
14621 if (options && options.writable === false) this.writable = false;
14622
14623 this.allowHalfOpen = true;
14624 if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
14625
14626 this.once('end', onend);
14627}
14628
14629Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
14630 // making it explicit this property is not enumerable
14631 // because otherwise some prototype manipulation in
14632 // userland will fail
14633 enumerable: false,
14634 get: function () {
14635 return this._writableState.highWaterMark;
14636 }
14637});
14638
14639// the no-half-open enforcer
14640function onend() {
14641 // if we allow half-open state, or if the writable side ended,
14642 // then we're ok.
14643 if (this.allowHalfOpen || this._writableState.ended) return;
14644
14645 // no more data can be written.
14646 // But allow more writes to happen in this tick.
14647 pna.nextTick(onEndNT, this);
14648}
14649
14650function onEndNT(self) {
14651 self.end();
14652}
14653
14654Object.defineProperty(Duplex.prototype, 'destroyed', {
14655 get: function () {
14656 if (this._readableState === undefined || this._writableState === undefined) {
14657 return false;
14658 }
14659 return this._readableState.destroyed && this._writableState.destroyed;
14660 },
14661 set: function (value) {
14662 // we ignore the value if the stream
14663 // has not been initialized yet
14664 if (this._readableState === undefined || this._writableState === undefined) {
14665 return;
14666 }
14667
14668 // backward compatibility, the user is explicitly
14669 // managing destroyed
14670 this._readableState.destroyed = value;
14671 this._writableState.destroyed = value;
14672 }
14673});
14674
14675Duplex.prototype._destroy = function (err, cb) {
14676 this.push(null);
14677 this.end();
14678
14679 pna.nextTick(cb, err);
14680};
14681},{"./_stream_readable":73,"./_stream_writable":75,"core-util-is":44,"inherits":56,"process-nextick-args":68}],72:[function(require,module,exports){
14682// Copyright Joyent, Inc. and other Node contributors.
14683//
14684// Permission is hereby granted, free of charge, to any person obtaining a
14685// copy of this software and associated documentation files (the
14686// "Software"), to deal in the Software without restriction, including
14687// without limitation the rights to use, copy, modify, merge, publish,
14688// distribute, sublicense, and/or sell copies of the Software, and to permit
14689// persons to whom the Software is furnished to do so, subject to the
14690// following conditions:
14691//
14692// The above copyright notice and this permission notice shall be included
14693// in all copies or substantial portions of the Software.
14694//
14695// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14696// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14697// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
14698// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
14699// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
14700// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
14701// USE OR OTHER DEALINGS IN THE SOFTWARE.
14702
14703// a passthrough stream.
14704// basically just the most minimal sort of Transform stream.
14705// Every written chunk gets output as-is.
14706
14707'use strict';
14708
14709module.exports = PassThrough;
14710
14711var Transform = require('./_stream_transform');
14712
14713/*<replacement>*/
14714var util = require('core-util-is');
14715util.inherits = require('inherits');
14716/*</replacement>*/
14717
14718util.inherits(PassThrough, Transform);
14719
14720function PassThrough(options) {
14721 if (!(this instanceof PassThrough)) return new PassThrough(options);
14722
14723 Transform.call(this, options);
14724}
14725
14726PassThrough.prototype._transform = function (chunk, encoding, cb) {
14727 cb(null, chunk);
14728};
14729},{"./_stream_transform":74,"core-util-is":44,"inherits":56}],73:[function(require,module,exports){
14730(function (process,global){
14731// Copyright Joyent, Inc. and other Node contributors.
14732//
14733// Permission is hereby granted, free of charge, to any person obtaining a
14734// copy of this software and associated documentation files (the
14735// "Software"), to deal in the Software without restriction, including
14736// without limitation the rights to use, copy, modify, merge, publish,
14737// distribute, sublicense, and/or sell copies of the Software, and to permit
14738// persons to whom the Software is furnished to do so, subject to the
14739// following conditions:
14740//
14741// The above copyright notice and this permission notice shall be included
14742// in all copies or substantial portions of the Software.
14743//
14744// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14745// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14746// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
14747// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
14748// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
14749// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
14750// USE OR OTHER DEALINGS IN THE SOFTWARE.
14751
14752'use strict';
14753
14754/*<replacement>*/
14755
14756var pna = require('process-nextick-args');
14757/*</replacement>*/
14758
14759module.exports = Readable;
14760
14761/*<replacement>*/
14762var isArray = require('isarray');
14763/*</replacement>*/
14764
14765/*<replacement>*/
14766var Duplex;
14767/*</replacement>*/
14768
14769Readable.ReadableState = ReadableState;
14770
14771/*<replacement>*/
14772var EE = require('events').EventEmitter;
14773
14774var EElistenerCount = function (emitter, type) {
14775 return emitter.listeners(type).length;
14776};
14777/*</replacement>*/
14778
14779/*<replacement>*/
14780var Stream = require('./internal/streams/stream');
14781/*</replacement>*/
14782
14783/*<replacement>*/
14784
14785var Buffer = require('safe-buffer').Buffer;
14786var OurUint8Array = global.Uint8Array || function () {};
14787function _uint8ArrayToBuffer(chunk) {
14788 return Buffer.from(chunk);
14789}
14790function _isUint8Array(obj) {
14791 return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
14792}
14793
14794/*</replacement>*/
14795
14796/*<replacement>*/
14797var util = require('core-util-is');
14798util.inherits = require('inherits');
14799/*</replacement>*/
14800
14801/*<replacement>*/
14802var debugUtil = require('util');
14803var debug = void 0;
14804if (debugUtil && debugUtil.debuglog) {
14805 debug = debugUtil.debuglog('stream');
14806} else {
14807 debug = function () {};
14808}
14809/*</replacement>*/
14810
14811var BufferList = require('./internal/streams/BufferList');
14812var destroyImpl = require('./internal/streams/destroy');
14813var StringDecoder;
14814
14815util.inherits(Readable, Stream);
14816
14817var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
14818
14819function prependListener(emitter, event, fn) {
14820 // Sadly this is not cacheable as some libraries bundle their own
14821 // event emitter implementation with them.
14822 if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
14823
14824 // This is a hack to make sure that our error handler is attached before any
14825 // userland ones. NEVER DO THIS. This is here only because this code needs
14826 // to continue to work with older versions of Node.js that do not include
14827 // the prependListener() method. The goal is to eventually remove this hack.
14828 if (!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]];
14829}
14830
14831function ReadableState(options, stream) {
14832 Duplex = Duplex || require('./_stream_duplex');
14833
14834 options = options || {};
14835
14836 // Duplex streams are both readable and writable, but share
14837 // the same options object.
14838 // However, some cases require setting options to different
14839 // values for the readable and the writable sides of the duplex stream.
14840 // These options can be provided separately as readableXXX and writableXXX.
14841 var isDuplex = stream instanceof Duplex;
14842
14843 // object stream flag. Used to make read(n) ignore n and to
14844 // make all the buffer merging and length checks go away
14845 this.objectMode = !!options.objectMode;
14846
14847 if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
14848
14849 // the point at which it stops calling _read() to fill the buffer
14850 // Note: 0 is a valid value, means "don't call _read preemptively ever"
14851 var hwm = options.highWaterMark;
14852 var readableHwm = options.readableHighWaterMark;
14853 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
14854
14855 if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
14856
14857 // cast to ints.
14858 this.highWaterMark = Math.floor(this.highWaterMark);
14859
14860 // A linked list is used to store data chunks instead of an array because the
14861 // linked list can remove elements from the beginning faster than
14862 // array.shift()
14863 this.buffer = new BufferList();
14864 this.length = 0;
14865 this.pipes = null;
14866 this.pipesCount = 0;
14867 this.flowing = null;
14868 this.ended = false;
14869 this.endEmitted = false;
14870 this.reading = false;
14871
14872 // a flag to be able to tell if the event 'readable'/'data' is emitted
14873 // immediately, or on a later tick. We set this to true at first, because
14874 // any actions that shouldn't happen until "later" should generally also
14875 // not happen before the first read call.
14876 this.sync = true;
14877
14878 // whenever we return null, then we set a flag to say
14879 // that we're awaiting a 'readable' event emission.
14880 this.needReadable = false;
14881 this.emittedReadable = false;
14882 this.readableListening = false;
14883 this.resumeScheduled = false;
14884
14885 // has it been destroyed
14886 this.destroyed = false;
14887
14888 // Crypto is kind of old and crusty. Historically, its default string
14889 // encoding is 'binary' so we have to make this configurable.
14890 // Everything else in the universe uses 'utf8', though.
14891 this.defaultEncoding = options.defaultEncoding || 'utf8';
14892
14893 // the number of writers that are awaiting a drain event in .pipe()s
14894 this.awaitDrain = 0;
14895
14896 // if true, a maybeReadMore has been scheduled
14897 this.readingMore = false;
14898
14899 this.decoder = null;
14900 this.encoding = null;
14901 if (options.encoding) {
14902 if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
14903 this.decoder = new StringDecoder(options.encoding);
14904 this.encoding = options.encoding;
14905 }
14906}
14907
14908function Readable(options) {
14909 Duplex = Duplex || require('./_stream_duplex');
14910
14911 if (!(this instanceof Readable)) return new Readable(options);
14912
14913 this._readableState = new ReadableState(options, this);
14914
14915 // legacy
14916 this.readable = true;
14917
14918 if (options) {
14919 if (typeof options.read === 'function') this._read = options.read;
14920
14921 if (typeof options.destroy === 'function') this._destroy = options.destroy;
14922 }
14923
14924 Stream.call(this);
14925}
14926
14927Object.defineProperty(Readable.prototype, 'destroyed', {
14928 get: function () {
14929 if (this._readableState === undefined) {
14930 return false;
14931 }
14932 return this._readableState.destroyed;
14933 },
14934 set: function (value) {
14935 // we ignore the value if the stream
14936 // has not been initialized yet
14937 if (!this._readableState) {
14938 return;
14939 }
14940
14941 // backward compatibility, the user is explicitly
14942 // managing destroyed
14943 this._readableState.destroyed = value;
14944 }
14945});
14946
14947Readable.prototype.destroy = destroyImpl.destroy;
14948Readable.prototype._undestroy = destroyImpl.undestroy;
14949Readable.prototype._destroy = function (err, cb) {
14950 this.push(null);
14951 cb(err);
14952};
14953
14954// Manually shove something into the read() buffer.
14955// This returns true if the highWaterMark has not been hit yet,
14956// similar to how Writable.write() returns true if you should
14957// write() some more.
14958Readable.prototype.push = function (chunk, encoding) {
14959 var state = this._readableState;
14960 var skipChunkCheck;
14961
14962 if (!state.objectMode) {
14963 if (typeof chunk === 'string') {
14964 encoding = encoding || state.defaultEncoding;
14965 if (encoding !== state.encoding) {
14966 chunk = Buffer.from(chunk, encoding);
14967 encoding = '';
14968 }
14969 skipChunkCheck = true;
14970 }
14971 } else {
14972 skipChunkCheck = true;
14973 }
14974
14975 return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
14976};
14977
14978// Unshift should *always* be something directly out of read()
14979Readable.prototype.unshift = function (chunk) {
14980 return readableAddChunk(this, chunk, null, true, false);
14981};
14982
14983function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
14984 var state = stream._readableState;
14985 if (chunk === null) {
14986 state.reading = false;
14987 onEofChunk(stream, state);
14988 } else {
14989 var er;
14990 if (!skipChunkCheck) er = chunkInvalid(state, chunk);
14991 if (er) {
14992 stream.emit('error', er);
14993 } else if (state.objectMode || chunk && chunk.length > 0) {
14994 if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
14995 chunk = _uint8ArrayToBuffer(chunk);
14996 }
14997
14998 if (addToFront) {
14999 if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
15000 } else if (state.ended) {
15001 stream.emit('error', new Error('stream.push() after EOF'));
15002 } else {
15003 state.reading = false;
15004 if (state.decoder && !encoding) {
15005 chunk = state.decoder.write(chunk);
15006 if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
15007 } else {
15008 addChunk(stream, state, chunk, false);
15009 }
15010 }
15011 } else if (!addToFront) {
15012 state.reading = false;
15013 }
15014 }
15015
15016 return needMoreData(state);
15017}
15018
15019function addChunk(stream, state, chunk, addToFront) {
15020 if (state.flowing && state.length === 0 && !state.sync) {
15021 stream.emit('data', chunk);
15022 stream.read(0);
15023 } else {
15024 // update the buffer info.
15025 state.length += state.objectMode ? 1 : chunk.length;
15026 if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
15027
15028 if (state.needReadable) emitReadable(stream);
15029 }
15030 maybeReadMore(stream, state);
15031}
15032
15033function chunkInvalid(state, chunk) {
15034 var er;
15035 if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
15036 er = new TypeError('Invalid non-string/buffer chunk');
15037 }
15038 return er;
15039}
15040
15041// if it's past the high water mark, we can push in some more.
15042// Also, if we have no data yet, we can stand some
15043// more bytes. This is to work around cases where hwm=0,
15044// such as the repl. Also, if the push() triggered a
15045// readable event, and the user called read(largeNumber) such that
15046// needReadable was set, then we ought to push more, so that another
15047// 'readable' event will be triggered.
15048function needMoreData(state) {
15049 return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
15050}
15051
15052Readable.prototype.isPaused = function () {
15053 return this._readableState.flowing === false;
15054};
15055
15056// backwards compatibility.
15057Readable.prototype.setEncoding = function (enc) {
15058 if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
15059 this._readableState.decoder = new StringDecoder(enc);
15060 this._readableState.encoding = enc;
15061 return this;
15062};
15063
15064// Don't raise the hwm > 8MB
15065var MAX_HWM = 0x800000;
15066function computeNewHighWaterMark(n) {
15067 if (n >= MAX_HWM) {
15068 n = MAX_HWM;
15069 } else {
15070 // Get the next highest power of 2 to prevent increasing hwm excessively in
15071 // tiny amounts
15072 n--;
15073 n |= n >>> 1;
15074 n |= n >>> 2;
15075 n |= n >>> 4;
15076 n |= n >>> 8;
15077 n |= n >>> 16;
15078 n++;
15079 }
15080 return n;
15081}
15082
15083// This function is designed to be inlinable, so please take care when making
15084// changes to the function body.
15085function howMuchToRead(n, state) {
15086 if (n <= 0 || state.length === 0 && state.ended) return 0;
15087 if (state.objectMode) return 1;
15088 if (n !== n) {
15089 // Only flow one buffer at a time
15090 if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
15091 }
15092 // If we're asking for more than the current hwm, then raise the hwm.
15093 if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
15094 if (n <= state.length) return n;
15095 // Don't have enough
15096 if (!state.ended) {
15097 state.needReadable = true;
15098 return 0;
15099 }
15100 return state.length;
15101}
15102
15103// you can override either this method, or the async _read(n) below.
15104Readable.prototype.read = function (n) {
15105 debug('read', n);
15106 n = parseInt(n, 10);
15107 var state = this._readableState;
15108 var nOrig = n;
15109
15110 if (n !== 0) state.emittedReadable = false;
15111
15112 // if we're doing read(0) to trigger a readable event, but we
15113 // already have a bunch of data in the buffer, then just trigger
15114 // the 'readable' event and move on.
15115 if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
15116 debug('read: emitReadable', state.length, state.ended);
15117 if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
15118 return null;
15119 }
15120
15121 n = howMuchToRead(n, state);
15122
15123 // if we've ended, and we're now clear, then finish it up.
15124 if (n === 0 && state.ended) {
15125 if (state.length === 0) endReadable(this);
15126 return null;
15127 }
15128
15129 // All the actual chunk generation logic needs to be
15130 // *below* the call to _read. The reason is that in certain
15131 // synthetic stream cases, such as passthrough streams, _read
15132 // may be a completely synchronous operation which may change
15133 // the state of the read buffer, providing enough data when
15134 // before there was *not* enough.
15135 //
15136 // So, the steps are:
15137 // 1. Figure out what the state of things will be after we do
15138 // a read from the buffer.
15139 //
15140 // 2. If that resulting state will trigger a _read, then call _read.
15141 // Note that this may be asynchronous, or synchronous. Yes, it is
15142 // deeply ugly to write APIs this way, but that still doesn't mean
15143 // that the Readable class should behave improperly, as streams are
15144 // designed to be sync/async agnostic.
15145 // Take note if the _read call is sync or async (ie, if the read call
15146 // has returned yet), so that we know whether or not it's safe to emit
15147 // 'readable' etc.
15148 //
15149 // 3. Actually pull the requested chunks out of the buffer and return.
15150
15151 // if we need a readable event, then we need to do some reading.
15152 var doRead = state.needReadable;
15153 debug('need readable', doRead);
15154
15155 // if we currently have less than the highWaterMark, then also read some
15156 if (state.length === 0 || state.length - n < state.highWaterMark) {
15157 doRead = true;
15158 debug('length less than watermark', doRead);
15159 }
15160
15161 // however, if we've ended, then there's no point, and if we're already
15162 // reading, then it's unnecessary.
15163 if (state.ended || state.reading) {
15164 doRead = false;
15165 debug('reading or ended', doRead);
15166 } else if (doRead) {
15167 debug('do read');
15168 state.reading = true;
15169 state.sync = true;
15170 // if the length is currently zero, then we *need* a readable event.
15171 if (state.length === 0) state.needReadable = true;
15172 // call internal read method
15173 this._read(state.highWaterMark);
15174 state.sync = false;
15175 // If _read pushed data synchronously, then `reading` will be false,
15176 // and we need to re-evaluate how much data we can return to the user.
15177 if (!state.reading) n = howMuchToRead(nOrig, state);
15178 }
15179
15180 var ret;
15181 if (n > 0) ret = fromList(n, state);else ret = null;
15182
15183 if (ret === null) {
15184 state.needReadable = true;
15185 n = 0;
15186 } else {
15187 state.length -= n;
15188 }
15189
15190 if (state.length === 0) {
15191 // If we have nothing in the buffer, then we want to know
15192 // as soon as we *do* get something into the buffer.
15193 if (!state.ended) state.needReadable = true;
15194
15195 // If we tried to read() past the EOF, then emit end on the next tick.
15196 if (nOrig !== n && state.ended) endReadable(this);
15197 }
15198
15199 if (ret !== null) this.emit('data', ret);
15200
15201 return ret;
15202};
15203
15204function onEofChunk(stream, state) {
15205 if (state.ended) return;
15206 if (state.decoder) {
15207 var chunk = state.decoder.end();
15208 if (chunk && chunk.length) {
15209 state.buffer.push(chunk);
15210 state.length += state.objectMode ? 1 : chunk.length;
15211 }
15212 }
15213 state.ended = true;
15214
15215 // emit 'readable' now to make sure it gets picked up.
15216 emitReadable(stream);
15217}
15218
15219// Don't emit readable right away in sync mode, because this can trigger
15220// another read() call => stack overflow. This way, it might trigger
15221// a nextTick recursion warning, but that's not so bad.
15222function emitReadable(stream) {
15223 var state = stream._readableState;
15224 state.needReadable = false;
15225 if (!state.emittedReadable) {
15226 debug('emitReadable', state.flowing);
15227 state.emittedReadable = true;
15228 if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
15229 }
15230}
15231
15232function emitReadable_(stream) {
15233 debug('emit readable');
15234 stream.emit('readable');
15235 flow(stream);
15236}
15237
15238// at this point, the user has presumably seen the 'readable' event,
15239// and called read() to consume some data. that may have triggered
15240// in turn another _read(n) call, in which case reading = true if
15241// it's in progress.
15242// However, if we're not ended, or reading, and the length < hwm,
15243// then go ahead and try to read some more preemptively.
15244function maybeReadMore(stream, state) {
15245 if (!state.readingMore) {
15246 state.readingMore = true;
15247 pna.nextTick(maybeReadMore_, stream, state);
15248 }
15249}
15250
15251function maybeReadMore_(stream, state) {
15252 var len = state.length;
15253 while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
15254 debug('maybeReadMore read 0');
15255 stream.read(0);
15256 if (len === state.length)
15257 // didn't get any data, stop spinning.
15258 break;else len = state.length;
15259 }
15260 state.readingMore = false;
15261}
15262
15263// abstract method. to be overridden in specific implementation classes.
15264// call cb(er, data) where data is <= n in length.
15265// for virtual (non-string, non-buffer) streams, "length" is somewhat
15266// arbitrary, and perhaps not very meaningful.
15267Readable.prototype._read = function (n) {
15268 this.emit('error', new Error('_read() is not implemented'));
15269};
15270
15271Readable.prototype.pipe = function (dest, pipeOpts) {
15272 var src = this;
15273 var state = this._readableState;
15274
15275 switch (state.pipesCount) {
15276 case 0:
15277 state.pipes = dest;
15278 break;
15279 case 1:
15280 state.pipes = [state.pipes, dest];
15281 break;
15282 default:
15283 state.pipes.push(dest);
15284 break;
15285 }
15286 state.pipesCount += 1;
15287 debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
15288
15289 var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
15290
15291 var endFn = doEnd ? onend : unpipe;
15292 if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
15293
15294 dest.on('unpipe', onunpipe);
15295 function onunpipe(readable, unpipeInfo) {
15296 debug('onunpipe');
15297 if (readable === src) {
15298 if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
15299 unpipeInfo.hasUnpiped = true;
15300 cleanup();
15301 }
15302 }
15303 }
15304
15305 function onend() {
15306 debug('onend');
15307 dest.end();
15308 }
15309
15310 // when the dest drains, it reduces the awaitDrain counter
15311 // on the source. This would be more elegant with a .once()
15312 // handler in flow(), but adding and removing repeatedly is
15313 // too slow.
15314 var ondrain = pipeOnDrain(src);
15315 dest.on('drain', ondrain);
15316
15317 var cleanedUp = false;
15318 function cleanup() {
15319 debug('cleanup');
15320 // cleanup event handlers once the pipe is broken
15321 dest.removeListener('close', onclose);
15322 dest.removeListener('finish', onfinish);
15323 dest.removeListener('drain', ondrain);
15324 dest.removeListener('error', onerror);
15325 dest.removeListener('unpipe', onunpipe);
15326 src.removeListener('end', onend);
15327 src.removeListener('end', unpipe);
15328 src.removeListener('data', ondata);
15329
15330 cleanedUp = true;
15331
15332 // if the reader is waiting for a drain event from this
15333 // specific writer, then it would cause it to never start
15334 // flowing again.
15335 // So, if this is awaiting a drain, then we just call it now.
15336 // If we don't know, then assume that we are waiting for one.
15337 if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
15338 }
15339
15340 // If the user pushes more data while we're writing to dest then we'll end up
15341 // in ondata again. However, we only want to increase awaitDrain once because
15342 // dest will only emit one 'drain' event for the multiple writes.
15343 // => Introduce a guard on increasing awaitDrain.
15344 var increasedAwaitDrain = false;
15345 src.on('data', ondata);
15346 function ondata(chunk) {
15347 debug('ondata');
15348 increasedAwaitDrain = false;
15349 var ret = dest.write(chunk);
15350 if (false === ret && !increasedAwaitDrain) {
15351 // If the user unpiped during `dest.write()`, it is possible
15352 // to get stuck in a permanently paused state if that write
15353 // also returned false.
15354 // => Check whether `dest` is still a piping destination.
15355 if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
15356 debug('false write response, pause', src._readableState.awaitDrain);
15357 src._readableState.awaitDrain++;
15358 increasedAwaitDrain = true;
15359 }
15360 src.pause();
15361 }
15362 }
15363
15364 // if the dest has an error, then stop piping into it.
15365 // however, don't suppress the throwing behavior for this.
15366 function onerror(er) {
15367 debug('onerror', er);
15368 unpipe();
15369 dest.removeListener('error', onerror);
15370 if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
15371 }
15372
15373 // Make sure our error handler is attached before userland ones.
15374 prependListener(dest, 'error', onerror);
15375
15376 // Both close and finish should trigger unpipe, but only once.
15377 function onclose() {
15378 dest.removeListener('finish', onfinish);
15379 unpipe();
15380 }
15381 dest.once('close', onclose);
15382 function onfinish() {
15383 debug('onfinish');
15384 dest.removeListener('close', onclose);
15385 unpipe();
15386 }
15387 dest.once('finish', onfinish);
15388
15389 function unpipe() {
15390 debug('unpipe');
15391 src.unpipe(dest);
15392 }
15393
15394 // tell the dest that it's being piped to
15395 dest.emit('pipe', src);
15396
15397 // start the flow if it hasn't been started already.
15398 if (!state.flowing) {
15399 debug('pipe resume');
15400 src.resume();
15401 }
15402
15403 return dest;
15404};
15405
15406function pipeOnDrain(src) {
15407 return function () {
15408 var state = src._readableState;
15409 debug('pipeOnDrain', state.awaitDrain);
15410 if (state.awaitDrain) state.awaitDrain--;
15411 if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
15412 state.flowing = true;
15413 flow(src);
15414 }
15415 };
15416}
15417
15418Readable.prototype.unpipe = function (dest) {
15419 var state = this._readableState;
15420 var unpipeInfo = { hasUnpiped: false };
15421
15422 // if we're not piping anywhere, then do nothing.
15423 if (state.pipesCount === 0) return this;
15424
15425 // just one destination. most common case.
15426 if (state.pipesCount === 1) {
15427 // passed in one, but it's not the right one.
15428 if (dest && dest !== state.pipes) return this;
15429
15430 if (!dest) dest = state.pipes;
15431
15432 // got a match.
15433 state.pipes = null;
15434 state.pipesCount = 0;
15435 state.flowing = false;
15436 if (dest) dest.emit('unpipe', this, unpipeInfo);
15437 return this;
15438 }
15439
15440 // slow case. multiple pipe destinations.
15441
15442 if (!dest) {
15443 // remove all.
15444 var dests = state.pipes;
15445 var len = state.pipesCount;
15446 state.pipes = null;
15447 state.pipesCount = 0;
15448 state.flowing = false;
15449
15450 for (var i = 0; i < len; i++) {
15451 dests[i].emit('unpipe', this, unpipeInfo);
15452 }return this;
15453 }
15454
15455 // try to find the right one.
15456 var index = indexOf(state.pipes, dest);
15457 if (index === -1) return this;
15458
15459 state.pipes.splice(index, 1);
15460 state.pipesCount -= 1;
15461 if (state.pipesCount === 1) state.pipes = state.pipes[0];
15462
15463 dest.emit('unpipe', this, unpipeInfo);
15464
15465 return this;
15466};
15467
15468// set up data events if they are asked for
15469// Ensure readable listeners eventually get something
15470Readable.prototype.on = function (ev, fn) {
15471 var res = Stream.prototype.on.call(this, ev, fn);
15472
15473 if (ev === 'data') {
15474 // Start flowing on next tick if stream isn't explicitly paused
15475 if (this._readableState.flowing !== false) this.resume();
15476 } else if (ev === 'readable') {
15477 var state = this._readableState;
15478 if (!state.endEmitted && !state.readableListening) {
15479 state.readableListening = state.needReadable = true;
15480 state.emittedReadable = false;
15481 if (!state.reading) {
15482 pna.nextTick(nReadingNextTick, this);
15483 } else if (state.length) {
15484 emitReadable(this);
15485 }
15486 }
15487 }
15488
15489 return res;
15490};
15491Readable.prototype.addListener = Readable.prototype.on;
15492
15493function nReadingNextTick(self) {
15494 debug('readable nexttick read 0');
15495 self.read(0);
15496}
15497
15498// pause() and resume() are remnants of the legacy readable stream API
15499// If the user uses them, then switch into old mode.
15500Readable.prototype.resume = function () {
15501 var state = this._readableState;
15502 if (!state.flowing) {
15503 debug('resume');
15504 state.flowing = true;
15505 resume(this, state);
15506 }
15507 return this;
15508};
15509
15510function resume(stream, state) {
15511 if (!state.resumeScheduled) {
15512 state.resumeScheduled = true;
15513 pna.nextTick(resume_, stream, state);
15514 }
15515}
15516
15517function resume_(stream, state) {
15518 if (!state.reading) {
15519 debug('resume read 0');
15520 stream.read(0);
15521 }
15522
15523 state.resumeScheduled = false;
15524 state.awaitDrain = 0;
15525 stream.emit('resume');
15526 flow(stream);
15527 if (state.flowing && !state.reading) stream.read(0);
15528}
15529
15530Readable.prototype.pause = function () {
15531 debug('call pause flowing=%j', this._readableState.flowing);
15532 if (false !== this._readableState.flowing) {
15533 debug('pause');
15534 this._readableState.flowing = false;
15535 this.emit('pause');
15536 }
15537 return this;
15538};
15539
15540function flow(stream) {
15541 var state = stream._readableState;
15542 debug('flow', state.flowing);
15543 while (state.flowing && stream.read() !== null) {}
15544}
15545
15546// wrap an old-style stream as the async data source.
15547// This is *not* part of the readable stream interface.
15548// It is an ugly unfortunate mess of history.
15549Readable.prototype.wrap = function (stream) {
15550 var _this = this;
15551
15552 var state = this._readableState;
15553 var paused = false;
15554
15555 stream.on('end', function () {
15556 debug('wrapped end');
15557 if (state.decoder && !state.ended) {
15558 var chunk = state.decoder.end();
15559 if (chunk && chunk.length) _this.push(chunk);
15560 }
15561
15562 _this.push(null);
15563 });
15564
15565 stream.on('data', function (chunk) {
15566 debug('wrapped data');
15567 if (state.decoder) chunk = state.decoder.write(chunk);
15568
15569 // don't skip over falsy values in objectMode
15570 if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
15571
15572 var ret = _this.push(chunk);
15573 if (!ret) {
15574 paused = true;
15575 stream.pause();
15576 }
15577 });
15578
15579 // proxy all the other methods.
15580 // important when wrapping filters and duplexes.
15581 for (var i in stream) {
15582 if (this[i] === undefined && typeof stream[i] === 'function') {
15583 this[i] = function (method) {
15584 return function () {
15585 return stream[method].apply(stream, arguments);
15586 };
15587 }(i);
15588 }
15589 }
15590
15591 // proxy certain important events.
15592 for (var n = 0; n < kProxyEvents.length; n++) {
15593 stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
15594 }
15595
15596 // when we try to consume some more bytes, simply unpause the
15597 // underlying stream.
15598 this._read = function (n) {
15599 debug('wrapped _read', n);
15600 if (paused) {
15601 paused = false;
15602 stream.resume();
15603 }
15604 };
15605
15606 return this;
15607};
15608
15609Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
15610 // making it explicit this property is not enumerable
15611 // because otherwise some prototype manipulation in
15612 // userland will fail
15613 enumerable: false,
15614 get: function () {
15615 return this._readableState.highWaterMark;
15616 }
15617});
15618
15619// exposed for testing purposes only.
15620Readable._fromList = fromList;
15621
15622// Pluck off n bytes from an array of buffers.
15623// Length is the combined lengths of all the buffers in the list.
15624// This function is designed to be inlinable, so please take care when making
15625// changes to the function body.
15626function fromList(n, state) {
15627 // nothing buffered
15628 if (state.length === 0) return null;
15629
15630 var ret;
15631 if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
15632 // read it all, truncate the list
15633 if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
15634 state.buffer.clear();
15635 } else {
15636 // read part of list
15637 ret = fromListPartial(n, state.buffer, state.decoder);
15638 }
15639
15640 return ret;
15641}
15642
15643// Extracts only enough buffered data to satisfy the amount requested.
15644// This function is designed to be inlinable, so please take care when making
15645// changes to the function body.
15646function fromListPartial(n, list, hasStrings) {
15647 var ret;
15648 if (n < list.head.data.length) {
15649 // slice is the same for buffers and strings
15650 ret = list.head.data.slice(0, n);
15651 list.head.data = list.head.data.slice(n);
15652 } else if (n === list.head.data.length) {
15653 // first chunk is a perfect match
15654 ret = list.shift();
15655 } else {
15656 // result spans more than one buffer
15657 ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
15658 }
15659 return ret;
15660}
15661
15662// Copies a specified amount of characters from the list of buffered data
15663// chunks.
15664// This function is designed to be inlinable, so please take care when making
15665// changes to the function body.
15666function copyFromBufferString(n, list) {
15667 var p = list.head;
15668 var c = 1;
15669 var ret = p.data;
15670 n -= ret.length;
15671 while (p = p.next) {
15672 var str = p.data;
15673 var nb = n > str.length ? str.length : n;
15674 if (nb === str.length) ret += str;else ret += str.slice(0, n);
15675 n -= nb;
15676 if (n === 0) {
15677 if (nb === str.length) {
15678 ++c;
15679 if (p.next) list.head = p.next;else list.head = list.tail = null;
15680 } else {
15681 list.head = p;
15682 p.data = str.slice(nb);
15683 }
15684 break;
15685 }
15686 ++c;
15687 }
15688 list.length -= c;
15689 return ret;
15690}
15691
15692// Copies a specified amount of bytes from the list of buffered data chunks.
15693// This function is designed to be inlinable, so please take care when making
15694// changes to the function body.
15695function copyFromBuffer(n, list) {
15696 var ret = Buffer.allocUnsafe(n);
15697 var p = list.head;
15698 var c = 1;
15699 p.data.copy(ret);
15700 n -= p.data.length;
15701 while (p = p.next) {
15702 var buf = p.data;
15703 var nb = n > buf.length ? buf.length : n;
15704 buf.copy(ret, ret.length - n, 0, nb);
15705 n -= nb;
15706 if (n === 0) {
15707 if (nb === buf.length) {
15708 ++c;
15709 if (p.next) list.head = p.next;else list.head = list.tail = null;
15710 } else {
15711 list.head = p;
15712 p.data = buf.slice(nb);
15713 }
15714 break;
15715 }
15716 ++c;
15717 }
15718 list.length -= c;
15719 return ret;
15720}
15721
15722function endReadable(stream) {
15723 var state = stream._readableState;
15724
15725 // If we get here before consuming all the bytes, then that is a
15726 // bug in node. Should never happen.
15727 if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
15728
15729 if (!state.endEmitted) {
15730 state.ended = true;
15731 pna.nextTick(endReadableNT, state, stream);
15732 }
15733}
15734
15735function endReadableNT(state, stream) {
15736 // Check that we didn't get one last unshift.
15737 if (!state.endEmitted && state.length === 0) {
15738 state.endEmitted = true;
15739 stream.readable = false;
15740 stream.emit('end');
15741 }
15742}
15743
15744function indexOf(xs, x) {
15745 for (var i = 0, l = xs.length; i < l; i++) {
15746 if (xs[i] === x) return i;
15747 }
15748 return -1;
15749}
15750}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
15751},{"./_stream_duplex":71,"./internal/streams/BufferList":76,"./internal/streams/destroy":77,"./internal/streams/stream":78,"_process":69,"core-util-is":44,"events":50,"inherits":56,"isarray":58,"process-nextick-args":68,"safe-buffer":83,"string_decoder/":85,"util":40}],74:[function(require,module,exports){
15752// Copyright Joyent, Inc. and other Node contributors.
15753//
15754// Permission is hereby granted, free of charge, to any person obtaining a
15755// copy of this software and associated documentation files (the
15756// "Software"), to deal in the Software without restriction, including
15757// without limitation the rights to use, copy, modify, merge, publish,
15758// distribute, sublicense, and/or sell copies of the Software, and to permit
15759// persons to whom the Software is furnished to do so, subject to the
15760// following conditions:
15761//
15762// The above copyright notice and this permission notice shall be included
15763// in all copies or substantial portions of the Software.
15764//
15765// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15766// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15767// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
15768// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
15769// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
15770// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
15771// USE OR OTHER DEALINGS IN THE SOFTWARE.
15772
15773// a transform stream is a readable/writable stream where you do
15774// something with the data. Sometimes it's called a "filter",
15775// but that's not a great name for it, since that implies a thing where
15776// some bits pass through, and others are simply ignored. (That would
15777// be a valid example of a transform, of course.)
15778//
15779// While the output is causally related to the input, it's not a
15780// necessarily symmetric or synchronous transformation. For example,
15781// a zlib stream might take multiple plain-text writes(), and then
15782// emit a single compressed chunk some time in the future.
15783//
15784// Here's how this works:
15785//
15786// The Transform stream has all the aspects of the readable and writable
15787// stream classes. When you write(chunk), that calls _write(chunk,cb)
15788// internally, and returns false if there's a lot of pending writes
15789// buffered up. When you call read(), that calls _read(n) until
15790// there's enough pending readable data buffered up.
15791//
15792// In a transform stream, the written data is placed in a buffer. When
15793// _read(n) is called, it transforms the queued up data, calling the
15794// buffered _write cb's as it consumes chunks. If consuming a single
15795// written chunk would result in multiple output chunks, then the first
15796// outputted bit calls the readcb, and subsequent chunks just go into
15797// the read buffer, and will cause it to emit 'readable' if necessary.
15798//
15799// This way, back-pressure is actually determined by the reading side,
15800// since _read has to be called to start processing a new chunk. However,
15801// a pathological inflate type of transform can cause excessive buffering
15802// here. For example, imagine a stream where every byte of input is
15803// interpreted as an integer from 0-255, and then results in that many
15804// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
15805// 1kb of data being output. In this case, you could write a very small
15806// amount of input, and end up with a very large amount of output. In
15807// such a pathological inflating mechanism, there'd be no way to tell
15808// the system to stop doing the transform. A single 4MB write could
15809// cause the system to run out of memory.
15810//
15811// However, even in such a pathological case, only a single written chunk
15812// would be consumed, and then the rest would wait (un-transformed) until
15813// the results of the previous transformed chunk were consumed.
15814
15815'use strict';
15816
15817module.exports = Transform;
15818
15819var Duplex = require('./_stream_duplex');
15820
15821/*<replacement>*/
15822var util = require('core-util-is');
15823util.inherits = require('inherits');
15824/*</replacement>*/
15825
15826util.inherits(Transform, Duplex);
15827
15828function afterTransform(er, data) {
15829 var ts = this._transformState;
15830 ts.transforming = false;
15831
15832 var cb = ts.writecb;
15833
15834 if (!cb) {
15835 return this.emit('error', new Error('write callback called multiple times'));
15836 }
15837
15838 ts.writechunk = null;
15839 ts.writecb = null;
15840
15841 if (data != null) // single equals check for both `null` and `undefined`
15842 this.push(data);
15843
15844 cb(er);
15845
15846 var rs = this._readableState;
15847 rs.reading = false;
15848 if (rs.needReadable || rs.length < rs.highWaterMark) {
15849 this._read(rs.highWaterMark);
15850 }
15851}
15852
15853function Transform(options) {
15854 if (!(this instanceof Transform)) return new Transform(options);
15855
15856 Duplex.call(this, options);
15857
15858 this._transformState = {
15859 afterTransform: afterTransform.bind(this),
15860 needTransform: false,
15861 transforming: false,
15862 writecb: null,
15863 writechunk: null,
15864 writeencoding: null
15865 };
15866
15867 // start out asking for a readable event once data is transformed.
15868 this._readableState.needReadable = true;
15869
15870 // we have implemented the _read method, and done the other things
15871 // that Readable wants before the first _read call, so unset the
15872 // sync guard flag.
15873 this._readableState.sync = false;
15874
15875 if (options) {
15876 if (typeof options.transform === 'function') this._transform = options.transform;
15877
15878 if (typeof options.flush === 'function') this._flush = options.flush;
15879 }
15880
15881 // When the writable side finishes, then flush out anything remaining.
15882 this.on('prefinish', prefinish);
15883}
15884
15885function prefinish() {
15886 var _this = this;
15887
15888 if (typeof this._flush === 'function') {
15889 this._flush(function (er, data) {
15890 done(_this, er, data);
15891 });
15892 } else {
15893 done(this, null, null);
15894 }
15895}
15896
15897Transform.prototype.push = function (chunk, encoding) {
15898 this._transformState.needTransform = false;
15899 return Duplex.prototype.push.call(this, chunk, encoding);
15900};
15901
15902// This is the part where you do stuff!
15903// override this function in implementation classes.
15904// 'chunk' is an input chunk.
15905//
15906// Call `push(newChunk)` to pass along transformed output
15907// to the readable side. You may call 'push' zero or more times.
15908//
15909// Call `cb(err)` when you are done with this chunk. If you pass
15910// an error, then that'll put the hurt on the whole operation. If you
15911// never call cb(), then you'll never get another chunk.
15912Transform.prototype._transform = function (chunk, encoding, cb) {
15913 throw new Error('_transform() is not implemented');
15914};
15915
15916Transform.prototype._write = function (chunk, encoding, cb) {
15917 var ts = this._transformState;
15918 ts.writecb = cb;
15919 ts.writechunk = chunk;
15920 ts.writeencoding = encoding;
15921 if (!ts.transforming) {
15922 var rs = this._readableState;
15923 if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
15924 }
15925};
15926
15927// Doesn't matter what the args are here.
15928// _transform does all the work.
15929// That we got here means that the readable side wants more data.
15930Transform.prototype._read = function (n) {
15931 var ts = this._transformState;
15932
15933 if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
15934 ts.transforming = true;
15935 this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
15936 } else {
15937 // mark that we need a transform, so that any data that comes in
15938 // will get processed, now that we've asked for it.
15939 ts.needTransform = true;
15940 }
15941};
15942
15943Transform.prototype._destroy = function (err, cb) {
15944 var _this2 = this;
15945
15946 Duplex.prototype._destroy.call(this, err, function (err2) {
15947 cb(err2);
15948 _this2.emit('close');
15949 });
15950};
15951
15952function done(stream, er, data) {
15953 if (er) return stream.emit('error', er);
15954
15955 if (data != null) // single equals check for both `null` and `undefined`
15956 stream.push(data);
15957
15958 // if there's nothing in the write buffer, then that means
15959 // that nothing more will ever be provided
15960 if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
15961
15962 if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
15963
15964 return stream.push(null);
15965}
15966},{"./_stream_duplex":71,"core-util-is":44,"inherits":56}],75:[function(require,module,exports){
15967(function (process,global,setImmediate){
15968// Copyright Joyent, Inc. and other Node contributors.
15969//
15970// Permission is hereby granted, free of charge, to any person obtaining a
15971// copy of this software and associated documentation files (the
15972// "Software"), to deal in the Software without restriction, including
15973// without limitation the rights to use, copy, modify, merge, publish,
15974// distribute, sublicense, and/or sell copies of the Software, and to permit
15975// persons to whom the Software is furnished to do so, subject to the
15976// following conditions:
15977//
15978// The above copyright notice and this permission notice shall be included
15979// in all copies or substantial portions of the Software.
15980//
15981// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15982// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15983// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
15984// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
15985// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
15986// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
15987// USE OR OTHER DEALINGS IN THE SOFTWARE.
15988
15989// A bit simpler than readable streams.
15990// Implement an async ._write(chunk, encoding, cb), and it'll handle all
15991// the drain event emission and buffering.
15992
15993'use strict';
15994
15995/*<replacement>*/
15996
15997var pna = require('process-nextick-args');
15998/*</replacement>*/
15999
16000module.exports = Writable;
16001
16002/* <replacement> */
16003function WriteReq(chunk, encoding, cb) {
16004 this.chunk = chunk;
16005 this.encoding = encoding;
16006 this.callback = cb;
16007 this.next = null;
16008}
16009
16010// It seems a linked list but it is not
16011// there will be only 2 of these for each stream
16012function CorkedRequest(state) {
16013 var _this = this;
16014
16015 this.next = null;
16016 this.entry = null;
16017 this.finish = function () {
16018 onCorkedFinish(_this, state);
16019 };
16020}
16021/* </replacement> */
16022
16023/*<replacement>*/
16024var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
16025/*</replacement>*/
16026
16027/*<replacement>*/
16028var Duplex;
16029/*</replacement>*/
16030
16031Writable.WritableState = WritableState;
16032
16033/*<replacement>*/
16034var util = require('core-util-is');
16035util.inherits = require('inherits');
16036/*</replacement>*/
16037
16038/*<replacement>*/
16039var internalUtil = {
16040 deprecate: require('util-deprecate')
16041};
16042/*</replacement>*/
16043
16044/*<replacement>*/
16045var Stream = require('./internal/streams/stream');
16046/*</replacement>*/
16047
16048/*<replacement>*/
16049
16050var Buffer = require('safe-buffer').Buffer;
16051var OurUint8Array = global.Uint8Array || function () {};
16052function _uint8ArrayToBuffer(chunk) {
16053 return Buffer.from(chunk);
16054}
16055function _isUint8Array(obj) {
16056 return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
16057}
16058
16059/*</replacement>*/
16060
16061var destroyImpl = require('./internal/streams/destroy');
16062
16063util.inherits(Writable, Stream);
16064
16065function nop() {}
16066
16067function WritableState(options, stream) {
16068 Duplex = Duplex || require('./_stream_duplex');
16069
16070 options = options || {};
16071
16072 // Duplex streams are both readable and writable, but share
16073 // the same options object.
16074 // However, some cases require setting options to different
16075 // values for the readable and the writable sides of the duplex stream.
16076 // These options can be provided separately as readableXXX and writableXXX.
16077 var isDuplex = stream instanceof Duplex;
16078
16079 // object stream flag to indicate whether or not this stream
16080 // contains buffers or objects.
16081 this.objectMode = !!options.objectMode;
16082
16083 if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
16084
16085 // the point at which write() starts returning false
16086 // Note: 0 is a valid value, means that we always return false if
16087 // the entire buffer is not flushed immediately on write()
16088 var hwm = options.highWaterMark;
16089 var writableHwm = options.writableHighWaterMark;
16090 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
16091
16092 if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
16093
16094 // cast to ints.
16095 this.highWaterMark = Math.floor(this.highWaterMark);
16096
16097 // if _final has been called
16098 this.finalCalled = false;
16099
16100 // drain event flag.
16101 this.needDrain = false;
16102 // at the start of calling end()
16103 this.ending = false;
16104 // when end() has been called, and returned
16105 this.ended = false;
16106 // when 'finish' is emitted
16107 this.finished = false;
16108
16109 // has it been destroyed
16110 this.destroyed = false;
16111
16112 // should we decode strings into buffers before passing to _write?
16113 // this is here so that some node-core streams can optimize string
16114 // handling at a lower level.
16115 var noDecode = options.decodeStrings === false;
16116 this.decodeStrings = !noDecode;
16117
16118 // Crypto is kind of old and crusty. Historically, its default string
16119 // encoding is 'binary' so we have to make this configurable.
16120 // Everything else in the universe uses 'utf8', though.
16121 this.defaultEncoding = options.defaultEncoding || 'utf8';
16122
16123 // not an actual buffer we keep track of, but a measurement
16124 // of how much we're waiting to get pushed to some underlying
16125 // socket or file.
16126 this.length = 0;
16127
16128 // a flag to see when we're in the middle of a write.
16129 this.writing = false;
16130
16131 // when true all writes will be buffered until .uncork() call
16132 this.corked = 0;
16133
16134 // a flag to be able to tell if the onwrite cb is called immediately,
16135 // or on a later tick. We set this to true at first, because any
16136 // actions that shouldn't happen until "later" should generally also
16137 // not happen before the first write call.
16138 this.sync = true;
16139
16140 // a flag to know if we're processing previously buffered items, which
16141 // may call the _write() callback in the same tick, so that we don't
16142 // end up in an overlapped onwrite situation.
16143 this.bufferProcessing = false;
16144
16145 // the callback that's passed to _write(chunk,cb)
16146 this.onwrite = function (er) {
16147 onwrite(stream, er);
16148 };
16149
16150 // the callback that the user supplies to write(chunk,encoding,cb)
16151 this.writecb = null;
16152
16153 // the amount that is being written when _write is called.
16154 this.writelen = 0;
16155
16156 this.bufferedRequest = null;
16157 this.lastBufferedRequest = null;
16158
16159 // number of pending user-supplied write callbacks
16160 // this must be 0 before 'finish' can be emitted
16161 this.pendingcb = 0;
16162
16163 // emit prefinish if the only thing we're waiting for is _write cbs
16164 // This is relevant for synchronous Transform streams
16165 this.prefinished = false;
16166
16167 // True if the error was already emitted and should not be thrown again
16168 this.errorEmitted = false;
16169
16170 // count buffered requests
16171 this.bufferedRequestCount = 0;
16172
16173 // allocate the first CorkedRequest, there is always
16174 // one allocated and free to use, and we maintain at most two
16175 this.corkedRequestsFree = new CorkedRequest(this);
16176}
16177
16178WritableState.prototype.getBuffer = function getBuffer() {
16179 var current = this.bufferedRequest;
16180 var out = [];
16181 while (current) {
16182 out.push(current);
16183 current = current.next;
16184 }
16185 return out;
16186};
16187
16188(function () {
16189 try {
16190 Object.defineProperty(WritableState.prototype, 'buffer', {
16191 get: internalUtil.deprecate(function () {
16192 return this.getBuffer();
16193 }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
16194 });
16195 } catch (_) {}
16196})();
16197
16198// Test _writableState for inheritance to account for Duplex streams,
16199// whose prototype chain only points to Readable.
16200var realHasInstance;
16201if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
16202 realHasInstance = Function.prototype[Symbol.hasInstance];
16203 Object.defineProperty(Writable, Symbol.hasInstance, {
16204 value: function (object) {
16205 if (realHasInstance.call(this, object)) return true;
16206 if (this !== Writable) return false;
16207
16208 return object && object._writableState instanceof WritableState;
16209 }
16210 });
16211} else {
16212 realHasInstance = function (object) {
16213 return object instanceof this;
16214 };
16215}
16216
16217function Writable(options) {
16218 Duplex = Duplex || require('./_stream_duplex');
16219
16220 // Writable ctor is applied to Duplexes, too.
16221 // `realHasInstance` is necessary because using plain `instanceof`
16222 // would return false, as no `_writableState` property is attached.
16223
16224 // Trying to use the custom `instanceof` for Writable here will also break the
16225 // Node.js LazyTransform implementation, which has a non-trivial getter for
16226 // `_writableState` that would lead to infinite recursion.
16227 if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
16228 return new Writable(options);
16229 }
16230
16231 this._writableState = new WritableState(options, this);
16232
16233 // legacy.
16234 this.writable = true;
16235
16236 if (options) {
16237 if (typeof options.write === 'function') this._write = options.write;
16238
16239 if (typeof options.writev === 'function') this._writev = options.writev;
16240
16241 if (typeof options.destroy === 'function') this._destroy = options.destroy;
16242
16243 if (typeof options.final === 'function') this._final = options.final;
16244 }
16245
16246 Stream.call(this);
16247}
16248
16249// Otherwise people can pipe Writable streams, which is just wrong.
16250Writable.prototype.pipe = function () {
16251 this.emit('error', new Error('Cannot pipe, not readable'));
16252};
16253
16254function writeAfterEnd(stream, cb) {
16255 var er = new Error('write after end');
16256 // TODO: defer error events consistently everywhere, not just the cb
16257 stream.emit('error', er);
16258 pna.nextTick(cb, er);
16259}
16260
16261// Checks that a user-supplied chunk is valid, especially for the particular
16262// mode the stream is in. Currently this means that `null` is never accepted
16263// and undefined/non-string values are only allowed in object mode.
16264function validChunk(stream, state, chunk, cb) {
16265 var valid = true;
16266 var er = false;
16267
16268 if (chunk === null) {
16269 er = new TypeError('May not write null values to stream');
16270 } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
16271 er = new TypeError('Invalid non-string/buffer chunk');
16272 }
16273 if (er) {
16274 stream.emit('error', er);
16275 pna.nextTick(cb, er);
16276 valid = false;
16277 }
16278 return valid;
16279}
16280
16281Writable.prototype.write = function (chunk, encoding, cb) {
16282 var state = this._writableState;
16283 var ret = false;
16284 var isBuf = !state.objectMode && _isUint8Array(chunk);
16285
16286 if (isBuf && !Buffer.isBuffer(chunk)) {
16287 chunk = _uint8ArrayToBuffer(chunk);
16288 }
16289
16290 if (typeof encoding === 'function') {
16291 cb = encoding;
16292 encoding = null;
16293 }
16294
16295 if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
16296
16297 if (typeof cb !== 'function') cb = nop;
16298
16299 if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
16300 state.pendingcb++;
16301 ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
16302 }
16303
16304 return ret;
16305};
16306
16307Writable.prototype.cork = function () {
16308 var state = this._writableState;
16309
16310 state.corked++;
16311};
16312
16313Writable.prototype.uncork = function () {
16314 var state = this._writableState;
16315
16316 if (state.corked) {
16317 state.corked--;
16318
16319 if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
16320 }
16321};
16322
16323Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
16324 // node::ParseEncoding() requires lower case.
16325 if (typeof encoding === 'string') encoding = encoding.toLowerCase();
16326 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);
16327 this._writableState.defaultEncoding = encoding;
16328 return this;
16329};
16330
16331function decodeChunk(state, chunk, encoding) {
16332 if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
16333 chunk = Buffer.from(chunk, encoding);
16334 }
16335 return chunk;
16336}
16337
16338Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
16339 // making it explicit this property is not enumerable
16340 // because otherwise some prototype manipulation in
16341 // userland will fail
16342 enumerable: false,
16343 get: function () {
16344 return this._writableState.highWaterMark;
16345 }
16346});
16347
16348// if we're already writing something, then just put this
16349// in the queue, and wait our turn. Otherwise, call _write
16350// If we return false, then we need a drain event, so set that flag.
16351function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
16352 if (!isBuf) {
16353 var newChunk = decodeChunk(state, chunk, encoding);
16354 if (chunk !== newChunk) {
16355 isBuf = true;
16356 encoding = 'buffer';
16357 chunk = newChunk;
16358 }
16359 }
16360 var len = state.objectMode ? 1 : chunk.length;
16361
16362 state.length += len;
16363
16364 var ret = state.length < state.highWaterMark;
16365 // we must ensure that previous needDrain will not be reset to false.
16366 if (!ret) state.needDrain = true;
16367
16368 if (state.writing || state.corked) {
16369 var last = state.lastBufferedRequest;
16370 state.lastBufferedRequest = {
16371 chunk: chunk,
16372 encoding: encoding,
16373 isBuf: isBuf,
16374 callback: cb,
16375 next: null
16376 };
16377 if (last) {
16378 last.next = state.lastBufferedRequest;
16379 } else {
16380 state.bufferedRequest = state.lastBufferedRequest;
16381 }
16382 state.bufferedRequestCount += 1;
16383 } else {
16384 doWrite(stream, state, false, len, chunk, encoding, cb);
16385 }
16386
16387 return ret;
16388}
16389
16390function doWrite(stream, state, writev, len, chunk, encoding, cb) {
16391 state.writelen = len;
16392 state.writecb = cb;
16393 state.writing = true;
16394 state.sync = true;
16395 if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
16396 state.sync = false;
16397}
16398
16399function onwriteError(stream, state, sync, er, cb) {
16400 --state.pendingcb;
16401
16402 if (sync) {
16403 // defer the callback if we are being called synchronously
16404 // to avoid piling up things on the stack
16405 pna.nextTick(cb, er);
16406 // this can emit finish, and it will always happen
16407 // after error
16408 pna.nextTick(finishMaybe, stream, state);
16409 stream._writableState.errorEmitted = true;
16410 stream.emit('error', er);
16411 } else {
16412 // the caller expect this to happen before if
16413 // it is async
16414 cb(er);
16415 stream._writableState.errorEmitted = true;
16416 stream.emit('error', er);
16417 // this can emit finish, but finish must
16418 // always follow error
16419 finishMaybe(stream, state);
16420 }
16421}
16422
16423function onwriteStateUpdate(state) {
16424 state.writing = false;
16425 state.writecb = null;
16426 state.length -= state.writelen;
16427 state.writelen = 0;
16428}
16429
16430function onwrite(stream, er) {
16431 var state = stream._writableState;
16432 var sync = state.sync;
16433 var cb = state.writecb;
16434
16435 onwriteStateUpdate(state);
16436
16437 if (er) onwriteError(stream, state, sync, er, cb);else {
16438 // Check if we're actually ready to finish, but don't emit yet
16439 var finished = needFinish(state);
16440
16441 if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
16442 clearBuffer(stream, state);
16443 }
16444
16445 if (sync) {
16446 /*<replacement>*/
16447 asyncWrite(afterWrite, stream, state, finished, cb);
16448 /*</replacement>*/
16449 } else {
16450 afterWrite(stream, state, finished, cb);
16451 }
16452 }
16453}
16454
16455function afterWrite(stream, state, finished, cb) {
16456 if (!finished) onwriteDrain(stream, state);
16457 state.pendingcb--;
16458 cb();
16459 finishMaybe(stream, state);
16460}
16461
16462// Must force callback to be called on nextTick, so that we don't
16463// emit 'drain' before the write() consumer gets the 'false' return
16464// value, and has a chance to attach a 'drain' listener.
16465function onwriteDrain(stream, state) {
16466 if (state.length === 0 && state.needDrain) {
16467 state.needDrain = false;
16468 stream.emit('drain');
16469 }
16470}
16471
16472// if there's something in the buffer waiting, then process it
16473function clearBuffer(stream, state) {
16474 state.bufferProcessing = true;
16475 var entry = state.bufferedRequest;
16476
16477 if (stream._writev && entry && entry.next) {
16478 // Fast case, write everything using _writev()
16479 var l = state.bufferedRequestCount;
16480 var buffer = new Array(l);
16481 var holder = state.corkedRequestsFree;
16482 holder.entry = entry;
16483
16484 var count = 0;
16485 var allBuffers = true;
16486 while (entry) {
16487 buffer[count] = entry;
16488 if (!entry.isBuf) allBuffers = false;
16489 entry = entry.next;
16490 count += 1;
16491 }
16492 buffer.allBuffers = allBuffers;
16493
16494 doWrite(stream, state, true, state.length, buffer, '', holder.finish);
16495
16496 // doWrite is almost always async, defer these to save a bit of time
16497 // as the hot path ends with doWrite
16498 state.pendingcb++;
16499 state.lastBufferedRequest = null;
16500 if (holder.next) {
16501 state.corkedRequestsFree = holder.next;
16502 holder.next = null;
16503 } else {
16504 state.corkedRequestsFree = new CorkedRequest(state);
16505 }
16506 state.bufferedRequestCount = 0;
16507 } else {
16508 // Slow case, write chunks one-by-one
16509 while (entry) {
16510 var chunk = entry.chunk;
16511 var encoding = entry.encoding;
16512 var cb = entry.callback;
16513 var len = state.objectMode ? 1 : chunk.length;
16514
16515 doWrite(stream, state, false, len, chunk, encoding, cb);
16516 entry = entry.next;
16517 state.bufferedRequestCount--;
16518 // if we didn't call the onwrite immediately, then
16519 // it means that we need to wait until it does.
16520 // also, that means that the chunk and cb are currently
16521 // being processed, so move the buffer counter past them.
16522 if (state.writing) {
16523 break;
16524 }
16525 }
16526
16527 if (entry === null) state.lastBufferedRequest = null;
16528 }
16529
16530 state.bufferedRequest = entry;
16531 state.bufferProcessing = false;
16532}
16533
16534Writable.prototype._write = function (chunk, encoding, cb) {
16535 cb(new Error('_write() is not implemented'));
16536};
16537
16538Writable.prototype._writev = null;
16539
16540Writable.prototype.end = function (chunk, encoding, cb) {
16541 var state = this._writableState;
16542
16543 if (typeof chunk === 'function') {
16544 cb = chunk;
16545 chunk = null;
16546 encoding = null;
16547 } else if (typeof encoding === 'function') {
16548 cb = encoding;
16549 encoding = null;
16550 }
16551
16552 if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
16553
16554 // .end() fully uncorks
16555 if (state.corked) {
16556 state.corked = 1;
16557 this.uncork();
16558 }
16559
16560 // ignore unnecessary end() calls.
16561 if (!state.ending && !state.finished) endWritable(this, state, cb);
16562};
16563
16564function needFinish(state) {
16565 return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
16566}
16567function callFinal(stream, state) {
16568 stream._final(function (err) {
16569 state.pendingcb--;
16570 if (err) {
16571 stream.emit('error', err);
16572 }
16573 state.prefinished = true;
16574 stream.emit('prefinish');
16575 finishMaybe(stream, state);
16576 });
16577}
16578function prefinish(stream, state) {
16579 if (!state.prefinished && !state.finalCalled) {
16580 if (typeof stream._final === 'function') {
16581 state.pendingcb++;
16582 state.finalCalled = true;
16583 pna.nextTick(callFinal, stream, state);
16584 } else {
16585 state.prefinished = true;
16586 stream.emit('prefinish');
16587 }
16588 }
16589}
16590
16591function finishMaybe(stream, state) {
16592 var need = needFinish(state);
16593 if (need) {
16594 prefinish(stream, state);
16595 if (state.pendingcb === 0) {
16596 state.finished = true;
16597 stream.emit('finish');
16598 }
16599 }
16600 return need;
16601}
16602
16603function endWritable(stream, state, cb) {
16604 state.ending = true;
16605 finishMaybe(stream, state);
16606 if (cb) {
16607 if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
16608 }
16609 state.ended = true;
16610 stream.writable = false;
16611}
16612
16613function onCorkedFinish(corkReq, state, err) {
16614 var entry = corkReq.entry;
16615 corkReq.entry = null;
16616 while (entry) {
16617 var cb = entry.callback;
16618 state.pendingcb--;
16619 cb(err);
16620 entry = entry.next;
16621 }
16622 if (state.corkedRequestsFree) {
16623 state.corkedRequestsFree.next = corkReq;
16624 } else {
16625 state.corkedRequestsFree = corkReq;
16626 }
16627}
16628
16629Object.defineProperty(Writable.prototype, 'destroyed', {
16630 get: function () {
16631 if (this._writableState === undefined) {
16632 return false;
16633 }
16634 return this._writableState.destroyed;
16635 },
16636 set: function (value) {
16637 // we ignore the value if the stream
16638 // has not been initialized yet
16639 if (!this._writableState) {
16640 return;
16641 }
16642
16643 // backward compatibility, the user is explicitly
16644 // managing destroyed
16645 this._writableState.destroyed = value;
16646 }
16647});
16648
16649Writable.prototype.destroy = destroyImpl.destroy;
16650Writable.prototype._undestroy = destroyImpl.undestroy;
16651Writable.prototype._destroy = function (err, cb) {
16652 this.end();
16653 cb(err);
16654};
16655}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate)
16656},{"./_stream_duplex":71,"./internal/streams/destroy":77,"./internal/streams/stream":78,"_process":69,"core-util-is":44,"inherits":56,"process-nextick-args":68,"safe-buffer":83,"timers":86,"util-deprecate":87}],76:[function(require,module,exports){
16657'use strict';
16658
16659function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16660
16661var Buffer = require('safe-buffer').Buffer;
16662var util = require('util');
16663
16664function copyBuffer(src, target, offset) {
16665 src.copy(target, offset);
16666}
16667
16668module.exports = function () {
16669 function BufferList() {
16670 _classCallCheck(this, BufferList);
16671
16672 this.head = null;
16673 this.tail = null;
16674 this.length = 0;
16675 }
16676
16677 BufferList.prototype.push = function push(v) {
16678 var entry = { data: v, next: null };
16679 if (this.length > 0) this.tail.next = entry;else this.head = entry;
16680 this.tail = entry;
16681 ++this.length;
16682 };
16683
16684 BufferList.prototype.unshift = function unshift(v) {
16685 var entry = { data: v, next: this.head };
16686 if (this.length === 0) this.tail = entry;
16687 this.head = entry;
16688 ++this.length;
16689 };
16690
16691 BufferList.prototype.shift = function shift() {
16692 if (this.length === 0) return;
16693 var ret = this.head.data;
16694 if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
16695 --this.length;
16696 return ret;
16697 };
16698
16699 BufferList.prototype.clear = function clear() {
16700 this.head = this.tail = null;
16701 this.length = 0;
16702 };
16703
16704 BufferList.prototype.join = function join(s) {
16705 if (this.length === 0) return '';
16706 var p = this.head;
16707 var ret = '' + p.data;
16708 while (p = p.next) {
16709 ret += s + p.data;
16710 }return ret;
16711 };
16712
16713 BufferList.prototype.concat = function concat(n) {
16714 if (this.length === 0) return Buffer.alloc(0);
16715 if (this.length === 1) return this.head.data;
16716 var ret = Buffer.allocUnsafe(n >>> 0);
16717 var p = this.head;
16718 var i = 0;
16719 while (p) {
16720 copyBuffer(p.data, ret, i);
16721 i += p.data.length;
16722 p = p.next;
16723 }
16724 return ret;
16725 };
16726
16727 return BufferList;
16728}();
16729
16730if (util && util.inspect && util.inspect.custom) {
16731 module.exports.prototype[util.inspect.custom] = function () {
16732 var obj = util.inspect({ length: this.length });
16733 return this.constructor.name + ' ' + obj;
16734 };
16735}
16736},{"safe-buffer":83,"util":40}],77:[function(require,module,exports){
16737'use strict';
16738
16739/*<replacement>*/
16740
16741var pna = require('process-nextick-args');
16742/*</replacement>*/
16743
16744// undocumented cb() API, needed for core, not for public API
16745function destroy(err, cb) {
16746 var _this = this;
16747
16748 var readableDestroyed = this._readableState && this._readableState.destroyed;
16749 var writableDestroyed = this._writableState && this._writableState.destroyed;
16750
16751 if (readableDestroyed || writableDestroyed) {
16752 if (cb) {
16753 cb(err);
16754 } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
16755 pna.nextTick(emitErrorNT, this, err);
16756 }
16757 return this;
16758 }
16759
16760 // we set destroyed to true before firing error callbacks in order
16761 // to make it re-entrance safe in case destroy() is called within callbacks
16762
16763 if (this._readableState) {
16764 this._readableState.destroyed = true;
16765 }
16766
16767 // if this is a duplex stream mark the writable part as destroyed as well
16768 if (this._writableState) {
16769 this._writableState.destroyed = true;
16770 }
16771
16772 this._destroy(err || null, function (err) {
16773 if (!cb && err) {
16774 pna.nextTick(emitErrorNT, _this, err);
16775 if (_this._writableState) {
16776 _this._writableState.errorEmitted = true;
16777 }
16778 } else if (cb) {
16779 cb(err);
16780 }
16781 });
16782
16783 return this;
16784}
16785
16786function undestroy() {
16787 if (this._readableState) {
16788 this._readableState.destroyed = false;
16789 this._readableState.reading = false;
16790 this._readableState.ended = false;
16791 this._readableState.endEmitted = false;
16792 }
16793
16794 if (this._writableState) {
16795 this._writableState.destroyed = false;
16796 this._writableState.ended = false;
16797 this._writableState.ending = false;
16798 this._writableState.finished = false;
16799 this._writableState.errorEmitted = false;
16800 }
16801}
16802
16803function emitErrorNT(self, err) {
16804 self.emit('error', err);
16805}
16806
16807module.exports = {
16808 destroy: destroy,
16809 undestroy: undestroy
16810};
16811},{"process-nextick-args":68}],78:[function(require,module,exports){
16812module.exports = require('events').EventEmitter;
16813
16814},{"events":50}],79:[function(require,module,exports){
16815module.exports = require('./readable').PassThrough
16816
16817},{"./readable":80}],80:[function(require,module,exports){
16818exports = module.exports = require('./lib/_stream_readable.js');
16819exports.Stream = exports;
16820exports.Readable = exports;
16821exports.Writable = require('./lib/_stream_writable.js');
16822exports.Duplex = require('./lib/_stream_duplex.js');
16823exports.Transform = require('./lib/_stream_transform.js');
16824exports.PassThrough = require('./lib/_stream_passthrough.js');
16825
16826},{"./lib/_stream_duplex.js":71,"./lib/_stream_passthrough.js":72,"./lib/_stream_readable.js":73,"./lib/_stream_transform.js":74,"./lib/_stream_writable.js":75}],81:[function(require,module,exports){
16827module.exports = require('./readable').Transform
16828
16829},{"./readable":80}],82:[function(require,module,exports){
16830module.exports = require('./lib/_stream_writable.js');
16831
16832},{"./lib/_stream_writable.js":75}],83:[function(require,module,exports){
16833/* eslint-disable node/no-deprecated-api */
16834var buffer = require('buffer')
16835var Buffer = buffer.Buffer
16836
16837// alternative to using Object.keys for old browsers
16838function copyProps (src, dst) {
16839 for (var key in src) {
16840 dst[key] = src[key]
16841 }
16842}
16843if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
16844 module.exports = buffer
16845} else {
16846 // Copy properties from require('buffer')
16847 copyProps(buffer, exports)
16848 exports.Buffer = SafeBuffer
16849}
16850
16851function SafeBuffer (arg, encodingOrOffset, length) {
16852 return Buffer(arg, encodingOrOffset, length)
16853}
16854
16855// Copy static methods from Buffer
16856copyProps(Buffer, SafeBuffer)
16857
16858SafeBuffer.from = function (arg, encodingOrOffset, length) {
16859 if (typeof arg === 'number') {
16860 throw new TypeError('Argument must not be a number')
16861 }
16862 return Buffer(arg, encodingOrOffset, length)
16863}
16864
16865SafeBuffer.alloc = function (size, fill, encoding) {
16866 if (typeof size !== 'number') {
16867 throw new TypeError('Argument must be a number')
16868 }
16869 var buf = Buffer(size)
16870 if (fill !== undefined) {
16871 if (typeof encoding === 'string') {
16872 buf.fill(fill, encoding)
16873 } else {
16874 buf.fill(fill)
16875 }
16876 } else {
16877 buf.fill(0)
16878 }
16879 return buf
16880}
16881
16882SafeBuffer.allocUnsafe = function (size) {
16883 if (typeof size !== 'number') {
16884 throw new TypeError('Argument must be a number')
16885 }
16886 return Buffer(size)
16887}
16888
16889SafeBuffer.allocUnsafeSlow = function (size) {
16890 if (typeof size !== 'number') {
16891 throw new TypeError('Argument must be a number')
16892 }
16893 return buffer.SlowBuffer(size)
16894}
16895
16896},{"buffer":43}],84:[function(require,module,exports){
16897// Copyright Joyent, Inc. and other Node contributors.
16898//
16899// Permission is hereby granted, free of charge, to any person obtaining a
16900// copy of this software and associated documentation files (the
16901// "Software"), to deal in the Software without restriction, including
16902// without limitation the rights to use, copy, modify, merge, publish,
16903// distribute, sublicense, and/or sell copies of the Software, and to permit
16904// persons to whom the Software is furnished to do so, subject to the
16905// following conditions:
16906//
16907// The above copyright notice and this permission notice shall be included
16908// in all copies or substantial portions of the Software.
16909//
16910// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16911// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16912// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
16913// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
16914// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16915// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
16916// USE OR OTHER DEALINGS IN THE SOFTWARE.
16917
16918module.exports = Stream;
16919
16920var EE = require('events').EventEmitter;
16921var inherits = require('inherits');
16922
16923inherits(Stream, EE);
16924Stream.Readable = require('readable-stream/readable.js');
16925Stream.Writable = require('readable-stream/writable.js');
16926Stream.Duplex = require('readable-stream/duplex.js');
16927Stream.Transform = require('readable-stream/transform.js');
16928Stream.PassThrough = require('readable-stream/passthrough.js');
16929
16930// Backwards-compat with node 0.4.x
16931Stream.Stream = Stream;
16932
16933
16934
16935// old-style streams. Note that the pipe method (the only relevant
16936// part of this class) is overridden in the Readable class.
16937
16938function Stream() {
16939 EE.call(this);
16940}
16941
16942Stream.prototype.pipe = function(dest, options) {
16943 var source = this;
16944
16945 function ondata(chunk) {
16946 if (dest.writable) {
16947 if (false === dest.write(chunk) && source.pause) {
16948 source.pause();
16949 }
16950 }
16951 }
16952
16953 source.on('data', ondata);
16954
16955 function ondrain() {
16956 if (source.readable && source.resume) {
16957 source.resume();
16958 }
16959 }
16960
16961 dest.on('drain', ondrain);
16962
16963 // If the 'end' option is not supplied, dest.end() will be called when
16964 // source gets the 'end' or 'close' events. Only dest.end() once.
16965 if (!dest._isStdio && (!options || options.end !== false)) {
16966 source.on('end', onend);
16967 source.on('close', onclose);
16968 }
16969
16970 var didOnEnd = false;
16971 function onend() {
16972 if (didOnEnd) return;
16973 didOnEnd = true;
16974
16975 dest.end();
16976 }
16977
16978
16979 function onclose() {
16980 if (didOnEnd) return;
16981 didOnEnd = true;
16982
16983 if (typeof dest.destroy === 'function') dest.destroy();
16984 }
16985
16986 // don't leave dangling pipes when there are errors.
16987 function onerror(er) {
16988 cleanup();
16989 if (EE.listenerCount(this, 'error') === 0) {
16990 throw er; // Unhandled stream error in pipe.
16991 }
16992 }
16993
16994 source.on('error', onerror);
16995 dest.on('error', onerror);
16996
16997 // remove all the event listeners that were added.
16998 function cleanup() {
16999 source.removeListener('data', ondata);
17000 dest.removeListener('drain', ondrain);
17001
17002 source.removeListener('end', onend);
17003 source.removeListener('close', onclose);
17004
17005 source.removeListener('error', onerror);
17006 dest.removeListener('error', onerror);
17007
17008 source.removeListener('end', cleanup);
17009 source.removeListener('close', cleanup);
17010
17011 dest.removeListener('close', cleanup);
17012 }
17013
17014 source.on('end', cleanup);
17015 source.on('close', cleanup);
17016
17017 dest.on('close', cleanup);
17018
17019 dest.emit('pipe', source);
17020
17021 // Allow for unix-like usage: A.pipe(B).pipe(C)
17022 return dest;
17023};
17024
17025},{"events":50,"inherits":56,"readable-stream/duplex.js":70,"readable-stream/passthrough.js":79,"readable-stream/readable.js":80,"readable-stream/transform.js":81,"readable-stream/writable.js":82}],85:[function(require,module,exports){
17026// Copyright Joyent, Inc. and other Node contributors.
17027//
17028// Permission is hereby granted, free of charge, to any person obtaining a
17029// copy of this software and associated documentation files (the
17030// "Software"), to deal in the Software without restriction, including
17031// without limitation the rights to use, copy, modify, merge, publish,
17032// distribute, sublicense, and/or sell copies of the Software, and to permit
17033// persons to whom the Software is furnished to do so, subject to the
17034// following conditions:
17035//
17036// The above copyright notice and this permission notice shall be included
17037// in all copies or substantial portions of the Software.
17038//
17039// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17040// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17041// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17042// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17043// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17044// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
17045// USE OR OTHER DEALINGS IN THE SOFTWARE.
17046
17047'use strict';
17048
17049/*<replacement>*/
17050
17051var Buffer = require('safe-buffer').Buffer;
17052/*</replacement>*/
17053
17054var isEncoding = Buffer.isEncoding || function (encoding) {
17055 encoding = '' + encoding;
17056 switch (encoding && encoding.toLowerCase()) {
17057 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':
17058 return true;
17059 default:
17060 return false;
17061 }
17062};
17063
17064function _normalizeEncoding(enc) {
17065 if (!enc) return 'utf8';
17066 var retried;
17067 while (true) {
17068 switch (enc) {
17069 case 'utf8':
17070 case 'utf-8':
17071 return 'utf8';
17072 case 'ucs2':
17073 case 'ucs-2':
17074 case 'utf16le':
17075 case 'utf-16le':
17076 return 'utf16le';
17077 case 'latin1':
17078 case 'binary':
17079 return 'latin1';
17080 case 'base64':
17081 case 'ascii':
17082 case 'hex':
17083 return enc;
17084 default:
17085 if (retried) return; // undefined
17086 enc = ('' + enc).toLowerCase();
17087 retried = true;
17088 }
17089 }
17090};
17091
17092// Do not cache `Buffer.isEncoding` when checking encoding names as some
17093// modules monkey-patch it to support additional encodings
17094function normalizeEncoding(enc) {
17095 var nenc = _normalizeEncoding(enc);
17096 if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
17097 return nenc || enc;
17098}
17099
17100// StringDecoder provides an interface for efficiently splitting a series of
17101// buffers into a series of JS strings without breaking apart multi-byte
17102// characters.
17103exports.StringDecoder = StringDecoder;
17104function StringDecoder(encoding) {
17105 this.encoding = normalizeEncoding(encoding);
17106 var nb;
17107 switch (this.encoding) {
17108 case 'utf16le':
17109 this.text = utf16Text;
17110 this.end = utf16End;
17111 nb = 4;
17112 break;
17113 case 'utf8':
17114 this.fillLast = utf8FillLast;
17115 nb = 4;
17116 break;
17117 case 'base64':
17118 this.text = base64Text;
17119 this.end = base64End;
17120 nb = 3;
17121 break;
17122 default:
17123 this.write = simpleWrite;
17124 this.end = simpleEnd;
17125 return;
17126 }
17127 this.lastNeed = 0;
17128 this.lastTotal = 0;
17129 this.lastChar = Buffer.allocUnsafe(nb);
17130}
17131
17132StringDecoder.prototype.write = function (buf) {
17133 if (buf.length === 0) return '';
17134 var r;
17135 var i;
17136 if (this.lastNeed) {
17137 r = this.fillLast(buf);
17138 if (r === undefined) return '';
17139 i = this.lastNeed;
17140 this.lastNeed = 0;
17141 } else {
17142 i = 0;
17143 }
17144 if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
17145 return r || '';
17146};
17147
17148StringDecoder.prototype.end = utf8End;
17149
17150// Returns only complete characters in a Buffer
17151StringDecoder.prototype.text = utf8Text;
17152
17153// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
17154StringDecoder.prototype.fillLast = function (buf) {
17155 if (this.lastNeed <= buf.length) {
17156 buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
17157 return this.lastChar.toString(this.encoding, 0, this.lastTotal);
17158 }
17159 buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
17160 this.lastNeed -= buf.length;
17161};
17162
17163// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
17164// continuation byte. If an invalid byte is detected, -2 is returned.
17165function utf8CheckByte(byte) {
17166 if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
17167 return byte >> 6 === 0x02 ? -1 : -2;
17168}
17169
17170// Checks at most 3 bytes at the end of a Buffer in order to detect an
17171// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
17172// needed to complete the UTF-8 character (if applicable) are returned.
17173function utf8CheckIncomplete(self, buf, i) {
17174 var j = buf.length - 1;
17175 if (j < i) return 0;
17176 var nb = utf8CheckByte(buf[j]);
17177 if (nb >= 0) {
17178 if (nb > 0) self.lastNeed = nb - 1;
17179 return nb;
17180 }
17181 if (--j < i || nb === -2) return 0;
17182 nb = utf8CheckByte(buf[j]);
17183 if (nb >= 0) {
17184 if (nb > 0) self.lastNeed = nb - 2;
17185 return nb;
17186 }
17187 if (--j < i || nb === -2) return 0;
17188 nb = utf8CheckByte(buf[j]);
17189 if (nb >= 0) {
17190 if (nb > 0) {
17191 if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
17192 }
17193 return nb;
17194 }
17195 return 0;
17196}
17197
17198// Validates as many continuation bytes for a multi-byte UTF-8 character as
17199// needed or are available. If we see a non-continuation byte where we expect
17200// one, we "replace" the validated continuation bytes we've seen so far with
17201// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
17202// behavior. The continuation byte check is included three times in the case
17203// where all of the continuation bytes for a character exist in the same buffer.
17204// It is also done this way as a slight performance increase instead of using a
17205// loop.
17206function utf8CheckExtraBytes(self, buf, p) {
17207 if ((buf[0] & 0xC0) !== 0x80) {
17208 self.lastNeed = 0;
17209 return '\ufffd';
17210 }
17211 if (self.lastNeed > 1 && buf.length > 1) {
17212 if ((buf[1] & 0xC0) !== 0x80) {
17213 self.lastNeed = 1;
17214 return '\ufffd';
17215 }
17216 if (self.lastNeed > 2 && buf.length > 2) {
17217 if ((buf[2] & 0xC0) !== 0x80) {
17218 self.lastNeed = 2;
17219 return '\ufffd';
17220 }
17221 }
17222 }
17223}
17224
17225// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
17226function utf8FillLast(buf) {
17227 var p = this.lastTotal - this.lastNeed;
17228 var r = utf8CheckExtraBytes(this, buf, p);
17229 if (r !== undefined) return r;
17230 if (this.lastNeed <= buf.length) {
17231 buf.copy(this.lastChar, p, 0, this.lastNeed);
17232 return this.lastChar.toString(this.encoding, 0, this.lastTotal);
17233 }
17234 buf.copy(this.lastChar, p, 0, buf.length);
17235 this.lastNeed -= buf.length;
17236}
17237
17238// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
17239// partial character, the character's bytes are buffered until the required
17240// number of bytes are available.
17241function utf8Text(buf, i) {
17242 var total = utf8CheckIncomplete(this, buf, i);
17243 if (!this.lastNeed) return buf.toString('utf8', i);
17244 this.lastTotal = total;
17245 var end = buf.length - (total - this.lastNeed);
17246 buf.copy(this.lastChar, 0, end);
17247 return buf.toString('utf8', i, end);
17248}
17249
17250// For UTF-8, a replacement character is added when ending on a partial
17251// character.
17252function utf8End(buf) {
17253 var r = buf && buf.length ? this.write(buf) : '';
17254 if (this.lastNeed) return r + '\ufffd';
17255 return r;
17256}
17257
17258// UTF-16LE typically needs two bytes per character, but even if we have an even
17259// number of bytes available, we need to check if we end on a leading/high
17260// surrogate. In that case, we need to wait for the next two bytes in order to
17261// decode the last character properly.
17262function utf16Text(buf, i) {
17263 if ((buf.length - i) % 2 === 0) {
17264 var r = buf.toString('utf16le', i);
17265 if (r) {
17266 var c = r.charCodeAt(r.length - 1);
17267 if (c >= 0xD800 && c <= 0xDBFF) {
17268 this.lastNeed = 2;
17269 this.lastTotal = 4;
17270 this.lastChar[0] = buf[buf.length - 2];
17271 this.lastChar[1] = buf[buf.length - 1];
17272 return r.slice(0, -1);
17273 }
17274 }
17275 return r;
17276 }
17277 this.lastNeed = 1;
17278 this.lastTotal = 2;
17279 this.lastChar[0] = buf[buf.length - 1];
17280 return buf.toString('utf16le', i, buf.length - 1);
17281}
17282
17283// For UTF-16LE we do not explicitly append special replacement characters if we
17284// end on a partial character, we simply let v8 handle that.
17285function utf16End(buf) {
17286 var r = buf && buf.length ? this.write(buf) : '';
17287 if (this.lastNeed) {
17288 var end = this.lastTotal - this.lastNeed;
17289 return r + this.lastChar.toString('utf16le', 0, end);
17290 }
17291 return r;
17292}
17293
17294function base64Text(buf, i) {
17295 var n = (buf.length - i) % 3;
17296 if (n === 0) return buf.toString('base64', i);
17297 this.lastNeed = 3 - n;
17298 this.lastTotal = 3;
17299 if (n === 1) {
17300 this.lastChar[0] = buf[buf.length - 1];
17301 } else {
17302 this.lastChar[0] = buf[buf.length - 2];
17303 this.lastChar[1] = buf[buf.length - 1];
17304 }
17305 return buf.toString('base64', i, buf.length - n);
17306}
17307
17308function base64End(buf) {
17309 var r = buf && buf.length ? this.write(buf) : '';
17310 if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
17311 return r;
17312}
17313
17314// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
17315function simpleWrite(buf) {
17316 return buf.toString(this.encoding);
17317}
17318
17319function simpleEnd(buf) {
17320 return buf && buf.length ? this.write(buf) : '';
17321}
17322},{"safe-buffer":83}],86:[function(require,module,exports){
17323(function (setImmediate,clearImmediate){
17324var nextTick = require('process/browser.js').nextTick;
17325var apply = Function.prototype.apply;
17326var slice = Array.prototype.slice;
17327var immediateIds = {};
17328var nextImmediateId = 0;
17329
17330// DOM APIs, for completeness
17331
17332exports.setTimeout = function() {
17333 return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
17334};
17335exports.setInterval = function() {
17336 return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
17337};
17338exports.clearTimeout =
17339exports.clearInterval = function(timeout) { timeout.close(); };
17340
17341function Timeout(id, clearFn) {
17342 this._id = id;
17343 this._clearFn = clearFn;
17344}
17345Timeout.prototype.unref = Timeout.prototype.ref = function() {};
17346Timeout.prototype.close = function() {
17347 this._clearFn.call(window, this._id);
17348};
17349
17350// Does not start the time, just sets up the members needed.
17351exports.enroll = function(item, msecs) {
17352 clearTimeout(item._idleTimeoutId);
17353 item._idleTimeout = msecs;
17354};
17355
17356exports.unenroll = function(item) {
17357 clearTimeout(item._idleTimeoutId);
17358 item._idleTimeout = -1;
17359};
17360
17361exports._unrefActive = exports.active = function(item) {
17362 clearTimeout(item._idleTimeoutId);
17363
17364 var msecs = item._idleTimeout;
17365 if (msecs >= 0) {
17366 item._idleTimeoutId = setTimeout(function onTimeout() {
17367 if (item._onTimeout)
17368 item._onTimeout();
17369 }, msecs);
17370 }
17371};
17372
17373// That's not how node.js implements it but the exposed api is the same.
17374exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
17375 var id = nextImmediateId++;
17376 var args = arguments.length < 2 ? false : slice.call(arguments, 1);
17377
17378 immediateIds[id] = true;
17379
17380 nextTick(function onNextTick() {
17381 if (immediateIds[id]) {
17382 // fn.call() is faster so we optimize for the common use-case
17383 // @see http://jsperf.com/call-apply-segu
17384 if (args) {
17385 fn.apply(null, args);
17386 } else {
17387 fn.call(null);
17388 }
17389 // Prevent ids from leaking
17390 exports.clearImmediate(id);
17391 }
17392 });
17393
17394 return id;
17395};
17396
17397exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {
17398 delete immediateIds[id];
17399};
17400}).call(this,require("timers").setImmediate,require("timers").clearImmediate)
17401},{"process/browser.js":69,"timers":86}],87:[function(require,module,exports){
17402(function (global){
17403
17404/**
17405 * Module exports.
17406 */
17407
17408module.exports = deprecate;
17409
17410/**
17411 * Mark that a method should not be used.
17412 * Returns a modified function which warns once by default.
17413 *
17414 * If `localStorage.noDeprecation = true` is set, then it is a no-op.
17415 *
17416 * If `localStorage.throwDeprecation = true` is set, then deprecated functions
17417 * will throw an Error when invoked.
17418 *
17419 * If `localStorage.traceDeprecation = true` is set, then deprecated functions
17420 * will invoke `console.trace()` instead of `console.error()`.
17421 *
17422 * @param {Function} fn - the function to deprecate
17423 * @param {String} msg - the string to print to the console when `fn` is invoked
17424 * @returns {Function} a new "deprecated" version of `fn`
17425 * @api public
17426 */
17427
17428function deprecate (fn, msg) {
17429 if (config('noDeprecation')) {
17430 return fn;
17431 }
17432
17433 var warned = false;
17434 function deprecated() {
17435 if (!warned) {
17436 if (config('throwDeprecation')) {
17437 throw new Error(msg);
17438 } else if (config('traceDeprecation')) {
17439 console.trace(msg);
17440 } else {
17441 console.warn(msg);
17442 }
17443 warned = true;
17444 }
17445 return fn.apply(this, arguments);
17446 }
17447
17448 return deprecated;
17449}
17450
17451/**
17452 * Checks `localStorage` for boolean values for the given `name`.
17453 *
17454 * @param {String} name
17455 * @returns {Boolean}
17456 * @api private
17457 */
17458
17459function config (name) {
17460 // accessing global.localStorage can trigger a DOMException in sandboxed iframes
17461 try {
17462 if (!global.localStorage) return false;
17463 } catch (_) {
17464 return false;
17465 }
17466 var val = global.localStorage[name];
17467 if (null == val) return false;
17468 return String(val).toLowerCase() === 'true';
17469}
17470
17471}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
17472},{}],88:[function(require,module,exports){
17473module.exports = function isBuffer(arg) {
17474 return arg && typeof arg === 'object'
17475 && typeof arg.copy === 'function'
17476 && typeof arg.fill === 'function'
17477 && typeof arg.readUInt8 === 'function';
17478}
17479},{}],89:[function(require,module,exports){
17480(function (process,global){
17481// Copyright Joyent, Inc. and other Node contributors.
17482//
17483// Permission is hereby granted, free of charge, to any person obtaining a
17484// copy of this software and associated documentation files (the
17485// "Software"), to deal in the Software without restriction, including
17486// without limitation the rights to use, copy, modify, merge, publish,
17487// distribute, sublicense, and/or sell copies of the Software, and to permit
17488// persons to whom the Software is furnished to do so, subject to the
17489// following conditions:
17490//
17491// The above copyright notice and this permission notice shall be included
17492// in all copies or substantial portions of the Software.
17493//
17494// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17495// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17496// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17497// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17498// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17499// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
17500// USE OR OTHER DEALINGS IN THE SOFTWARE.
17501
17502var formatRegExp = /%[sdj%]/g;
17503exports.format = function(f) {
17504 if (!isString(f)) {
17505 var objects = [];
17506 for (var i = 0; i < arguments.length; i++) {
17507 objects.push(inspect(arguments[i]));
17508 }
17509 return objects.join(' ');
17510 }
17511
17512 var i = 1;
17513 var args = arguments;
17514 var len = args.length;
17515 var str = String(f).replace(formatRegExp, function(x) {
17516 if (x === '%%') return '%';
17517 if (i >= len) return x;
17518 switch (x) {
17519 case '%s': return String(args[i++]);
17520 case '%d': return Number(args[i++]);
17521 case '%j':
17522 try {
17523 return JSON.stringify(args[i++]);
17524 } catch (_) {
17525 return '[Circular]';
17526 }
17527 default:
17528 return x;
17529 }
17530 });
17531 for (var x = args[i]; i < len; x = args[++i]) {
17532 if (isNull(x) || !isObject(x)) {
17533 str += ' ' + x;
17534 } else {
17535 str += ' ' + inspect(x);
17536 }
17537 }
17538 return str;
17539};
17540
17541
17542// Mark that a method should not be used.
17543// Returns a modified function which warns once by default.
17544// If --no-deprecation is set, then it is a no-op.
17545exports.deprecate = function(fn, msg) {
17546 // Allow for deprecating things in the process of starting up.
17547 if (isUndefined(global.process)) {
17548 return function() {
17549 return exports.deprecate(fn, msg).apply(this, arguments);
17550 };
17551 }
17552
17553 if (process.noDeprecation === true) {
17554 return fn;
17555 }
17556
17557 var warned = false;
17558 function deprecated() {
17559 if (!warned) {
17560 if (process.throwDeprecation) {
17561 throw new Error(msg);
17562 } else if (process.traceDeprecation) {
17563 console.trace(msg);
17564 } else {
17565 console.error(msg);
17566 }
17567 warned = true;
17568 }
17569 return fn.apply(this, arguments);
17570 }
17571
17572 return deprecated;
17573};
17574
17575
17576var debugs = {};
17577var debugEnviron;
17578exports.debuglog = function(set) {
17579 if (isUndefined(debugEnviron))
17580 debugEnviron = process.env.NODE_DEBUG || '';
17581 set = set.toUpperCase();
17582 if (!debugs[set]) {
17583 if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
17584 var pid = process.pid;
17585 debugs[set] = function() {
17586 var msg = exports.format.apply(exports, arguments);
17587 console.error('%s %d: %s', set, pid, msg);
17588 };
17589 } else {
17590 debugs[set] = function() {};
17591 }
17592 }
17593 return debugs[set];
17594};
17595
17596
17597/**
17598 * Echos the value of a value. Trys to print the value out
17599 * in the best way possible given the different types.
17600 *
17601 * @param {Object} obj The object to print out.
17602 * @param {Object} opts Optional options object that alters the output.
17603 */
17604/* legacy: obj, showHidden, depth, colors*/
17605function inspect(obj, opts) {
17606 // default options
17607 var ctx = {
17608 seen: [],
17609 stylize: stylizeNoColor
17610 };
17611 // legacy...
17612 if (arguments.length >= 3) ctx.depth = arguments[2];
17613 if (arguments.length >= 4) ctx.colors = arguments[3];
17614 if (isBoolean(opts)) {
17615 // legacy...
17616 ctx.showHidden = opts;
17617 } else if (opts) {
17618 // got an "options" object
17619 exports._extend(ctx, opts);
17620 }
17621 // set default options
17622 if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
17623 if (isUndefined(ctx.depth)) ctx.depth = 2;
17624 if (isUndefined(ctx.colors)) ctx.colors = false;
17625 if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
17626 if (ctx.colors) ctx.stylize = stylizeWithColor;
17627 return formatValue(ctx, obj, ctx.depth);
17628}
17629exports.inspect = inspect;
17630
17631
17632// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
17633inspect.colors = {
17634 'bold' : [1, 22],
17635 'italic' : [3, 23],
17636 'underline' : [4, 24],
17637 'inverse' : [7, 27],
17638 'white' : [37, 39],
17639 'grey' : [90, 39],
17640 'black' : [30, 39],
17641 'blue' : [34, 39],
17642 'cyan' : [36, 39],
17643 'green' : [32, 39],
17644 'magenta' : [35, 39],
17645 'red' : [31, 39],
17646 'yellow' : [33, 39]
17647};
17648
17649// Don't use 'blue' not visible on cmd.exe
17650inspect.styles = {
17651 'special': 'cyan',
17652 'number': 'yellow',
17653 'boolean': 'yellow',
17654 'undefined': 'grey',
17655 'null': 'bold',
17656 'string': 'green',
17657 'date': 'magenta',
17658 // "name": intentionally not styling
17659 'regexp': 'red'
17660};
17661
17662
17663function stylizeWithColor(str, styleType) {
17664 var style = inspect.styles[styleType];
17665
17666 if (style) {
17667 return '\u001b[' + inspect.colors[style][0] + 'm' + str +
17668 '\u001b[' + inspect.colors[style][1] + 'm';
17669 } else {
17670 return str;
17671 }
17672}
17673
17674
17675function stylizeNoColor(str, styleType) {
17676 return str;
17677}
17678
17679
17680function arrayToHash(array) {
17681 var hash = {};
17682
17683 array.forEach(function(val, idx) {
17684 hash[val] = true;
17685 });
17686
17687 return hash;
17688}
17689
17690
17691function formatValue(ctx, value, recurseTimes) {
17692 // Provide a hook for user-specified inspect functions.
17693 // Check that value is an object with an inspect function on it
17694 if (ctx.customInspect &&
17695 value &&
17696 isFunction(value.inspect) &&
17697 // Filter out the util module, it's inspect function is special
17698 value.inspect !== exports.inspect &&
17699 // Also filter out any prototype objects using the circular check.
17700 !(value.constructor && value.constructor.prototype === value)) {
17701 var ret = value.inspect(recurseTimes, ctx);
17702 if (!isString(ret)) {
17703 ret = formatValue(ctx, ret, recurseTimes);
17704 }
17705 return ret;
17706 }
17707
17708 // Primitive types cannot have properties
17709 var primitive = formatPrimitive(ctx, value);
17710 if (primitive) {
17711 return primitive;
17712 }
17713
17714 // Look up the keys of the object.
17715 var keys = Object.keys(value);
17716 var visibleKeys = arrayToHash(keys);
17717
17718 if (ctx.showHidden) {
17719 keys = Object.getOwnPropertyNames(value);
17720 }
17721
17722 // IE doesn't make error fields non-enumerable
17723 // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
17724 if (isError(value)
17725 && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
17726 return formatError(value);
17727 }
17728
17729 // Some type of object without properties can be shortcutted.
17730 if (keys.length === 0) {
17731 if (isFunction(value)) {
17732 var name = value.name ? ': ' + value.name : '';
17733 return ctx.stylize('[Function' + name + ']', 'special');
17734 }
17735 if (isRegExp(value)) {
17736 return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
17737 }
17738 if (isDate(value)) {
17739 return ctx.stylize(Date.prototype.toString.call(value), 'date');
17740 }
17741 if (isError(value)) {
17742 return formatError(value);
17743 }
17744 }
17745
17746 var base = '', array = false, braces = ['{', '}'];
17747
17748 // Make Array say that they are Array
17749 if (isArray(value)) {
17750 array = true;
17751 braces = ['[', ']'];
17752 }
17753
17754 // Make functions say that they are functions
17755 if (isFunction(value)) {
17756 var n = value.name ? ': ' + value.name : '';
17757 base = ' [Function' + n + ']';
17758 }
17759
17760 // Make RegExps say that they are RegExps
17761 if (isRegExp(value)) {
17762 base = ' ' + RegExp.prototype.toString.call(value);
17763 }
17764
17765 // Make dates with properties first say the date
17766 if (isDate(value)) {
17767 base = ' ' + Date.prototype.toUTCString.call(value);
17768 }
17769
17770 // Make error with message first say the error
17771 if (isError(value)) {
17772 base = ' ' + formatError(value);
17773 }
17774
17775 if (keys.length === 0 && (!array || value.length == 0)) {
17776 return braces[0] + base + braces[1];
17777 }
17778
17779 if (recurseTimes < 0) {
17780 if (isRegExp(value)) {
17781 return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
17782 } else {
17783 return ctx.stylize('[Object]', 'special');
17784 }
17785 }
17786
17787 ctx.seen.push(value);
17788
17789 var output;
17790 if (array) {
17791 output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
17792 } else {
17793 output = keys.map(function(key) {
17794 return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
17795 });
17796 }
17797
17798 ctx.seen.pop();
17799
17800 return reduceToSingleString(output, base, braces);
17801}
17802
17803
17804function formatPrimitive(ctx, value) {
17805 if (isUndefined(value))
17806 return ctx.stylize('undefined', 'undefined');
17807 if (isString(value)) {
17808 var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
17809 .replace(/'/g, "\\'")
17810 .replace(/\\"/g, '"') + '\'';
17811 return ctx.stylize(simple, 'string');
17812 }
17813 if (isNumber(value))
17814 return ctx.stylize('' + value, 'number');
17815 if (isBoolean(value))
17816 return ctx.stylize('' + value, 'boolean');
17817 // For some reason typeof null is "object", so special case here.
17818 if (isNull(value))
17819 return ctx.stylize('null', 'null');
17820}
17821
17822
17823function formatError(value) {
17824 return '[' + Error.prototype.toString.call(value) + ']';
17825}
17826
17827
17828function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
17829 var output = [];
17830 for (var i = 0, l = value.length; i < l; ++i) {
17831 if (hasOwnProperty(value, String(i))) {
17832 output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
17833 String(i), true));
17834 } else {
17835 output.push('');
17836 }
17837 }
17838 keys.forEach(function(key) {
17839 if (!key.match(/^\d+$/)) {
17840 output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
17841 key, true));
17842 }
17843 });
17844 return output;
17845}
17846
17847
17848function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
17849 var name, str, desc;
17850 desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
17851 if (desc.get) {
17852 if (desc.set) {
17853 str = ctx.stylize('[Getter/Setter]', 'special');
17854 } else {
17855 str = ctx.stylize('[Getter]', 'special');
17856 }
17857 } else {
17858 if (desc.set) {
17859 str = ctx.stylize('[Setter]', 'special');
17860 }
17861 }
17862 if (!hasOwnProperty(visibleKeys, key)) {
17863 name = '[' + key + ']';
17864 }
17865 if (!str) {
17866 if (ctx.seen.indexOf(desc.value) < 0) {
17867 if (isNull(recurseTimes)) {
17868 str = formatValue(ctx, desc.value, null);
17869 } else {
17870 str = formatValue(ctx, desc.value, recurseTimes - 1);
17871 }
17872 if (str.indexOf('\n') > -1) {
17873 if (array) {
17874 str = str.split('\n').map(function(line) {
17875 return ' ' + line;
17876 }).join('\n').substr(2);
17877 } else {
17878 str = '\n' + str.split('\n').map(function(line) {
17879 return ' ' + line;
17880 }).join('\n');
17881 }
17882 }
17883 } else {
17884 str = ctx.stylize('[Circular]', 'special');
17885 }
17886 }
17887 if (isUndefined(name)) {
17888 if (array && key.match(/^\d+$/)) {
17889 return str;
17890 }
17891 name = JSON.stringify('' + key);
17892 if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
17893 name = name.substr(1, name.length - 2);
17894 name = ctx.stylize(name, 'name');
17895 } else {
17896 name = name.replace(/'/g, "\\'")
17897 .replace(/\\"/g, '"')
17898 .replace(/(^"|"$)/g, "'");
17899 name = ctx.stylize(name, 'string');
17900 }
17901 }
17902
17903 return name + ': ' + str;
17904}
17905
17906
17907function reduceToSingleString(output, base, braces) {
17908 var numLinesEst = 0;
17909 var length = output.reduce(function(prev, cur) {
17910 numLinesEst++;
17911 if (cur.indexOf('\n') >= 0) numLinesEst++;
17912 return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
17913 }, 0);
17914
17915 if (length > 60) {
17916 return braces[0] +
17917 (base === '' ? '' : base + '\n ') +
17918 ' ' +
17919 output.join(',\n ') +
17920 ' ' +
17921 braces[1];
17922 }
17923
17924 return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
17925}
17926
17927
17928// NOTE: These type checking functions intentionally don't use `instanceof`
17929// because it is fragile and can be easily faked with `Object.create()`.
17930function isArray(ar) {
17931 return Array.isArray(ar);
17932}
17933exports.isArray = isArray;
17934
17935function isBoolean(arg) {
17936 return typeof arg === 'boolean';
17937}
17938exports.isBoolean = isBoolean;
17939
17940function isNull(arg) {
17941 return arg === null;
17942}
17943exports.isNull = isNull;
17944
17945function isNullOrUndefined(arg) {
17946 return arg == null;
17947}
17948exports.isNullOrUndefined = isNullOrUndefined;
17949
17950function isNumber(arg) {
17951 return typeof arg === 'number';
17952}
17953exports.isNumber = isNumber;
17954
17955function isString(arg) {
17956 return typeof arg === 'string';
17957}
17958exports.isString = isString;
17959
17960function isSymbol(arg) {
17961 return typeof arg === 'symbol';
17962}
17963exports.isSymbol = isSymbol;
17964
17965function isUndefined(arg) {
17966 return arg === void 0;
17967}
17968exports.isUndefined = isUndefined;
17969
17970function isRegExp(re) {
17971 return isObject(re) && objectToString(re) === '[object RegExp]';
17972}
17973exports.isRegExp = isRegExp;
17974
17975function isObject(arg) {
17976 return typeof arg === 'object' && arg !== null;
17977}
17978exports.isObject = isObject;
17979
17980function isDate(d) {
17981 return isObject(d) && objectToString(d) === '[object Date]';
17982}
17983exports.isDate = isDate;
17984
17985function isError(e) {
17986 return isObject(e) &&
17987 (objectToString(e) === '[object Error]' || e instanceof Error);
17988}
17989exports.isError = isError;
17990
17991function isFunction(arg) {
17992 return typeof arg === 'function';
17993}
17994exports.isFunction = isFunction;
17995
17996function isPrimitive(arg) {
17997 return arg === null ||
17998 typeof arg === 'boolean' ||
17999 typeof arg === 'number' ||
18000 typeof arg === 'string' ||
18001 typeof arg === 'symbol' || // ES6 symbol
18002 typeof arg === 'undefined';
18003}
18004exports.isPrimitive = isPrimitive;
18005
18006exports.isBuffer = require('./support/isBuffer');
18007
18008function objectToString(o) {
18009 return Object.prototype.toString.call(o);
18010}
18011
18012
18013function pad(n) {
18014 return n < 10 ? '0' + n.toString(10) : n.toString(10);
18015}
18016
18017
18018var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
18019 'Oct', 'Nov', 'Dec'];
18020
18021// 26 Feb 16:19:34
18022function timestamp() {
18023 var d = new Date();
18024 var time = [pad(d.getHours()),
18025 pad(d.getMinutes()),
18026 pad(d.getSeconds())].join(':');
18027 return [d.getDate(), months[d.getMonth()], time].join(' ');
18028}
18029
18030
18031// log is just a thin wrapper to console.log that prepends a timestamp
18032exports.log = function() {
18033 console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
18034};
18035
18036
18037/**
18038 * Inherit the prototype methods from one constructor into another.
18039 *
18040 * The Function.prototype.inherits from lang.js rewritten as a standalone
18041 * function (not on Function.prototype). NOTE: If this file is to be loaded
18042 * during bootstrapping this function needs to be rewritten using some native
18043 * functions as prototype setup using normal JavaScript does not work as
18044 * expected during bootstrapping (see mirror.js in r114903).
18045 *
18046 * @param {function} ctor Constructor function which needs to inherit the
18047 * prototype.
18048 * @param {function} superCtor Constructor function to inherit prototype from.
18049 */
18050exports.inherits = require('inherits');
18051
18052exports._extend = function(origin, add) {
18053 // Don't do anything if add isn't an object
18054 if (!add || !isObject(add)) return origin;
18055
18056 var keys = Object.keys(add);
18057 var i = keys.length;
18058 while (i--) {
18059 origin[keys[i]] = add[keys[i]];
18060 }
18061 return origin;
18062};
18063
18064function hasOwnProperty(obj, prop) {
18065 return Object.prototype.hasOwnProperty.call(obj, prop);
18066}
18067
18068}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
18069},{"./support/isBuffer":88,"_process":69,"inherits":56}],90:[function(require,module,exports){
18070module.exports={
18071 "name": "mocha",
18072 "version": "6.1.4",
18073 "homepage": "https://mochajs.org/",
18074 "notifyLogo": "https://ibin.co/4QuRuGjXvl36.png"
18075}
18076},{}]},{},[1]);