UNPKG

591 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 esmUtils = utils.supportsEsModules() ? require('./esm-utils') : undefined;
1412var createStatsCollector = require('./stats-collector');
1413var createInvalidReporterError = errors.createInvalidReporterError;
1414var createInvalidInterfaceError = errors.createInvalidInterfaceError;
1415var EVENT_FILE_PRE_REQUIRE = Suite.constants.EVENT_FILE_PRE_REQUIRE;
1416var EVENT_FILE_POST_REQUIRE = Suite.constants.EVENT_FILE_POST_REQUIRE;
1417var EVENT_FILE_REQUIRE = Suite.constants.EVENT_FILE_REQUIRE;
1418var sQuote = utils.sQuote;
1419
1420exports = module.exports = Mocha;
1421
1422/**
1423 * To require local UIs and reporters when running in node.
1424 */
1425
1426if (!process.browser) {
1427 var cwd = process.cwd();
1428 module.paths.push(cwd, path.join(cwd, 'node_modules'));
1429}
1430
1431/**
1432 * Expose internals.
1433 */
1434
1435/**
1436 * @public
1437 * @class utils
1438 * @memberof Mocha
1439 */
1440exports.utils = utils;
1441exports.interfaces = require('./interfaces');
1442/**
1443 * @public
1444 * @memberof Mocha
1445 */
1446exports.reporters = builtinReporters;
1447exports.Runnable = require('./runnable');
1448exports.Context = require('./context');
1449/**
1450 *
1451 * @memberof Mocha
1452 */
1453exports.Runner = require('./runner');
1454exports.Suite = Suite;
1455exports.Hook = require('./hook');
1456exports.Test = require('./test');
1457
1458/**
1459 * Constructs a new Mocha instance with `options`.
1460 *
1461 * @public
1462 * @class Mocha
1463 * @param {Object} [options] - Settings object.
1464 * @param {boolean} [options.allowUncaught] - Propagate uncaught errors?
1465 * @param {boolean} [options.asyncOnly] - Force `done` callback or promise?
1466 * @param {boolean} [options.bail] - Bail after first test failure?
1467 * @param {boolean} [options.checkLeaks] - Check for global variable leaks?
1468 * @param {boolean} [options.color] - Color TTY output from reporter?
1469 * @param {boolean} [options.delay] - Delay root suite execution?
1470 * @param {boolean} [options.diff] - Show diff on failure?
1471 * @param {string} [options.fgrep] - Test filter given string.
1472 * @param {boolean} [options.forbidOnly] - Tests marked `only` fail the suite?
1473 * @param {boolean} [options.forbidPending] - Pending tests fail the suite?
1474 * @param {boolean} [options.fullTrace] - Full stacktrace upon failure?
1475 * @param {string[]} [options.global] - Variables expected in global scope.
1476 * @param {RegExp|string} [options.grep] - Test filter given regular expression.
1477 * @param {boolean} [options.growl] - Enable desktop notifications?
1478 * @param {boolean} [options.inlineDiffs] - Display inline diffs?
1479 * @param {boolean} [options.invert] - Invert test filter matches?
1480 * @param {boolean} [options.noHighlighting] - Disable syntax highlighting?
1481 * @param {string|constructor} [options.reporter] - Reporter name or constructor.
1482 * @param {Object} [options.reporterOption] - Reporter settings object.
1483 * @param {number} [options.retries] - Number of times to retry failed tests.
1484 * @param {number} [options.slow] - Slow threshold value.
1485 * @param {number|string} [options.timeout] - Timeout threshold value.
1486 * @param {string} [options.ui] - Interface name.
1487 */
1488function Mocha(options) {
1489 options = utils.assign({}, mocharc, options || {});
1490 this.files = [];
1491 this.options = options;
1492 // root suite
1493 this.suite = new exports.Suite('', new exports.Context(), true);
1494
1495 this.grep(options.grep)
1496 .fgrep(options.fgrep)
1497 .ui(options.ui)
1498 .reporter(options.reporter, options.reporterOption)
1499 .slow(options.slow)
1500 .global(options.global);
1501
1502 // this guard exists because Suite#timeout does not consider `undefined` to be valid input
1503 if (typeof options.timeout !== 'undefined') {
1504 this.timeout(options.timeout === false ? 0 : options.timeout);
1505 }
1506
1507 if ('retries' in options) {
1508 this.retries(options.retries);
1509 }
1510
1511 [
1512 'allowUncaught',
1513 'asyncOnly',
1514 'bail',
1515 'checkLeaks',
1516 'color',
1517 'delay',
1518 'diff',
1519 'forbidOnly',
1520 'forbidPending',
1521 'fullTrace',
1522 'growl',
1523 'inlineDiffs',
1524 'invert'
1525 ].forEach(function(opt) {
1526 if (options[opt]) {
1527 this[opt]();
1528 }
1529 }, this);
1530}
1531
1532/**
1533 * Enables or disables bailing on the first failure.
1534 *
1535 * @public
1536 * @see [CLI option](../#-bail-b)
1537 * @param {boolean} [bail=true] - Whether to bail on first error.
1538 * @returns {Mocha} this
1539 * @chainable
1540 */
1541Mocha.prototype.bail = function(bail) {
1542 this.suite.bail(bail !== false);
1543 return this;
1544};
1545
1546/**
1547 * @summary
1548 * Adds `file` to be loaded for execution.
1549 *
1550 * @description
1551 * Useful for generic setup code that must be included within test suite.
1552 *
1553 * @public
1554 * @see [CLI option](../#-file-filedirectoryglob)
1555 * @param {string} file - Pathname of file to be loaded.
1556 * @returns {Mocha} this
1557 * @chainable
1558 */
1559Mocha.prototype.addFile = function(file) {
1560 this.files.push(file);
1561 return this;
1562};
1563
1564/**
1565 * Sets reporter to `reporter`, defaults to "spec".
1566 *
1567 * @public
1568 * @see [CLI option](../#-reporter-name-r-name)
1569 * @see [Reporters](../#reporters)
1570 * @param {String|Function} reporter - Reporter name or constructor.
1571 * @param {Object} [reporterOptions] - Options used to configure the reporter.
1572 * @returns {Mocha} this
1573 * @chainable
1574 * @throws {Error} if requested reporter cannot be loaded
1575 * @example
1576 *
1577 * // Use XUnit reporter and direct its output to file
1578 * mocha.reporter('xunit', { output: '/path/to/testspec.xunit.xml' });
1579 */
1580Mocha.prototype.reporter = function(reporter, reporterOptions) {
1581 if (typeof reporter === 'function') {
1582 this._reporter = reporter;
1583 } else {
1584 reporter = reporter || 'spec';
1585 var _reporter;
1586 // Try to load a built-in reporter.
1587 if (builtinReporters[reporter]) {
1588 _reporter = builtinReporters[reporter];
1589 }
1590 // Try to load reporters from process.cwd() and node_modules
1591 if (!_reporter) {
1592 try {
1593 _reporter = require(reporter);
1594 } catch (err) {
1595 if (
1596 err.code !== 'MODULE_NOT_FOUND' ||
1597 err.message.indexOf('Cannot find module') !== -1
1598 ) {
1599 // Try to load reporters from a path (absolute or relative)
1600 try {
1601 _reporter = require(path.resolve(process.cwd(), reporter));
1602 } catch (_err) {
1603 _err.code !== 'MODULE_NOT_FOUND' ||
1604 _err.message.indexOf('Cannot find module') !== -1
1605 ? console.warn(sQuote(reporter) + ' reporter not found')
1606 : console.warn(
1607 sQuote(reporter) +
1608 ' reporter blew up with error:\n' +
1609 err.stack
1610 );
1611 }
1612 } else {
1613 console.warn(
1614 sQuote(reporter) + ' reporter blew up with error:\n' + err.stack
1615 );
1616 }
1617 }
1618 }
1619 if (!_reporter) {
1620 throw createInvalidReporterError(
1621 'invalid reporter ' + sQuote(reporter),
1622 reporter
1623 );
1624 }
1625 this._reporter = _reporter;
1626 }
1627 this.options.reporterOption = reporterOptions;
1628 // alias option name is used in public reporters xunit/tap/progress
1629 this.options.reporterOptions = reporterOptions;
1630 return this;
1631};
1632
1633/**
1634 * Sets test UI `name`, defaults to "bdd".
1635 *
1636 * @public
1637 * @see [CLI option](../#-ui-name-u-name)
1638 * @see [Interface DSLs](../#interfaces)
1639 * @param {string|Function} [ui=bdd] - Interface name or class.
1640 * @returns {Mocha} this
1641 * @chainable
1642 * @throws {Error} if requested interface cannot be loaded
1643 */
1644Mocha.prototype.ui = function(ui) {
1645 var bindInterface;
1646 if (typeof ui === 'function') {
1647 bindInterface = ui;
1648 } else {
1649 ui = ui || 'bdd';
1650 bindInterface = exports.interfaces[ui];
1651 if (!bindInterface) {
1652 try {
1653 bindInterface = require(ui);
1654 } catch (err) {
1655 throw createInvalidInterfaceError(
1656 'invalid interface ' + sQuote(ui),
1657 ui
1658 );
1659 }
1660 }
1661 }
1662 bindInterface(this.suite);
1663
1664 this.suite.on(EVENT_FILE_PRE_REQUIRE, function(context) {
1665 exports.afterEach = context.afterEach || context.teardown;
1666 exports.after = context.after || context.suiteTeardown;
1667 exports.beforeEach = context.beforeEach || context.setup;
1668 exports.before = context.before || context.suiteSetup;
1669 exports.describe = context.describe || context.suite;
1670 exports.it = context.it || context.test;
1671 exports.xit = context.xit || (context.test && context.test.skip);
1672 exports.setup = context.setup || context.beforeEach;
1673 exports.suiteSetup = context.suiteSetup || context.before;
1674 exports.suiteTeardown = context.suiteTeardown || context.after;
1675 exports.suite = context.suite || context.describe;
1676 exports.teardown = context.teardown || context.afterEach;
1677 exports.test = context.test || context.it;
1678 exports.run = context.run;
1679 });
1680
1681 return this;
1682};
1683
1684/**
1685 * Loads `files` prior to execution. Does not support ES Modules.
1686 *
1687 * @description
1688 * The implementation relies on Node's `require` to execute
1689 * the test interface functions and will be subject to its cache.
1690 * Supports only CommonJS modules. To load ES modules, use Mocha#loadFilesAsync.
1691 *
1692 * @private
1693 * @see {@link Mocha#addFile}
1694 * @see {@link Mocha#run}
1695 * @see {@link Mocha#unloadFiles}
1696 * @see {@link Mocha#loadFilesAsync}
1697 * @param {Function} [fn] - Callback invoked upon completion.
1698 */
1699Mocha.prototype.loadFiles = function(fn) {
1700 var self = this;
1701 var suite = this.suite;
1702 this.files.forEach(function(file) {
1703 file = path.resolve(file);
1704 suite.emit(EVENT_FILE_PRE_REQUIRE, global, file, self);
1705 suite.emit(EVENT_FILE_REQUIRE, require(file), file, self);
1706 suite.emit(EVENT_FILE_POST_REQUIRE, global, file, self);
1707 });
1708 fn && fn();
1709};
1710
1711/**
1712 * Loads `files` prior to execution. Supports Node ES Modules.
1713 *
1714 * @description
1715 * The implementation relies on Node's `require` and `import` to execute
1716 * the test interface functions and will be subject to its cache.
1717 * Supports both CJS and ESM modules.
1718 *
1719 * @private
1720 * @see {@link Mocha#addFile}
1721 * @see {@link Mocha#run}
1722 * @see {@link Mocha#unloadFiles}
1723 *
1724 * @returns {Promise}
1725 */
1726Mocha.prototype.loadFilesAsync = function() {
1727 var self = this;
1728 var suite = this.suite;
1729
1730 if (!esmUtils) {
1731 return new Promise(function(resolve) {
1732 self.loadFiles(resolve);
1733 });
1734 }
1735
1736 return esmUtils.loadFilesAsync(
1737 this.files,
1738 function(file) {
1739 suite.emit(EVENT_FILE_PRE_REQUIRE, global, file, self);
1740 },
1741 function(file, resultModule) {
1742 suite.emit(EVENT_FILE_REQUIRE, resultModule, file, self);
1743 suite.emit(EVENT_FILE_POST_REQUIRE, global, file, self);
1744 }
1745 );
1746};
1747
1748/**
1749 * Removes a previously loaded file from Node's `require` cache.
1750 *
1751 * @private
1752 * @static
1753 * @see {@link Mocha#unloadFiles}
1754 * @param {string} file - Pathname of file to be unloaded.
1755 */
1756Mocha.unloadFile = function(file) {
1757 delete require.cache[require.resolve(file)];
1758};
1759
1760/**
1761 * Unloads `files` from Node's `require` cache.
1762 *
1763 * @description
1764 * This allows files to be "freshly" reloaded, providing the ability
1765 * to reuse a Mocha instance programmatically.
1766 *
1767 * <strong>Intended for consumers &mdash; not used internally</strong>
1768 *
1769 * @public
1770 * @see {@link Mocha#run}
1771 * @returns {Mocha} this
1772 * @chainable
1773 */
1774Mocha.prototype.unloadFiles = function() {
1775 this.files.forEach(Mocha.unloadFile);
1776 return this;
1777};
1778
1779/**
1780 * Sets `grep` filter after escaping RegExp special characters.
1781 *
1782 * @public
1783 * @see {@link Mocha#grep}
1784 * @param {string} str - Value to be converted to a regexp.
1785 * @returns {Mocha} this
1786 * @chainable
1787 * @example
1788 *
1789 * // Select tests whose full title begins with `"foo"` followed by a period
1790 * mocha.fgrep('foo.');
1791 */
1792Mocha.prototype.fgrep = function(str) {
1793 if (!str) {
1794 return this;
1795 }
1796 return this.grep(new RegExp(escapeRe(str)));
1797};
1798
1799/**
1800 * @summary
1801 * Sets `grep` filter used to select specific tests for execution.
1802 *
1803 * @description
1804 * If `re` is a regexp-like string, it will be converted to regexp.
1805 * The regexp is tested against the full title of each test (i.e., the
1806 * name of the test preceded by titles of each its ancestral suites).
1807 * As such, using an <em>exact-match</em> fixed pattern against the
1808 * test name itself will not yield any matches.
1809 * <br>
1810 * <strong>Previous filter value will be overwritten on each call!</strong>
1811 *
1812 * @public
1813 * @see [CLI option](../#-grep-regexp-g-regexp)
1814 * @see {@link Mocha#fgrep}
1815 * @see {@link Mocha#invert}
1816 * @param {RegExp|String} re - Regular expression used to select tests.
1817 * @return {Mocha} this
1818 * @chainable
1819 * @example
1820 *
1821 * // Select tests whose full title contains `"match"`, ignoring case
1822 * mocha.grep(/match/i);
1823 * @example
1824 *
1825 * // Same as above but with regexp-like string argument
1826 * mocha.grep('/match/i');
1827 * @example
1828 *
1829 * // ## Anti-example
1830 * // Given embedded test `it('only-this-test')`...
1831 * mocha.grep('/^only-this-test$/'); // NO! Use `.only()` to do this!
1832 */
1833Mocha.prototype.grep = function(re) {
1834 if (utils.isString(re)) {
1835 // extract args if it's regex-like, i.e: [string, pattern, flag]
1836 var arg = re.match(/^\/(.*)\/(g|i|)$|.*/);
1837 this.options.grep = new RegExp(arg[1] || arg[0], arg[2]);
1838 } else {
1839 this.options.grep = re;
1840 }
1841 return this;
1842};
1843
1844/**
1845 * Inverts `grep` matches.
1846 *
1847 * @public
1848 * @see {@link Mocha#grep}
1849 * @return {Mocha} this
1850 * @chainable
1851 * @example
1852 *
1853 * // Select tests whose full title does *not* contain `"match"`, ignoring case
1854 * mocha.grep(/match/i).invert();
1855 */
1856Mocha.prototype.invert = function() {
1857 this.options.invert = true;
1858 return this;
1859};
1860
1861/**
1862 * Enables or disables ignoring global leaks.
1863 *
1864 * @deprecated since v7.0.0
1865 * @public
1866 * @see {@link Mocha#checkLeaks}
1867 * @param {boolean} [ignoreLeaks=false] - Whether to ignore global leaks.
1868 * @return {Mocha} this
1869 * @chainable
1870 */
1871Mocha.prototype.ignoreLeaks = function(ignoreLeaks) {
1872 utils.deprecate(
1873 '"ignoreLeaks()" is DEPRECATED, please use "checkLeaks()" instead.'
1874 );
1875 this.options.checkLeaks = !ignoreLeaks;
1876 return this;
1877};
1878
1879/**
1880 * Enables or disables checking for global variables leaked while running tests.
1881 *
1882 * @public
1883 * @see [CLI option](../#-check-leaks)
1884 * @param {boolean} [checkLeaks=true] - Whether to check for global variable leaks.
1885 * @return {Mocha} this
1886 * @chainable
1887 */
1888Mocha.prototype.checkLeaks = function(checkLeaks) {
1889 this.options.checkLeaks = checkLeaks !== false;
1890 return this;
1891};
1892
1893/**
1894 * Displays full stack trace upon test failure.
1895 *
1896 * @public
1897 * @see [CLI option](../#-full-trace)
1898 * @param {boolean} [fullTrace=true] - Whether to print full stacktrace upon failure.
1899 * @return {Mocha} this
1900 * @chainable
1901 */
1902Mocha.prototype.fullTrace = function(fullTrace) {
1903 this.options.fullTrace = fullTrace !== false;
1904 return this;
1905};
1906
1907/**
1908 * Enables desktop notification support if prerequisite software installed.
1909 *
1910 * @public
1911 * @see [CLI option](../#-growl-g)
1912 * @return {Mocha} this
1913 * @chainable
1914 */
1915Mocha.prototype.growl = function() {
1916 this.options.growl = this.isGrowlCapable();
1917 if (!this.options.growl) {
1918 var detail = process.browser
1919 ? 'notification support not available in this browser...'
1920 : 'notification support prerequisites not installed...';
1921 console.error(detail + ' cannot enable!');
1922 }
1923 return this;
1924};
1925
1926/**
1927 * @summary
1928 * Determines if Growl support seems likely.
1929 *
1930 * @description
1931 * <strong>Not available when run in browser.</strong>
1932 *
1933 * @private
1934 * @see {@link Growl#isCapable}
1935 * @see {@link Mocha#growl}
1936 * @return {boolean} whether Growl support can be expected
1937 */
1938Mocha.prototype.isGrowlCapable = growl.isCapable;
1939
1940/**
1941 * Implements desktop notifications using a pseudo-reporter.
1942 *
1943 * @private
1944 * @see {@link Mocha#growl}
1945 * @see {@link Growl#notify}
1946 * @param {Runner} runner - Runner instance.
1947 */
1948Mocha.prototype._growl = growl.notify;
1949
1950/**
1951 * Specifies whitelist of variable names to be expected in global scope.
1952 *
1953 * @public
1954 * @see [CLI option](../#-global-variable-name)
1955 * @see {@link Mocha#checkLeaks}
1956 * @param {String[]|String} global - Accepted global variable name(s).
1957 * @return {Mocha} this
1958 * @chainable
1959 * @example
1960 *
1961 * // Specify variables to be expected in global scope
1962 * mocha.global(['jQuery', 'MyLib']);
1963 */
1964Mocha.prototype.global = function(global) {
1965 this.options.global = (this.options.global || [])
1966 .concat(global)
1967 .filter(Boolean)
1968 .filter(function(elt, idx, arr) {
1969 return arr.indexOf(elt) === idx;
1970 });
1971 return this;
1972};
1973// for backwards compability, 'globals' is an alias of 'global'
1974Mocha.prototype.globals = Mocha.prototype.global;
1975
1976/**
1977 * Enables or disables TTY color output by screen-oriented reporters.
1978 *
1979 * @deprecated since v7.0.0
1980 * @public
1981 * @see {@link Mocha#color}
1982 * @param {boolean} colors - Whether to enable color output.
1983 * @return {Mocha} this
1984 * @chainable
1985 */
1986Mocha.prototype.useColors = function(colors) {
1987 utils.deprecate('"useColors()" is DEPRECATED, please use "color()" instead.');
1988 if (colors !== undefined) {
1989 this.options.color = colors;
1990 }
1991 return this;
1992};
1993
1994/**
1995 * Enables or disables TTY color output by screen-oriented reporters.
1996 *
1997 * @public
1998 * @see [CLI option](../#-color-c-colors)
1999 * @param {boolean} [color=true] - Whether to enable color output.
2000 * @return {Mocha} this
2001 * @chainable
2002 */
2003Mocha.prototype.color = function(color) {
2004 this.options.color = color !== false;
2005 return this;
2006};
2007
2008/**
2009 * Determines if reporter should use inline diffs (rather than +/-)
2010 * in test failure output.
2011 *
2012 * @deprecated since v7.0.0
2013 * @public
2014 * @see {@link Mocha#inlineDiffs}
2015 * @param {boolean} [inlineDiffs=false] - Whether to use inline diffs.
2016 * @return {Mocha} this
2017 * @chainable
2018 */
2019Mocha.prototype.useInlineDiffs = function(inlineDiffs) {
2020 utils.deprecate(
2021 '"useInlineDiffs()" is DEPRECATED, please use "inlineDiffs()" instead.'
2022 );
2023 this.options.inlineDiffs = inlineDiffs !== undefined && inlineDiffs;
2024 return this;
2025};
2026
2027/**
2028 * Enables or disables reporter to use inline diffs (rather than +/-)
2029 * in test failure output.
2030 *
2031 * @public
2032 * @see [CLI option](../#-inline-diffs)
2033 * @param {boolean} [inlineDiffs=true] - Whether to use inline diffs.
2034 * @return {Mocha} this
2035 * @chainable
2036 */
2037Mocha.prototype.inlineDiffs = function(inlineDiffs) {
2038 this.options.inlineDiffs = inlineDiffs !== false;
2039 return this;
2040};
2041
2042/**
2043 * Determines if reporter should include diffs in test failure output.
2044 *
2045 * @deprecated since v7.0.0
2046 * @public
2047 * @see {@link Mocha#diff}
2048 * @param {boolean} [hideDiff=false] - Whether to hide diffs.
2049 * @return {Mocha} this
2050 * @chainable
2051 */
2052Mocha.prototype.hideDiff = function(hideDiff) {
2053 utils.deprecate('"hideDiff()" is DEPRECATED, please use "diff()" instead.');
2054 this.options.diff = !(hideDiff === true);
2055 return this;
2056};
2057
2058/**
2059 * Enables or disables reporter to include diff in test failure output.
2060 *
2061 * @public
2062 * @see [CLI option](../#-diff)
2063 * @param {boolean} [diff=true] - Whether to show diff on failure.
2064 * @return {Mocha} this
2065 * @chainable
2066 */
2067Mocha.prototype.diff = function(diff) {
2068 this.options.diff = diff !== false;
2069 return this;
2070};
2071
2072/**
2073 * @summary
2074 * Sets timeout threshold value.
2075 *
2076 * @description
2077 * A string argument can use shorthand (such as "2s") and will be converted.
2078 * If the value is `0`, timeouts will be disabled.
2079 *
2080 * @public
2081 * @see [CLI option](../#-timeout-ms-t-ms)
2082 * @see [Timeouts](../#timeouts)
2083 * @see {@link Mocha#enableTimeouts}
2084 * @param {number|string} msecs - Timeout threshold value.
2085 * @return {Mocha} this
2086 * @chainable
2087 * @example
2088 *
2089 * // Sets timeout to one second
2090 * mocha.timeout(1000);
2091 * @example
2092 *
2093 * // Same as above but using string argument
2094 * mocha.timeout('1s');
2095 */
2096Mocha.prototype.timeout = function(msecs) {
2097 this.suite.timeout(msecs);
2098 return this;
2099};
2100
2101/**
2102 * Sets the number of times to retry failed tests.
2103 *
2104 * @public
2105 * @see [CLI option](../#-retries-n)
2106 * @see [Retry Tests](../#retry-tests)
2107 * @param {number} retry - Number of times to retry failed tests.
2108 * @return {Mocha} this
2109 * @chainable
2110 * @example
2111 *
2112 * // Allow any failed test to retry one more time
2113 * mocha.retries(1);
2114 */
2115Mocha.prototype.retries = function(n) {
2116 this.suite.retries(n);
2117 return this;
2118};
2119
2120/**
2121 * Sets slowness threshold value.
2122 *
2123 * @public
2124 * @see [CLI option](../#-slow-ms-s-ms)
2125 * @param {number} msecs - Slowness threshold value.
2126 * @return {Mocha} this
2127 * @chainable
2128 * @example
2129 *
2130 * // Sets "slow" threshold to half a second
2131 * mocha.slow(500);
2132 * @example
2133 *
2134 * // Same as above but using string argument
2135 * mocha.slow('0.5s');
2136 */
2137Mocha.prototype.slow = function(msecs) {
2138 this.suite.slow(msecs);
2139 return this;
2140};
2141
2142/**
2143 * Enables or disables timeouts.
2144 *
2145 * @public
2146 * @see [CLI option](../#-timeout-ms-t-ms)
2147 * @param {boolean} enableTimeouts - Whether to enable timeouts.
2148 * @return {Mocha} this
2149 * @chainable
2150 */
2151Mocha.prototype.enableTimeouts = function(enableTimeouts) {
2152 this.suite.enableTimeouts(
2153 arguments.length && enableTimeouts !== undefined ? enableTimeouts : true
2154 );
2155 return this;
2156};
2157
2158/**
2159 * Forces all tests to either accept a `done` callback or return a promise.
2160 *
2161 * @public
2162 * @see [CLI option](../#-async-only-a)
2163 * @param {boolean} [asyncOnly=true] - Wether to force `done` callback or promise.
2164 * @return {Mocha} this
2165 * @chainable
2166 */
2167Mocha.prototype.asyncOnly = function(asyncOnly) {
2168 this.options.asyncOnly = asyncOnly !== false;
2169 return this;
2170};
2171
2172/**
2173 * Disables syntax highlighting (in browser).
2174 *
2175 * @public
2176 * @return {Mocha} this
2177 * @chainable
2178 */
2179Mocha.prototype.noHighlighting = function() {
2180 this.options.noHighlighting = true;
2181 return this;
2182};
2183
2184/**
2185 * Enables or disables uncaught errors to propagate.
2186 *
2187 * @public
2188 * @see [CLI option](../#-allow-uncaught)
2189 * @param {boolean} [allowUncaught=true] - Whether to propagate uncaught errors.
2190 * @return {Mocha} this
2191 * @chainable
2192 */
2193Mocha.prototype.allowUncaught = function(allowUncaught) {
2194 this.options.allowUncaught = allowUncaught !== false;
2195 return this;
2196};
2197
2198/**
2199 * @summary
2200 * Delays root suite execution.
2201 *
2202 * @description
2203 * Used to perform asynch operations before any suites are run.
2204 *
2205 * @public
2206 * @see [delayed root suite](../#delayed-root-suite)
2207 * @returns {Mocha} this
2208 * @chainable
2209 */
2210Mocha.prototype.delay = function delay() {
2211 this.options.delay = true;
2212 return this;
2213};
2214
2215/**
2216 * Causes tests marked `only` to fail the suite.
2217 *
2218 * @public
2219 * @see [CLI option](../#-forbid-only)
2220 * @param {boolean} [forbidOnly=true] - Whether tests marked `only` fail the suite.
2221 * @returns {Mocha} this
2222 * @chainable
2223 */
2224Mocha.prototype.forbidOnly = function(forbidOnly) {
2225 this.options.forbidOnly = forbidOnly !== false;
2226 return this;
2227};
2228
2229/**
2230 * Causes pending tests and tests marked `skip` to fail the suite.
2231 *
2232 * @public
2233 * @see [CLI option](../#-forbid-pending)
2234 * @param {boolean} [forbidPending=true] - Whether pending tests fail the suite.
2235 * @returns {Mocha} this
2236 * @chainable
2237 */
2238Mocha.prototype.forbidPending = function(forbidPending) {
2239 this.options.forbidPending = forbidPending !== false;
2240 return this;
2241};
2242
2243/**
2244 * Mocha version as specified by "package.json".
2245 *
2246 * @name Mocha#version
2247 * @type string
2248 * @readonly
2249 */
2250Object.defineProperty(Mocha.prototype, 'version', {
2251 value: require('../package.json').version,
2252 configurable: false,
2253 enumerable: true,
2254 writable: false
2255});
2256
2257/**
2258 * Callback to be invoked when test execution is complete.
2259 *
2260 * @callback DoneCB
2261 * @param {number} failures - Number of failures that occurred.
2262 */
2263
2264/**
2265 * Runs root suite and invokes `fn()` when complete.
2266 *
2267 * @description
2268 * To run tests multiple times (or to run tests in files that are
2269 * already in the `require` cache), make sure to clear them from
2270 * the cache first!
2271 *
2272 * This method supports only CommonJS test files, and not ES modules ones.
2273 * To use ES module (and CommonJS) test files, call Mocha#runAsync instead.
2274 *
2275 * @public
2276 * @see {@link Mocha#runAsync}
2277 * @see {@link Mocha#unloadFiles}
2278 * @see {@link Runner#run}
2279 * @param {DoneCB} [fn] - Callback invoked when test execution completed.
2280 * @return {Runner} runner instance
2281 */
2282Mocha.prototype.run = function(fn) {
2283 if (this.files.length) {
2284 this.loadFiles();
2285 }
2286 return this._startRunning(fn);
2287};
2288
2289Mocha.prototype._startRunning = function(fn) {
2290 var self = this;
2291 var suite = self.suite;
2292 var options = self.options;
2293 options.files = self.files;
2294 var runner = new exports.Runner(suite, options.delay);
2295 createStatsCollector(runner);
2296 var reporter = new self._reporter(runner, options);
2297 runner.checkLeaks = options.checkLeaks === true;
2298 runner.fullStackTrace = options.fullTrace;
2299 runner.asyncOnly = options.asyncOnly;
2300 runner.allowUncaught = options.allowUncaught;
2301 runner.forbidOnly = options.forbidOnly;
2302 runner.forbidPending = options.forbidPending;
2303 if (options.grep) {
2304 runner.grep(options.grep, options.invert);
2305 }
2306 if (options.global) {
2307 runner.globals(options.global);
2308 }
2309 if (options.growl) {
2310 self._growl(runner);
2311 }
2312 if (options.color !== undefined) {
2313 exports.reporters.Base.useColors = options.color;
2314 }
2315 exports.reporters.Base.inlineDiffs = options.inlineDiffs;
2316 exports.reporters.Base.hideDiff = !options.diff;
2317
2318 function done(failures) {
2319 fn = fn || utils.noop;
2320 if (reporter.done) {
2321 reporter.done(failures, fn);
2322 } else {
2323 fn(failures);
2324 }
2325 }
2326
2327 return runner.run(done);
2328};
2329
2330/**
2331 * Runs root suite and invokes `fn()` when complete. Supports ES Modules.
2332 *
2333 * @description
2334 * To run tests multiple times (or to run tests in files that are
2335 * already in the `require` cache), make sure to clear them from
2336 * the cache first!
2337 *
2338 * This method supports both ES Modules and CommonJS test files.
2339 *
2340 * @public
2341 * @see {@link Mocha#unloadFiles}
2342 * @see {@link Runner#run}
2343 * @return {Promise<Runner>} runner instance
2344 */
2345Mocha.prototype.runAsync = function() {
2346 var loadResult = this.files.length
2347 ? this.loadFilesAsync()
2348 : Promise.resolve();
2349
2350 var self = this;
2351 return loadResult.then(function() {
2352 return new Promise(function(resolve) {
2353 self._startRunning(function(result) {
2354 resolve(result);
2355 });
2356 });
2357 });
2358};
2359
2360}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
2361},{"../package.json":90,"./context":5,"./errors":6,"./esm-utils":42,"./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){
2362module.exports={
2363 "diff": true,
2364 "extension": ["js", "cjs", "mjs"],
2365 "opts": "./test/mocha.opts",
2366 "package": "./package.json",
2367 "reporter": "spec",
2368 "slow": 75,
2369 "timeout": 2000,
2370 "ui": "bdd",
2371 "watch-ignore": ["node_modules", ".git"]
2372}
2373
2374},{}],16:[function(require,module,exports){
2375'use strict';
2376
2377module.exports = Pending;
2378
2379/**
2380 * Initialize a new `Pending` error with the given message.
2381 *
2382 * @param {string} message
2383 */
2384function Pending(message) {
2385 this.message = message;
2386}
2387
2388},{}],17:[function(require,module,exports){
2389(function (process){
2390'use strict';
2391/**
2392 * @module Base
2393 */
2394/**
2395 * Module dependencies.
2396 */
2397
2398var tty = require('tty');
2399var diff = require('diff');
2400var milliseconds = require('ms');
2401var utils = require('../utils');
2402var supportsColor = process.browser ? null : require('supports-color');
2403var constants = require('../runner').constants;
2404var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
2405var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
2406
2407/**
2408 * Expose `Base`.
2409 */
2410
2411exports = module.exports = Base;
2412
2413/**
2414 * Check if both stdio streams are associated with a tty.
2415 */
2416
2417var isatty = process.stdout.isTTY && process.stderr.isTTY;
2418
2419/**
2420 * Save log references to avoid tests interfering (see GH-3604).
2421 */
2422var consoleLog = console.log;
2423
2424/**
2425 * Enable coloring by default, except in the browser interface.
2426 */
2427
2428exports.useColors =
2429 !process.browser &&
2430 (supportsColor.stdout || process.env.MOCHA_COLORS !== undefined);
2431
2432/**
2433 * Inline diffs instead of +/-
2434 */
2435
2436exports.inlineDiffs = false;
2437
2438/**
2439 * Default color map.
2440 */
2441
2442exports.colors = {
2443 pass: 90,
2444 fail: 31,
2445 'bright pass': 92,
2446 'bright fail': 91,
2447 'bright yellow': 93,
2448 pending: 36,
2449 suite: 0,
2450 'error title': 0,
2451 'error message': 31,
2452 'error stack': 90,
2453 checkmark: 32,
2454 fast: 90,
2455 medium: 33,
2456 slow: 31,
2457 green: 32,
2458 light: 90,
2459 'diff gutter': 90,
2460 'diff added': 32,
2461 'diff removed': 31
2462};
2463
2464/**
2465 * Default symbol map.
2466 */
2467
2468exports.symbols = {
2469 ok: '✓',
2470 err: '✖',
2471 dot: '․',
2472 comma: ',',
2473 bang: '!'
2474};
2475
2476// With node.js on Windows: use symbols available in terminal default fonts
2477if (process.platform === 'win32') {
2478 exports.symbols.ok = '\u221A';
2479 exports.symbols.err = '\u00D7';
2480 exports.symbols.dot = '.';
2481}
2482
2483/**
2484 * Color `str` with the given `type`,
2485 * allowing colors to be disabled,
2486 * as well as user-defined color
2487 * schemes.
2488 *
2489 * @private
2490 * @param {string} type
2491 * @param {string} str
2492 * @return {string}
2493 */
2494var color = (exports.color = function(type, str) {
2495 if (!exports.useColors) {
2496 return String(str);
2497 }
2498 return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m';
2499});
2500
2501/**
2502 * Expose term window size, with some defaults for when stderr is not a tty.
2503 */
2504
2505exports.window = {
2506 width: 75
2507};
2508
2509if (isatty) {
2510 exports.window.width = process.stdout.getWindowSize
2511 ? process.stdout.getWindowSize(1)[0]
2512 : tty.getWindowSize()[1];
2513}
2514
2515/**
2516 * Expose some basic cursor interactions that are common among reporters.
2517 */
2518
2519exports.cursor = {
2520 hide: function() {
2521 isatty && process.stdout.write('\u001b[?25l');
2522 },
2523
2524 show: function() {
2525 isatty && process.stdout.write('\u001b[?25h');
2526 },
2527
2528 deleteLine: function() {
2529 isatty && process.stdout.write('\u001b[2K');
2530 },
2531
2532 beginningOfLine: function() {
2533 isatty && process.stdout.write('\u001b[0G');
2534 },
2535
2536 CR: function() {
2537 if (isatty) {
2538 exports.cursor.deleteLine();
2539 exports.cursor.beginningOfLine();
2540 } else {
2541 process.stdout.write('\r');
2542 }
2543 }
2544};
2545
2546var showDiff = (exports.showDiff = function(err) {
2547 return (
2548 err &&
2549 err.showDiff !== false &&
2550 sameType(err.actual, err.expected) &&
2551 err.expected !== undefined
2552 );
2553});
2554
2555function stringifyDiffObjs(err) {
2556 if (!utils.isString(err.actual) || !utils.isString(err.expected)) {
2557 err.actual = utils.stringify(err.actual);
2558 err.expected = utils.stringify(err.expected);
2559 }
2560}
2561
2562/**
2563 * Returns a diff between 2 strings with coloured ANSI output.
2564 *
2565 * @description
2566 * The diff will be either inline or unified dependent on the value
2567 * of `Base.inlineDiff`.
2568 *
2569 * @param {string} actual
2570 * @param {string} expected
2571 * @return {string} Diff
2572 */
2573var generateDiff = (exports.generateDiff = function(actual, expected) {
2574 try {
2575 return exports.inlineDiffs
2576 ? inlineDiff(actual, expected)
2577 : unifiedDiff(actual, expected);
2578 } catch (err) {
2579 var msg =
2580 '\n ' +
2581 color('diff added', '+ expected') +
2582 ' ' +
2583 color('diff removed', '- actual: failed to generate Mocha diff') +
2584 '\n';
2585 return msg;
2586 }
2587});
2588
2589/**
2590 * Outputs the given `failures` as a list.
2591 *
2592 * @public
2593 * @memberof Mocha.reporters.Base
2594 * @variation 1
2595 * @param {Object[]} failures - Each is Test instance with corresponding
2596 * Error property
2597 */
2598exports.list = function(failures) {
2599 var multipleErr, multipleTest;
2600 Base.consoleLog();
2601 failures.forEach(function(test, i) {
2602 // format
2603 var fmt =
2604 color('error title', ' %s) %s:\n') +
2605 color('error message', ' %s') +
2606 color('error stack', '\n%s\n');
2607
2608 // msg
2609 var msg;
2610 var err;
2611 if (test.err && test.err.multiple) {
2612 if (multipleTest !== test) {
2613 multipleTest = test;
2614 multipleErr = [test.err].concat(test.err.multiple);
2615 }
2616 err = multipleErr.shift();
2617 } else {
2618 err = test.err;
2619 }
2620 var message;
2621 if (err.message && typeof err.message.toString === 'function') {
2622 message = err.message + '';
2623 } else if (typeof err.inspect === 'function') {
2624 message = err.inspect() + '';
2625 } else {
2626 message = '';
2627 }
2628 var stack = err.stack || message;
2629 var index = message ? stack.indexOf(message) : -1;
2630
2631 if (index === -1) {
2632 msg = message;
2633 } else {
2634 index += message.length;
2635 msg = stack.slice(0, index);
2636 // remove msg from stack
2637 stack = stack.slice(index + 1);
2638 }
2639
2640 // uncaught
2641 if (err.uncaught) {
2642 msg = 'Uncaught ' + msg;
2643 }
2644 // explicitly show diff
2645 if (!exports.hideDiff && showDiff(err)) {
2646 stringifyDiffObjs(err);
2647 fmt =
2648 color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n');
2649 var match = message.match(/^([^:]+): expected/);
2650 msg = '\n ' + color('error message', match ? match[1] : msg);
2651
2652 msg += generateDiff(err.actual, err.expected);
2653 }
2654
2655 // indent stack trace
2656 stack = stack.replace(/^/gm, ' ');
2657
2658 // indented test title
2659 var testTitle = '';
2660 test.titlePath().forEach(function(str, index) {
2661 if (index !== 0) {
2662 testTitle += '\n ';
2663 }
2664 for (var i = 0; i < index; i++) {
2665 testTitle += ' ';
2666 }
2667 testTitle += str;
2668 });
2669
2670 Base.consoleLog(fmt, i + 1, testTitle, msg, stack);
2671 });
2672};
2673
2674/**
2675 * Constructs a new `Base` reporter instance.
2676 *
2677 * @description
2678 * All other reporters generally inherit from this reporter.
2679 *
2680 * @public
2681 * @class
2682 * @memberof Mocha.reporters
2683 * @param {Runner} runner - Instance triggers reporter actions.
2684 * @param {Object} [options] - runner options
2685 */
2686function Base(runner, options) {
2687 var failures = (this.failures = []);
2688
2689 if (!runner) {
2690 throw new TypeError('Missing runner argument');
2691 }
2692 this.options = options || {};
2693 this.runner = runner;
2694 this.stats = runner.stats; // assigned so Reporters keep a closer reference
2695
2696 runner.on(EVENT_TEST_PASS, function(test) {
2697 if (test.duration > test.slow()) {
2698 test.speed = 'slow';
2699 } else if (test.duration > test.slow() / 2) {
2700 test.speed = 'medium';
2701 } else {
2702 test.speed = 'fast';
2703 }
2704 });
2705
2706 runner.on(EVENT_TEST_FAIL, function(test, err) {
2707 if (showDiff(err)) {
2708 stringifyDiffObjs(err);
2709 }
2710 // more than one error per test
2711 if (test.err && err instanceof Error) {
2712 test.err.multiple = (test.err.multiple || []).concat(err);
2713 } else {
2714 test.err = err;
2715 }
2716 failures.push(test);
2717 });
2718}
2719
2720/**
2721 * Outputs common epilogue used by many of the bundled reporters.
2722 *
2723 * @public
2724 * @memberof Mocha.reporters
2725 */
2726Base.prototype.epilogue = function() {
2727 var stats = this.stats;
2728 var fmt;
2729
2730 Base.consoleLog();
2731
2732 // passes
2733 fmt =
2734 color('bright pass', ' ') +
2735 color('green', ' %d passing') +
2736 color('light', ' (%s)');
2737
2738 Base.consoleLog(fmt, stats.passes || 0, milliseconds(stats.duration));
2739
2740 // pending
2741 if (stats.pending) {
2742 fmt = color('pending', ' ') + color('pending', ' %d pending');
2743
2744 Base.consoleLog(fmt, stats.pending);
2745 }
2746
2747 // failures
2748 if (stats.failures) {
2749 fmt = color('fail', ' %d failing');
2750
2751 Base.consoleLog(fmt, stats.failures);
2752
2753 Base.list(this.failures);
2754 Base.consoleLog();
2755 }
2756
2757 Base.consoleLog();
2758};
2759
2760/**
2761 * Pads the given `str` to `len`.
2762 *
2763 * @private
2764 * @param {string} str
2765 * @param {string} len
2766 * @return {string}
2767 */
2768function pad(str, len) {
2769 str = String(str);
2770 return Array(len - str.length + 1).join(' ') + str;
2771}
2772
2773/**
2774 * Returns inline diff between 2 strings with coloured ANSI output.
2775 *
2776 * @private
2777 * @param {String} actual
2778 * @param {String} expected
2779 * @return {string} Diff
2780 */
2781function inlineDiff(actual, expected) {
2782 var msg = errorDiff(actual, expected);
2783
2784 // linenos
2785 var lines = msg.split('\n');
2786 if (lines.length > 4) {
2787 var width = String(lines.length).length;
2788 msg = lines
2789 .map(function(str, i) {
2790 return pad(++i, width) + ' |' + ' ' + str;
2791 })
2792 .join('\n');
2793 }
2794
2795 // legend
2796 msg =
2797 '\n' +
2798 color('diff removed', 'actual') +
2799 ' ' +
2800 color('diff added', 'expected') +
2801 '\n\n' +
2802 msg +
2803 '\n';
2804
2805 // indent
2806 msg = msg.replace(/^/gm, ' ');
2807 return msg;
2808}
2809
2810/**
2811 * Returns unified diff between two strings with coloured ANSI output.
2812 *
2813 * @private
2814 * @param {String} actual
2815 * @param {String} expected
2816 * @return {string} The diff.
2817 */
2818function unifiedDiff(actual, expected) {
2819 var indent = ' ';
2820 function cleanUp(line) {
2821 if (line[0] === '+') {
2822 return indent + colorLines('diff added', line);
2823 }
2824 if (line[0] === '-') {
2825 return indent + colorLines('diff removed', line);
2826 }
2827 if (line.match(/@@/)) {
2828 return '--';
2829 }
2830 if (line.match(/\\ No newline/)) {
2831 return null;
2832 }
2833 return indent + line;
2834 }
2835 function notBlank(line) {
2836 return typeof line !== 'undefined' && line !== null;
2837 }
2838 var msg = diff.createPatch('string', actual, expected);
2839 var lines = msg.split('\n').splice(5);
2840 return (
2841 '\n ' +
2842 colorLines('diff added', '+ expected') +
2843 ' ' +
2844 colorLines('diff removed', '- actual') +
2845 '\n\n' +
2846 lines
2847 .map(cleanUp)
2848 .filter(notBlank)
2849 .join('\n')
2850 );
2851}
2852
2853/**
2854 * Returns character diff for `err`.
2855 *
2856 * @private
2857 * @param {String} actual
2858 * @param {String} expected
2859 * @return {string} the diff
2860 */
2861function errorDiff(actual, expected) {
2862 return diff
2863 .diffWordsWithSpace(actual, expected)
2864 .map(function(str) {
2865 if (str.added) {
2866 return colorLines('diff added', str.value);
2867 }
2868 if (str.removed) {
2869 return colorLines('diff removed', str.value);
2870 }
2871 return str.value;
2872 })
2873 .join('');
2874}
2875
2876/**
2877 * Colors lines for `str`, using the color `name`.
2878 *
2879 * @private
2880 * @param {string} name
2881 * @param {string} str
2882 * @return {string}
2883 */
2884function colorLines(name, str) {
2885 return str
2886 .split('\n')
2887 .map(function(str) {
2888 return color(name, str);
2889 })
2890 .join('\n');
2891}
2892
2893/**
2894 * Object#toString reference.
2895 */
2896var objToString = Object.prototype.toString;
2897
2898/**
2899 * Checks that a / b have the same type.
2900 *
2901 * @private
2902 * @param {Object} a
2903 * @param {Object} b
2904 * @return {boolean}
2905 */
2906function sameType(a, b) {
2907 return objToString.call(a) === objToString.call(b);
2908}
2909
2910Base.consoleLog = consoleLog;
2911
2912Base.abstract = true;
2913
2914}).call(this,require('_process'))
2915},{"../runner":34,"../utils":38,"_process":69,"diff":48,"ms":60,"supports-color":42,"tty":4}],18:[function(require,module,exports){
2916'use strict';
2917/**
2918 * @module Doc
2919 */
2920/**
2921 * Module dependencies.
2922 */
2923
2924var Base = require('./base');
2925var utils = require('../utils');
2926var constants = require('../runner').constants;
2927var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
2928var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
2929var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
2930var EVENT_SUITE_END = constants.EVENT_SUITE_END;
2931
2932/**
2933 * Expose `Doc`.
2934 */
2935
2936exports = module.exports = Doc;
2937
2938/**
2939 * Constructs a new `Doc` reporter instance.
2940 *
2941 * @public
2942 * @class
2943 * @memberof Mocha.reporters
2944 * @extends Mocha.reporters.Base
2945 * @param {Runner} runner - Instance triggers reporter actions.
2946 * @param {Object} [options] - runner options
2947 */
2948function Doc(runner, options) {
2949 Base.call(this, runner, options);
2950
2951 var indents = 2;
2952
2953 function indent() {
2954 return Array(indents).join(' ');
2955 }
2956
2957 runner.on(EVENT_SUITE_BEGIN, function(suite) {
2958 if (suite.root) {
2959 return;
2960 }
2961 ++indents;
2962 Base.consoleLog('%s<section class="suite">', indent());
2963 ++indents;
2964 Base.consoleLog('%s<h1>%s</h1>', indent(), utils.escape(suite.title));
2965 Base.consoleLog('%s<dl>', indent());
2966 });
2967
2968 runner.on(EVENT_SUITE_END, function(suite) {
2969 if (suite.root) {
2970 return;
2971 }
2972 Base.consoleLog('%s</dl>', indent());
2973 --indents;
2974 Base.consoleLog('%s</section>', indent());
2975 --indents;
2976 });
2977
2978 runner.on(EVENT_TEST_PASS, function(test) {
2979 Base.consoleLog('%s <dt>%s</dt>', indent(), utils.escape(test.title));
2980 var code = utils.escape(utils.clean(test.body));
2981 Base.consoleLog('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
2982 });
2983
2984 runner.on(EVENT_TEST_FAIL, function(test, err) {
2985 Base.consoleLog(
2986 '%s <dt class="error">%s</dt>',
2987 indent(),
2988 utils.escape(test.title)
2989 );
2990 var code = utils.escape(utils.clean(test.body));
2991 Base.consoleLog(
2992 '%s <dd class="error"><pre><code>%s</code></pre></dd>',
2993 indent(),
2994 code
2995 );
2996 Base.consoleLog(
2997 '%s <dd class="error">%s</dd>',
2998 indent(),
2999 utils.escape(err)
3000 );
3001 });
3002}
3003
3004Doc.description = 'HTML documentation';
3005
3006},{"../runner":34,"../utils":38,"./base":17}],19:[function(require,module,exports){
3007(function (process){
3008'use strict';
3009/**
3010 * @module Dot
3011 */
3012/**
3013 * Module dependencies.
3014 */
3015
3016var Base = require('./base');
3017var inherits = require('../utils').inherits;
3018var constants = require('../runner').constants;
3019var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
3020var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
3021var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
3022var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
3023var EVENT_RUN_END = constants.EVENT_RUN_END;
3024
3025/**
3026 * Expose `Dot`.
3027 */
3028
3029exports = module.exports = Dot;
3030
3031/**
3032 * Constructs a new `Dot` reporter instance.
3033 *
3034 * @public
3035 * @class
3036 * @memberof Mocha.reporters
3037 * @extends Mocha.reporters.Base
3038 * @param {Runner} runner - Instance triggers reporter actions.
3039 * @param {Object} [options] - runner options
3040 */
3041function Dot(runner, options) {
3042 Base.call(this, runner, options);
3043
3044 var self = this;
3045 var width = (Base.window.width * 0.75) | 0;
3046 var n = -1;
3047
3048 runner.on(EVENT_RUN_BEGIN, function() {
3049 process.stdout.write('\n');
3050 });
3051
3052 runner.on(EVENT_TEST_PENDING, function() {
3053 if (++n % width === 0) {
3054 process.stdout.write('\n ');
3055 }
3056 process.stdout.write(Base.color('pending', Base.symbols.comma));
3057 });
3058
3059 runner.on(EVENT_TEST_PASS, function(test) {
3060 if (++n % width === 0) {
3061 process.stdout.write('\n ');
3062 }
3063 if (test.speed === 'slow') {
3064 process.stdout.write(Base.color('bright yellow', Base.symbols.dot));
3065 } else {
3066 process.stdout.write(Base.color(test.speed, Base.symbols.dot));
3067 }
3068 });
3069
3070 runner.on(EVENT_TEST_FAIL, function() {
3071 if (++n % width === 0) {
3072 process.stdout.write('\n ');
3073 }
3074 process.stdout.write(Base.color('fail', Base.symbols.bang));
3075 });
3076
3077 runner.once(EVENT_RUN_END, function() {
3078 process.stdout.write('\n');
3079 self.epilogue();
3080 });
3081}
3082
3083/**
3084 * Inherit from `Base.prototype`.
3085 */
3086inherits(Dot, Base);
3087
3088Dot.description = 'dot matrix representation';
3089
3090}).call(this,require('_process'))
3091},{"../runner":34,"../utils":38,"./base":17,"_process":69}],20:[function(require,module,exports){
3092(function (global){
3093'use strict';
3094
3095/* eslint-env browser */
3096/**
3097 * @module HTML
3098 */
3099/**
3100 * Module dependencies.
3101 */
3102
3103var Base = require('./base');
3104var utils = require('../utils');
3105var Progress = require('../browser/progress');
3106var escapeRe = require('escape-string-regexp');
3107var constants = require('../runner').constants;
3108var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
3109var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
3110var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
3111var EVENT_SUITE_END = constants.EVENT_SUITE_END;
3112var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
3113var escape = utils.escape;
3114
3115/**
3116 * Save timer references to avoid Sinon interfering (see GH-237).
3117 */
3118
3119var Date = global.Date;
3120
3121/**
3122 * Expose `HTML`.
3123 */
3124
3125exports = module.exports = HTML;
3126
3127/**
3128 * Stats template.
3129 */
3130
3131var statsTemplate =
3132 '<ul id="mocha-stats">' +
3133 '<li class="progress"><canvas width="40" height="40"></canvas></li>' +
3134 '<li class="passes"><a href="javascript:void(0);">passes:</a> <em>0</em></li>' +
3135 '<li class="failures"><a href="javascript:void(0);">failures:</a> <em>0</em></li>' +
3136 '<li class="duration">duration: <em>0</em>s</li>' +
3137 '</ul>';
3138
3139var playIcon = '&#x2023;';
3140
3141/**
3142 * Constructs a new `HTML` reporter instance.
3143 *
3144 * @public
3145 * @class
3146 * @memberof Mocha.reporters
3147 * @extends Mocha.reporters.Base
3148 * @param {Runner} runner - Instance triggers reporter actions.
3149 * @param {Object} [options] - runner options
3150 */
3151function HTML(runner, options) {
3152 Base.call(this, runner, options);
3153
3154 var self = this;
3155 var stats = this.stats;
3156 var stat = fragment(statsTemplate);
3157 var items = stat.getElementsByTagName('li');
3158 var passes = items[1].getElementsByTagName('em')[0];
3159 var passesLink = items[1].getElementsByTagName('a')[0];
3160 var failures = items[2].getElementsByTagName('em')[0];
3161 var failuresLink = items[2].getElementsByTagName('a')[0];
3162 var duration = items[3].getElementsByTagName('em')[0];
3163 var canvas = stat.getElementsByTagName('canvas')[0];
3164 var report = fragment('<ul id="mocha-report"></ul>');
3165 var stack = [report];
3166 var progress;
3167 var ctx;
3168 var root = document.getElementById('mocha');
3169
3170 if (canvas.getContext) {
3171 var ratio = window.devicePixelRatio || 1;
3172 canvas.style.width = canvas.width;
3173 canvas.style.height = canvas.height;
3174 canvas.width *= ratio;
3175 canvas.height *= ratio;
3176 ctx = canvas.getContext('2d');
3177 ctx.scale(ratio, ratio);
3178 progress = new Progress();
3179 }
3180
3181 if (!root) {
3182 return error('#mocha div missing, add it to your document');
3183 }
3184
3185 // pass toggle
3186 on(passesLink, 'click', function(evt) {
3187 evt.preventDefault();
3188 unhide();
3189 var name = /pass/.test(report.className) ? '' : ' pass';
3190 report.className = report.className.replace(/fail|pass/g, '') + name;
3191 if (report.className.trim()) {
3192 hideSuitesWithout('test pass');
3193 }
3194 });
3195
3196 // failure toggle
3197 on(failuresLink, 'click', function(evt) {
3198 evt.preventDefault();
3199 unhide();
3200 var name = /fail/.test(report.className) ? '' : ' fail';
3201 report.className = report.className.replace(/fail|pass/g, '') + name;
3202 if (report.className.trim()) {
3203 hideSuitesWithout('test fail');
3204 }
3205 });
3206
3207 root.appendChild(stat);
3208 root.appendChild(report);
3209
3210 if (progress) {
3211 progress.size(40);
3212 }
3213
3214 runner.on(EVENT_SUITE_BEGIN, function(suite) {
3215 if (suite.root) {
3216 return;
3217 }
3218
3219 // suite
3220 var url = self.suiteURL(suite);
3221 var el = fragment(
3222 '<li class="suite"><h1><a href="%s">%s</a></h1></li>',
3223 url,
3224 escape(suite.title)
3225 );
3226
3227 // container
3228 stack[0].appendChild(el);
3229 stack.unshift(document.createElement('ul'));
3230 el.appendChild(stack[0]);
3231 });
3232
3233 runner.on(EVENT_SUITE_END, function(suite) {
3234 if (suite.root) {
3235 updateStats();
3236 return;
3237 }
3238 stack.shift();
3239 });
3240
3241 runner.on(EVENT_TEST_PASS, function(test) {
3242 var url = self.testURL(test);
3243 var markup =
3244 '<li class="test pass %e"><h2>%e<span class="duration">%ems</span> ' +
3245 '<a href="%s" class="replay">' +
3246 playIcon +
3247 '</a></h2></li>';
3248 var el = fragment(markup, test.speed, test.title, test.duration, url);
3249 self.addCodeToggle(el, test.body);
3250 appendToStack(el);
3251 updateStats();
3252 });
3253
3254 runner.on(EVENT_TEST_FAIL, function(test) {
3255 var el = fragment(
3256 '<li class="test fail"><h2>%e <a href="%e" class="replay">' +
3257 playIcon +
3258 '</a></h2></li>',
3259 test.title,
3260 self.testURL(test)
3261 );
3262 var stackString; // Note: Includes leading newline
3263 var message = test.err.toString();
3264
3265 // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we
3266 // check for the result of the stringifying.
3267 if (message === '[object Error]') {
3268 message = test.err.message;
3269 }
3270
3271 if (test.err.stack) {
3272 var indexOfMessage = test.err.stack.indexOf(test.err.message);
3273 if (indexOfMessage === -1) {
3274 stackString = test.err.stack;
3275 } else {
3276 stackString = test.err.stack.substr(
3277 test.err.message.length + indexOfMessage
3278 );
3279 }
3280 } else if (test.err.sourceURL && test.err.line !== undefined) {
3281 // Safari doesn't give you a stack. Let's at least provide a source line.
3282 stackString = '\n(' + test.err.sourceURL + ':' + test.err.line + ')';
3283 }
3284
3285 stackString = stackString || '';
3286
3287 if (test.err.htmlMessage && stackString) {
3288 el.appendChild(
3289 fragment(
3290 '<div class="html-error">%s\n<pre class="error">%e</pre></div>',
3291 test.err.htmlMessage,
3292 stackString
3293 )
3294 );
3295 } else if (test.err.htmlMessage) {
3296 el.appendChild(
3297 fragment('<div class="html-error">%s</div>', test.err.htmlMessage)
3298 );
3299 } else {
3300 el.appendChild(
3301 fragment('<pre class="error">%e%e</pre>', message, stackString)
3302 );
3303 }
3304
3305 self.addCodeToggle(el, test.body);
3306 appendToStack(el);
3307 updateStats();
3308 });
3309
3310 runner.on(EVENT_TEST_PENDING, function(test) {
3311 var el = fragment(
3312 '<li class="test pass pending"><h2>%e</h2></li>',
3313 test.title
3314 );
3315 appendToStack(el);
3316 updateStats();
3317 });
3318
3319 function appendToStack(el) {
3320 // Don't call .appendChild if #mocha-report was already .shift()'ed off the stack.
3321 if (stack[0]) {
3322 stack[0].appendChild(el);
3323 }
3324 }
3325
3326 function updateStats() {
3327 // TODO: add to stats
3328 var percent = ((stats.tests / runner.total) * 100) | 0;
3329 if (progress) {
3330 progress.update(percent).draw(ctx);
3331 }
3332
3333 // update stats
3334 var ms = new Date() - stats.start;
3335 text(passes, stats.passes);
3336 text(failures, stats.failures);
3337 text(duration, (ms / 1000).toFixed(2));
3338 }
3339}
3340
3341/**
3342 * Makes a URL, preserving querystring ("search") parameters.
3343 *
3344 * @param {string} s
3345 * @return {string} A new URL.
3346 */
3347function makeUrl(s) {
3348 var search = window.location.search;
3349
3350 // Remove previous grep query parameter if present
3351 if (search) {
3352 search = search.replace(/[?&]grep=[^&\s]*/g, '').replace(/^&/, '?');
3353 }
3354
3355 return (
3356 window.location.pathname +
3357 (search ? search + '&' : '?') +
3358 'grep=' +
3359 encodeURIComponent(escapeRe(s))
3360 );
3361}
3362
3363/**
3364 * Provide suite URL.
3365 *
3366 * @param {Object} [suite]
3367 */
3368HTML.prototype.suiteURL = function(suite) {
3369 return makeUrl(suite.fullTitle());
3370};
3371
3372/**
3373 * Provide test URL.
3374 *
3375 * @param {Object} [test]
3376 */
3377HTML.prototype.testURL = function(test) {
3378 return makeUrl(test.fullTitle());
3379};
3380
3381/**
3382 * Adds code toggle functionality for the provided test's list element.
3383 *
3384 * @param {HTMLLIElement} el
3385 * @param {string} contents
3386 */
3387HTML.prototype.addCodeToggle = function(el, contents) {
3388 var h2 = el.getElementsByTagName('h2')[0];
3389
3390 on(h2, 'click', function() {
3391 pre.style.display = pre.style.display === 'none' ? 'block' : 'none';
3392 });
3393
3394 var pre = fragment('<pre><code>%e</code></pre>', utils.clean(contents));
3395 el.appendChild(pre);
3396 pre.style.display = 'none';
3397};
3398
3399/**
3400 * Display error `msg`.
3401 *
3402 * @param {string} msg
3403 */
3404function error(msg) {
3405 document.body.appendChild(fragment('<div id="mocha-error">%s</div>', msg));
3406}
3407
3408/**
3409 * Return a DOM fragment from `html`.
3410 *
3411 * @param {string} html
3412 */
3413function fragment(html) {
3414 var args = arguments;
3415 var div = document.createElement('div');
3416 var i = 1;
3417
3418 div.innerHTML = html.replace(/%([se])/g, function(_, type) {
3419 switch (type) {
3420 case 's':
3421 return String(args[i++]);
3422 case 'e':
3423 return escape(args[i++]);
3424 // no default
3425 }
3426 });
3427
3428 return div.firstChild;
3429}
3430
3431/**
3432 * Check for suites that do not have elements
3433 * with `classname`, and hide them.
3434 *
3435 * @param {text} classname
3436 */
3437function hideSuitesWithout(classname) {
3438 var suites = document.getElementsByClassName('suite');
3439 for (var i = 0; i < suites.length; i++) {
3440 var els = suites[i].getElementsByClassName(classname);
3441 if (!els.length) {
3442 suites[i].className += ' hidden';
3443 }
3444 }
3445}
3446
3447/**
3448 * Unhide .hidden suites.
3449 */
3450function unhide() {
3451 var els = document.getElementsByClassName('suite hidden');
3452 while (els.length > 0) {
3453 els[0].className = els[0].className.replace('suite hidden', 'suite');
3454 }
3455}
3456
3457/**
3458 * Set an element's text contents.
3459 *
3460 * @param {HTMLElement} el
3461 * @param {string} contents
3462 */
3463function text(el, contents) {
3464 if (el.textContent) {
3465 el.textContent = contents;
3466 } else {
3467 el.innerText = contents;
3468 }
3469}
3470
3471/**
3472 * Listen on `event` with callback `fn`.
3473 */
3474function on(el, event, fn) {
3475 if (el.addEventListener) {
3476 el.addEventListener(event, fn, false);
3477 } else {
3478 el.attachEvent('on' + event, fn);
3479 }
3480}
3481
3482HTML.browserOnly = true;
3483
3484}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
3485},{"../browser/progress":3,"../runner":34,"../utils":38,"./base":17,"escape-string-regexp":49}],21:[function(require,module,exports){
3486'use strict';
3487
3488// Alias exports to a their normalized format Mocha#reporter to prevent a need
3489// for dynamic (try/catch) requires, which Browserify doesn't handle.
3490exports.Base = exports.base = require('./base');
3491exports.Dot = exports.dot = require('./dot');
3492exports.Doc = exports.doc = require('./doc');
3493exports.TAP = exports.tap = require('./tap');
3494exports.JSON = exports.json = require('./json');
3495exports.HTML = exports.html = require('./html');
3496exports.List = exports.list = require('./list');
3497exports.Min = exports.min = require('./min');
3498exports.Spec = exports.spec = require('./spec');
3499exports.Nyan = exports.nyan = require('./nyan');
3500exports.XUnit = exports.xunit = require('./xunit');
3501exports.Markdown = exports.markdown = require('./markdown');
3502exports.Progress = exports.progress = require('./progress');
3503exports.Landing = exports.landing = require('./landing');
3504exports.JSONStream = exports['json-stream'] = require('./json-stream');
3505
3506},{"./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){
3507(function (process){
3508'use strict';
3509/**
3510 * @module JSONStream
3511 */
3512/**
3513 * Module dependencies.
3514 */
3515
3516var Base = require('./base');
3517var constants = require('../runner').constants;
3518var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
3519var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
3520var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
3521var EVENT_RUN_END = constants.EVENT_RUN_END;
3522
3523/**
3524 * Expose `JSONStream`.
3525 */
3526
3527exports = module.exports = JSONStream;
3528
3529/**
3530 * Constructs a new `JSONStream` reporter instance.
3531 *
3532 * @public
3533 * @class
3534 * @memberof Mocha.reporters
3535 * @extends Mocha.reporters.Base
3536 * @param {Runner} runner - Instance triggers reporter actions.
3537 * @param {Object} [options] - runner options
3538 */
3539function JSONStream(runner, options) {
3540 Base.call(this, runner, options);
3541
3542 var self = this;
3543 var total = runner.total;
3544
3545 runner.once(EVENT_RUN_BEGIN, function() {
3546 writeEvent(['start', {total: total}]);
3547 });
3548
3549 runner.on(EVENT_TEST_PASS, function(test) {
3550 writeEvent(['pass', clean(test)]);
3551 });
3552
3553 runner.on(EVENT_TEST_FAIL, function(test, err) {
3554 test = clean(test);
3555 test.err = err.message;
3556 test.stack = err.stack || null;
3557 writeEvent(['fail', test]);
3558 });
3559
3560 runner.once(EVENT_RUN_END, function() {
3561 writeEvent(['end', self.stats]);
3562 });
3563}
3564
3565/**
3566 * Mocha event to be written to the output stream.
3567 * @typedef {Array} JSONStream~MochaEvent
3568 */
3569
3570/**
3571 * Writes Mocha event to reporter output stream.
3572 *
3573 * @private
3574 * @param {JSONStream~MochaEvent} event - Mocha event to be output.
3575 */
3576function writeEvent(event) {
3577 process.stdout.write(JSON.stringify(event) + '\n');
3578}
3579
3580/**
3581 * Returns an object literal representation of `test`
3582 * free of cyclic properties, etc.
3583 *
3584 * @private
3585 * @param {Test} test - Instance used as data source.
3586 * @return {Object} object containing pared-down test instance data
3587 */
3588function clean(test) {
3589 return {
3590 title: test.title,
3591 fullTitle: test.fullTitle(),
3592 duration: test.duration,
3593 currentRetry: test.currentRetry()
3594 };
3595}
3596
3597JSONStream.description = 'newline delimited JSON events';
3598
3599}).call(this,require('_process'))
3600},{"../runner":34,"./base":17,"_process":69}],23:[function(require,module,exports){
3601(function (process){
3602'use strict';
3603/**
3604 * @module JSON
3605 */
3606/**
3607 * Module dependencies.
3608 */
3609
3610var Base = require('./base');
3611var constants = require('../runner').constants;
3612var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
3613var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
3614var EVENT_TEST_END = constants.EVENT_TEST_END;
3615var EVENT_RUN_END = constants.EVENT_RUN_END;
3616var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
3617
3618/**
3619 * Expose `JSON`.
3620 */
3621
3622exports = module.exports = JSONReporter;
3623
3624/**
3625 * Constructs a new `JSON` reporter instance.
3626 *
3627 * @public
3628 * @class JSON
3629 * @memberof Mocha.reporters
3630 * @extends Mocha.reporters.Base
3631 * @param {Runner} runner - Instance triggers reporter actions.
3632 * @param {Object} [options] - runner options
3633 */
3634function JSONReporter(runner, options) {
3635 Base.call(this, runner, options);
3636
3637 var self = this;
3638 var tests = [];
3639 var pending = [];
3640 var failures = [];
3641 var passes = [];
3642
3643 runner.on(EVENT_TEST_END, function(test) {
3644 tests.push(test);
3645 });
3646
3647 runner.on(EVENT_TEST_PASS, function(test) {
3648 passes.push(test);
3649 });
3650
3651 runner.on(EVENT_TEST_FAIL, function(test) {
3652 failures.push(test);
3653 });
3654
3655 runner.on(EVENT_TEST_PENDING, function(test) {
3656 pending.push(test);
3657 });
3658
3659 runner.once(EVENT_RUN_END, function() {
3660 var obj = {
3661 stats: self.stats,
3662 tests: tests.map(clean),
3663 pending: pending.map(clean),
3664 failures: failures.map(clean),
3665 passes: passes.map(clean)
3666 };
3667
3668 runner.testResults = obj;
3669
3670 process.stdout.write(JSON.stringify(obj, null, 2));
3671 });
3672}
3673
3674/**
3675 * Return a plain-object representation of `test`
3676 * free of cyclic properties etc.
3677 *
3678 * @private
3679 * @param {Object} test
3680 * @return {Object}
3681 */
3682function clean(test) {
3683 var err = test.err || {};
3684 if (err instanceof Error) {
3685 err = errorJSON(err);
3686 }
3687
3688 return {
3689 title: test.title,
3690 fullTitle: test.fullTitle(),
3691 duration: test.duration,
3692 currentRetry: test.currentRetry(),
3693 err: cleanCycles(err)
3694 };
3695}
3696
3697/**
3698 * Replaces any circular references inside `obj` with '[object Object]'
3699 *
3700 * @private
3701 * @param {Object} obj
3702 * @return {Object}
3703 */
3704function cleanCycles(obj) {
3705 var cache = [];
3706 return JSON.parse(
3707 JSON.stringify(obj, function(key, value) {
3708 if (typeof value === 'object' && value !== null) {
3709 if (cache.indexOf(value) !== -1) {
3710 // Instead of going in a circle, we'll print [object Object]
3711 return '' + value;
3712 }
3713 cache.push(value);
3714 }
3715
3716 return value;
3717 })
3718 );
3719}
3720
3721/**
3722 * Transform an Error object into a JSON object.
3723 *
3724 * @private
3725 * @param {Error} err
3726 * @return {Object}
3727 */
3728function errorJSON(err) {
3729 var res = {};
3730 Object.getOwnPropertyNames(err).forEach(function(key) {
3731 res[key] = err[key];
3732 }, err);
3733 return res;
3734}
3735
3736JSONReporter.description = 'single JSON object';
3737
3738}).call(this,require('_process'))
3739},{"../runner":34,"./base":17,"_process":69}],24:[function(require,module,exports){
3740(function (process){
3741'use strict';
3742/**
3743 * @module Landing
3744 */
3745/**
3746 * Module dependencies.
3747 */
3748
3749var Base = require('./base');
3750var inherits = require('../utils').inherits;
3751var constants = require('../runner').constants;
3752var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
3753var EVENT_RUN_END = constants.EVENT_RUN_END;
3754var EVENT_TEST_END = constants.EVENT_TEST_END;
3755var STATE_FAILED = require('../runnable').constants.STATE_FAILED;
3756
3757var cursor = Base.cursor;
3758var color = Base.color;
3759
3760/**
3761 * Expose `Landing`.
3762 */
3763
3764exports = module.exports = Landing;
3765
3766/**
3767 * Airplane color.
3768 */
3769
3770Base.colors.plane = 0;
3771
3772/**
3773 * Airplane crash color.
3774 */
3775
3776Base.colors['plane crash'] = 31;
3777
3778/**
3779 * Runway color.
3780 */
3781
3782Base.colors.runway = 90;
3783
3784/**
3785 * Constructs a new `Landing` reporter instance.
3786 *
3787 * @public
3788 * @class
3789 * @memberof Mocha.reporters
3790 * @extends Mocha.reporters.Base
3791 * @param {Runner} runner - Instance triggers reporter actions.
3792 * @param {Object} [options] - runner options
3793 */
3794function Landing(runner, options) {
3795 Base.call(this, runner, options);
3796
3797 var self = this;
3798 var width = (Base.window.width * 0.75) | 0;
3799 var total = runner.total;
3800 var stream = process.stdout;
3801 var plane = color('plane', '✈');
3802 var crashed = -1;
3803 var n = 0;
3804
3805 function runway() {
3806 var buf = Array(width).join('-');
3807 return ' ' + color('runway', buf);
3808 }
3809
3810 runner.on(EVENT_RUN_BEGIN, function() {
3811 stream.write('\n\n\n ');
3812 cursor.hide();
3813 });
3814
3815 runner.on(EVENT_TEST_END, function(test) {
3816 // check if the plane crashed
3817 var col = crashed === -1 ? ((width * ++n) / total) | 0 : crashed;
3818
3819 // show the crash
3820 if (test.state === STATE_FAILED) {
3821 plane = color('plane crash', '✈');
3822 crashed = col;
3823 }
3824
3825 // render landing strip
3826 stream.write('\u001b[' + (width + 1) + 'D\u001b[2A');
3827 stream.write(runway());
3828 stream.write('\n ');
3829 stream.write(color('runway', Array(col).join('⋅')));
3830 stream.write(plane);
3831 stream.write(color('runway', Array(width - col).join('⋅') + '\n'));
3832 stream.write(runway());
3833 stream.write('\u001b[0m');
3834 });
3835
3836 runner.once(EVENT_RUN_END, function() {
3837 cursor.show();
3838 process.stdout.write('\n');
3839 self.epilogue();
3840 });
3841}
3842
3843/**
3844 * Inherit from `Base.prototype`.
3845 */
3846inherits(Landing, Base);
3847
3848Landing.description = 'Unicode landing strip';
3849
3850}).call(this,require('_process'))
3851},{"../runnable":33,"../runner":34,"../utils":38,"./base":17,"_process":69}],25:[function(require,module,exports){
3852(function (process){
3853'use strict';
3854/**
3855 * @module List
3856 */
3857/**
3858 * Module dependencies.
3859 */
3860
3861var Base = require('./base');
3862var inherits = require('../utils').inherits;
3863var constants = require('../runner').constants;
3864var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
3865var EVENT_RUN_END = constants.EVENT_RUN_END;
3866var EVENT_TEST_BEGIN = constants.EVENT_TEST_BEGIN;
3867var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
3868var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
3869var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
3870var color = Base.color;
3871var cursor = Base.cursor;
3872
3873/**
3874 * Expose `List`.
3875 */
3876
3877exports = module.exports = List;
3878
3879/**
3880 * Constructs a new `List` reporter instance.
3881 *
3882 * @public
3883 * @class
3884 * @memberof Mocha.reporters
3885 * @extends Mocha.reporters.Base
3886 * @param {Runner} runner - Instance triggers reporter actions.
3887 * @param {Object} [options] - runner options
3888 */
3889function List(runner, options) {
3890 Base.call(this, runner, options);
3891
3892 var self = this;
3893 var n = 0;
3894
3895 runner.on(EVENT_RUN_BEGIN, function() {
3896 Base.consoleLog();
3897 });
3898
3899 runner.on(EVENT_TEST_BEGIN, function(test) {
3900 process.stdout.write(color('pass', ' ' + test.fullTitle() + ': '));
3901 });
3902
3903 runner.on(EVENT_TEST_PENDING, function(test) {
3904 var fmt = color('checkmark', ' -') + color('pending', ' %s');
3905 Base.consoleLog(fmt, test.fullTitle());
3906 });
3907
3908 runner.on(EVENT_TEST_PASS, function(test) {
3909 var fmt =
3910 color('checkmark', ' ' + Base.symbols.ok) +
3911 color('pass', ' %s: ') +
3912 color(test.speed, '%dms');
3913 cursor.CR();
3914 Base.consoleLog(fmt, test.fullTitle(), test.duration);
3915 });
3916
3917 runner.on(EVENT_TEST_FAIL, function(test) {
3918 cursor.CR();
3919 Base.consoleLog(color('fail', ' %d) %s'), ++n, test.fullTitle());
3920 });
3921
3922 runner.once(EVENT_RUN_END, self.epilogue.bind(self));
3923}
3924
3925/**
3926 * Inherit from `Base.prototype`.
3927 */
3928inherits(List, Base);
3929
3930List.description = 'like "spec" reporter but flat';
3931
3932}).call(this,require('_process'))
3933},{"../runner":34,"../utils":38,"./base":17,"_process":69}],26:[function(require,module,exports){
3934(function (process){
3935'use strict';
3936/**
3937 * @module Markdown
3938 */
3939/**
3940 * Module dependencies.
3941 */
3942
3943var Base = require('./base');
3944var utils = require('../utils');
3945var constants = require('../runner').constants;
3946var EVENT_RUN_END = constants.EVENT_RUN_END;
3947var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
3948var EVENT_SUITE_END = constants.EVENT_SUITE_END;
3949var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
3950
3951/**
3952 * Constants
3953 */
3954
3955var SUITE_PREFIX = '$';
3956
3957/**
3958 * Expose `Markdown`.
3959 */
3960
3961exports = module.exports = Markdown;
3962
3963/**
3964 * Constructs a new `Markdown` reporter instance.
3965 *
3966 * @public
3967 * @class
3968 * @memberof Mocha.reporters
3969 * @extends Mocha.reporters.Base
3970 * @param {Runner} runner - Instance triggers reporter actions.
3971 * @param {Object} [options] - runner options
3972 */
3973function Markdown(runner, options) {
3974 Base.call(this, runner, options);
3975
3976 var level = 0;
3977 var buf = '';
3978
3979 function title(str) {
3980 return Array(level).join('#') + ' ' + str;
3981 }
3982
3983 function mapTOC(suite, obj) {
3984 var ret = obj;
3985 var key = SUITE_PREFIX + suite.title;
3986
3987 obj = obj[key] = obj[key] || {suite: suite};
3988 suite.suites.forEach(function(suite) {
3989 mapTOC(suite, obj);
3990 });
3991
3992 return ret;
3993 }
3994
3995 function stringifyTOC(obj, level) {
3996 ++level;
3997 var buf = '';
3998 var link;
3999 for (var key in obj) {
4000 if (key === 'suite') {
4001 continue;
4002 }
4003 if (key !== SUITE_PREFIX) {
4004 link = ' - [' + key.substring(1) + ']';
4005 link += '(#' + utils.slug(obj[key].suite.fullTitle()) + ')\n';
4006 buf += Array(level).join(' ') + link;
4007 }
4008 buf += stringifyTOC(obj[key], level);
4009 }
4010 return buf;
4011 }
4012
4013 function generateTOC(suite) {
4014 var obj = mapTOC(suite, {});
4015 return stringifyTOC(obj, 0);
4016 }
4017
4018 generateTOC(runner.suite);
4019
4020 runner.on(EVENT_SUITE_BEGIN, function(suite) {
4021 ++level;
4022 var slug = utils.slug(suite.fullTitle());
4023 buf += '<a name="' + slug + '"></a>' + '\n';
4024 buf += title(suite.title) + '\n';
4025 });
4026
4027 runner.on(EVENT_SUITE_END, function() {
4028 --level;
4029 });
4030
4031 runner.on(EVENT_TEST_PASS, function(test) {
4032 var code = utils.clean(test.body);
4033 buf += test.title + '.\n';
4034 buf += '\n```js\n';
4035 buf += code + '\n';
4036 buf += '```\n\n';
4037 });
4038
4039 runner.once(EVENT_RUN_END, function() {
4040 process.stdout.write('# TOC\n');
4041 process.stdout.write(generateTOC(runner.suite));
4042 process.stdout.write(buf);
4043 });
4044}
4045
4046Markdown.description = 'GitHub Flavored Markdown';
4047
4048}).call(this,require('_process'))
4049},{"../runner":34,"../utils":38,"./base":17,"_process":69}],27:[function(require,module,exports){
4050(function (process){
4051'use strict';
4052/**
4053 * @module Min
4054 */
4055/**
4056 * Module dependencies.
4057 */
4058
4059var Base = require('./base');
4060var inherits = require('../utils').inherits;
4061var constants = require('../runner').constants;
4062var EVENT_RUN_END = constants.EVENT_RUN_END;
4063var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
4064
4065/**
4066 * Expose `Min`.
4067 */
4068
4069exports = module.exports = Min;
4070
4071/**
4072 * Constructs a new `Min` reporter instance.
4073 *
4074 * @description
4075 * This minimal test reporter is best used with '--watch'.
4076 *
4077 * @public
4078 * @class
4079 * @memberof Mocha.reporters
4080 * @extends Mocha.reporters.Base
4081 * @param {Runner} runner - Instance triggers reporter actions.
4082 * @param {Object} [options] - runner options
4083 */
4084function Min(runner, options) {
4085 Base.call(this, runner, options);
4086
4087 runner.on(EVENT_RUN_BEGIN, function() {
4088 // clear screen
4089 process.stdout.write('\u001b[2J');
4090 // set cursor position
4091 process.stdout.write('\u001b[1;3H');
4092 });
4093
4094 runner.once(EVENT_RUN_END, this.epilogue.bind(this));
4095}
4096
4097/**
4098 * Inherit from `Base.prototype`.
4099 */
4100inherits(Min, Base);
4101
4102Min.description = 'essentially just a summary';
4103
4104}).call(this,require('_process'))
4105},{"../runner":34,"../utils":38,"./base":17,"_process":69}],28:[function(require,module,exports){
4106(function (process){
4107'use strict';
4108/**
4109 * @module Nyan
4110 */
4111/**
4112 * Module dependencies.
4113 */
4114
4115var Base = require('./base');
4116var constants = require('../runner').constants;
4117var inherits = require('../utils').inherits;
4118var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
4119var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
4120var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
4121var EVENT_RUN_END = constants.EVENT_RUN_END;
4122var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
4123
4124/**
4125 * Expose `Dot`.
4126 */
4127
4128exports = module.exports = NyanCat;
4129
4130/**
4131 * Constructs a new `Nyan` reporter instance.
4132 *
4133 * @public
4134 * @class Nyan
4135 * @memberof Mocha.reporters
4136 * @extends Mocha.reporters.Base
4137 * @param {Runner} runner - Instance triggers reporter actions.
4138 * @param {Object} [options] - runner options
4139 */
4140function NyanCat(runner, options) {
4141 Base.call(this, runner, options);
4142
4143 var self = this;
4144 var width = (Base.window.width * 0.75) | 0;
4145 var nyanCatWidth = (this.nyanCatWidth = 11);
4146
4147 this.colorIndex = 0;
4148 this.numberOfLines = 4;
4149 this.rainbowColors = self.generateColors();
4150 this.scoreboardWidth = 5;
4151 this.tick = 0;
4152 this.trajectories = [[], [], [], []];
4153 this.trajectoryWidthMax = width - nyanCatWidth;
4154
4155 runner.on(EVENT_RUN_BEGIN, function() {
4156 Base.cursor.hide();
4157 self.draw();
4158 });
4159
4160 runner.on(EVENT_TEST_PENDING, function() {
4161 self.draw();
4162 });
4163
4164 runner.on(EVENT_TEST_PASS, function() {
4165 self.draw();
4166 });
4167
4168 runner.on(EVENT_TEST_FAIL, function() {
4169 self.draw();
4170 });
4171
4172 runner.once(EVENT_RUN_END, function() {
4173 Base.cursor.show();
4174 for (var i = 0; i < self.numberOfLines; i++) {
4175 write('\n');
4176 }
4177 self.epilogue();
4178 });
4179}
4180
4181/**
4182 * Inherit from `Base.prototype`.
4183 */
4184inherits(NyanCat, Base);
4185
4186/**
4187 * Draw the nyan cat
4188 *
4189 * @private
4190 */
4191
4192NyanCat.prototype.draw = function() {
4193 this.appendRainbow();
4194 this.drawScoreboard();
4195 this.drawRainbow();
4196 this.drawNyanCat();
4197 this.tick = !this.tick;
4198};
4199
4200/**
4201 * Draw the "scoreboard" showing the number
4202 * of passes, failures and pending tests.
4203 *
4204 * @private
4205 */
4206
4207NyanCat.prototype.drawScoreboard = function() {
4208 var stats = this.stats;
4209
4210 function draw(type, n) {
4211 write(' ');
4212 write(Base.color(type, n));
4213 write('\n');
4214 }
4215
4216 draw('green', stats.passes);
4217 draw('fail', stats.failures);
4218 draw('pending', stats.pending);
4219 write('\n');
4220
4221 this.cursorUp(this.numberOfLines);
4222};
4223
4224/**
4225 * Append the rainbow.
4226 *
4227 * @private
4228 */
4229
4230NyanCat.prototype.appendRainbow = function() {
4231 var segment = this.tick ? '_' : '-';
4232 var rainbowified = this.rainbowify(segment);
4233
4234 for (var index = 0; index < this.numberOfLines; index++) {
4235 var trajectory = this.trajectories[index];
4236 if (trajectory.length >= this.trajectoryWidthMax) {
4237 trajectory.shift();
4238 }
4239 trajectory.push(rainbowified);
4240 }
4241};
4242
4243/**
4244 * Draw the rainbow.
4245 *
4246 * @private
4247 */
4248
4249NyanCat.prototype.drawRainbow = function() {
4250 var self = this;
4251
4252 this.trajectories.forEach(function(line) {
4253 write('\u001b[' + self.scoreboardWidth + 'C');
4254 write(line.join(''));
4255 write('\n');
4256 });
4257
4258 this.cursorUp(this.numberOfLines);
4259};
4260
4261/**
4262 * Draw the nyan cat
4263 *
4264 * @private
4265 */
4266NyanCat.prototype.drawNyanCat = function() {
4267 var self = this;
4268 var startWidth = this.scoreboardWidth + this.trajectories[0].length;
4269 var dist = '\u001b[' + startWidth + 'C';
4270 var padding = '';
4271
4272 write(dist);
4273 write('_,------,');
4274 write('\n');
4275
4276 write(dist);
4277 padding = self.tick ? ' ' : ' ';
4278 write('_|' + padding + '/\\_/\\ ');
4279 write('\n');
4280
4281 write(dist);
4282 padding = self.tick ? '_' : '__';
4283 var tail = self.tick ? '~' : '^';
4284 write(tail + '|' + padding + this.face() + ' ');
4285 write('\n');
4286
4287 write(dist);
4288 padding = self.tick ? ' ' : ' ';
4289 write(padding + '"" "" ');
4290 write('\n');
4291
4292 this.cursorUp(this.numberOfLines);
4293};
4294
4295/**
4296 * Draw nyan cat face.
4297 *
4298 * @private
4299 * @return {string}
4300 */
4301
4302NyanCat.prototype.face = function() {
4303 var stats = this.stats;
4304 if (stats.failures) {
4305 return '( x .x)';
4306 } else if (stats.pending) {
4307 return '( o .o)';
4308 } else if (stats.passes) {
4309 return '( ^ .^)';
4310 }
4311 return '( - .-)';
4312};
4313
4314/**
4315 * Move cursor up `n`.
4316 *
4317 * @private
4318 * @param {number} n
4319 */
4320
4321NyanCat.prototype.cursorUp = function(n) {
4322 write('\u001b[' + n + 'A');
4323};
4324
4325/**
4326 * Move cursor down `n`.
4327 *
4328 * @private
4329 * @param {number} n
4330 */
4331
4332NyanCat.prototype.cursorDown = function(n) {
4333 write('\u001b[' + n + 'B');
4334};
4335
4336/**
4337 * Generate rainbow colors.
4338 *
4339 * @private
4340 * @return {Array}
4341 */
4342NyanCat.prototype.generateColors = function() {
4343 var colors = [];
4344
4345 for (var i = 0; i < 6 * 7; i++) {
4346 var pi3 = Math.floor(Math.PI / 3);
4347 var n = i * (1.0 / 6);
4348 var r = Math.floor(3 * Math.sin(n) + 3);
4349 var g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3);
4350 var b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3);
4351 colors.push(36 * r + 6 * g + b + 16);
4352 }
4353
4354 return colors;
4355};
4356
4357/**
4358 * Apply rainbow to the given `str`.
4359 *
4360 * @private
4361 * @param {string} str
4362 * @return {string}
4363 */
4364NyanCat.prototype.rainbowify = function(str) {
4365 if (!Base.useColors) {
4366 return str;
4367 }
4368 var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length];
4369 this.colorIndex += 1;
4370 return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m';
4371};
4372
4373/**
4374 * Stdout helper.
4375 *
4376 * @param {string} string A message to write to stdout.
4377 */
4378function write(string) {
4379 process.stdout.write(string);
4380}
4381
4382NyanCat.description = '"nyan cat"';
4383
4384}).call(this,require('_process'))
4385},{"../runner":34,"../utils":38,"./base":17,"_process":69}],29:[function(require,module,exports){
4386(function (process){
4387'use strict';
4388/**
4389 * @module Progress
4390 */
4391/**
4392 * Module dependencies.
4393 */
4394
4395var Base = require('./base');
4396var constants = require('../runner').constants;
4397var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
4398var EVENT_TEST_END = constants.EVENT_TEST_END;
4399var EVENT_RUN_END = constants.EVENT_RUN_END;
4400var inherits = require('../utils').inherits;
4401var color = Base.color;
4402var cursor = Base.cursor;
4403
4404/**
4405 * Expose `Progress`.
4406 */
4407
4408exports = module.exports = Progress;
4409
4410/**
4411 * General progress bar color.
4412 */
4413
4414Base.colors.progress = 90;
4415
4416/**
4417 * Constructs a new `Progress` reporter instance.
4418 *
4419 * @public
4420 * @class
4421 * @memberof Mocha.reporters
4422 * @extends Mocha.reporters.Base
4423 * @param {Runner} runner - Instance triggers reporter actions.
4424 * @param {Object} [options] - runner options
4425 */
4426function Progress(runner, options) {
4427 Base.call(this, runner, options);
4428
4429 var self = this;
4430 var width = (Base.window.width * 0.5) | 0;
4431 var total = runner.total;
4432 var complete = 0;
4433 var lastN = -1;
4434
4435 // default chars
4436 options = options || {};
4437 var reporterOptions = options.reporterOptions || {};
4438
4439 options.open = reporterOptions.open || '[';
4440 options.complete = reporterOptions.complete || '▬';
4441 options.incomplete = reporterOptions.incomplete || Base.symbols.dot;
4442 options.close = reporterOptions.close || ']';
4443 options.verbose = reporterOptions.verbose || false;
4444
4445 // tests started
4446 runner.on(EVENT_RUN_BEGIN, function() {
4447 process.stdout.write('\n');
4448 cursor.hide();
4449 });
4450
4451 // tests complete
4452 runner.on(EVENT_TEST_END, function() {
4453 complete++;
4454
4455 var percent = complete / total;
4456 var n = (width * percent) | 0;
4457 var i = width - n;
4458
4459 if (n === lastN && !options.verbose) {
4460 // Don't re-render the line if it hasn't changed
4461 return;
4462 }
4463 lastN = n;
4464
4465 cursor.CR();
4466 process.stdout.write('\u001b[J');
4467 process.stdout.write(color('progress', ' ' + options.open));
4468 process.stdout.write(Array(n).join(options.complete));
4469 process.stdout.write(Array(i).join(options.incomplete));
4470 process.stdout.write(color('progress', options.close));
4471 if (options.verbose) {
4472 process.stdout.write(color('progress', ' ' + complete + ' of ' + total));
4473 }
4474 });
4475
4476 // tests are complete, output some stats
4477 // and the failures if any
4478 runner.once(EVENT_RUN_END, function() {
4479 cursor.show();
4480 process.stdout.write('\n');
4481 self.epilogue();
4482 });
4483}
4484
4485/**
4486 * Inherit from `Base.prototype`.
4487 */
4488inherits(Progress, Base);
4489
4490Progress.description = 'a progress bar';
4491
4492}).call(this,require('_process'))
4493},{"../runner":34,"../utils":38,"./base":17,"_process":69}],30:[function(require,module,exports){
4494'use strict';
4495/**
4496 * @module Spec
4497 */
4498/**
4499 * Module dependencies.
4500 */
4501
4502var Base = require('./base');
4503var constants = require('../runner').constants;
4504var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
4505var EVENT_RUN_END = constants.EVENT_RUN_END;
4506var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
4507var EVENT_SUITE_END = constants.EVENT_SUITE_END;
4508var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
4509var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
4510var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
4511var inherits = require('../utils').inherits;
4512var color = Base.color;
4513
4514/**
4515 * Expose `Spec`.
4516 */
4517
4518exports = module.exports = Spec;
4519
4520/**
4521 * Constructs a new `Spec` reporter instance.
4522 *
4523 * @public
4524 * @class
4525 * @memberof Mocha.reporters
4526 * @extends Mocha.reporters.Base
4527 * @param {Runner} runner - Instance triggers reporter actions.
4528 * @param {Object} [options] - runner options
4529 */
4530function Spec(runner, options) {
4531 Base.call(this, runner, options);
4532
4533 var self = this;
4534 var indents = 0;
4535 var n = 0;
4536
4537 function indent() {
4538 return Array(indents).join(' ');
4539 }
4540
4541 runner.on(EVENT_RUN_BEGIN, function() {
4542 Base.consoleLog();
4543 });
4544
4545 runner.on(EVENT_SUITE_BEGIN, function(suite) {
4546 ++indents;
4547 Base.consoleLog(color('suite', '%s%s'), indent(), suite.title);
4548 });
4549
4550 runner.on(EVENT_SUITE_END, function() {
4551 --indents;
4552 if (indents === 1) {
4553 Base.consoleLog();
4554 }
4555 });
4556
4557 runner.on(EVENT_TEST_PENDING, function(test) {
4558 var fmt = indent() + color('pending', ' - %s');
4559 Base.consoleLog(fmt, test.title);
4560 });
4561
4562 runner.on(EVENT_TEST_PASS, function(test) {
4563 var fmt;
4564 if (test.speed === 'fast') {
4565 fmt =
4566 indent() +
4567 color('checkmark', ' ' + Base.symbols.ok) +
4568 color('pass', ' %s');
4569 Base.consoleLog(fmt, test.title);
4570 } else {
4571 fmt =
4572 indent() +
4573 color('checkmark', ' ' + Base.symbols.ok) +
4574 color('pass', ' %s') +
4575 color(test.speed, ' (%dms)');
4576 Base.consoleLog(fmt, test.title, test.duration);
4577 }
4578 });
4579
4580 runner.on(EVENT_TEST_FAIL, function(test) {
4581 Base.consoleLog(indent() + color('fail', ' %d) %s'), ++n, test.title);
4582 });
4583
4584 runner.once(EVENT_RUN_END, self.epilogue.bind(self));
4585}
4586
4587/**
4588 * Inherit from `Base.prototype`.
4589 */
4590inherits(Spec, Base);
4591
4592Spec.description = 'hierarchical & verbose [default]';
4593
4594},{"../runner":34,"../utils":38,"./base":17}],31:[function(require,module,exports){
4595(function (process){
4596'use strict';
4597/**
4598 * @module TAP
4599 */
4600/**
4601 * Module dependencies.
4602 */
4603
4604var util = require('util');
4605var Base = require('./base');
4606var constants = require('../runner').constants;
4607var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
4608var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
4609var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
4610var EVENT_RUN_END = constants.EVENT_RUN_END;
4611var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
4612var EVENT_TEST_END = constants.EVENT_TEST_END;
4613var inherits = require('../utils').inherits;
4614var sprintf = util.format;
4615
4616/**
4617 * Expose `TAP`.
4618 */
4619
4620exports = module.exports = TAP;
4621
4622/**
4623 * Constructs a new `TAP` reporter instance.
4624 *
4625 * @public
4626 * @class
4627 * @memberof Mocha.reporters
4628 * @extends Mocha.reporters.Base
4629 * @param {Runner} runner - Instance triggers reporter actions.
4630 * @param {Object} [options] - runner options
4631 */
4632function TAP(runner, options) {
4633 Base.call(this, runner, options);
4634
4635 var self = this;
4636 var n = 1;
4637
4638 var tapVersion = '12';
4639 if (options && options.reporterOptions) {
4640 if (options.reporterOptions.tapVersion) {
4641 tapVersion = options.reporterOptions.tapVersion.toString();
4642 }
4643 }
4644
4645 this._producer = createProducer(tapVersion);
4646
4647 runner.once(EVENT_RUN_BEGIN, function() {
4648 var ntests = runner.grepTotal(runner.suite);
4649 self._producer.writeVersion();
4650 self._producer.writePlan(ntests);
4651 });
4652
4653 runner.on(EVENT_TEST_END, function() {
4654 ++n;
4655 });
4656
4657 runner.on(EVENT_TEST_PENDING, function(test) {
4658 self._producer.writePending(n, test);
4659 });
4660
4661 runner.on(EVENT_TEST_PASS, function(test) {
4662 self._producer.writePass(n, test);
4663 });
4664
4665 runner.on(EVENT_TEST_FAIL, function(test, err) {
4666 self._producer.writeFail(n, test, err);
4667 });
4668
4669 runner.once(EVENT_RUN_END, function() {
4670 self._producer.writeEpilogue(runner.stats);
4671 });
4672}
4673
4674/**
4675 * Inherit from `Base.prototype`.
4676 */
4677inherits(TAP, Base);
4678
4679/**
4680 * Returns a TAP-safe title of `test`.
4681 *
4682 * @private
4683 * @param {Test} test - Test instance.
4684 * @return {String} title with any hash character removed
4685 */
4686function title(test) {
4687 return test.fullTitle().replace(/#/g, '');
4688}
4689
4690/**
4691 * Writes newline-terminated formatted string to reporter output stream.
4692 *
4693 * @private
4694 * @param {string} format - `printf`-like format string
4695 * @param {...*} [varArgs] - Format string arguments
4696 */
4697function println(format, varArgs) {
4698 var vargs = Array.from(arguments);
4699 vargs[0] += '\n';
4700 process.stdout.write(sprintf.apply(null, vargs));
4701}
4702
4703/**
4704 * Returns a `tapVersion`-appropriate TAP producer instance, if possible.
4705 *
4706 * @private
4707 * @param {string} tapVersion - Version of TAP specification to produce.
4708 * @returns {TAPProducer} specification-appropriate instance
4709 * @throws {Error} if specification version has no associated producer.
4710 */
4711function createProducer(tapVersion) {
4712 var producers = {
4713 '12': new TAP12Producer(),
4714 '13': new TAP13Producer()
4715 };
4716 var producer = producers[tapVersion];
4717
4718 if (!producer) {
4719 throw new Error(
4720 'invalid or unsupported TAP version: ' + JSON.stringify(tapVersion)
4721 );
4722 }
4723
4724 return producer;
4725}
4726
4727/**
4728 * @summary
4729 * Constructs a new TAPProducer.
4730 *
4731 * @description
4732 * <em>Only</em> to be used as an abstract base class.
4733 *
4734 * @private
4735 * @constructor
4736 */
4737function TAPProducer() {}
4738
4739/**
4740 * Writes the TAP version to reporter output stream.
4741 *
4742 * @abstract
4743 */
4744TAPProducer.prototype.writeVersion = function() {};
4745
4746/**
4747 * Writes the plan to reporter output stream.
4748 *
4749 * @abstract
4750 * @param {number} ntests - Number of tests that are planned to run.
4751 */
4752TAPProducer.prototype.writePlan = function(ntests) {
4753 println('%d..%d', 1, ntests);
4754};
4755
4756/**
4757 * Writes that test passed to reporter output stream.
4758 *
4759 * @abstract
4760 * @param {number} n - Index of test that passed.
4761 * @param {Test} test - Instance containing test information.
4762 */
4763TAPProducer.prototype.writePass = function(n, test) {
4764 println('ok %d %s', n, title(test));
4765};
4766
4767/**
4768 * Writes that test was skipped to reporter output stream.
4769 *
4770 * @abstract
4771 * @param {number} n - Index of test that was skipped.
4772 * @param {Test} test - Instance containing test information.
4773 */
4774TAPProducer.prototype.writePending = function(n, test) {
4775 println('ok %d %s # SKIP -', n, title(test));
4776};
4777
4778/**
4779 * Writes that test failed to reporter output stream.
4780 *
4781 * @abstract
4782 * @param {number} n - Index of test that failed.
4783 * @param {Test} test - Instance containing test information.
4784 * @param {Error} err - Reason the test failed.
4785 */
4786TAPProducer.prototype.writeFail = function(n, test, err) {
4787 println('not ok %d %s', n, title(test));
4788};
4789
4790/**
4791 * Writes the summary epilogue to reporter output stream.
4792 *
4793 * @abstract
4794 * @param {Object} stats - Object containing run statistics.
4795 */
4796TAPProducer.prototype.writeEpilogue = function(stats) {
4797 // :TBD: Why is this not counting pending tests?
4798 println('# tests ' + (stats.passes + stats.failures));
4799 println('# pass ' + stats.passes);
4800 // :TBD: Why are we not showing pending results?
4801 println('# fail ' + stats.failures);
4802};
4803
4804/**
4805 * @summary
4806 * Constructs a new TAP12Producer.
4807 *
4808 * @description
4809 * Produces output conforming to the TAP12 specification.
4810 *
4811 * @private
4812 * @constructor
4813 * @extends TAPProducer
4814 * @see {@link https://testanything.org/tap-specification.html|Specification}
4815 */
4816function TAP12Producer() {
4817 /**
4818 * Writes that test failed to reporter output stream, with error formatting.
4819 * @override
4820 */
4821 this.writeFail = function(n, test, err) {
4822 TAPProducer.prototype.writeFail.call(this, n, test, err);
4823 if (err.message) {
4824 println(err.message.replace(/^/gm, ' '));
4825 }
4826 if (err.stack) {
4827 println(err.stack.replace(/^/gm, ' '));
4828 }
4829 };
4830}
4831
4832/**
4833 * Inherit from `TAPProducer.prototype`.
4834 */
4835inherits(TAP12Producer, TAPProducer);
4836
4837/**
4838 * @summary
4839 * Constructs a new TAP13Producer.
4840 *
4841 * @description
4842 * Produces output conforming to the TAP13 specification.
4843 *
4844 * @private
4845 * @constructor
4846 * @extends TAPProducer
4847 * @see {@link https://testanything.org/tap-version-13-specification.html|Specification}
4848 */
4849function TAP13Producer() {
4850 /**
4851 * Writes the TAP version to reporter output stream.
4852 * @override
4853 */
4854 this.writeVersion = function() {
4855 println('TAP version 13');
4856 };
4857
4858 /**
4859 * Writes that test failed to reporter output stream, with error formatting.
4860 * @override
4861 */
4862 this.writeFail = function(n, test, err) {
4863 TAPProducer.prototype.writeFail.call(this, n, test, err);
4864 var emitYamlBlock = err.message != null || err.stack != null;
4865 if (emitYamlBlock) {
4866 println(indent(1) + '---');
4867 if (err.message) {
4868 println(indent(2) + 'message: |-');
4869 println(err.message.replace(/^/gm, indent(3)));
4870 }
4871 if (err.stack) {
4872 println(indent(2) + 'stack: |-');
4873 println(err.stack.replace(/^/gm, indent(3)));
4874 }
4875 println(indent(1) + '...');
4876 }
4877 };
4878
4879 function indent(level) {
4880 return Array(level + 1).join(' ');
4881 }
4882}
4883
4884/**
4885 * Inherit from `TAPProducer.prototype`.
4886 */
4887inherits(TAP13Producer, TAPProducer);
4888
4889TAP.description = 'TAP-compatible output';
4890
4891}).call(this,require('_process'))
4892},{"../runner":34,"../utils":38,"./base":17,"_process":69,"util":89}],32:[function(require,module,exports){
4893(function (process,global){
4894'use strict';
4895/**
4896 * @module XUnit
4897 */
4898/**
4899 * Module dependencies.
4900 */
4901
4902var Base = require('./base');
4903var utils = require('../utils');
4904var fs = require('fs');
4905var mkdirp = require('mkdirp');
4906var path = require('path');
4907var errors = require('../errors');
4908var createUnsupportedError = errors.createUnsupportedError;
4909var constants = require('../runner').constants;
4910var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
4911var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
4912var EVENT_RUN_END = constants.EVENT_RUN_END;
4913var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
4914var STATE_FAILED = require('../runnable').constants.STATE_FAILED;
4915var inherits = utils.inherits;
4916var escape = utils.escape;
4917
4918/**
4919 * Save timer references to avoid Sinon interfering (see GH-237).
4920 */
4921var Date = global.Date;
4922
4923/**
4924 * Expose `XUnit`.
4925 */
4926
4927exports = module.exports = XUnit;
4928
4929/**
4930 * Constructs a new `XUnit` reporter instance.
4931 *
4932 * @public
4933 * @class
4934 * @memberof Mocha.reporters
4935 * @extends Mocha.reporters.Base
4936 * @param {Runner} runner - Instance triggers reporter actions.
4937 * @param {Object} [options] - runner options
4938 */
4939function XUnit(runner, options) {
4940 Base.call(this, runner, options);
4941
4942 var stats = this.stats;
4943 var tests = [];
4944 var self = this;
4945
4946 // the name of the test suite, as it will appear in the resulting XML file
4947 var suiteName;
4948
4949 // the default name of the test suite if none is provided
4950 var DEFAULT_SUITE_NAME = 'Mocha Tests';
4951
4952 if (options && options.reporterOptions) {
4953 if (options.reporterOptions.output) {
4954 if (!fs.createWriteStream) {
4955 throw createUnsupportedError('file output not supported in browser');
4956 }
4957
4958 mkdirp.sync(path.dirname(options.reporterOptions.output));
4959 self.fileStream = fs.createWriteStream(options.reporterOptions.output);
4960 }
4961
4962 // get the suite name from the reporter options (if provided)
4963 suiteName = options.reporterOptions.suiteName;
4964 }
4965
4966 // fall back to the default suite name
4967 suiteName = suiteName || DEFAULT_SUITE_NAME;
4968
4969 runner.on(EVENT_TEST_PENDING, function(test) {
4970 tests.push(test);
4971 });
4972
4973 runner.on(EVENT_TEST_PASS, function(test) {
4974 tests.push(test);
4975 });
4976
4977 runner.on(EVENT_TEST_FAIL, function(test) {
4978 tests.push(test);
4979 });
4980
4981 runner.once(EVENT_RUN_END, function() {
4982 self.write(
4983 tag(
4984 'testsuite',
4985 {
4986 name: suiteName,
4987 tests: stats.tests,
4988 failures: 0,
4989 errors: stats.failures,
4990 skipped: stats.tests - stats.failures - stats.passes,
4991 timestamp: new Date().toUTCString(),
4992 time: stats.duration / 1000 || 0
4993 },
4994 false
4995 )
4996 );
4997
4998 tests.forEach(function(t) {
4999 self.test(t);
5000 });
5001
5002 self.write('</testsuite>');
5003 });
5004}
5005
5006/**
5007 * Inherit from `Base.prototype`.
5008 */
5009inherits(XUnit, Base);
5010
5011/**
5012 * Override done to close the stream (if it's a file).
5013 *
5014 * @param failures
5015 * @param {Function} fn
5016 */
5017XUnit.prototype.done = function(failures, fn) {
5018 if (this.fileStream) {
5019 this.fileStream.end(function() {
5020 fn(failures);
5021 });
5022 } else {
5023 fn(failures);
5024 }
5025};
5026
5027/**
5028 * Write out the given line.
5029 *
5030 * @param {string} line
5031 */
5032XUnit.prototype.write = function(line) {
5033 if (this.fileStream) {
5034 this.fileStream.write(line + '\n');
5035 } else if (typeof process === 'object' && process.stdout) {
5036 process.stdout.write(line + '\n');
5037 } else {
5038 Base.consoleLog(line);
5039 }
5040};
5041
5042/**
5043 * Output tag for the given `test.`
5044 *
5045 * @param {Test} test
5046 */
5047XUnit.prototype.test = function(test) {
5048 Base.useColors = false;
5049
5050 var attrs = {
5051 classname: test.parent.fullTitle(),
5052 name: test.title,
5053 time: test.duration / 1000 || 0
5054 };
5055
5056 if (test.state === STATE_FAILED) {
5057 var err = test.err;
5058 var diff =
5059 !Base.hideDiff && Base.showDiff(err)
5060 ? '\n' + Base.generateDiff(err.actual, err.expected)
5061 : '';
5062 this.write(
5063 tag(
5064 'testcase',
5065 attrs,
5066 false,
5067 tag(
5068 'failure',
5069 {},
5070 false,
5071 escape(err.message) + escape(diff) + '\n' + escape(err.stack)
5072 )
5073 )
5074 );
5075 } else if (test.isPending()) {
5076 this.write(tag('testcase', attrs, false, tag('skipped', {}, true)));
5077 } else {
5078 this.write(tag('testcase', attrs, true));
5079 }
5080};
5081
5082/**
5083 * HTML tag helper.
5084 *
5085 * @param name
5086 * @param attrs
5087 * @param close
5088 * @param content
5089 * @return {string}
5090 */
5091function tag(name, attrs, close, content) {
5092 var end = close ? '/>' : '>';
5093 var pairs = [];
5094 var tag;
5095
5096 for (var key in attrs) {
5097 if (Object.prototype.hasOwnProperty.call(attrs, key)) {
5098 pairs.push(key + '="' + escape(attrs[key]) + '"');
5099 }
5100 }
5101
5102 tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end;
5103 if (content) {
5104 tag += content + '</' + name + end;
5105 }
5106 return tag;
5107}
5108
5109XUnit.description = 'XUnit-compatible XML output';
5110
5111}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
5112},{"../errors":6,"../runnable":33,"../runner":34,"../utils":38,"./base":17,"_process":69,"fs":42,"mkdirp":59,"path":42}],33:[function(require,module,exports){
5113(function (global){
5114'use strict';
5115
5116var EventEmitter = require('events').EventEmitter;
5117var Pending = require('./pending');
5118var debug = require('debug')('mocha:runnable');
5119var milliseconds = require('ms');
5120var utils = require('./utils');
5121var createInvalidExceptionError = require('./errors')
5122 .createInvalidExceptionError;
5123
5124/**
5125 * Save timer references to avoid Sinon interfering (see GH-237).
5126 */
5127var Date = global.Date;
5128var setTimeout = global.setTimeout;
5129var clearTimeout = global.clearTimeout;
5130var toString = Object.prototype.toString;
5131
5132module.exports = Runnable;
5133
5134/**
5135 * Initialize a new `Runnable` with the given `title` and callback `fn`.
5136 *
5137 * @class
5138 * @extends external:EventEmitter
5139 * @public
5140 * @param {String} title
5141 * @param {Function} fn
5142 */
5143function Runnable(title, fn) {
5144 this.title = title;
5145 this.fn = fn;
5146 this.body = (fn || '').toString();
5147 this.async = fn && fn.length;
5148 this.sync = !this.async;
5149 this._timeout = 2000;
5150 this._slow = 75;
5151 this._enableTimeouts = true;
5152 this.timedOut = false;
5153 this._retries = -1;
5154 this._currentRetry = 0;
5155 this.pending = false;
5156}
5157
5158/**
5159 * Inherit from `EventEmitter.prototype`.
5160 */
5161utils.inherits(Runnable, EventEmitter);
5162
5163/**
5164 * Get current timeout value in msecs.
5165 *
5166 * @private
5167 * @returns {number} current timeout threshold value
5168 */
5169/**
5170 * @summary
5171 * Set timeout threshold value (msecs).
5172 *
5173 * @description
5174 * A string argument can use shorthand (e.g., "2s") and will be converted.
5175 * The value will be clamped to range [<code>0</code>, <code>2^<sup>31</sup>-1</code>].
5176 * If clamped value matches either range endpoint, timeouts will be disabled.
5177 *
5178 * @private
5179 * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout#Maximum_delay_value}
5180 * @param {number|string} ms - Timeout threshold value.
5181 * @returns {Runnable} this
5182 * @chainable
5183 */
5184Runnable.prototype.timeout = function(ms) {
5185 if (!arguments.length) {
5186 return this._timeout;
5187 }
5188 if (typeof ms === 'string') {
5189 ms = milliseconds(ms);
5190 }
5191
5192 // Clamp to range
5193 var INT_MAX = Math.pow(2, 31) - 1;
5194 var range = [0, INT_MAX];
5195 ms = utils.clamp(ms, range);
5196
5197 // see #1652 for reasoning
5198 if (ms === range[0] || ms === range[1]) {
5199 this._enableTimeouts = false;
5200 }
5201 debug('timeout %d', ms);
5202 this._timeout = ms;
5203 if (this.timer) {
5204 this.resetTimeout();
5205 }
5206 return this;
5207};
5208
5209/**
5210 * Set or get slow `ms`.
5211 *
5212 * @private
5213 * @param {number|string} ms
5214 * @return {Runnable|number} ms or Runnable instance.
5215 */
5216Runnable.prototype.slow = function(ms) {
5217 if (!arguments.length || typeof ms === 'undefined') {
5218 return this._slow;
5219 }
5220 if (typeof ms === 'string') {
5221 ms = milliseconds(ms);
5222 }
5223 debug('slow %d', ms);
5224 this._slow = ms;
5225 return this;
5226};
5227
5228/**
5229 * Set and get whether timeout is `enabled`.
5230 *
5231 * @private
5232 * @param {boolean} enabled
5233 * @return {Runnable|boolean} enabled or Runnable instance.
5234 */
5235Runnable.prototype.enableTimeouts = function(enabled) {
5236 if (!arguments.length) {
5237 return this._enableTimeouts;
5238 }
5239 debug('enableTimeouts %s', enabled);
5240 this._enableTimeouts = enabled;
5241 return this;
5242};
5243
5244/**
5245 * Halt and mark as pending.
5246 *
5247 * @memberof Mocha.Runnable
5248 * @public
5249 */
5250Runnable.prototype.skip = function() {
5251 this.pending = true;
5252 throw new Pending('sync skip; aborting execution');
5253};
5254
5255/**
5256 * Check if this runnable or its parent suite is marked as pending.
5257 *
5258 * @private
5259 */
5260Runnable.prototype.isPending = function() {
5261 return this.pending || (this.parent && this.parent.isPending());
5262};
5263
5264/**
5265 * Return `true` if this Runnable has failed.
5266 * @return {boolean}
5267 * @private
5268 */
5269Runnable.prototype.isFailed = function() {
5270 return !this.isPending() && this.state === constants.STATE_FAILED;
5271};
5272
5273/**
5274 * Return `true` if this Runnable has passed.
5275 * @return {boolean}
5276 * @private
5277 */
5278Runnable.prototype.isPassed = function() {
5279 return !this.isPending() && this.state === constants.STATE_PASSED;
5280};
5281
5282/**
5283 * Set or get number of retries.
5284 *
5285 * @private
5286 */
5287Runnable.prototype.retries = function(n) {
5288 if (!arguments.length) {
5289 return this._retries;
5290 }
5291 this._retries = n;
5292};
5293
5294/**
5295 * Set or get current retry
5296 *
5297 * @private
5298 */
5299Runnable.prototype.currentRetry = function(n) {
5300 if (!arguments.length) {
5301 return this._currentRetry;
5302 }
5303 this._currentRetry = n;
5304};
5305
5306/**
5307 * Return the full title generated by recursively concatenating the parent's
5308 * full title.
5309 *
5310 * @memberof Mocha.Runnable
5311 * @public
5312 * @return {string}
5313 */
5314Runnable.prototype.fullTitle = function() {
5315 return this.titlePath().join(' ');
5316};
5317
5318/**
5319 * Return the title path generated by concatenating the parent's title path with the title.
5320 *
5321 * @memberof Mocha.Runnable
5322 * @public
5323 * @return {string}
5324 */
5325Runnable.prototype.titlePath = function() {
5326 return this.parent.titlePath().concat([this.title]);
5327};
5328
5329/**
5330 * Clear the timeout.
5331 *
5332 * @private
5333 */
5334Runnable.prototype.clearTimeout = function() {
5335 clearTimeout(this.timer);
5336};
5337
5338/**
5339 * Inspect the runnable void of private properties.
5340 *
5341 * @private
5342 * @return {string}
5343 */
5344Runnable.prototype.inspect = function() {
5345 return JSON.stringify(
5346 this,
5347 function(key, val) {
5348 if (key[0] === '_') {
5349 return;
5350 }
5351 if (key === 'parent') {
5352 return '#<Suite>';
5353 }
5354 if (key === 'ctx') {
5355 return '#<Context>';
5356 }
5357 return val;
5358 },
5359 2
5360 );
5361};
5362
5363/**
5364 * Reset the timeout.
5365 *
5366 * @private
5367 */
5368Runnable.prototype.resetTimeout = function() {
5369 var self = this;
5370 var ms = this.timeout() || 1e9;
5371
5372 if (!this._enableTimeouts) {
5373 return;
5374 }
5375 this.clearTimeout();
5376 this.timer = setTimeout(function() {
5377 if (!self._enableTimeouts) {
5378 return;
5379 }
5380 self.callback(self._timeoutError(ms));
5381 self.timedOut = true;
5382 }, ms);
5383};
5384
5385/**
5386 * Set or get a list of whitelisted globals for this test run.
5387 *
5388 * @private
5389 * @param {string[]} globals
5390 */
5391Runnable.prototype.globals = function(globals) {
5392 if (!arguments.length) {
5393 return this._allowedGlobals;
5394 }
5395 this._allowedGlobals = globals;
5396};
5397
5398/**
5399 * Run the test and invoke `fn(err)`.
5400 *
5401 * @param {Function} fn
5402 * @private
5403 */
5404Runnable.prototype.run = function(fn) {
5405 var self = this;
5406 var start = new Date();
5407 var ctx = this.ctx;
5408 var finished;
5409 var emitted;
5410
5411 // Sometimes the ctx exists, but it is not runnable
5412 if (ctx && ctx.runnable) {
5413 ctx.runnable(this);
5414 }
5415
5416 // called multiple times
5417 function multiple(err) {
5418 if (emitted) {
5419 return;
5420 }
5421 emitted = true;
5422 var msg = 'done() called multiple times';
5423 if (err && err.message) {
5424 err.message += " (and Mocha's " + msg + ')';
5425 self.emit('error', err);
5426 } else {
5427 self.emit('error', new Error(msg));
5428 }
5429 }
5430
5431 // finished
5432 function done(err) {
5433 var ms = self.timeout();
5434 if (self.timedOut) {
5435 return;
5436 }
5437
5438 if (finished) {
5439 return multiple(err);
5440 }
5441
5442 self.clearTimeout();
5443 self.duration = new Date() - start;
5444 finished = true;
5445 if (!err && self.duration > ms && self._enableTimeouts) {
5446 err = self._timeoutError(ms);
5447 }
5448 fn(err);
5449 }
5450
5451 // for .resetTimeout()
5452 this.callback = done;
5453
5454 // explicit async with `done` argument
5455 if (this.async) {
5456 this.resetTimeout();
5457
5458 // allows skip() to be used in an explicit async context
5459 this.skip = function asyncSkip() {
5460 this.pending = true;
5461 done();
5462 // halt execution, the uncaught handler will ignore the failure.
5463 throw new Pending('async skip; aborting execution');
5464 };
5465
5466 try {
5467 callFnAsync(this.fn);
5468 } catch (err) {
5469 // handles async runnables which actually run synchronously
5470 emitted = true;
5471 if (err instanceof Pending) {
5472 return; // done() is already called in this.skip()
5473 } else if (this.allowUncaught) {
5474 throw err;
5475 }
5476 done(Runnable.toValueOrError(err));
5477 }
5478 return;
5479 }
5480
5481 // sync or promise-returning
5482 try {
5483 if (this.isPending()) {
5484 done();
5485 } else {
5486 callFn(this.fn);
5487 }
5488 } catch (err) {
5489 emitted = true;
5490 if (err instanceof Pending) {
5491 return done();
5492 } else if (this.allowUncaught) {
5493 throw err;
5494 }
5495 done(Runnable.toValueOrError(err));
5496 }
5497
5498 function callFn(fn) {
5499 var result = fn.call(ctx);
5500 if (result && typeof result.then === 'function') {
5501 self.resetTimeout();
5502 result.then(
5503 function() {
5504 done();
5505 // Return null so libraries like bluebird do not warn about
5506 // subsequently constructed Promises.
5507 return null;
5508 },
5509 function(reason) {
5510 done(reason || new Error('Promise rejected with no or falsy reason'));
5511 }
5512 );
5513 } else {
5514 if (self.asyncOnly) {
5515 return done(
5516 new Error(
5517 '--async-only option in use without declaring `done()` or returning a promise'
5518 )
5519 );
5520 }
5521
5522 done();
5523 }
5524 }
5525
5526 function callFnAsync(fn) {
5527 var result = fn.call(ctx, function(err) {
5528 if (err instanceof Error || toString.call(err) === '[object Error]') {
5529 return done(err);
5530 }
5531 if (err) {
5532 if (Object.prototype.toString.call(err) === '[object Object]') {
5533 return done(
5534 new Error('done() invoked with non-Error: ' + JSON.stringify(err))
5535 );
5536 }
5537 return done(new Error('done() invoked with non-Error: ' + err));
5538 }
5539 if (result && utils.isPromise(result)) {
5540 return done(
5541 new Error(
5542 'Resolution method is overspecified. Specify a callback *or* return a Promise; not both.'
5543 )
5544 );
5545 }
5546
5547 done();
5548 });
5549 }
5550};
5551
5552/**
5553 * Instantiates a "timeout" error
5554 *
5555 * @param {number} ms - Timeout (in milliseconds)
5556 * @returns {Error} a "timeout" error
5557 * @private
5558 */
5559Runnable.prototype._timeoutError = function(ms) {
5560 var msg =
5561 'Timeout of ' +
5562 ms +
5563 'ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.';
5564 if (this.file) {
5565 msg += ' (' + this.file + ')';
5566 }
5567 return new Error(msg);
5568};
5569
5570var constants = utils.defineConstants(
5571 /**
5572 * {@link Runnable}-related constants.
5573 * @public
5574 * @memberof Runnable
5575 * @readonly
5576 * @static
5577 * @alias constants
5578 * @enum {string}
5579 */
5580 {
5581 /**
5582 * Value of `state` prop when a `Runnable` has failed
5583 */
5584 STATE_FAILED: 'failed',
5585 /**
5586 * Value of `state` prop when a `Runnable` has passed
5587 */
5588 STATE_PASSED: 'passed'
5589 }
5590);
5591
5592/**
5593 * Given `value`, return identity if truthy, otherwise create an "invalid exception" error and return that.
5594 * @param {*} [value] - Value to return, if present
5595 * @returns {*|Error} `value`, otherwise an `Error`
5596 * @private
5597 */
5598Runnable.toValueOrError = function(value) {
5599 return (
5600 value ||
5601 createInvalidExceptionError(
5602 'Runnable failed with falsy or undefined exception. Please throw an Error instead.',
5603 value
5604 )
5605 );
5606};
5607
5608Runnable.constants = constants;
5609
5610}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
5611},{"./errors":6,"./pending":16,"./utils":38,"debug":45,"events":50,"ms":60}],34:[function(require,module,exports){
5612(function (process,global){
5613'use strict';
5614
5615/**
5616 * Module dependencies.
5617 */
5618var util = require('util');
5619var EventEmitter = require('events').EventEmitter;
5620var Pending = require('./pending');
5621var utils = require('./utils');
5622var inherits = utils.inherits;
5623var debug = require('debug')('mocha:runner');
5624var Runnable = require('./runnable');
5625var Suite = require('./suite');
5626var HOOK_TYPE_BEFORE_EACH = Suite.constants.HOOK_TYPE_BEFORE_EACH;
5627var HOOK_TYPE_AFTER_EACH = Suite.constants.HOOK_TYPE_AFTER_EACH;
5628var HOOK_TYPE_AFTER_ALL = Suite.constants.HOOK_TYPE_AFTER_ALL;
5629var HOOK_TYPE_BEFORE_ALL = Suite.constants.HOOK_TYPE_BEFORE_ALL;
5630var EVENT_ROOT_SUITE_RUN = Suite.constants.EVENT_ROOT_SUITE_RUN;
5631var STATE_FAILED = Runnable.constants.STATE_FAILED;
5632var STATE_PASSED = Runnable.constants.STATE_PASSED;
5633var dQuote = utils.dQuote;
5634var ngettext = utils.ngettext;
5635var sQuote = utils.sQuote;
5636var stackFilter = utils.stackTraceFilter();
5637var stringify = utils.stringify;
5638var type = utils.type;
5639var errors = require('./errors');
5640var createInvalidExceptionError = errors.createInvalidExceptionError;
5641var createUnsupportedError = errors.createUnsupportedError;
5642
5643/**
5644 * Non-enumerable globals.
5645 * @readonly
5646 */
5647var globals = [
5648 'setTimeout',
5649 'clearTimeout',
5650 'setInterval',
5651 'clearInterval',
5652 'XMLHttpRequest',
5653 'Date',
5654 'setImmediate',
5655 'clearImmediate'
5656];
5657
5658var constants = utils.defineConstants(
5659 /**
5660 * {@link Runner}-related constants.
5661 * @public
5662 * @memberof Runner
5663 * @readonly
5664 * @alias constants
5665 * @static
5666 * @enum {string}
5667 */
5668 {
5669 /**
5670 * Emitted when {@link Hook} execution begins
5671 */
5672 EVENT_HOOK_BEGIN: 'hook',
5673 /**
5674 * Emitted when {@link Hook} execution ends
5675 */
5676 EVENT_HOOK_END: 'hook end',
5677 /**
5678 * Emitted when Root {@link Suite} execution begins (all files have been parsed and hooks/tests are ready for execution)
5679 */
5680 EVENT_RUN_BEGIN: 'start',
5681 /**
5682 * Emitted when Root {@link Suite} execution has been delayed via `delay` option
5683 */
5684 EVENT_DELAY_BEGIN: 'waiting',
5685 /**
5686 * Emitted when delayed Root {@link Suite} execution is triggered by user via `global.run()`
5687 */
5688 EVENT_DELAY_END: 'ready',
5689 /**
5690 * Emitted when Root {@link Suite} execution ends
5691 */
5692 EVENT_RUN_END: 'end',
5693 /**
5694 * Emitted when {@link Suite} execution begins
5695 */
5696 EVENT_SUITE_BEGIN: 'suite',
5697 /**
5698 * Emitted when {@link Suite} execution ends
5699 */
5700 EVENT_SUITE_END: 'suite end',
5701 /**
5702 * Emitted when {@link Test} execution begins
5703 */
5704 EVENT_TEST_BEGIN: 'test',
5705 /**
5706 * Emitted when {@link Test} execution ends
5707 */
5708 EVENT_TEST_END: 'test end',
5709 /**
5710 * Emitted when {@link Test} execution fails
5711 */
5712 EVENT_TEST_FAIL: 'fail',
5713 /**
5714 * Emitted when {@link Test} execution succeeds
5715 */
5716 EVENT_TEST_PASS: 'pass',
5717 /**
5718 * Emitted when {@link Test} becomes pending
5719 */
5720 EVENT_TEST_PENDING: 'pending',
5721 /**
5722 * Emitted when {@link Test} execution has failed, but will retry
5723 */
5724 EVENT_TEST_RETRY: 'retry'
5725 }
5726);
5727
5728module.exports = Runner;
5729
5730/**
5731 * Initialize a `Runner` at the Root {@link Suite}, which represents a hierarchy of {@link Suite|Suites} and {@link Test|Tests}.
5732 *
5733 * @extends external:EventEmitter
5734 * @public
5735 * @class
5736 * @param {Suite} suite Root suite
5737 * @param {boolean} [delay] Whether or not to delay execution of root suite
5738 * until ready.
5739 */
5740function Runner(suite, delay) {
5741 var self = this;
5742 this._globals = [];
5743 this._abort = false;
5744 this._delay = delay;
5745 this.suite = suite;
5746 this.started = false;
5747 this.total = suite.total();
5748 this.failures = 0;
5749 this.on(constants.EVENT_TEST_END, function(test) {
5750 self.checkGlobals(test);
5751 });
5752 this.on(constants.EVENT_HOOK_END, function(hook) {
5753 self.checkGlobals(hook);
5754 });
5755 this._defaultGrep = /.*/;
5756 this.grep(this._defaultGrep);
5757 this.globals(this.globalProps());
5758}
5759
5760/**
5761 * Wrapper for setImmediate, process.nextTick, or browser polyfill.
5762 *
5763 * @param {Function} fn
5764 * @private
5765 */
5766Runner.immediately = global.setImmediate || process.nextTick;
5767
5768/**
5769 * Inherit from `EventEmitter.prototype`.
5770 */
5771inherits(Runner, EventEmitter);
5772
5773/**
5774 * Run tests with full titles matching `re`. Updates runner.total
5775 * with number of tests matched.
5776 *
5777 * @public
5778 * @memberof Runner
5779 * @param {RegExp} re
5780 * @param {boolean} invert
5781 * @return {Runner} Runner instance.
5782 */
5783Runner.prototype.grep = function(re, invert) {
5784 debug('grep %s', re);
5785 this._grep = re;
5786 this._invert = invert;
5787 this.total = this.grepTotal(this.suite);
5788 return this;
5789};
5790
5791/**
5792 * Returns the number of tests matching the grep search for the
5793 * given suite.
5794 *
5795 * @memberof Runner
5796 * @public
5797 * @param {Suite} suite
5798 * @return {number}
5799 */
5800Runner.prototype.grepTotal = function(suite) {
5801 var self = this;
5802 var total = 0;
5803
5804 suite.eachTest(function(test) {
5805 var match = self._grep.test(test.fullTitle());
5806 if (self._invert) {
5807 match = !match;
5808 }
5809 if (match) {
5810 total++;
5811 }
5812 });
5813
5814 return total;
5815};
5816
5817/**
5818 * Return a list of global properties.
5819 *
5820 * @return {Array}
5821 * @private
5822 */
5823Runner.prototype.globalProps = function() {
5824 var props = Object.keys(global);
5825
5826 // non-enumerables
5827 for (var i = 0; i < globals.length; ++i) {
5828 if (~props.indexOf(globals[i])) {
5829 continue;
5830 }
5831 props.push(globals[i]);
5832 }
5833
5834 return props;
5835};
5836
5837/**
5838 * Allow the given `arr` of globals.
5839 *
5840 * @public
5841 * @memberof Runner
5842 * @param {Array} arr
5843 * @return {Runner} Runner instance.
5844 */
5845Runner.prototype.globals = function(arr) {
5846 if (!arguments.length) {
5847 return this._globals;
5848 }
5849 debug('globals %j', arr);
5850 this._globals = this._globals.concat(arr);
5851 return this;
5852};
5853
5854/**
5855 * Check for global variable leaks.
5856 *
5857 * @private
5858 */
5859Runner.prototype.checkGlobals = function(test) {
5860 if (!this.checkLeaks) {
5861 return;
5862 }
5863 var ok = this._globals;
5864
5865 var globals = this.globalProps();
5866 var leaks;
5867
5868 if (test) {
5869 ok = ok.concat(test._allowedGlobals || []);
5870 }
5871
5872 if (this.prevGlobalsLength === globals.length) {
5873 return;
5874 }
5875 this.prevGlobalsLength = globals.length;
5876
5877 leaks = filterLeaks(ok, globals);
5878 this._globals = this._globals.concat(leaks);
5879
5880 if (leaks.length) {
5881 var format = ngettext(
5882 leaks.length,
5883 'global leak detected: %s',
5884 'global leaks detected: %s'
5885 );
5886 var error = new Error(util.format(format, leaks.map(sQuote).join(', ')));
5887 this.fail(test, error);
5888 }
5889};
5890
5891/**
5892 * Fail the given `test`.
5893 *
5894 * @private
5895 * @param {Test} test
5896 * @param {Error} err
5897 */
5898Runner.prototype.fail = function(test, err) {
5899 if (test.isPending()) {
5900 return;
5901 }
5902
5903 ++this.failures;
5904 test.state = STATE_FAILED;
5905
5906 if (!isError(err)) {
5907 err = thrown2Error(err);
5908 }
5909
5910 try {
5911 err.stack =
5912 this.fullStackTrace || !err.stack ? err.stack : stackFilter(err.stack);
5913 } catch (ignore) {
5914 // some environments do not take kindly to monkeying with the stack
5915 }
5916
5917 this.emit(constants.EVENT_TEST_FAIL, test, err);
5918};
5919
5920/**
5921 * Fail the given `hook` with `err`.
5922 *
5923 * Hook failures work in the following pattern:
5924 * - If bail, run corresponding `after each` and `after` hooks,
5925 * then exit
5926 * - Failed `before` hook skips all tests in a suite and subsuites,
5927 * but jumps to corresponding `after` hook
5928 * - Failed `before each` hook skips remaining tests in a
5929 * suite and jumps to corresponding `after each` hook,
5930 * which is run only once
5931 * - Failed `after` hook does not alter execution order
5932 * - Failed `after each` hook skips remaining tests in a
5933 * suite and subsuites, but executes other `after each`
5934 * hooks
5935 *
5936 * @private
5937 * @param {Hook} hook
5938 * @param {Error} err
5939 */
5940Runner.prototype.failHook = function(hook, err) {
5941 hook.originalTitle = hook.originalTitle || hook.title;
5942 if (hook.ctx && hook.ctx.currentTest) {
5943 hook.title =
5944 hook.originalTitle + ' for ' + dQuote(hook.ctx.currentTest.title);
5945 } else {
5946 var parentTitle;
5947 if (hook.parent.title) {
5948 parentTitle = hook.parent.title;
5949 } else {
5950 parentTitle = hook.parent.root ? '{root}' : '';
5951 }
5952 hook.title = hook.originalTitle + ' in ' + dQuote(parentTitle);
5953 }
5954
5955 this.fail(hook, err);
5956};
5957
5958/**
5959 * Run hook `name` callbacks and then invoke `fn()`.
5960 *
5961 * @private
5962 * @param {string} name
5963 * @param {Function} fn
5964 */
5965
5966Runner.prototype.hook = function(name, fn) {
5967 var suite = this.suite;
5968 var hooks = suite.getHooks(name);
5969 var self = this;
5970
5971 function next(i) {
5972 var hook = hooks[i];
5973 if (!hook) {
5974 return fn();
5975 }
5976 self.currentRunnable = hook;
5977
5978 if (name === HOOK_TYPE_BEFORE_ALL) {
5979 hook.ctx.currentTest = hook.parent.tests[0];
5980 } else if (name === HOOK_TYPE_AFTER_ALL) {
5981 hook.ctx.currentTest = hook.parent.tests[hook.parent.tests.length - 1];
5982 } else {
5983 hook.ctx.currentTest = self.test;
5984 }
5985
5986 hook.allowUncaught = self.allowUncaught;
5987
5988 self.emit(constants.EVENT_HOOK_BEGIN, hook);
5989
5990 if (!hook.listeners('error').length) {
5991 hook.on('error', function(err) {
5992 self.failHook(hook, err);
5993 });
5994 }
5995
5996 hook.run(function(err) {
5997 var testError = hook.error();
5998 if (testError) {
5999 self.fail(self.test, testError);
6000 }
6001 // conditional skip
6002 if (hook.pending) {
6003 if (name === HOOK_TYPE_AFTER_EACH) {
6004 // TODO define and implement use case
6005 if (self.test) {
6006 self.test.pending = true;
6007 }
6008 } else if (name === HOOK_TYPE_BEFORE_EACH) {
6009 if (self.test) {
6010 self.test.pending = true;
6011 }
6012 self.emit(constants.EVENT_HOOK_END, hook);
6013 hook.pending = false; // activates hook for next test
6014 return fn(new Error('abort hookDown'));
6015 } else if (name === HOOK_TYPE_BEFORE_ALL) {
6016 suite.tests.forEach(function(test) {
6017 test.pending = true;
6018 });
6019 suite.suites.forEach(function(suite) {
6020 suite.pending = true;
6021 });
6022 } else {
6023 hook.pending = false;
6024 var errForbid = createUnsupportedError('`this.skip` forbidden');
6025 self.failHook(hook, errForbid);
6026 return fn(errForbid);
6027 }
6028 } else if (err) {
6029 self.failHook(hook, err);
6030 // stop executing hooks, notify callee of hook err
6031 return fn(err);
6032 }
6033 self.emit(constants.EVENT_HOOK_END, hook);
6034 delete hook.ctx.currentTest;
6035 next(++i);
6036 });
6037 }
6038
6039 Runner.immediately(function() {
6040 next(0);
6041 });
6042};
6043
6044/**
6045 * Run hook `name` for the given array of `suites`
6046 * in order, and callback `fn(err, errSuite)`.
6047 *
6048 * @private
6049 * @param {string} name
6050 * @param {Array} suites
6051 * @param {Function} fn
6052 */
6053Runner.prototype.hooks = function(name, suites, fn) {
6054 var self = this;
6055 var orig = this.suite;
6056
6057 function next(suite) {
6058 self.suite = suite;
6059
6060 if (!suite) {
6061 self.suite = orig;
6062 return fn();
6063 }
6064
6065 self.hook(name, function(err) {
6066 if (err) {
6067 var errSuite = self.suite;
6068 self.suite = orig;
6069 return fn(err, errSuite);
6070 }
6071
6072 next(suites.pop());
6073 });
6074 }
6075
6076 next(suites.pop());
6077};
6078
6079/**
6080 * Run hooks from the top level down.
6081 *
6082 * @param {String} name
6083 * @param {Function} fn
6084 * @private
6085 */
6086Runner.prototype.hookUp = function(name, fn) {
6087 var suites = [this.suite].concat(this.parents()).reverse();
6088 this.hooks(name, suites, fn);
6089};
6090
6091/**
6092 * Run hooks from the bottom up.
6093 *
6094 * @param {String} name
6095 * @param {Function} fn
6096 * @private
6097 */
6098Runner.prototype.hookDown = function(name, fn) {
6099 var suites = [this.suite].concat(this.parents());
6100 this.hooks(name, suites, fn);
6101};
6102
6103/**
6104 * Return an array of parent Suites from
6105 * closest to furthest.
6106 *
6107 * @return {Array}
6108 * @private
6109 */
6110Runner.prototype.parents = function() {
6111 var suite = this.suite;
6112 var suites = [];
6113 while (suite.parent) {
6114 suite = suite.parent;
6115 suites.push(suite);
6116 }
6117 return suites;
6118};
6119
6120/**
6121 * Run the current test and callback `fn(err)`.
6122 *
6123 * @param {Function} fn
6124 * @private
6125 */
6126Runner.prototype.runTest = function(fn) {
6127 var self = this;
6128 var test = this.test;
6129
6130 if (!test) {
6131 return;
6132 }
6133
6134 var suite = this.parents().reverse()[0] || this.suite;
6135 if (this.forbidOnly && suite.hasOnly()) {
6136 fn(new Error('`.only` forbidden'));
6137 return;
6138 }
6139 if (this.asyncOnly) {
6140 test.asyncOnly = true;
6141 }
6142 test.on('error', function(err) {
6143 if (err instanceof Pending) {
6144 return;
6145 }
6146 self.fail(test, err);
6147 });
6148 if (this.allowUncaught) {
6149 test.allowUncaught = true;
6150 return test.run(fn);
6151 }
6152 try {
6153 test.run(fn);
6154 } catch (err) {
6155 fn(err);
6156 }
6157};
6158
6159/**
6160 * Run tests in the given `suite` and invoke the callback `fn()` when complete.
6161 *
6162 * @private
6163 * @param {Suite} suite
6164 * @param {Function} fn
6165 */
6166Runner.prototype.runTests = function(suite, fn) {
6167 var self = this;
6168 var tests = suite.tests.slice();
6169 var test;
6170
6171 function hookErr(_, errSuite, after) {
6172 // before/after Each hook for errSuite failed:
6173 var orig = self.suite;
6174
6175 // for failed 'after each' hook start from errSuite parent,
6176 // otherwise start from errSuite itself
6177 self.suite = after ? errSuite.parent : errSuite;
6178
6179 if (self.suite) {
6180 // call hookUp afterEach
6181 self.hookUp(HOOK_TYPE_AFTER_EACH, function(err2, errSuite2) {
6182 self.suite = orig;
6183 // some hooks may fail even now
6184 if (err2) {
6185 return hookErr(err2, errSuite2, true);
6186 }
6187 // report error suite
6188 fn(errSuite);
6189 });
6190 } else {
6191 // there is no need calling other 'after each' hooks
6192 self.suite = orig;
6193 fn(errSuite);
6194 }
6195 }
6196
6197 function next(err, errSuite) {
6198 // if we bail after first err
6199 if (self.failures && suite._bail) {
6200 tests = [];
6201 }
6202
6203 if (self._abort) {
6204 return fn();
6205 }
6206
6207 if (err) {
6208 return hookErr(err, errSuite, true);
6209 }
6210
6211 // next test
6212 test = tests.shift();
6213
6214 // all done
6215 if (!test) {
6216 return fn();
6217 }
6218
6219 // grep
6220 var match = self._grep.test(test.fullTitle());
6221 if (self._invert) {
6222 match = !match;
6223 }
6224 if (!match) {
6225 // Run immediately only if we have defined a grep. When we
6226 // define a grep — It can cause maximum callstack error if
6227 // the grep is doing a large recursive loop by neglecting
6228 // all tests. The run immediately function also comes with
6229 // a performance cost. So we don't want to run immediately
6230 // if we run the whole test suite, because running the whole
6231 // test suite don't do any immediate recursive loops. Thus,
6232 // allowing a JS runtime to breathe.
6233 if (self._grep !== self._defaultGrep) {
6234 Runner.immediately(next);
6235 } else {
6236 next();
6237 }
6238 return;
6239 }
6240
6241 // static skip, no hooks are executed
6242 if (test.isPending()) {
6243 if (self.forbidPending) {
6244 test.isPending = alwaysFalse;
6245 self.fail(test, new Error('Pending test forbidden'));
6246 delete test.isPending;
6247 } else {
6248 self.emit(constants.EVENT_TEST_PENDING, test);
6249 }
6250 self.emit(constants.EVENT_TEST_END, test);
6251 return next();
6252 }
6253
6254 // execute test and hook(s)
6255 self.emit(constants.EVENT_TEST_BEGIN, (self.test = test));
6256 self.hookDown(HOOK_TYPE_BEFORE_EACH, function(err, errSuite) {
6257 // conditional skip within beforeEach
6258 if (test.isPending()) {
6259 if (self.forbidPending) {
6260 test.isPending = alwaysFalse;
6261 self.fail(test, new Error('Pending test forbidden'));
6262 delete test.isPending;
6263 } else {
6264 self.emit(constants.EVENT_TEST_PENDING, test);
6265 }
6266 self.emit(constants.EVENT_TEST_END, test);
6267 // skip inner afterEach hooks below errSuite level
6268 var origSuite = self.suite;
6269 self.suite = errSuite;
6270 return self.hookUp(HOOK_TYPE_AFTER_EACH, function(e, eSuite) {
6271 self.suite = origSuite;
6272 next(e, eSuite);
6273 });
6274 }
6275 if (err) {
6276 return hookErr(err, errSuite, false);
6277 }
6278 self.currentRunnable = self.test;
6279 self.runTest(function(err) {
6280 test = self.test;
6281 // conditional skip within it
6282 if (test.pending) {
6283 if (self.forbidPending) {
6284 test.isPending = alwaysFalse;
6285 self.fail(test, new Error('Pending test forbidden'));
6286 delete test.isPending;
6287 } else {
6288 self.emit(constants.EVENT_TEST_PENDING, test);
6289 }
6290 self.emit(constants.EVENT_TEST_END, test);
6291 return self.hookUp(HOOK_TYPE_AFTER_EACH, next);
6292 } else if (err) {
6293 var retry = test.currentRetry();
6294 if (retry < test.retries()) {
6295 var clonedTest = test.clone();
6296 clonedTest.currentRetry(retry + 1);
6297 tests.unshift(clonedTest);
6298
6299 self.emit(constants.EVENT_TEST_RETRY, test, err);
6300
6301 // Early return + hook trigger so that it doesn't
6302 // increment the count wrong
6303 return self.hookUp(HOOK_TYPE_AFTER_EACH, next);
6304 } else {
6305 self.fail(test, err);
6306 }
6307 self.emit(constants.EVENT_TEST_END, test);
6308 return self.hookUp(HOOK_TYPE_AFTER_EACH, next);
6309 }
6310
6311 test.state = STATE_PASSED;
6312 self.emit(constants.EVENT_TEST_PASS, test);
6313 self.emit(constants.EVENT_TEST_END, test);
6314 self.hookUp(HOOK_TYPE_AFTER_EACH, next);
6315 });
6316 });
6317 }
6318
6319 this.next = next;
6320 this.hookErr = hookErr;
6321 next();
6322};
6323
6324function alwaysFalse() {
6325 return false;
6326}
6327
6328/**
6329 * Run the given `suite` and invoke the callback `fn()` when complete.
6330 *
6331 * @private
6332 * @param {Suite} suite
6333 * @param {Function} fn
6334 */
6335Runner.prototype.runSuite = function(suite, fn) {
6336 var i = 0;
6337 var self = this;
6338 var total = this.grepTotal(suite);
6339 var afterAllHookCalled = false;
6340
6341 debug('run suite %s', suite.fullTitle());
6342
6343 if (!total || (self.failures && suite._bail)) {
6344 return fn();
6345 }
6346
6347 this.emit(constants.EVENT_SUITE_BEGIN, (this.suite = suite));
6348
6349 function next(errSuite) {
6350 if (errSuite) {
6351 // current suite failed on a hook from errSuite
6352 if (errSuite === suite) {
6353 // if errSuite is current suite
6354 // continue to the next sibling suite
6355 return done();
6356 }
6357 // errSuite is among the parents of current suite
6358 // stop execution of errSuite and all sub-suites
6359 return done(errSuite);
6360 }
6361
6362 if (self._abort) {
6363 return done();
6364 }
6365
6366 var curr = suite.suites[i++];
6367 if (!curr) {
6368 return done();
6369 }
6370
6371 // Avoid grep neglecting large number of tests causing a
6372 // huge recursive loop and thus a maximum call stack error.
6373 // See comment in `this.runTests()` for more information.
6374 if (self._grep !== self._defaultGrep) {
6375 Runner.immediately(function() {
6376 self.runSuite(curr, next);
6377 });
6378 } else {
6379 self.runSuite(curr, next);
6380 }
6381 }
6382
6383 function done(errSuite) {
6384 self.suite = suite;
6385 self.nextSuite = next;
6386
6387 if (afterAllHookCalled) {
6388 fn(errSuite);
6389 } else {
6390 // mark that the afterAll block has been called once
6391 // and so can be skipped if there is an error in it.
6392 afterAllHookCalled = true;
6393
6394 // remove reference to test
6395 delete self.test;
6396
6397 self.hook(HOOK_TYPE_AFTER_ALL, function() {
6398 self.emit(constants.EVENT_SUITE_END, suite);
6399 fn(errSuite);
6400 });
6401 }
6402 }
6403
6404 this.nextSuite = next;
6405
6406 this.hook(HOOK_TYPE_BEFORE_ALL, function(err) {
6407 if (err) {
6408 return done();
6409 }
6410 self.runTests(suite, next);
6411 });
6412};
6413
6414/**
6415 * Handle uncaught exceptions.
6416 *
6417 * @param {Error} err
6418 * @private
6419 */
6420Runner.prototype.uncaught = function(err) {
6421 if (err instanceof Pending) {
6422 return;
6423 }
6424 if (this.allowUncaught) {
6425 throw err;
6426 }
6427
6428 if (err) {
6429 debug('uncaught exception %O', err);
6430 } else {
6431 debug('uncaught undefined/falsy exception');
6432 err = createInvalidExceptionError(
6433 'Caught falsy/undefined exception which would otherwise be uncaught. No stack trace found; try a debugger',
6434 err
6435 );
6436 }
6437
6438 if (!isError(err)) {
6439 err = thrown2Error(err);
6440 }
6441 err.uncaught = true;
6442
6443 var runnable = this.currentRunnable;
6444
6445 if (!runnable) {
6446 runnable = new Runnable('Uncaught error outside test suite');
6447 runnable.parent = this.suite;
6448
6449 if (this.started) {
6450 this.fail(runnable, err);
6451 } else {
6452 // Can't recover from this failure
6453 this.emit(constants.EVENT_RUN_BEGIN);
6454 this.fail(runnable, err);
6455 this.emit(constants.EVENT_RUN_END);
6456 }
6457
6458 return;
6459 }
6460
6461 runnable.clearTimeout();
6462
6463 if (runnable.isFailed()) {
6464 // Ignore error if already failed
6465 return;
6466 } else if (runnable.isPending()) {
6467 // report 'pending test' retrospectively as failed
6468 runnable.isPending = alwaysFalse;
6469 this.fail(runnable, err);
6470 delete runnable.isPending;
6471 return;
6472 }
6473
6474 // we cannot recover gracefully if a Runnable has already passed
6475 // then fails asynchronously
6476 var alreadyPassed = runnable.isPassed();
6477 // this will change the state to "failed" regardless of the current value
6478 this.fail(runnable, err);
6479 if (!alreadyPassed) {
6480 // recover from test
6481 if (runnable.type === constants.EVENT_TEST_BEGIN) {
6482 this.emit(constants.EVENT_TEST_END, runnable);
6483 this.hookUp(HOOK_TYPE_AFTER_EACH, this.next);
6484 return;
6485 }
6486 debug(runnable);
6487
6488 // recover from hooks
6489 var errSuite = this.suite;
6490
6491 // XXX how about a less awful way to determine this?
6492 // if hook failure is in afterEach block
6493 if (runnable.fullTitle().indexOf('after each') > -1) {
6494 return this.hookErr(err, errSuite, true);
6495 }
6496 // if hook failure is in beforeEach block
6497 if (runnable.fullTitle().indexOf('before each') > -1) {
6498 return this.hookErr(err, errSuite, false);
6499 }
6500 // if hook failure is in after or before blocks
6501 return this.nextSuite(errSuite);
6502 }
6503
6504 // bail
6505 this.abort();
6506};
6507
6508/**
6509 * Run the root suite and invoke `fn(failures)`
6510 * on completion.
6511 *
6512 * @public
6513 * @memberof Runner
6514 * @param {Function} fn
6515 * @return {Runner} Runner instance.
6516 */
6517Runner.prototype.run = function(fn) {
6518 var self = this;
6519 var rootSuite = this.suite;
6520
6521 fn = fn || function() {};
6522
6523 function uncaught(err) {
6524 self.uncaught(err);
6525 }
6526
6527 function start() {
6528 // If there is an `only` filter
6529 if (rootSuite.hasOnly()) {
6530 rootSuite.filterOnly();
6531 }
6532 self.started = true;
6533 if (self._delay) {
6534 self.emit(constants.EVENT_DELAY_END);
6535 }
6536 self.emit(constants.EVENT_RUN_BEGIN);
6537
6538 self.runSuite(rootSuite, function() {
6539 debug('finished running');
6540 self.emit(constants.EVENT_RUN_END);
6541 });
6542 }
6543
6544 debug(constants.EVENT_RUN_BEGIN);
6545
6546 // references cleanup to avoid memory leaks
6547 this.on(constants.EVENT_SUITE_END, function(suite) {
6548 suite.cleanReferences();
6549 });
6550
6551 // callback
6552 this.on(constants.EVENT_RUN_END, function() {
6553 debug(constants.EVENT_RUN_END);
6554 process.removeListener('uncaughtException', uncaught);
6555 process.on('uncaughtException', function(err) {
6556 if (err instanceof Pending) {
6557 return;
6558 }
6559 throw err;
6560 });
6561 fn(self.failures);
6562 });
6563
6564 // uncaught exception
6565 process.on('uncaughtException', uncaught);
6566
6567 if (this._delay) {
6568 // for reporters, I guess.
6569 // might be nice to debounce some dots while we wait.
6570 this.emit(constants.EVENT_DELAY_BEGIN, rootSuite);
6571 rootSuite.once(EVENT_ROOT_SUITE_RUN, start);
6572 } else {
6573 start();
6574 }
6575
6576 return this;
6577};
6578
6579/**
6580 * Cleanly abort execution.
6581 *
6582 * @memberof Runner
6583 * @public
6584 * @return {Runner} Runner instance.
6585 */
6586Runner.prototype.abort = function() {
6587 debug('aborting');
6588 this._abort = true;
6589
6590 return this;
6591};
6592
6593/**
6594 * Filter leaks with the given globals flagged as `ok`.
6595 *
6596 * @private
6597 * @param {Array} ok
6598 * @param {Array} globals
6599 * @return {Array}
6600 */
6601function filterLeaks(ok, globals) {
6602 return globals.filter(function(key) {
6603 // Firefox and Chrome exposes iframes as index inside the window object
6604 if (/^\d+/.test(key)) {
6605 return false;
6606 }
6607
6608 // in firefox
6609 // if runner runs in an iframe, this iframe's window.getInterface method
6610 // not init at first it is assigned in some seconds
6611 if (global.navigator && /^getInterface/.test(key)) {
6612 return false;
6613 }
6614
6615 // an iframe could be approached by window[iframeIndex]
6616 // in ie6,7,8 and opera, iframeIndex is enumerable, this could cause leak
6617 if (global.navigator && /^\d+/.test(key)) {
6618 return false;
6619 }
6620
6621 // Opera and IE expose global variables for HTML element IDs (issue #243)
6622 if (/^mocha-/.test(key)) {
6623 return false;
6624 }
6625
6626 var matched = ok.filter(function(ok) {
6627 if (~ok.indexOf('*')) {
6628 return key.indexOf(ok.split('*')[0]) === 0;
6629 }
6630 return key === ok;
6631 });
6632 return !matched.length && (!global.navigator || key !== 'onerror');
6633 });
6634}
6635
6636/**
6637 * Check if argument is an instance of Error object or a duck-typed equivalent.
6638 *
6639 * @private
6640 * @param {Object} err - object to check
6641 * @param {string} err.message - error message
6642 * @returns {boolean}
6643 */
6644function isError(err) {
6645 return err instanceof Error || (err && typeof err.message === 'string');
6646}
6647
6648/**
6649 *
6650 * Converts thrown non-extensible type into proper Error.
6651 *
6652 * @private
6653 * @param {*} thrown - Non-extensible type thrown by code
6654 * @return {Error}
6655 */
6656function thrown2Error(err) {
6657 return new Error(
6658 'the ' + type(err) + ' ' + stringify(err) + ' was thrown, throw an Error :)'
6659 );
6660}
6661
6662Runner.constants = constants;
6663
6664/**
6665 * Node.js' `EventEmitter`
6666 * @external EventEmitter
6667 * @see {@link https://nodejs.org/api/events.html#events_class_eventemitter}
6668 */
6669
6670}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
6671},{"./errors":6,"./pending":16,"./runnable":33,"./suite":36,"./utils":38,"_process":69,"debug":45,"events":50,"util":89}],35:[function(require,module,exports){
6672(function (global){
6673'use strict';
6674
6675/**
6676 * Provides a factory function for a {@link StatsCollector} object.
6677 * @module
6678 */
6679
6680var constants = require('./runner').constants;
6681var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
6682var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
6683var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
6684var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
6685var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
6686var EVENT_RUN_END = constants.EVENT_RUN_END;
6687var EVENT_TEST_END = constants.EVENT_TEST_END;
6688
6689/**
6690 * Test statistics collector.
6691 *
6692 * @public
6693 * @typedef {Object} StatsCollector
6694 * @property {number} suites - integer count of suites run.
6695 * @property {number} tests - integer count of tests run.
6696 * @property {number} passes - integer count of passing tests.
6697 * @property {number} pending - integer count of pending tests.
6698 * @property {number} failures - integer count of failed tests.
6699 * @property {Date} start - time when testing began.
6700 * @property {Date} end - time when testing concluded.
6701 * @property {number} duration - number of msecs that testing took.
6702 */
6703
6704var Date = global.Date;
6705
6706/**
6707 * Provides stats such as test duration, number of tests passed / failed etc., by listening for events emitted by `runner`.
6708 *
6709 * @private
6710 * @param {Runner} runner - Runner instance
6711 * @throws {TypeError} If falsy `runner`
6712 */
6713function createStatsCollector(runner) {
6714 /**
6715 * @type StatsCollector
6716 */
6717 var stats = {
6718 suites: 0,
6719 tests: 0,
6720 passes: 0,
6721 pending: 0,
6722 failures: 0
6723 };
6724
6725 if (!runner) {
6726 throw new TypeError('Missing runner argument');
6727 }
6728
6729 runner.stats = stats;
6730
6731 runner.once(EVENT_RUN_BEGIN, function() {
6732 stats.start = new Date();
6733 });
6734 runner.on(EVENT_SUITE_BEGIN, function(suite) {
6735 suite.root || stats.suites++;
6736 });
6737 runner.on(EVENT_TEST_PASS, function() {
6738 stats.passes++;
6739 });
6740 runner.on(EVENT_TEST_FAIL, function() {
6741 stats.failures++;
6742 });
6743 runner.on(EVENT_TEST_PENDING, function() {
6744 stats.pending++;
6745 });
6746 runner.on(EVENT_TEST_END, function() {
6747 stats.tests++;
6748 });
6749 runner.once(EVENT_RUN_END, function() {
6750 stats.end = new Date();
6751 stats.duration = stats.end - stats.start;
6752 });
6753}
6754
6755module.exports = createStatsCollector;
6756
6757}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
6758},{"./runner":34}],36:[function(require,module,exports){
6759'use strict';
6760
6761/**
6762 * Module dependencies.
6763 */
6764var EventEmitter = require('events').EventEmitter;
6765var Hook = require('./hook');
6766var utils = require('./utils');
6767var inherits = utils.inherits;
6768var debug = require('debug')('mocha:suite');
6769var milliseconds = require('ms');
6770var errors = require('./errors');
6771var createInvalidArgumentTypeError = errors.createInvalidArgumentTypeError;
6772
6773/**
6774 * Expose `Suite`.
6775 */
6776
6777exports = module.exports = Suite;
6778
6779/**
6780 * Create a new `Suite` with the given `title` and parent `Suite`.
6781 *
6782 * @public
6783 * @param {Suite} parent - Parent suite (required!)
6784 * @param {string} title - Title
6785 * @return {Suite}
6786 */
6787Suite.create = function(parent, title) {
6788 var suite = new Suite(title, parent.ctx);
6789 suite.parent = parent;
6790 title = suite.fullTitle();
6791 parent.addSuite(suite);
6792 return suite;
6793};
6794
6795/**
6796 * Constructs a new `Suite` instance with the given `title`, `ctx`, and `isRoot`.
6797 *
6798 * @public
6799 * @class
6800 * @extends EventEmitter
6801 * @see {@link https://nodejs.org/api/events.html#events_class_eventemitter|EventEmitter}
6802 * @param {string} title - Suite title.
6803 * @param {Context} parentContext - Parent context instance.
6804 * @param {boolean} [isRoot=false] - Whether this is the root suite.
6805 */
6806function Suite(title, parentContext, isRoot) {
6807 if (!utils.isString(title)) {
6808 throw createInvalidArgumentTypeError(
6809 'Suite argument "title" must be a string. Received type "' +
6810 typeof title +
6811 '"',
6812 'title',
6813 'string'
6814 );
6815 }
6816 this.title = title;
6817 function Context() {}
6818 Context.prototype = parentContext;
6819 this.ctx = new Context();
6820 this.suites = [];
6821 this.tests = [];
6822 this.pending = false;
6823 this._beforeEach = [];
6824 this._beforeAll = [];
6825 this._afterEach = [];
6826 this._afterAll = [];
6827 this.root = isRoot === true;
6828 this._timeout = 2000;
6829 this._enableTimeouts = true;
6830 this._slow = 75;
6831 this._bail = false;
6832 this._retries = -1;
6833 this._onlyTests = [];
6834 this._onlySuites = [];
6835 this.delayed = false;
6836
6837 this.on('newListener', function(event) {
6838 if (deprecatedEvents[event]) {
6839 utils.deprecate(
6840 'Event "' +
6841 event +
6842 '" is deprecated. Please let the Mocha team know about your use case: https://git.io/v6Lwm'
6843 );
6844 }
6845 });
6846}
6847
6848/**
6849 * Inherit from `EventEmitter.prototype`.
6850 */
6851inherits(Suite, EventEmitter);
6852
6853/**
6854 * Return a clone of this `Suite`.
6855 *
6856 * @private
6857 * @return {Suite}
6858 */
6859Suite.prototype.clone = function() {
6860 var suite = new Suite(this.title);
6861 debug('clone');
6862 suite.ctx = this.ctx;
6863 suite.root = this.root;
6864 suite.timeout(this.timeout());
6865 suite.retries(this.retries());
6866 suite.enableTimeouts(this.enableTimeouts());
6867 suite.slow(this.slow());
6868 suite.bail(this.bail());
6869 return suite;
6870};
6871
6872/**
6873 * Set or get timeout `ms` or short-hand such as "2s".
6874 *
6875 * @private
6876 * @todo Do not attempt to set value if `ms` is undefined
6877 * @param {number|string} ms
6878 * @return {Suite|number} for chaining
6879 */
6880Suite.prototype.timeout = function(ms) {
6881 if (!arguments.length) {
6882 return this._timeout;
6883 }
6884 if (ms.toString() === '0') {
6885 this._enableTimeouts = false;
6886 }
6887 if (typeof ms === 'string') {
6888 ms = milliseconds(ms);
6889 }
6890 debug('timeout %d', ms);
6891 this._timeout = parseInt(ms, 10);
6892 return this;
6893};
6894
6895/**
6896 * Set or get number of times to retry a failed test.
6897 *
6898 * @private
6899 * @param {number|string} n
6900 * @return {Suite|number} for chaining
6901 */
6902Suite.prototype.retries = function(n) {
6903 if (!arguments.length) {
6904 return this._retries;
6905 }
6906 debug('retries %d', n);
6907 this._retries = parseInt(n, 10) || 0;
6908 return this;
6909};
6910
6911/**
6912 * Set or get timeout to `enabled`.
6913 *
6914 * @private
6915 * @param {boolean} enabled
6916 * @return {Suite|boolean} self or enabled
6917 */
6918Suite.prototype.enableTimeouts = function(enabled) {
6919 if (!arguments.length) {
6920 return this._enableTimeouts;
6921 }
6922 debug('enableTimeouts %s', enabled);
6923 this._enableTimeouts = enabled;
6924 return this;
6925};
6926
6927/**
6928 * Set or get slow `ms` or short-hand such as "2s".
6929 *
6930 * @private
6931 * @param {number|string} ms
6932 * @return {Suite|number} for chaining
6933 */
6934Suite.prototype.slow = function(ms) {
6935 if (!arguments.length) {
6936 return this._slow;
6937 }
6938 if (typeof ms === 'string') {
6939 ms = milliseconds(ms);
6940 }
6941 debug('slow %d', ms);
6942 this._slow = ms;
6943 return this;
6944};
6945
6946/**
6947 * Set or get whether to bail after first error.
6948 *
6949 * @private
6950 * @param {boolean} bail
6951 * @return {Suite|number} for chaining
6952 */
6953Suite.prototype.bail = function(bail) {
6954 if (!arguments.length) {
6955 return this._bail;
6956 }
6957 debug('bail %s', bail);
6958 this._bail = bail;
6959 return this;
6960};
6961
6962/**
6963 * Check if this suite or its parent suite is marked as pending.
6964 *
6965 * @private
6966 */
6967Suite.prototype.isPending = function() {
6968 return this.pending || (this.parent && this.parent.isPending());
6969};
6970
6971/**
6972 * Generic hook-creator.
6973 * @private
6974 * @param {string} title - Title of hook
6975 * @param {Function} fn - Hook callback
6976 * @returns {Hook} A new hook
6977 */
6978Suite.prototype._createHook = function(title, fn) {
6979 var hook = new Hook(title, fn);
6980 hook.parent = this;
6981 hook.timeout(this.timeout());
6982 hook.retries(this.retries());
6983 hook.enableTimeouts(this.enableTimeouts());
6984 hook.slow(this.slow());
6985 hook.ctx = this.ctx;
6986 hook.file = this.file;
6987 return hook;
6988};
6989
6990/**
6991 * Run `fn(test[, done])` before running tests.
6992 *
6993 * @private
6994 * @param {string} title
6995 * @param {Function} fn
6996 * @return {Suite} for chaining
6997 */
6998Suite.prototype.beforeAll = function(title, fn) {
6999 if (this.isPending()) {
7000 return this;
7001 }
7002 if (typeof title === 'function') {
7003 fn = title;
7004 title = fn.name;
7005 }
7006 title = '"before all" hook' + (title ? ': ' + title : '');
7007
7008 var hook = this._createHook(title, fn);
7009 this._beforeAll.push(hook);
7010 this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_ALL, hook);
7011 return this;
7012};
7013
7014/**
7015 * Run `fn(test[, done])` after running tests.
7016 *
7017 * @private
7018 * @param {string} title
7019 * @param {Function} fn
7020 * @return {Suite} for chaining
7021 */
7022Suite.prototype.afterAll = function(title, fn) {
7023 if (this.isPending()) {
7024 return this;
7025 }
7026 if (typeof title === 'function') {
7027 fn = title;
7028 title = fn.name;
7029 }
7030 title = '"after all" hook' + (title ? ': ' + title : '');
7031
7032 var hook = this._createHook(title, fn);
7033 this._afterAll.push(hook);
7034 this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_ALL, hook);
7035 return this;
7036};
7037
7038/**
7039 * Run `fn(test[, done])` before each test case.
7040 *
7041 * @private
7042 * @param {string} title
7043 * @param {Function} fn
7044 * @return {Suite} for chaining
7045 */
7046Suite.prototype.beforeEach = function(title, fn) {
7047 if (this.isPending()) {
7048 return this;
7049 }
7050 if (typeof title === 'function') {
7051 fn = title;
7052 title = fn.name;
7053 }
7054 title = '"before each" hook' + (title ? ': ' + title : '');
7055
7056 var hook = this._createHook(title, fn);
7057 this._beforeEach.push(hook);
7058 this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_EACH, hook);
7059 return this;
7060};
7061
7062/**
7063 * Run `fn(test[, done])` after each test case.
7064 *
7065 * @private
7066 * @param {string} title
7067 * @param {Function} fn
7068 * @return {Suite} for chaining
7069 */
7070Suite.prototype.afterEach = function(title, fn) {
7071 if (this.isPending()) {
7072 return this;
7073 }
7074 if (typeof title === 'function') {
7075 fn = title;
7076 title = fn.name;
7077 }
7078 title = '"after each" hook' + (title ? ': ' + title : '');
7079
7080 var hook = this._createHook(title, fn);
7081 this._afterEach.push(hook);
7082 this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_EACH, hook);
7083 return this;
7084};
7085
7086/**
7087 * Add a test `suite`.
7088 *
7089 * @private
7090 * @param {Suite} suite
7091 * @return {Suite} for chaining
7092 */
7093Suite.prototype.addSuite = function(suite) {
7094 suite.parent = this;
7095 suite.root = false;
7096 suite.timeout(this.timeout());
7097 suite.retries(this.retries());
7098 suite.enableTimeouts(this.enableTimeouts());
7099 suite.slow(this.slow());
7100 suite.bail(this.bail());
7101 this.suites.push(suite);
7102 this.emit(constants.EVENT_SUITE_ADD_SUITE, suite);
7103 return this;
7104};
7105
7106/**
7107 * Add a `test` to this suite.
7108 *
7109 * @private
7110 * @param {Test} test
7111 * @return {Suite} for chaining
7112 */
7113Suite.prototype.addTest = function(test) {
7114 test.parent = this;
7115 test.timeout(this.timeout());
7116 test.retries(this.retries());
7117 test.enableTimeouts(this.enableTimeouts());
7118 test.slow(this.slow());
7119 test.ctx = this.ctx;
7120 this.tests.push(test);
7121 this.emit(constants.EVENT_SUITE_ADD_TEST, test);
7122 return this;
7123};
7124
7125/**
7126 * Return the full title generated by recursively concatenating the parent's
7127 * full title.
7128 *
7129 * @memberof Suite
7130 * @public
7131 * @return {string}
7132 */
7133Suite.prototype.fullTitle = function() {
7134 return this.titlePath().join(' ');
7135};
7136
7137/**
7138 * Return the title path generated by recursively concatenating the parent's
7139 * title path.
7140 *
7141 * @memberof Suite
7142 * @public
7143 * @return {string}
7144 */
7145Suite.prototype.titlePath = function() {
7146 var result = [];
7147 if (this.parent) {
7148 result = result.concat(this.parent.titlePath());
7149 }
7150 if (!this.root) {
7151 result.push(this.title);
7152 }
7153 return result;
7154};
7155
7156/**
7157 * Return the total number of tests.
7158 *
7159 * @memberof Suite
7160 * @public
7161 * @return {number}
7162 */
7163Suite.prototype.total = function() {
7164 return (
7165 this.suites.reduce(function(sum, suite) {
7166 return sum + suite.total();
7167 }, 0) + this.tests.length
7168 );
7169};
7170
7171/**
7172 * Iterates through each suite recursively to find all tests. Applies a
7173 * function in the format `fn(test)`.
7174 *
7175 * @private
7176 * @param {Function} fn
7177 * @return {Suite}
7178 */
7179Suite.prototype.eachTest = function(fn) {
7180 this.tests.forEach(fn);
7181 this.suites.forEach(function(suite) {
7182 suite.eachTest(fn);
7183 });
7184 return this;
7185};
7186
7187/**
7188 * This will run the root suite if we happen to be running in delayed mode.
7189 * @private
7190 */
7191Suite.prototype.run = function run() {
7192 if (this.root) {
7193 this.emit(constants.EVENT_ROOT_SUITE_RUN);
7194 }
7195};
7196
7197/**
7198 * Determines whether a suite has an `only` test or suite as a descendant.
7199 *
7200 * @private
7201 * @returns {Boolean}
7202 */
7203Suite.prototype.hasOnly = function hasOnly() {
7204 return (
7205 this._onlyTests.length > 0 ||
7206 this._onlySuites.length > 0 ||
7207 this.suites.some(function(suite) {
7208 return suite.hasOnly();
7209 })
7210 );
7211};
7212
7213/**
7214 * Filter suites based on `isOnly` logic.
7215 *
7216 * @private
7217 * @returns {Boolean}
7218 */
7219Suite.prototype.filterOnly = function filterOnly() {
7220 if (this._onlyTests.length) {
7221 // If the suite contains `only` tests, run those and ignore any nested suites.
7222 this.tests = this._onlyTests;
7223 this.suites = [];
7224 } else {
7225 // Otherwise, do not run any of the tests in this suite.
7226 this.tests = [];
7227 this._onlySuites.forEach(function(onlySuite) {
7228 // If there are other `only` tests/suites nested in the current `only` suite, then filter that `only` suite.
7229 // Otherwise, all of the tests on this `only` suite should be run, so don't filter it.
7230 if (onlySuite.hasOnly()) {
7231 onlySuite.filterOnly();
7232 }
7233 });
7234 // Run the `only` suites, as well as any other suites that have `only` tests/suites as descendants.
7235 var onlySuites = this._onlySuites;
7236 this.suites = this.suites.filter(function(childSuite) {
7237 return onlySuites.indexOf(childSuite) !== -1 || childSuite.filterOnly();
7238 });
7239 }
7240 // Keep the suite only if there is something to run
7241 return this.tests.length > 0 || this.suites.length > 0;
7242};
7243
7244/**
7245 * Adds a suite to the list of subsuites marked `only`.
7246 *
7247 * @private
7248 * @param {Suite} suite
7249 */
7250Suite.prototype.appendOnlySuite = function(suite) {
7251 this._onlySuites.push(suite);
7252};
7253
7254/**
7255 * Adds a test to the list of tests marked `only`.
7256 *
7257 * @private
7258 * @param {Test} test
7259 */
7260Suite.prototype.appendOnlyTest = function(test) {
7261 this._onlyTests.push(test);
7262};
7263
7264/**
7265 * Returns the array of hooks by hook name; see `HOOK_TYPE_*` constants.
7266 * @private
7267 */
7268Suite.prototype.getHooks = function getHooks(name) {
7269 return this['_' + name];
7270};
7271
7272/**
7273 * Cleans up the references to all the deferred functions
7274 * (before/after/beforeEach/afterEach) and tests of a Suite.
7275 * These must be deleted otherwise a memory leak can happen,
7276 * as those functions may reference variables from closures,
7277 * thus those variables can never be garbage collected as long
7278 * as the deferred functions exist.
7279 *
7280 * @private
7281 */
7282Suite.prototype.cleanReferences = function cleanReferences() {
7283 function cleanArrReferences(arr) {
7284 for (var i = 0; i < arr.length; i++) {
7285 delete arr[i].fn;
7286 }
7287 }
7288
7289 if (Array.isArray(this._beforeAll)) {
7290 cleanArrReferences(this._beforeAll);
7291 }
7292
7293 if (Array.isArray(this._beforeEach)) {
7294 cleanArrReferences(this._beforeEach);
7295 }
7296
7297 if (Array.isArray(this._afterAll)) {
7298 cleanArrReferences(this._afterAll);
7299 }
7300
7301 if (Array.isArray(this._afterEach)) {
7302 cleanArrReferences(this._afterEach);
7303 }
7304
7305 for (var i = 0; i < this.tests.length; i++) {
7306 delete this.tests[i].fn;
7307 }
7308};
7309
7310var constants = utils.defineConstants(
7311 /**
7312 * {@link Suite}-related constants.
7313 * @public
7314 * @memberof Suite
7315 * @alias constants
7316 * @readonly
7317 * @static
7318 * @enum {string}
7319 */
7320 {
7321 /**
7322 * Event emitted after a test file has been loaded Not emitted in browser.
7323 */
7324 EVENT_FILE_POST_REQUIRE: 'post-require',
7325 /**
7326 * Event emitted before a test file has been loaded. In browser, this is emitted once an interface has been selected.
7327 */
7328 EVENT_FILE_PRE_REQUIRE: 'pre-require',
7329 /**
7330 * Event emitted immediately after a test file has been loaded. Not emitted in browser.
7331 */
7332 EVENT_FILE_REQUIRE: 'require',
7333 /**
7334 * Event emitted when `global.run()` is called (use with `delay` option)
7335 */
7336 EVENT_ROOT_SUITE_RUN: 'run',
7337
7338 /**
7339 * Namespace for collection of a `Suite`'s "after all" hooks
7340 */
7341 HOOK_TYPE_AFTER_ALL: 'afterAll',
7342 /**
7343 * Namespace for collection of a `Suite`'s "after each" hooks
7344 */
7345 HOOK_TYPE_AFTER_EACH: 'afterEach',
7346 /**
7347 * Namespace for collection of a `Suite`'s "before all" hooks
7348 */
7349 HOOK_TYPE_BEFORE_ALL: 'beforeAll',
7350 /**
7351 * Namespace for collection of a `Suite`'s "before all" hooks
7352 */
7353 HOOK_TYPE_BEFORE_EACH: 'beforeEach',
7354
7355 // the following events are all deprecated
7356
7357 /**
7358 * Emitted after an "after all" `Hook` has been added to a `Suite`. Deprecated
7359 */
7360 EVENT_SUITE_ADD_HOOK_AFTER_ALL: 'afterAll',
7361 /**
7362 * Emitted after an "after each" `Hook` has been added to a `Suite` Deprecated
7363 */
7364 EVENT_SUITE_ADD_HOOK_AFTER_EACH: 'afterEach',
7365 /**
7366 * Emitted after an "before all" `Hook` has been added to a `Suite` Deprecated
7367 */
7368 EVENT_SUITE_ADD_HOOK_BEFORE_ALL: 'beforeAll',
7369 /**
7370 * Emitted after an "before each" `Hook` has been added to a `Suite` Deprecated
7371 */
7372 EVENT_SUITE_ADD_HOOK_BEFORE_EACH: 'beforeEach',
7373 /**
7374 * Emitted after a child `Suite` has been added to a `Suite`. Deprecated
7375 */
7376 EVENT_SUITE_ADD_SUITE: 'suite',
7377 /**
7378 * Emitted after a `Test` has been added to a `Suite`. Deprecated
7379 */
7380 EVENT_SUITE_ADD_TEST: 'test'
7381 }
7382);
7383
7384/**
7385 * @summary There are no known use cases for these events.
7386 * @desc This is a `Set`-like object having all keys being the constant's string value and the value being `true`.
7387 * @todo Remove eventually
7388 * @type {Object<string,boolean>}
7389 * @ignore
7390 */
7391var deprecatedEvents = Object.keys(constants)
7392 .filter(function(constant) {
7393 return constant.substring(0, 15) === 'EVENT_SUITE_ADD';
7394 })
7395 .reduce(function(acc, constant) {
7396 acc[constants[constant]] = true;
7397 return acc;
7398 }, utils.createMap());
7399
7400Suite.constants = constants;
7401
7402},{"./errors":6,"./hook":7,"./utils":38,"debug":45,"events":50,"ms":60}],37:[function(require,module,exports){
7403'use strict';
7404var Runnable = require('./runnable');
7405var utils = require('./utils');
7406var errors = require('./errors');
7407var createInvalidArgumentTypeError = errors.createInvalidArgumentTypeError;
7408var isString = utils.isString;
7409
7410module.exports = Test;
7411
7412/**
7413 * Initialize a new `Test` with the given `title` and callback `fn`.
7414 *
7415 * @public
7416 * @class
7417 * @extends Runnable
7418 * @param {String} title - Test title (required)
7419 * @param {Function} [fn] - Test callback. If omitted, the Test is considered "pending"
7420 */
7421function Test(title, fn) {
7422 if (!isString(title)) {
7423 throw createInvalidArgumentTypeError(
7424 'Test argument "title" should be a string. Received type "' +
7425 typeof title +
7426 '"',
7427 'title',
7428 'string'
7429 );
7430 }
7431 Runnable.call(this, title, fn);
7432 this.pending = !fn;
7433 this.type = 'test';
7434}
7435
7436/**
7437 * Inherit from `Runnable.prototype`.
7438 */
7439utils.inherits(Test, Runnable);
7440
7441Test.prototype.clone = function() {
7442 var test = new Test(this.title, this.fn);
7443 test.timeout(this.timeout());
7444 test.slow(this.slow());
7445 test.enableTimeouts(this.enableTimeouts());
7446 test.retries(this.retries());
7447 test.currentRetry(this.currentRetry());
7448 test.globals(this.globals());
7449 test.parent = this.parent;
7450 test.file = this.file;
7451 test.ctx = this.ctx;
7452 return test;
7453};
7454
7455},{"./errors":6,"./runnable":33,"./utils":38}],38:[function(require,module,exports){
7456(function (process,Buffer){
7457'use strict';
7458
7459/**
7460 * Various utility functions used throughout Mocha's codebase.
7461 * @module utils
7462 */
7463
7464/**
7465 * Module dependencies.
7466 */
7467
7468var fs = require('fs');
7469var path = require('path');
7470var util = require('util');
7471var glob = require('glob');
7472var he = require('he');
7473var errors = require('./errors');
7474var createNoFilesMatchPatternError = errors.createNoFilesMatchPatternError;
7475var createMissingArgumentError = errors.createMissingArgumentError;
7476
7477var assign = (exports.assign = require('object.assign').getPolyfill());
7478
7479/**
7480 * Inherit the prototype methods from one constructor into another.
7481 *
7482 * @param {function} ctor - Constructor function which needs to inherit the
7483 * prototype.
7484 * @param {function} superCtor - Constructor function to inherit prototype from.
7485 * @throws {TypeError} if either constructor is null, or if super constructor
7486 * lacks a prototype.
7487 */
7488exports.inherits = util.inherits;
7489
7490/**
7491 * Escape special characters in the given string of html.
7492 *
7493 * @private
7494 * @param {string} html
7495 * @return {string}
7496 */
7497exports.escape = function(html) {
7498 return he.encode(String(html), {useNamedReferences: false});
7499};
7500
7501/**
7502 * Test if the given obj is type of string.
7503 *
7504 * @private
7505 * @param {Object} obj
7506 * @return {boolean}
7507 */
7508exports.isString = function(obj) {
7509 return typeof obj === 'string';
7510};
7511
7512/**
7513 * Compute a slug from the given `str`.
7514 *
7515 * @private
7516 * @param {string} str
7517 * @return {string}
7518 */
7519exports.slug = function(str) {
7520 return str
7521 .toLowerCase()
7522 .replace(/ +/g, '-')
7523 .replace(/[^-\w]/g, '');
7524};
7525
7526/**
7527 * Strip the function definition from `str`, and re-indent for pre whitespace.
7528 *
7529 * @param {string} str
7530 * @return {string}
7531 */
7532exports.clean = function(str) {
7533 str = str
7534 .replace(/\r\n?|[\n\u2028\u2029]/g, '\n')
7535 .replace(/^\uFEFF/, '')
7536 // (traditional)-> space/name parameters body (lambda)-> parameters body multi-statement/single keep body content
7537 .replace(
7538 /^function(?:\s*|\s+[^(]*)\([^)]*\)\s*\{((?:.|\n)*?)\s*\}$|^\([^)]*\)\s*=>\s*(?:\{((?:.|\n)*?)\s*\}|((?:.|\n)*))$/,
7539 '$1$2$3'
7540 );
7541
7542 var spaces = str.match(/^\n?( *)/)[1].length;
7543 var tabs = str.match(/^\n?(\t*)/)[1].length;
7544 var re = new RegExp(
7545 '^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs || spaces) + '}',
7546 'gm'
7547 );
7548
7549 str = str.replace(re, '');
7550
7551 return str.trim();
7552};
7553
7554/**
7555 * Parse the given `qs`.
7556 *
7557 * @private
7558 * @param {string} qs
7559 * @return {Object}
7560 */
7561exports.parseQuery = function(qs) {
7562 return qs
7563 .replace('?', '')
7564 .split('&')
7565 .reduce(function(obj, pair) {
7566 var i = pair.indexOf('=');
7567 var key = pair.slice(0, i);
7568 var val = pair.slice(++i);
7569
7570 // Due to how the URLSearchParams API treats spaces
7571 obj[key] = decodeURIComponent(val.replace(/\+/g, '%20'));
7572
7573 return obj;
7574 }, {});
7575};
7576
7577/**
7578 * Highlight the given string of `js`.
7579 *
7580 * @private
7581 * @param {string} js
7582 * @return {string}
7583 */
7584function highlight(js) {
7585 return js
7586 .replace(/</g, '&lt;')
7587 .replace(/>/g, '&gt;')
7588 .replace(/\/\/(.*)/gm, '<span class="comment">//$1</span>')
7589 .replace(/('.*?')/gm, '<span class="string">$1</span>')
7590 .replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>')
7591 .replace(/(\d+)/gm, '<span class="number">$1</span>')
7592 .replace(
7593 /\bnew[ \t]+(\w+)/gm,
7594 '<span class="keyword">new</span> <span class="init">$1</span>'
7595 )
7596 .replace(
7597 /\b(function|new|throw|return|var|if|else)\b/gm,
7598 '<span class="keyword">$1</span>'
7599 );
7600}
7601
7602/**
7603 * Highlight the contents of tag `name`.
7604 *
7605 * @private
7606 * @param {string} name
7607 */
7608exports.highlightTags = function(name) {
7609 var code = document.getElementById('mocha').getElementsByTagName(name);
7610 for (var i = 0, len = code.length; i < len; ++i) {
7611 code[i].innerHTML = highlight(code[i].innerHTML);
7612 }
7613};
7614
7615/**
7616 * If a value could have properties, and has none, this function is called,
7617 * which returns a string representation of the empty value.
7618 *
7619 * Functions w/ no properties return `'[Function]'`
7620 * Arrays w/ length === 0 return `'[]'`
7621 * Objects w/ no properties return `'{}'`
7622 * All else: return result of `value.toString()`
7623 *
7624 * @private
7625 * @param {*} value The value to inspect.
7626 * @param {string} typeHint The type of the value
7627 * @returns {string}
7628 */
7629function emptyRepresentation(value, typeHint) {
7630 switch (typeHint) {
7631 case 'function':
7632 return '[Function]';
7633 case 'object':
7634 return '{}';
7635 case 'array':
7636 return '[]';
7637 default:
7638 return value.toString();
7639 }
7640}
7641
7642/**
7643 * Takes some variable and asks `Object.prototype.toString()` what it thinks it
7644 * is.
7645 *
7646 * @private
7647 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString
7648 * @param {*} value The value to test.
7649 * @returns {string} Computed type
7650 * @example
7651 * type({}) // 'object'
7652 * type([]) // 'array'
7653 * type(1) // 'number'
7654 * type(false) // 'boolean'
7655 * type(Infinity) // 'number'
7656 * type(null) // 'null'
7657 * type(new Date()) // 'date'
7658 * type(/foo/) // 'regexp'
7659 * type('type') // 'string'
7660 * type(global) // 'global'
7661 * type(new String('foo') // 'object'
7662 */
7663var type = (exports.type = function type(value) {
7664 if (value === undefined) {
7665 return 'undefined';
7666 } else if (value === null) {
7667 return 'null';
7668 } else if (Buffer.isBuffer(value)) {
7669 return 'buffer';
7670 }
7671 return Object.prototype.toString
7672 .call(value)
7673 .replace(/^\[.+\s(.+?)]$/, '$1')
7674 .toLowerCase();
7675});
7676
7677/**
7678 * Stringify `value`. Different behavior depending on type of value:
7679 *
7680 * - If `value` is undefined or null, return `'[undefined]'` or `'[null]'`, respectively.
7681 * - If `value` is not an object, function or array, return result of `value.toString()` wrapped in double-quotes.
7682 * - If `value` is an *empty* object, function, or array, return result of function
7683 * {@link emptyRepresentation}.
7684 * - If `value` has properties, call {@link exports.canonicalize} on it, then return result of
7685 * JSON.stringify().
7686 *
7687 * @private
7688 * @see exports.type
7689 * @param {*} value
7690 * @return {string}
7691 */
7692exports.stringify = function(value) {
7693 var typeHint = type(value);
7694
7695 if (!~['object', 'array', 'function'].indexOf(typeHint)) {
7696 if (typeHint === 'buffer') {
7697 var json = Buffer.prototype.toJSON.call(value);
7698 // Based on the toJSON result
7699 return jsonStringify(
7700 json.data && json.type ? json.data : json,
7701 2
7702 ).replace(/,(\n|$)/g, '$1');
7703 }
7704
7705 // IE7/IE8 has a bizarre String constructor; needs to be coerced
7706 // into an array and back to obj.
7707 if (typeHint === 'string' && typeof value === 'object') {
7708 value = value.split('').reduce(function(acc, char, idx) {
7709 acc[idx] = char;
7710 return acc;
7711 }, {});
7712 typeHint = 'object';
7713 } else {
7714 return jsonStringify(value);
7715 }
7716 }
7717
7718 for (var prop in value) {
7719 if (Object.prototype.hasOwnProperty.call(value, prop)) {
7720 return jsonStringify(
7721 exports.canonicalize(value, null, typeHint),
7722 2
7723 ).replace(/,(\n|$)/g, '$1');
7724 }
7725 }
7726
7727 return emptyRepresentation(value, typeHint);
7728};
7729
7730/**
7731 * like JSON.stringify but more sense.
7732 *
7733 * @private
7734 * @param {Object} object
7735 * @param {number=} spaces
7736 * @param {number=} depth
7737 * @returns {*}
7738 */
7739function jsonStringify(object, spaces, depth) {
7740 if (typeof spaces === 'undefined') {
7741 // primitive types
7742 return _stringify(object);
7743 }
7744
7745 depth = depth || 1;
7746 var space = spaces * depth;
7747 var str = Array.isArray(object) ? '[' : '{';
7748 var end = Array.isArray(object) ? ']' : '}';
7749 var length =
7750 typeof object.length === 'number'
7751 ? object.length
7752 : Object.keys(object).length;
7753 // `.repeat()` polyfill
7754 function repeat(s, n) {
7755 return new Array(n).join(s);
7756 }
7757
7758 function _stringify(val) {
7759 switch (type(val)) {
7760 case 'null':
7761 case 'undefined':
7762 val = '[' + val + ']';
7763 break;
7764 case 'array':
7765 case 'object':
7766 val = jsonStringify(val, spaces, depth + 1);
7767 break;
7768 case 'boolean':
7769 case 'regexp':
7770 case 'symbol':
7771 case 'number':
7772 val =
7773 val === 0 && 1 / val === -Infinity // `-0`
7774 ? '-0'
7775 : val.toString();
7776 break;
7777 case 'date':
7778 var sDate = isNaN(val.getTime()) ? val.toString() : val.toISOString();
7779 val = '[Date: ' + sDate + ']';
7780 break;
7781 case 'buffer':
7782 var json = val.toJSON();
7783 // Based on the toJSON result
7784 json = json.data && json.type ? json.data : json;
7785 val = '[Buffer: ' + jsonStringify(json, 2, depth + 1) + ']';
7786 break;
7787 default:
7788 val =
7789 val === '[Function]' || val === '[Circular]'
7790 ? val
7791 : JSON.stringify(val); // string
7792 }
7793 return val;
7794 }
7795
7796 for (var i in object) {
7797 if (!Object.prototype.hasOwnProperty.call(object, i)) {
7798 continue; // not my business
7799 }
7800 --length;
7801 str +=
7802 '\n ' +
7803 repeat(' ', space) +
7804 (Array.isArray(object) ? '' : '"' + i + '": ') + // key
7805 _stringify(object[i]) + // value
7806 (length ? ',' : ''); // comma
7807 }
7808
7809 return (
7810 str +
7811 // [], {}
7812 (str.length !== 1 ? '\n' + repeat(' ', --space) + end : end)
7813 );
7814}
7815
7816/**
7817 * Return a new Thing that has the keys in sorted order. Recursive.
7818 *
7819 * If the Thing...
7820 * - has already been seen, return string `'[Circular]'`
7821 * - is `undefined`, return string `'[undefined]'`
7822 * - is `null`, return value `null`
7823 * - is some other primitive, return the value
7824 * - is not a primitive or an `Array`, `Object`, or `Function`, return the value of the Thing's `toString()` method
7825 * - is a non-empty `Array`, `Object`, or `Function`, return the result of calling this function again.
7826 * - is an empty `Array`, `Object`, or `Function`, return the result of calling `emptyRepresentation()`
7827 *
7828 * @private
7829 * @see {@link exports.stringify}
7830 * @param {*} value Thing to inspect. May or may not have properties.
7831 * @param {Array} [stack=[]] Stack of seen values
7832 * @param {string} [typeHint] Type hint
7833 * @return {(Object|Array|Function|string|undefined)}
7834 */
7835exports.canonicalize = function canonicalize(value, stack, typeHint) {
7836 var canonicalizedObj;
7837 /* eslint-disable no-unused-vars */
7838 var prop;
7839 /* eslint-enable no-unused-vars */
7840 typeHint = typeHint || type(value);
7841 function withStack(value, fn) {
7842 stack.push(value);
7843 fn();
7844 stack.pop();
7845 }
7846
7847 stack = stack || [];
7848
7849 if (stack.indexOf(value) !== -1) {
7850 return '[Circular]';
7851 }
7852
7853 switch (typeHint) {
7854 case 'undefined':
7855 case 'buffer':
7856 case 'null':
7857 canonicalizedObj = value;
7858 break;
7859 case 'array':
7860 withStack(value, function() {
7861 canonicalizedObj = value.map(function(item) {
7862 return exports.canonicalize(item, stack);
7863 });
7864 });
7865 break;
7866 case 'function':
7867 /* eslint-disable guard-for-in */
7868 for (prop in value) {
7869 canonicalizedObj = {};
7870 break;
7871 }
7872 /* eslint-enable guard-for-in */
7873 if (!canonicalizedObj) {
7874 canonicalizedObj = emptyRepresentation(value, typeHint);
7875 break;
7876 }
7877 /* falls through */
7878 case 'object':
7879 canonicalizedObj = canonicalizedObj || {};
7880 withStack(value, function() {
7881 Object.keys(value)
7882 .sort()
7883 .forEach(function(key) {
7884 canonicalizedObj[key] = exports.canonicalize(value[key], stack);
7885 });
7886 });
7887 break;
7888 case 'date':
7889 case 'number':
7890 case 'regexp':
7891 case 'boolean':
7892 case 'symbol':
7893 canonicalizedObj = value;
7894 break;
7895 default:
7896 canonicalizedObj = value + '';
7897 }
7898
7899 return canonicalizedObj;
7900};
7901
7902/**
7903 * Determines if pathname has a matching file extension.
7904 *
7905 * @private
7906 * @param {string} pathname - Pathname to check for match.
7907 * @param {string[]} exts - List of file extensions (sans period).
7908 * @return {boolean} whether file extension matches.
7909 * @example
7910 * hasMatchingExtname('foo.html', ['js', 'css']); // => false
7911 */
7912function hasMatchingExtname(pathname, exts) {
7913 var suffix = path.extname(pathname).slice(1);
7914 return exts.some(function(element) {
7915 return suffix === element;
7916 });
7917}
7918
7919/**
7920 * Determines if pathname would be a "hidden" file (or directory) on UN*X.
7921 *
7922 * @description
7923 * On UN*X, pathnames beginning with a full stop (aka dot) are hidden during
7924 * typical usage. Dotfiles, plain-text configuration files, are prime examples.
7925 *
7926 * @see {@link http://xahlee.info/UnixResource_dir/writ/unix_origin_of_dot_filename.html|Origin of Dot File Names}
7927 *
7928 * @private
7929 * @param {string} pathname - Pathname to check for match.
7930 * @return {boolean} whether pathname would be considered a hidden file.
7931 * @example
7932 * isHiddenOnUnix('.profile'); // => true
7933 */
7934function isHiddenOnUnix(pathname) {
7935 return path.basename(pathname)[0] === '.';
7936}
7937
7938/**
7939 * Lookup file names at the given `path`.
7940 *
7941 * @description
7942 * Filenames are returned in _traversal_ order by the OS/filesystem.
7943 * **Make no assumption that the names will be sorted in any fashion.**
7944 *
7945 * @public
7946 * @memberof Mocha.utils
7947 * @param {string} filepath - Base path to start searching from.
7948 * @param {string[]} [extensions=[]] - File extensions to look for.
7949 * @param {boolean} [recursive=false] - Whether to recurse into subdirectories.
7950 * @return {string[]} An array of paths.
7951 * @throws {Error} if no files match pattern.
7952 * @throws {TypeError} if `filepath` is directory and `extensions` not provided.
7953 */
7954exports.lookupFiles = function lookupFiles(filepath, extensions, recursive) {
7955 extensions = extensions || [];
7956 recursive = recursive || false;
7957 var files = [];
7958 var stat;
7959
7960 if (!fs.existsSync(filepath)) {
7961 var pattern;
7962 if (glob.hasMagic(filepath)) {
7963 // Handle glob as is without extensions
7964 pattern = filepath;
7965 } else {
7966 // glob pattern e.g. 'filepath+(.js|.ts)'
7967 var strExtensions = extensions
7968 .map(function(v) {
7969 return '.' + v;
7970 })
7971 .join('|');
7972 pattern = filepath + '+(' + strExtensions + ')';
7973 }
7974 files = glob.sync(pattern, {nodir: true});
7975 if (!files.length) {
7976 throw createNoFilesMatchPatternError(
7977 'Cannot find any files matching pattern ' + exports.dQuote(filepath),
7978 filepath
7979 );
7980 }
7981 return files;
7982 }
7983
7984 // Handle file
7985 try {
7986 stat = fs.statSync(filepath);
7987 if (stat.isFile()) {
7988 return filepath;
7989 }
7990 } catch (err) {
7991 // ignore error
7992 return;
7993 }
7994
7995 // Handle directory
7996 fs.readdirSync(filepath).forEach(function(dirent) {
7997 var pathname = path.join(filepath, dirent);
7998 var stat;
7999
8000 try {
8001 stat = fs.statSync(pathname);
8002 if (stat.isDirectory()) {
8003 if (recursive) {
8004 files = files.concat(lookupFiles(pathname, extensions, recursive));
8005 }
8006 return;
8007 }
8008 } catch (err) {
8009 // ignore error
8010 return;
8011 }
8012 if (!extensions.length) {
8013 throw createMissingArgumentError(
8014 util.format(
8015 'Argument %s required when argument %s is a directory',
8016 exports.sQuote('extensions'),
8017 exports.sQuote('filepath')
8018 ),
8019 'extensions',
8020 'array'
8021 );
8022 }
8023
8024 if (
8025 !stat.isFile() ||
8026 !hasMatchingExtname(pathname, extensions) ||
8027 isHiddenOnUnix(pathname)
8028 ) {
8029 return;
8030 }
8031 files.push(pathname);
8032 });
8033
8034 return files;
8035};
8036
8037/**
8038 * process.emitWarning or a polyfill
8039 * @see https://nodejs.org/api/process.html#process_process_emitwarning_warning_options
8040 * @ignore
8041 */
8042function emitWarning(msg, type) {
8043 if (process.emitWarning) {
8044 process.emitWarning(msg, type);
8045 } else {
8046 process.nextTick(function() {
8047 console.warn(type + ': ' + msg);
8048 });
8049 }
8050}
8051
8052/**
8053 * Show a deprecation warning. Each distinct message is only displayed once.
8054 * Ignores empty messages.
8055 *
8056 * @param {string} [msg] - Warning to print
8057 * @private
8058 */
8059exports.deprecate = function deprecate(msg) {
8060 msg = String(msg);
8061 if (msg && !deprecate.cache[msg]) {
8062 deprecate.cache[msg] = true;
8063 emitWarning(msg, 'DeprecationWarning');
8064 }
8065};
8066exports.deprecate.cache = {};
8067
8068/**
8069 * Show a generic warning.
8070 * Ignores empty messages.
8071 *
8072 * @param {string} [msg] - Warning to print
8073 * @private
8074 */
8075exports.warn = function warn(msg) {
8076 if (msg) {
8077 emitWarning(msg);
8078 }
8079};
8080
8081/**
8082 * @summary
8083 * This Filter based on `mocha-clean` module.(see: `github.com/rstacruz/mocha-clean`)
8084 * @description
8085 * When invoking this function you get a filter function that get the Error.stack as an input,
8086 * and return a prettify output.
8087 * (i.e: strip Mocha and internal node functions from stack trace).
8088 * @returns {Function}
8089 */
8090exports.stackTraceFilter = function() {
8091 // TODO: Replace with `process.browser`
8092 var is = typeof document === 'undefined' ? {node: true} : {browser: true};
8093 var slash = path.sep;
8094 var cwd;
8095 if (is.node) {
8096 cwd = process.cwd() + slash;
8097 } else {
8098 cwd = (typeof location === 'undefined'
8099 ? window.location
8100 : location
8101 ).href.replace(/\/[^/]*$/, '/');
8102 slash = '/';
8103 }
8104
8105 function isMochaInternal(line) {
8106 return (
8107 ~line.indexOf('node_modules' + slash + 'mocha' + slash) ||
8108 ~line.indexOf(slash + 'mocha.js') ||
8109 ~line.indexOf(slash + 'mocha.min.js')
8110 );
8111 }
8112
8113 function isNodeInternal(line) {
8114 return (
8115 ~line.indexOf('(timers.js:') ||
8116 ~line.indexOf('(events.js:') ||
8117 ~line.indexOf('(node.js:') ||
8118 ~line.indexOf('(module.js:') ||
8119 ~line.indexOf('GeneratorFunctionPrototype.next (native)') ||
8120 false
8121 );
8122 }
8123
8124 return function(stack) {
8125 stack = stack.split('\n');
8126
8127 stack = stack.reduce(function(list, line) {
8128 if (isMochaInternal(line)) {
8129 return list;
8130 }
8131
8132 if (is.node && isNodeInternal(line)) {
8133 return list;
8134 }
8135
8136 // Clean up cwd(absolute)
8137 if (/:\d+:\d+\)?$/.test(line)) {
8138 line = line.replace('(' + cwd, '(');
8139 }
8140
8141 list.push(line);
8142 return list;
8143 }, []);
8144
8145 return stack.join('\n');
8146 };
8147};
8148
8149/**
8150 * Crude, but effective.
8151 * @public
8152 * @param {*} value
8153 * @returns {boolean} Whether or not `value` is a Promise
8154 */
8155exports.isPromise = function isPromise(value) {
8156 return (
8157 typeof value === 'object' &&
8158 value !== null &&
8159 typeof value.then === 'function'
8160 );
8161};
8162
8163/**
8164 * Clamps a numeric value to an inclusive range.
8165 *
8166 * @param {number} value - Value to be clamped.
8167 * @param {numer[]} range - Two element array specifying [min, max] range.
8168 * @returns {number} clamped value
8169 */
8170exports.clamp = function clamp(value, range) {
8171 return Math.min(Math.max(value, range[0]), range[1]);
8172};
8173
8174/**
8175 * Single quote text by combining with undirectional ASCII quotation marks.
8176 *
8177 * @description
8178 * Provides a simple means of markup for quoting text to be used in output.
8179 * Use this to quote names of variables, methods, and packages.
8180 *
8181 * <samp>package 'foo' cannot be found</samp>
8182 *
8183 * @private
8184 * @param {string} str - Value to be quoted.
8185 * @returns {string} quoted value
8186 * @example
8187 * sQuote('n') // => 'n'
8188 */
8189exports.sQuote = function(str) {
8190 return "'" + str + "'";
8191};
8192
8193/**
8194 * Double quote text by combining with undirectional ASCII quotation marks.
8195 *
8196 * @description
8197 * Provides a simple means of markup for quoting text to be used in output.
8198 * Use this to quote names of datatypes, classes, pathnames, and strings.
8199 *
8200 * <samp>argument 'value' must be "string" or "number"</samp>
8201 *
8202 * @private
8203 * @param {string} str - Value to be quoted.
8204 * @returns {string} quoted value
8205 * @example
8206 * dQuote('number') // => "number"
8207 */
8208exports.dQuote = function(str) {
8209 return '"' + str + '"';
8210};
8211
8212/**
8213 * Provides simplistic message translation for dealing with plurality.
8214 *
8215 * @description
8216 * Use this to create messages which need to be singular or plural.
8217 * Some languages have several plural forms, so _complete_ message clauses
8218 * are preferable to generating the message on the fly.
8219 *
8220 * @private
8221 * @param {number} n - Non-negative integer
8222 * @param {string} msg1 - Message to be used in English for `n = 1`
8223 * @param {string} msg2 - Message to be used in English for `n = 0, 2, 3, ...`
8224 * @returns {string} message corresponding to value of `n`
8225 * @example
8226 * var sprintf = require('util').format;
8227 * var pkgs = ['one', 'two'];
8228 * var msg = sprintf(
8229 * ngettext(
8230 * pkgs.length,
8231 * 'cannot load package: %s',
8232 * 'cannot load packages: %s'
8233 * ),
8234 * pkgs.map(sQuote).join(', ')
8235 * );
8236 * console.log(msg); // => cannot load packages: 'one', 'two'
8237 */
8238exports.ngettext = function(n, msg1, msg2) {
8239 if (typeof n === 'number' && n >= 0) {
8240 return n === 1 ? msg1 : msg2;
8241 }
8242};
8243
8244/**
8245 * It's a noop.
8246 * @public
8247 */
8248exports.noop = function() {};
8249
8250/**
8251 * Creates a map-like object.
8252 *
8253 * @description
8254 * A "map" is an object with no prototype, for our purposes. In some cases
8255 * this would be more appropriate than a `Map`, especially if your environment
8256 * doesn't support it. Recommended for use in Mocha's public APIs.
8257 *
8258 * @public
8259 * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map|MDN:Map}
8260 * @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}
8261 * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign|MDN:Object.assign}
8262 * @param {...*} [obj] - Arguments to `Object.assign()`.
8263 * @returns {Object} An object with no prototype, having `...obj` properties
8264 */
8265exports.createMap = function(obj) {
8266 return assign.apply(
8267 null,
8268 [Object.create(null)].concat(Array.prototype.slice.call(arguments))
8269 );
8270};
8271
8272/**
8273 * Creates a read-only map-like object.
8274 *
8275 * @description
8276 * This differs from {@link module:utils.createMap createMap} only in that
8277 * the argument must be non-empty, because the result is frozen.
8278 *
8279 * @see {@link module:utils.createMap createMap}
8280 * @param {...*} [obj] - Arguments to `Object.assign()`.
8281 * @returns {Object} A frozen object with no prototype, having `...obj` properties
8282 * @throws {TypeError} if argument is not a non-empty object.
8283 */
8284exports.defineConstants = function(obj) {
8285 if (type(obj) !== 'object' || !Object.keys(obj).length) {
8286 throw new TypeError('Invalid argument; expected a non-empty object');
8287 }
8288 return Object.freeze(exports.createMap(obj));
8289};
8290
8291/**
8292 * Whether current version of Node support ES modules
8293 *
8294 * @description
8295 * Versions prior to 10 did not support ES Modules, and version 10 has an old incompatibile version of ESM.
8296 * This function returns whether Node.JS has ES Module supports that is compatible with Mocha's needs,
8297 * which is version 12 and older
8298 *
8299 * @param {Boolean} unflagged whether the support is unflagged (`true`) or only using the `--experimental-modules` flag (`false`)
8300 * @returns {Boolean} whether the current version of Node.JS supports ES Modules in a way that is compatbile with Mocha
8301 */
8302exports.supportsEsModules = function(unflagged) {
8303 if (typeof document !== 'undefined') {
8304 return false;
8305 }
8306 if (
8307 typeof process !== 'object' ||
8308 !process.versions ||
8309 !process.versions.node
8310 ) {
8311 return false;
8312 }
8313 var versionFields = process.versions.node.split('.');
8314 var major = +versionFields[0];
8315 var minor = +versionFields[1];
8316
8317 if (major >= 13) {
8318 if (unflagged) {
8319 return minor >= 2;
8320 }
8321 return true;
8322 }
8323 if (unflagged) {
8324 return false;
8325 }
8326 if (major < 12) {
8327 return false;
8328 }
8329 // major === 12
8330
8331 return minor >= 11;
8332};
8333
8334}).call(this,require('_process'),require("buffer").Buffer)
8335},{"./errors":6,"_process":69,"buffer":43,"fs":42,"glob":42,"he":54,"object.assign":65,"path":42,"util":89}],39:[function(require,module,exports){
8336'use strict'
8337
8338exports.byteLength = byteLength
8339exports.toByteArray = toByteArray
8340exports.fromByteArray = fromByteArray
8341
8342var lookup = []
8343var revLookup = []
8344var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
8345
8346var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
8347for (var i = 0, len = code.length; i < len; ++i) {
8348 lookup[i] = code[i]
8349 revLookup[code.charCodeAt(i)] = i
8350}
8351
8352// Support decoding URL-safe base64 strings, as Node.js does.
8353// See: https://en.wikipedia.org/wiki/Base64#URL_applications
8354revLookup['-'.charCodeAt(0)] = 62
8355revLookup['_'.charCodeAt(0)] = 63
8356
8357function getLens (b64) {
8358 var len = b64.length
8359
8360 if (len % 4 > 0) {
8361 throw new Error('Invalid string. Length must be a multiple of 4')
8362 }
8363
8364 // Trim off extra bytes after placeholder bytes are found
8365 // See: https://github.com/beatgammit/base64-js/issues/42
8366 var validLen = b64.indexOf('=')
8367 if (validLen === -1) validLen = len
8368
8369 var placeHoldersLen = validLen === len
8370 ? 0
8371 : 4 - (validLen % 4)
8372
8373 return [validLen, placeHoldersLen]
8374}
8375
8376// base64 is 4/3 + up to two characters of the original data
8377function byteLength (b64) {
8378 var lens = getLens(b64)
8379 var validLen = lens[0]
8380 var placeHoldersLen = lens[1]
8381 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
8382}
8383
8384function _byteLength (b64, validLen, placeHoldersLen) {
8385 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
8386}
8387
8388function toByteArray (b64) {
8389 var tmp
8390 var lens = getLens(b64)
8391 var validLen = lens[0]
8392 var placeHoldersLen = lens[1]
8393
8394 var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
8395
8396 var curByte = 0
8397
8398 // if there are placeholders, only get up to the last complete 4 chars
8399 var len = placeHoldersLen > 0
8400 ? validLen - 4
8401 : validLen
8402
8403 for (var i = 0; i < len; i += 4) {
8404 tmp =
8405 (revLookup[b64.charCodeAt(i)] << 18) |
8406 (revLookup[b64.charCodeAt(i + 1)] << 12) |
8407 (revLookup[b64.charCodeAt(i + 2)] << 6) |
8408 revLookup[b64.charCodeAt(i + 3)]
8409 arr[curByte++] = (tmp >> 16) & 0xFF
8410 arr[curByte++] = (tmp >> 8) & 0xFF
8411 arr[curByte++] = tmp & 0xFF
8412 }
8413
8414 if (placeHoldersLen === 2) {
8415 tmp =
8416 (revLookup[b64.charCodeAt(i)] << 2) |
8417 (revLookup[b64.charCodeAt(i + 1)] >> 4)
8418 arr[curByte++] = tmp & 0xFF
8419 }
8420
8421 if (placeHoldersLen === 1) {
8422 tmp =
8423 (revLookup[b64.charCodeAt(i)] << 10) |
8424 (revLookup[b64.charCodeAt(i + 1)] << 4) |
8425 (revLookup[b64.charCodeAt(i + 2)] >> 2)
8426 arr[curByte++] = (tmp >> 8) & 0xFF
8427 arr[curByte++] = tmp & 0xFF
8428 }
8429
8430 return arr
8431}
8432
8433function tripletToBase64 (num) {
8434 return lookup[num >> 18 & 0x3F] +
8435 lookup[num >> 12 & 0x3F] +
8436 lookup[num >> 6 & 0x3F] +
8437 lookup[num & 0x3F]
8438}
8439
8440function encodeChunk (uint8, start, end) {
8441 var tmp
8442 var output = []
8443 for (var i = start; i < end; i += 3) {
8444 tmp =
8445 ((uint8[i] << 16) & 0xFF0000) +
8446 ((uint8[i + 1] << 8) & 0xFF00) +
8447 (uint8[i + 2] & 0xFF)
8448 output.push(tripletToBase64(tmp))
8449 }
8450 return output.join('')
8451}
8452
8453function fromByteArray (uint8) {
8454 var tmp
8455 var len = uint8.length
8456 var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
8457 var parts = []
8458 var maxChunkLength = 16383 // must be multiple of 3
8459
8460 // go through the array every three bytes, we'll deal with trailing stuff later
8461 for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
8462 parts.push(encodeChunk(
8463 uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
8464 ))
8465 }
8466
8467 // pad the end with zeros, but make sure to not forget the extra bytes
8468 if (extraBytes === 1) {
8469 tmp = uint8[len - 1]
8470 parts.push(
8471 lookup[tmp >> 2] +
8472 lookup[(tmp << 4) & 0x3F] +
8473 '=='
8474 )
8475 } else if (extraBytes === 2) {
8476 tmp = (uint8[len - 2] << 8) + uint8[len - 1]
8477 parts.push(
8478 lookup[tmp >> 10] +
8479 lookup[(tmp >> 4) & 0x3F] +
8480 lookup[(tmp << 2) & 0x3F] +
8481 '='
8482 )
8483 }
8484
8485 return parts.join('')
8486}
8487
8488},{}],40:[function(require,module,exports){
8489
8490},{}],41:[function(require,module,exports){
8491(function (process){
8492var WritableStream = require('stream').Writable
8493var inherits = require('util').inherits
8494
8495module.exports = BrowserStdout
8496
8497
8498inherits(BrowserStdout, WritableStream)
8499
8500function BrowserStdout(opts) {
8501 if (!(this instanceof BrowserStdout)) return new BrowserStdout(opts)
8502
8503 opts = opts || {}
8504 WritableStream.call(this, opts)
8505 this.label = (opts.label !== undefined) ? opts.label : 'stdout'
8506}
8507
8508BrowserStdout.prototype._write = function(chunks, encoding, cb) {
8509 var output = chunks.toString ? chunks.toString() : chunks
8510 if (this.label === false) {
8511 console.log(output)
8512 } else {
8513 console.log(this.label+':', output)
8514 }
8515 process.nextTick(cb)
8516}
8517
8518}).call(this,require('_process'))
8519},{"_process":69,"stream":84,"util":89}],42:[function(require,module,exports){
8520arguments[4][40][0].apply(exports,arguments)
8521},{"dup":40}],43:[function(require,module,exports){
8522(function (Buffer){
8523/*!
8524 * The buffer module from node.js, for the browser.
8525 *
8526 * @author Feross Aboukhadijeh <https://feross.org>
8527 * @license MIT
8528 */
8529/* eslint-disable no-proto */
8530
8531'use strict'
8532
8533var base64 = require('base64-js')
8534var ieee754 = require('ieee754')
8535
8536exports.Buffer = Buffer
8537exports.SlowBuffer = SlowBuffer
8538exports.INSPECT_MAX_BYTES = 50
8539
8540var K_MAX_LENGTH = 0x7fffffff
8541exports.kMaxLength = K_MAX_LENGTH
8542
8543/**
8544 * If `Buffer.TYPED_ARRAY_SUPPORT`:
8545 * === true Use Uint8Array implementation (fastest)
8546 * === false Print warning and recommend using `buffer` v4.x which has an Object
8547 * implementation (most compatible, even IE6)
8548 *
8549 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
8550 * Opera 11.6+, iOS 4.2+.
8551 *
8552 * We report that the browser does not support typed arrays if the are not subclassable
8553 * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
8554 * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
8555 * for __proto__ and has a buggy typed array implementation.
8556 */
8557Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
8558
8559if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
8560 typeof console.error === 'function') {
8561 console.error(
8562 'This browser lacks typed array (Uint8Array) support which is required by ' +
8563 '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
8564 )
8565}
8566
8567function typedArraySupport () {
8568 // Can typed array instances can be augmented?
8569 try {
8570 var arr = new Uint8Array(1)
8571 arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } }
8572 return arr.foo() === 42
8573 } catch (e) {
8574 return false
8575 }
8576}
8577
8578Object.defineProperty(Buffer.prototype, 'parent', {
8579 enumerable: true,
8580 get: function () {
8581 if (!Buffer.isBuffer(this)) return undefined
8582 return this.buffer
8583 }
8584})
8585
8586Object.defineProperty(Buffer.prototype, 'offset', {
8587 enumerable: true,
8588 get: function () {
8589 if (!Buffer.isBuffer(this)) return undefined
8590 return this.byteOffset
8591 }
8592})
8593
8594function createBuffer (length) {
8595 if (length > K_MAX_LENGTH) {
8596 throw new RangeError('The value "' + length + '" is invalid for option "size"')
8597 }
8598 // Return an augmented `Uint8Array` instance
8599 var buf = new Uint8Array(length)
8600 buf.__proto__ = Buffer.prototype
8601 return buf
8602}
8603
8604/**
8605 * The Buffer constructor returns instances of `Uint8Array` that have their
8606 * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
8607 * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
8608 * and the `Uint8Array` methods. Square bracket notation works as expected -- it
8609 * returns a single octet.
8610 *
8611 * The `Uint8Array` prototype remains unmodified.
8612 */
8613
8614function Buffer (arg, encodingOrOffset, length) {
8615 // Common case.
8616 if (typeof arg === 'number') {
8617 if (typeof encodingOrOffset === 'string') {
8618 throw new TypeError(
8619 'The "string" argument must be of type string. Received type number'
8620 )
8621 }
8622 return allocUnsafe(arg)
8623 }
8624 return from(arg, encodingOrOffset, length)
8625}
8626
8627// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
8628if (typeof Symbol !== 'undefined' && Symbol.species != null &&
8629 Buffer[Symbol.species] === Buffer) {
8630 Object.defineProperty(Buffer, Symbol.species, {
8631 value: null,
8632 configurable: true,
8633 enumerable: false,
8634 writable: false
8635 })
8636}
8637
8638Buffer.poolSize = 8192 // not used by this implementation
8639
8640function from (value, encodingOrOffset, length) {
8641 if (typeof value === 'string') {
8642 return fromString(value, encodingOrOffset)
8643 }
8644
8645 if (ArrayBuffer.isView(value)) {
8646 return fromArrayLike(value)
8647 }
8648
8649 if (value == null) {
8650 throw TypeError(
8651 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
8652 'or Array-like Object. Received type ' + (typeof value)
8653 )
8654 }
8655
8656 if (isInstance(value, ArrayBuffer) ||
8657 (value && isInstance(value.buffer, ArrayBuffer))) {
8658 return fromArrayBuffer(value, encodingOrOffset, length)
8659 }
8660
8661 if (typeof value === 'number') {
8662 throw new TypeError(
8663 'The "value" argument must not be of type number. Received type number'
8664 )
8665 }
8666
8667 var valueOf = value.valueOf && value.valueOf()
8668 if (valueOf != null && valueOf !== value) {
8669 return Buffer.from(valueOf, encodingOrOffset, length)
8670 }
8671
8672 var b = fromObject(value)
8673 if (b) return b
8674
8675 if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
8676 typeof value[Symbol.toPrimitive] === 'function') {
8677 return Buffer.from(
8678 value[Symbol.toPrimitive]('string'), encodingOrOffset, length
8679 )
8680 }
8681
8682 throw new TypeError(
8683 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
8684 'or Array-like Object. Received type ' + (typeof value)
8685 )
8686}
8687
8688/**
8689 * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
8690 * if value is a number.
8691 * Buffer.from(str[, encoding])
8692 * Buffer.from(array)
8693 * Buffer.from(buffer)
8694 * Buffer.from(arrayBuffer[, byteOffset[, length]])
8695 **/
8696Buffer.from = function (value, encodingOrOffset, length) {
8697 return from(value, encodingOrOffset, length)
8698}
8699
8700// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
8701// https://github.com/feross/buffer/pull/148
8702Buffer.prototype.__proto__ = Uint8Array.prototype
8703Buffer.__proto__ = Uint8Array
8704
8705function assertSize (size) {
8706 if (typeof size !== 'number') {
8707 throw new TypeError('"size" argument must be of type number')
8708 } else if (size < 0) {
8709 throw new RangeError('The value "' + size + '" is invalid for option "size"')
8710 }
8711}
8712
8713function alloc (size, fill, encoding) {
8714 assertSize(size)
8715 if (size <= 0) {
8716 return createBuffer(size)
8717 }
8718 if (fill !== undefined) {
8719 // Only pay attention to encoding if it's a string. This
8720 // prevents accidentally sending in a number that would
8721 // be interpretted as a start offset.
8722 return typeof encoding === 'string'
8723 ? createBuffer(size).fill(fill, encoding)
8724 : createBuffer(size).fill(fill)
8725 }
8726 return createBuffer(size)
8727}
8728
8729/**
8730 * Creates a new filled Buffer instance.
8731 * alloc(size[, fill[, encoding]])
8732 **/
8733Buffer.alloc = function (size, fill, encoding) {
8734 return alloc(size, fill, encoding)
8735}
8736
8737function allocUnsafe (size) {
8738 assertSize(size)
8739 return createBuffer(size < 0 ? 0 : checked(size) | 0)
8740}
8741
8742/**
8743 * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
8744 * */
8745Buffer.allocUnsafe = function (size) {
8746 return allocUnsafe(size)
8747}
8748/**
8749 * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
8750 */
8751Buffer.allocUnsafeSlow = function (size) {
8752 return allocUnsafe(size)
8753}
8754
8755function fromString (string, encoding) {
8756 if (typeof encoding !== 'string' || encoding === '') {
8757 encoding = 'utf8'
8758 }
8759
8760 if (!Buffer.isEncoding(encoding)) {
8761 throw new TypeError('Unknown encoding: ' + encoding)
8762 }
8763
8764 var length = byteLength(string, encoding) | 0
8765 var buf = createBuffer(length)
8766
8767 var actual = buf.write(string, encoding)
8768
8769 if (actual !== length) {
8770 // Writing a hex string, for example, that contains invalid characters will
8771 // cause everything after the first invalid character to be ignored. (e.g.
8772 // 'abxxcd' will be treated as 'ab')
8773 buf = buf.slice(0, actual)
8774 }
8775
8776 return buf
8777}
8778
8779function fromArrayLike (array) {
8780 var length = array.length < 0 ? 0 : checked(array.length) | 0
8781 var buf = createBuffer(length)
8782 for (var i = 0; i < length; i += 1) {
8783 buf[i] = array[i] & 255
8784 }
8785 return buf
8786}
8787
8788function fromArrayBuffer (array, byteOffset, length) {
8789 if (byteOffset < 0 || array.byteLength < byteOffset) {
8790 throw new RangeError('"offset" is outside of buffer bounds')
8791 }
8792
8793 if (array.byteLength < byteOffset + (length || 0)) {
8794 throw new RangeError('"length" is outside of buffer bounds')
8795 }
8796
8797 var buf
8798 if (byteOffset === undefined && length === undefined) {
8799 buf = new Uint8Array(array)
8800 } else if (length === undefined) {
8801 buf = new Uint8Array(array, byteOffset)
8802 } else {
8803 buf = new Uint8Array(array, byteOffset, length)
8804 }
8805
8806 // Return an augmented `Uint8Array` instance
8807 buf.__proto__ = Buffer.prototype
8808 return buf
8809}
8810
8811function fromObject (obj) {
8812 if (Buffer.isBuffer(obj)) {
8813 var len = checked(obj.length) | 0
8814 var buf = createBuffer(len)
8815
8816 if (buf.length === 0) {
8817 return buf
8818 }
8819
8820 obj.copy(buf, 0, 0, len)
8821 return buf
8822 }
8823
8824 if (obj.length !== undefined) {
8825 if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
8826 return createBuffer(0)
8827 }
8828 return fromArrayLike(obj)
8829 }
8830
8831 if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
8832 return fromArrayLike(obj.data)
8833 }
8834}
8835
8836function checked (length) {
8837 // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
8838 // length is NaN (which is otherwise coerced to zero.)
8839 if (length >= K_MAX_LENGTH) {
8840 throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
8841 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
8842 }
8843 return length | 0
8844}
8845
8846function SlowBuffer (length) {
8847 if (+length != length) { // eslint-disable-line eqeqeq
8848 length = 0
8849 }
8850 return Buffer.alloc(+length)
8851}
8852
8853Buffer.isBuffer = function isBuffer (b) {
8854 return b != null && b._isBuffer === true &&
8855 b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
8856}
8857
8858Buffer.compare = function compare (a, b) {
8859 if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)
8860 if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)
8861 if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
8862 throw new TypeError(
8863 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
8864 )
8865 }
8866
8867 if (a === b) return 0
8868
8869 var x = a.length
8870 var y = b.length
8871
8872 for (var i = 0, len = Math.min(x, y); i < len; ++i) {
8873 if (a[i] !== b[i]) {
8874 x = a[i]
8875 y = b[i]
8876 break
8877 }
8878 }
8879
8880 if (x < y) return -1
8881 if (y < x) return 1
8882 return 0
8883}
8884
8885Buffer.isEncoding = function isEncoding (encoding) {
8886 switch (String(encoding).toLowerCase()) {
8887 case 'hex':
8888 case 'utf8':
8889 case 'utf-8':
8890 case 'ascii':
8891 case 'latin1':
8892 case 'binary':
8893 case 'base64':
8894 case 'ucs2':
8895 case 'ucs-2':
8896 case 'utf16le':
8897 case 'utf-16le':
8898 return true
8899 default:
8900 return false
8901 }
8902}
8903
8904Buffer.concat = function concat (list, length) {
8905 if (!Array.isArray(list)) {
8906 throw new TypeError('"list" argument must be an Array of Buffers')
8907 }
8908
8909 if (list.length === 0) {
8910 return Buffer.alloc(0)
8911 }
8912
8913 var i
8914 if (length === undefined) {
8915 length = 0
8916 for (i = 0; i < list.length; ++i) {
8917 length += list[i].length
8918 }
8919 }
8920
8921 var buffer = Buffer.allocUnsafe(length)
8922 var pos = 0
8923 for (i = 0; i < list.length; ++i) {
8924 var buf = list[i]
8925 if (isInstance(buf, Uint8Array)) {
8926 buf = Buffer.from(buf)
8927 }
8928 if (!Buffer.isBuffer(buf)) {
8929 throw new TypeError('"list" argument must be an Array of Buffers')
8930 }
8931 buf.copy(buffer, pos)
8932 pos += buf.length
8933 }
8934 return buffer
8935}
8936
8937function byteLength (string, encoding) {
8938 if (Buffer.isBuffer(string)) {
8939 return string.length
8940 }
8941 if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
8942 return string.byteLength
8943 }
8944 if (typeof string !== 'string') {
8945 throw new TypeError(
8946 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
8947 'Received type ' + typeof string
8948 )
8949 }
8950
8951 var len = string.length
8952 var mustMatch = (arguments.length > 2 && arguments[2] === true)
8953 if (!mustMatch && len === 0) return 0
8954
8955 // Use a for loop to avoid recursion
8956 var loweredCase = false
8957 for (;;) {
8958 switch (encoding) {
8959 case 'ascii':
8960 case 'latin1':
8961 case 'binary':
8962 return len
8963 case 'utf8':
8964 case 'utf-8':
8965 return utf8ToBytes(string).length
8966 case 'ucs2':
8967 case 'ucs-2':
8968 case 'utf16le':
8969 case 'utf-16le':
8970 return len * 2
8971 case 'hex':
8972 return len >>> 1
8973 case 'base64':
8974 return base64ToBytes(string).length
8975 default:
8976 if (loweredCase) {
8977 return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
8978 }
8979 encoding = ('' + encoding).toLowerCase()
8980 loweredCase = true
8981 }
8982 }
8983}
8984Buffer.byteLength = byteLength
8985
8986function slowToString (encoding, start, end) {
8987 var loweredCase = false
8988
8989 // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
8990 // property of a typed array.
8991
8992 // This behaves neither like String nor Uint8Array in that we set start/end
8993 // to their upper/lower bounds if the value passed is out of range.
8994 // undefined is handled specially as per ECMA-262 6th Edition,
8995 // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
8996 if (start === undefined || start < 0) {
8997 start = 0
8998 }
8999 // Return early if start > this.length. Done here to prevent potential uint32
9000 // coercion fail below.
9001 if (start > this.length) {
9002 return ''
9003 }
9004
9005 if (end === undefined || end > this.length) {
9006 end = this.length
9007 }
9008
9009 if (end <= 0) {
9010 return ''
9011 }
9012
9013 // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
9014 end >>>= 0
9015 start >>>= 0
9016
9017 if (end <= start) {
9018 return ''
9019 }
9020
9021 if (!encoding) encoding = 'utf8'
9022
9023 while (true) {
9024 switch (encoding) {
9025 case 'hex':
9026 return hexSlice(this, start, end)
9027
9028 case 'utf8':
9029 case 'utf-8':
9030 return utf8Slice(this, start, end)
9031
9032 case 'ascii':
9033 return asciiSlice(this, start, end)
9034
9035 case 'latin1':
9036 case 'binary':
9037 return latin1Slice(this, start, end)
9038
9039 case 'base64':
9040 return base64Slice(this, start, end)
9041
9042 case 'ucs2':
9043 case 'ucs-2':
9044 case 'utf16le':
9045 case 'utf-16le':
9046 return utf16leSlice(this, start, end)
9047
9048 default:
9049 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
9050 encoding = (encoding + '').toLowerCase()
9051 loweredCase = true
9052 }
9053 }
9054}
9055
9056// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
9057// to detect a Buffer instance. It's not possible to use `instanceof Buffer`
9058// reliably in a browserify context because there could be multiple different
9059// copies of the 'buffer' package in use. This method works even for Buffer
9060// instances that were created from another copy of the `buffer` package.
9061// See: https://github.com/feross/buffer/issues/154
9062Buffer.prototype._isBuffer = true
9063
9064function swap (b, n, m) {
9065 var i = b[n]
9066 b[n] = b[m]
9067 b[m] = i
9068}
9069
9070Buffer.prototype.swap16 = function swap16 () {
9071 var len = this.length
9072 if (len % 2 !== 0) {
9073 throw new RangeError('Buffer size must be a multiple of 16-bits')
9074 }
9075 for (var i = 0; i < len; i += 2) {
9076 swap(this, i, i + 1)
9077 }
9078 return this
9079}
9080
9081Buffer.prototype.swap32 = function swap32 () {
9082 var len = this.length
9083 if (len % 4 !== 0) {
9084 throw new RangeError('Buffer size must be a multiple of 32-bits')
9085 }
9086 for (var i = 0; i < len; i += 4) {
9087 swap(this, i, i + 3)
9088 swap(this, i + 1, i + 2)
9089 }
9090 return this
9091}
9092
9093Buffer.prototype.swap64 = function swap64 () {
9094 var len = this.length
9095 if (len % 8 !== 0) {
9096 throw new RangeError('Buffer size must be a multiple of 64-bits')
9097 }
9098 for (var i = 0; i < len; i += 8) {
9099 swap(this, i, i + 7)
9100 swap(this, i + 1, i + 6)
9101 swap(this, i + 2, i + 5)
9102 swap(this, i + 3, i + 4)
9103 }
9104 return this
9105}
9106
9107Buffer.prototype.toString = function toString () {
9108 var length = this.length
9109 if (length === 0) return ''
9110 if (arguments.length === 0) return utf8Slice(this, 0, length)
9111 return slowToString.apply(this, arguments)
9112}
9113
9114Buffer.prototype.toLocaleString = Buffer.prototype.toString
9115
9116Buffer.prototype.equals = function equals (b) {
9117 if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
9118 if (this === b) return true
9119 return Buffer.compare(this, b) === 0
9120}
9121
9122Buffer.prototype.inspect = function inspect () {
9123 var str = ''
9124 var max = exports.INSPECT_MAX_BYTES
9125 str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
9126 if (this.length > max) str += ' ... '
9127 return '<Buffer ' + str + '>'
9128}
9129
9130Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
9131 if (isInstance(target, Uint8Array)) {
9132 target = Buffer.from(target, target.offset, target.byteLength)
9133 }
9134 if (!Buffer.isBuffer(target)) {
9135 throw new TypeError(
9136 'The "target" argument must be one of type Buffer or Uint8Array. ' +
9137 'Received type ' + (typeof target)
9138 )
9139 }
9140
9141 if (start === undefined) {
9142 start = 0
9143 }
9144 if (end === undefined) {
9145 end = target ? target.length : 0
9146 }
9147 if (thisStart === undefined) {
9148 thisStart = 0
9149 }
9150 if (thisEnd === undefined) {
9151 thisEnd = this.length
9152 }
9153
9154 if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
9155 throw new RangeError('out of range index')
9156 }
9157
9158 if (thisStart >= thisEnd && start >= end) {
9159 return 0
9160 }
9161 if (thisStart >= thisEnd) {
9162 return -1
9163 }
9164 if (start >= end) {
9165 return 1
9166 }
9167
9168 start >>>= 0
9169 end >>>= 0
9170 thisStart >>>= 0
9171 thisEnd >>>= 0
9172
9173 if (this === target) return 0
9174
9175 var x = thisEnd - thisStart
9176 var y = end - start
9177 var len = Math.min(x, y)
9178
9179 var thisCopy = this.slice(thisStart, thisEnd)
9180 var targetCopy = target.slice(start, end)
9181
9182 for (var i = 0; i < len; ++i) {
9183 if (thisCopy[i] !== targetCopy[i]) {
9184 x = thisCopy[i]
9185 y = targetCopy[i]
9186 break
9187 }
9188 }
9189
9190 if (x < y) return -1
9191 if (y < x) return 1
9192 return 0
9193}
9194
9195// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
9196// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
9197//
9198// Arguments:
9199// - buffer - a Buffer to search
9200// - val - a string, Buffer, or number
9201// - byteOffset - an index into `buffer`; will be clamped to an int32
9202// - encoding - an optional encoding, relevant is val is a string
9203// - dir - true for indexOf, false for lastIndexOf
9204function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
9205 // Empty buffer means no match
9206 if (buffer.length === 0) return -1
9207
9208 // Normalize byteOffset
9209 if (typeof byteOffset === 'string') {
9210 encoding = byteOffset
9211 byteOffset = 0
9212 } else if (byteOffset > 0x7fffffff) {
9213 byteOffset = 0x7fffffff
9214 } else if (byteOffset < -0x80000000) {
9215 byteOffset = -0x80000000
9216 }
9217 byteOffset = +byteOffset // Coerce to Number.
9218 if (numberIsNaN(byteOffset)) {
9219 // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
9220 byteOffset = dir ? 0 : (buffer.length - 1)
9221 }
9222
9223 // Normalize byteOffset: negative offsets start from the end of the buffer
9224 if (byteOffset < 0) byteOffset = buffer.length + byteOffset
9225 if (byteOffset >= buffer.length) {
9226 if (dir) return -1
9227 else byteOffset = buffer.length - 1
9228 } else if (byteOffset < 0) {
9229 if (dir) byteOffset = 0
9230 else return -1
9231 }
9232
9233 // Normalize val
9234 if (typeof val === 'string') {
9235 val = Buffer.from(val, encoding)
9236 }
9237
9238 // Finally, search either indexOf (if dir is true) or lastIndexOf
9239 if (Buffer.isBuffer(val)) {
9240 // Special case: looking for empty string/buffer always fails
9241 if (val.length === 0) {
9242 return -1
9243 }
9244 return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
9245 } else if (typeof val === 'number') {
9246 val = val & 0xFF // Search for a byte value [0-255]
9247 if (typeof Uint8Array.prototype.indexOf === 'function') {
9248 if (dir) {
9249 return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
9250 } else {
9251 return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
9252 }
9253 }
9254 return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
9255 }
9256
9257 throw new TypeError('val must be string, number or Buffer')
9258}
9259
9260function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
9261 var indexSize = 1
9262 var arrLength = arr.length
9263 var valLength = val.length
9264
9265 if (encoding !== undefined) {
9266 encoding = String(encoding).toLowerCase()
9267 if (encoding === 'ucs2' || encoding === 'ucs-2' ||
9268 encoding === 'utf16le' || encoding === 'utf-16le') {
9269 if (arr.length < 2 || val.length < 2) {
9270 return -1
9271 }
9272 indexSize = 2
9273 arrLength /= 2
9274 valLength /= 2
9275 byteOffset /= 2
9276 }
9277 }
9278
9279 function read (buf, i) {
9280 if (indexSize === 1) {
9281 return buf[i]
9282 } else {
9283 return buf.readUInt16BE(i * indexSize)
9284 }
9285 }
9286
9287 var i
9288 if (dir) {
9289 var foundIndex = -1
9290 for (i = byteOffset; i < arrLength; i++) {
9291 if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
9292 if (foundIndex === -1) foundIndex = i
9293 if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
9294 } else {
9295 if (foundIndex !== -1) i -= i - foundIndex
9296 foundIndex = -1
9297 }
9298 }
9299 } else {
9300 if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
9301 for (i = byteOffset; i >= 0; i--) {
9302 var found = true
9303 for (var j = 0; j < valLength; j++) {
9304 if (read(arr, i + j) !== read(val, j)) {
9305 found = false
9306 break
9307 }
9308 }
9309 if (found) return i
9310 }
9311 }
9312
9313 return -1
9314}
9315
9316Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
9317 return this.indexOf(val, byteOffset, encoding) !== -1
9318}
9319
9320Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
9321 return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
9322}
9323
9324Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
9325 return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
9326}
9327
9328function hexWrite (buf, string, offset, length) {
9329 offset = Number(offset) || 0
9330 var remaining = buf.length - offset
9331 if (!length) {
9332 length = remaining
9333 } else {
9334 length = Number(length)
9335 if (length > remaining) {
9336 length = remaining
9337 }
9338 }
9339
9340 var strLen = string.length
9341
9342 if (length > strLen / 2) {
9343 length = strLen / 2
9344 }
9345 for (var i = 0; i < length; ++i) {
9346 var parsed = parseInt(string.substr(i * 2, 2), 16)
9347 if (numberIsNaN(parsed)) return i
9348 buf[offset + i] = parsed
9349 }
9350 return i
9351}
9352
9353function utf8Write (buf, string, offset, length) {
9354 return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
9355}
9356
9357function asciiWrite (buf, string, offset, length) {
9358 return blitBuffer(asciiToBytes(string), buf, offset, length)
9359}
9360
9361function latin1Write (buf, string, offset, length) {
9362 return asciiWrite(buf, string, offset, length)
9363}
9364
9365function base64Write (buf, string, offset, length) {
9366 return blitBuffer(base64ToBytes(string), buf, offset, length)
9367}
9368
9369function ucs2Write (buf, string, offset, length) {
9370 return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
9371}
9372
9373Buffer.prototype.write = function write (string, offset, length, encoding) {
9374 // Buffer#write(string)
9375 if (offset === undefined) {
9376 encoding = 'utf8'
9377 length = this.length
9378 offset = 0
9379 // Buffer#write(string, encoding)
9380 } else if (length === undefined && typeof offset === 'string') {
9381 encoding = offset
9382 length = this.length
9383 offset = 0
9384 // Buffer#write(string, offset[, length][, encoding])
9385 } else if (isFinite(offset)) {
9386 offset = offset >>> 0
9387 if (isFinite(length)) {
9388 length = length >>> 0
9389 if (encoding === undefined) encoding = 'utf8'
9390 } else {
9391 encoding = length
9392 length = undefined
9393 }
9394 } else {
9395 throw new Error(
9396 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
9397 )
9398 }
9399
9400 var remaining = this.length - offset
9401 if (length === undefined || length > remaining) length = remaining
9402
9403 if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
9404 throw new RangeError('Attempt to write outside buffer bounds')
9405 }
9406
9407 if (!encoding) encoding = 'utf8'
9408
9409 var loweredCase = false
9410 for (;;) {
9411 switch (encoding) {
9412 case 'hex':
9413 return hexWrite(this, string, offset, length)
9414
9415 case 'utf8':
9416 case 'utf-8':
9417 return utf8Write(this, string, offset, length)
9418
9419 case 'ascii':
9420 return asciiWrite(this, string, offset, length)
9421
9422 case 'latin1':
9423 case 'binary':
9424 return latin1Write(this, string, offset, length)
9425
9426 case 'base64':
9427 // Warning: maxLength not taken into account in base64Write
9428 return base64Write(this, string, offset, length)
9429
9430 case 'ucs2':
9431 case 'ucs-2':
9432 case 'utf16le':
9433 case 'utf-16le':
9434 return ucs2Write(this, string, offset, length)
9435
9436 default:
9437 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
9438 encoding = ('' + encoding).toLowerCase()
9439 loweredCase = true
9440 }
9441 }
9442}
9443
9444Buffer.prototype.toJSON = function toJSON () {
9445 return {
9446 type: 'Buffer',
9447 data: Array.prototype.slice.call(this._arr || this, 0)
9448 }
9449}
9450
9451function base64Slice (buf, start, end) {
9452 if (start === 0 && end === buf.length) {
9453 return base64.fromByteArray(buf)
9454 } else {
9455 return base64.fromByteArray(buf.slice(start, end))
9456 }
9457}
9458
9459function utf8Slice (buf, start, end) {
9460 end = Math.min(buf.length, end)
9461 var res = []
9462
9463 var i = start
9464 while (i < end) {
9465 var firstByte = buf[i]
9466 var codePoint = null
9467 var bytesPerSequence = (firstByte > 0xEF) ? 4
9468 : (firstByte > 0xDF) ? 3
9469 : (firstByte > 0xBF) ? 2
9470 : 1
9471
9472 if (i + bytesPerSequence <= end) {
9473 var secondByte, thirdByte, fourthByte, tempCodePoint
9474
9475 switch (bytesPerSequence) {
9476 case 1:
9477 if (firstByte < 0x80) {
9478 codePoint = firstByte
9479 }
9480 break
9481 case 2:
9482 secondByte = buf[i + 1]
9483 if ((secondByte & 0xC0) === 0x80) {
9484 tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
9485 if (tempCodePoint > 0x7F) {
9486 codePoint = tempCodePoint
9487 }
9488 }
9489 break
9490 case 3:
9491 secondByte = buf[i + 1]
9492 thirdByte = buf[i + 2]
9493 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
9494 tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
9495 if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
9496 codePoint = tempCodePoint
9497 }
9498 }
9499 break
9500 case 4:
9501 secondByte = buf[i + 1]
9502 thirdByte = buf[i + 2]
9503 fourthByte = buf[i + 3]
9504 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
9505 tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
9506 if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
9507 codePoint = tempCodePoint
9508 }
9509 }
9510 }
9511 }
9512
9513 if (codePoint === null) {
9514 // we did not generate a valid codePoint so insert a
9515 // replacement char (U+FFFD) and advance only 1 byte
9516 codePoint = 0xFFFD
9517 bytesPerSequence = 1
9518 } else if (codePoint > 0xFFFF) {
9519 // encode to utf16 (surrogate pair dance)
9520 codePoint -= 0x10000
9521 res.push(codePoint >>> 10 & 0x3FF | 0xD800)
9522 codePoint = 0xDC00 | codePoint & 0x3FF
9523 }
9524
9525 res.push(codePoint)
9526 i += bytesPerSequence
9527 }
9528
9529 return decodeCodePointsArray(res)
9530}
9531
9532// Based on http://stackoverflow.com/a/22747272/680742, the browser with
9533// the lowest limit is Chrome, with 0x10000 args.
9534// We go 1 magnitude less, for safety
9535var MAX_ARGUMENTS_LENGTH = 0x1000
9536
9537function decodeCodePointsArray (codePoints) {
9538 var len = codePoints.length
9539 if (len <= MAX_ARGUMENTS_LENGTH) {
9540 return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
9541 }
9542
9543 // Decode in chunks to avoid "call stack size exceeded".
9544 var res = ''
9545 var i = 0
9546 while (i < len) {
9547 res += String.fromCharCode.apply(
9548 String,
9549 codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
9550 )
9551 }
9552 return res
9553}
9554
9555function asciiSlice (buf, start, end) {
9556 var ret = ''
9557 end = Math.min(buf.length, end)
9558
9559 for (var i = start; i < end; ++i) {
9560 ret += String.fromCharCode(buf[i] & 0x7F)
9561 }
9562 return ret
9563}
9564
9565function latin1Slice (buf, start, end) {
9566 var ret = ''
9567 end = Math.min(buf.length, end)
9568
9569 for (var i = start; i < end; ++i) {
9570 ret += String.fromCharCode(buf[i])
9571 }
9572 return ret
9573}
9574
9575function hexSlice (buf, start, end) {
9576 var len = buf.length
9577
9578 if (!start || start < 0) start = 0
9579 if (!end || end < 0 || end > len) end = len
9580
9581 var out = ''
9582 for (var i = start; i < end; ++i) {
9583 out += toHex(buf[i])
9584 }
9585 return out
9586}
9587
9588function utf16leSlice (buf, start, end) {
9589 var bytes = buf.slice(start, end)
9590 var res = ''
9591 for (var i = 0; i < bytes.length; i += 2) {
9592 res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
9593 }
9594 return res
9595}
9596
9597Buffer.prototype.slice = function slice (start, end) {
9598 var len = this.length
9599 start = ~~start
9600 end = end === undefined ? len : ~~end
9601
9602 if (start < 0) {
9603 start += len
9604 if (start < 0) start = 0
9605 } else if (start > len) {
9606 start = len
9607 }
9608
9609 if (end < 0) {
9610 end += len
9611 if (end < 0) end = 0
9612 } else if (end > len) {
9613 end = len
9614 }
9615
9616 if (end < start) end = start
9617
9618 var newBuf = this.subarray(start, end)
9619 // Return an augmented `Uint8Array` instance
9620 newBuf.__proto__ = Buffer.prototype
9621 return newBuf
9622}
9623
9624/*
9625 * Need to make sure that buffer isn't trying to write out of bounds.
9626 */
9627function checkOffset (offset, ext, length) {
9628 if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
9629 if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
9630}
9631
9632Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
9633 offset = offset >>> 0
9634 byteLength = byteLength >>> 0
9635 if (!noAssert) checkOffset(offset, byteLength, this.length)
9636
9637 var val = this[offset]
9638 var mul = 1
9639 var i = 0
9640 while (++i < byteLength && (mul *= 0x100)) {
9641 val += this[offset + i] * mul
9642 }
9643
9644 return val
9645}
9646
9647Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
9648 offset = offset >>> 0
9649 byteLength = byteLength >>> 0
9650 if (!noAssert) {
9651 checkOffset(offset, byteLength, this.length)
9652 }
9653
9654 var val = this[offset + --byteLength]
9655 var mul = 1
9656 while (byteLength > 0 && (mul *= 0x100)) {
9657 val += this[offset + --byteLength] * mul
9658 }
9659
9660 return val
9661}
9662
9663Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
9664 offset = offset >>> 0
9665 if (!noAssert) checkOffset(offset, 1, this.length)
9666 return this[offset]
9667}
9668
9669Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
9670 offset = offset >>> 0
9671 if (!noAssert) checkOffset(offset, 2, this.length)
9672 return this[offset] | (this[offset + 1] << 8)
9673}
9674
9675Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
9676 offset = offset >>> 0
9677 if (!noAssert) checkOffset(offset, 2, this.length)
9678 return (this[offset] << 8) | this[offset + 1]
9679}
9680
9681Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
9682 offset = offset >>> 0
9683 if (!noAssert) checkOffset(offset, 4, this.length)
9684
9685 return ((this[offset]) |
9686 (this[offset + 1] << 8) |
9687 (this[offset + 2] << 16)) +
9688 (this[offset + 3] * 0x1000000)
9689}
9690
9691Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
9692 offset = offset >>> 0
9693 if (!noAssert) checkOffset(offset, 4, this.length)
9694
9695 return (this[offset] * 0x1000000) +
9696 ((this[offset + 1] << 16) |
9697 (this[offset + 2] << 8) |
9698 this[offset + 3])
9699}
9700
9701Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
9702 offset = offset >>> 0
9703 byteLength = byteLength >>> 0
9704 if (!noAssert) checkOffset(offset, byteLength, this.length)
9705
9706 var val = this[offset]
9707 var mul = 1
9708 var i = 0
9709 while (++i < byteLength && (mul *= 0x100)) {
9710 val += this[offset + i] * mul
9711 }
9712 mul *= 0x80
9713
9714 if (val >= mul) val -= Math.pow(2, 8 * byteLength)
9715
9716 return val
9717}
9718
9719Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
9720 offset = offset >>> 0
9721 byteLength = byteLength >>> 0
9722 if (!noAssert) checkOffset(offset, byteLength, this.length)
9723
9724 var i = byteLength
9725 var mul = 1
9726 var val = this[offset + --i]
9727 while (i > 0 && (mul *= 0x100)) {
9728 val += this[offset + --i] * mul
9729 }
9730 mul *= 0x80
9731
9732 if (val >= mul) val -= Math.pow(2, 8 * byteLength)
9733
9734 return val
9735}
9736
9737Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
9738 offset = offset >>> 0
9739 if (!noAssert) checkOffset(offset, 1, this.length)
9740 if (!(this[offset] & 0x80)) return (this[offset])
9741 return ((0xff - this[offset] + 1) * -1)
9742}
9743
9744Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
9745 offset = offset >>> 0
9746 if (!noAssert) checkOffset(offset, 2, this.length)
9747 var val = this[offset] | (this[offset + 1] << 8)
9748 return (val & 0x8000) ? val | 0xFFFF0000 : val
9749}
9750
9751Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
9752 offset = offset >>> 0
9753 if (!noAssert) checkOffset(offset, 2, this.length)
9754 var val = this[offset + 1] | (this[offset] << 8)
9755 return (val & 0x8000) ? val | 0xFFFF0000 : val
9756}
9757
9758Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
9759 offset = offset >>> 0
9760 if (!noAssert) checkOffset(offset, 4, this.length)
9761
9762 return (this[offset]) |
9763 (this[offset + 1] << 8) |
9764 (this[offset + 2] << 16) |
9765 (this[offset + 3] << 24)
9766}
9767
9768Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
9769 offset = offset >>> 0
9770 if (!noAssert) checkOffset(offset, 4, this.length)
9771
9772 return (this[offset] << 24) |
9773 (this[offset + 1] << 16) |
9774 (this[offset + 2] << 8) |
9775 (this[offset + 3])
9776}
9777
9778Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
9779 offset = offset >>> 0
9780 if (!noAssert) checkOffset(offset, 4, this.length)
9781 return ieee754.read(this, offset, true, 23, 4)
9782}
9783
9784Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
9785 offset = offset >>> 0
9786 if (!noAssert) checkOffset(offset, 4, this.length)
9787 return ieee754.read(this, offset, false, 23, 4)
9788}
9789
9790Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
9791 offset = offset >>> 0
9792 if (!noAssert) checkOffset(offset, 8, this.length)
9793 return ieee754.read(this, offset, true, 52, 8)
9794}
9795
9796Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
9797 offset = offset >>> 0
9798 if (!noAssert) checkOffset(offset, 8, this.length)
9799 return ieee754.read(this, offset, false, 52, 8)
9800}
9801
9802function checkInt (buf, value, offset, ext, max, min) {
9803 if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
9804 if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
9805 if (offset + ext > buf.length) throw new RangeError('Index out of range')
9806}
9807
9808Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
9809 value = +value
9810 offset = offset >>> 0
9811 byteLength = byteLength >>> 0
9812 if (!noAssert) {
9813 var maxBytes = Math.pow(2, 8 * byteLength) - 1
9814 checkInt(this, value, offset, byteLength, maxBytes, 0)
9815 }
9816
9817 var mul = 1
9818 var i = 0
9819 this[offset] = value & 0xFF
9820 while (++i < byteLength && (mul *= 0x100)) {
9821 this[offset + i] = (value / mul) & 0xFF
9822 }
9823
9824 return offset + byteLength
9825}
9826
9827Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
9828 value = +value
9829 offset = offset >>> 0
9830 byteLength = byteLength >>> 0
9831 if (!noAssert) {
9832 var maxBytes = Math.pow(2, 8 * byteLength) - 1
9833 checkInt(this, value, offset, byteLength, maxBytes, 0)
9834 }
9835
9836 var i = byteLength - 1
9837 var mul = 1
9838 this[offset + i] = value & 0xFF
9839 while (--i >= 0 && (mul *= 0x100)) {
9840 this[offset + i] = (value / mul) & 0xFF
9841 }
9842
9843 return offset + byteLength
9844}
9845
9846Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
9847 value = +value
9848 offset = offset >>> 0
9849 if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
9850 this[offset] = (value & 0xff)
9851 return offset + 1
9852}
9853
9854Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
9855 value = +value
9856 offset = offset >>> 0
9857 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
9858 this[offset] = (value & 0xff)
9859 this[offset + 1] = (value >>> 8)
9860 return offset + 2
9861}
9862
9863Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
9864 value = +value
9865 offset = offset >>> 0
9866 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
9867 this[offset] = (value >>> 8)
9868 this[offset + 1] = (value & 0xff)
9869 return offset + 2
9870}
9871
9872Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
9873 value = +value
9874 offset = offset >>> 0
9875 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
9876 this[offset + 3] = (value >>> 24)
9877 this[offset + 2] = (value >>> 16)
9878 this[offset + 1] = (value >>> 8)
9879 this[offset] = (value & 0xff)
9880 return offset + 4
9881}
9882
9883Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
9884 value = +value
9885 offset = offset >>> 0
9886 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
9887 this[offset] = (value >>> 24)
9888 this[offset + 1] = (value >>> 16)
9889 this[offset + 2] = (value >>> 8)
9890 this[offset + 3] = (value & 0xff)
9891 return offset + 4
9892}
9893
9894Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
9895 value = +value
9896 offset = offset >>> 0
9897 if (!noAssert) {
9898 var limit = Math.pow(2, (8 * byteLength) - 1)
9899
9900 checkInt(this, value, offset, byteLength, limit - 1, -limit)
9901 }
9902
9903 var i = 0
9904 var mul = 1
9905 var sub = 0
9906 this[offset] = value & 0xFF
9907 while (++i < byteLength && (mul *= 0x100)) {
9908 if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
9909 sub = 1
9910 }
9911 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
9912 }
9913
9914 return offset + byteLength
9915}
9916
9917Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
9918 value = +value
9919 offset = offset >>> 0
9920 if (!noAssert) {
9921 var limit = Math.pow(2, (8 * byteLength) - 1)
9922
9923 checkInt(this, value, offset, byteLength, limit - 1, -limit)
9924 }
9925
9926 var i = byteLength - 1
9927 var mul = 1
9928 var sub = 0
9929 this[offset + i] = value & 0xFF
9930 while (--i >= 0 && (mul *= 0x100)) {
9931 if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
9932 sub = 1
9933 }
9934 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
9935 }
9936
9937 return offset + byteLength
9938}
9939
9940Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
9941 value = +value
9942 offset = offset >>> 0
9943 if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
9944 if (value < 0) value = 0xff + value + 1
9945 this[offset] = (value & 0xff)
9946 return offset + 1
9947}
9948
9949Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
9950 value = +value
9951 offset = offset >>> 0
9952 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
9953 this[offset] = (value & 0xff)
9954 this[offset + 1] = (value >>> 8)
9955 return offset + 2
9956}
9957
9958Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
9959 value = +value
9960 offset = offset >>> 0
9961 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
9962 this[offset] = (value >>> 8)
9963 this[offset + 1] = (value & 0xff)
9964 return offset + 2
9965}
9966
9967Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
9968 value = +value
9969 offset = offset >>> 0
9970 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
9971 this[offset] = (value & 0xff)
9972 this[offset + 1] = (value >>> 8)
9973 this[offset + 2] = (value >>> 16)
9974 this[offset + 3] = (value >>> 24)
9975 return offset + 4
9976}
9977
9978Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
9979 value = +value
9980 offset = offset >>> 0
9981 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
9982 if (value < 0) value = 0xffffffff + value + 1
9983 this[offset] = (value >>> 24)
9984 this[offset + 1] = (value >>> 16)
9985 this[offset + 2] = (value >>> 8)
9986 this[offset + 3] = (value & 0xff)
9987 return offset + 4
9988}
9989
9990function checkIEEE754 (buf, value, offset, ext, max, min) {
9991 if (offset + ext > buf.length) throw new RangeError('Index out of range')
9992 if (offset < 0) throw new RangeError('Index out of range')
9993}
9994
9995function writeFloat (buf, value, offset, littleEndian, noAssert) {
9996 value = +value
9997 offset = offset >>> 0
9998 if (!noAssert) {
9999 checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
10000 }
10001 ieee754.write(buf, value, offset, littleEndian, 23, 4)
10002 return offset + 4
10003}
10004
10005Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
10006 return writeFloat(this, value, offset, true, noAssert)
10007}
10008
10009Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
10010 return writeFloat(this, value, offset, false, noAssert)
10011}
10012
10013function writeDouble (buf, value, offset, littleEndian, noAssert) {
10014 value = +value
10015 offset = offset >>> 0
10016 if (!noAssert) {
10017 checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
10018 }
10019 ieee754.write(buf, value, offset, littleEndian, 52, 8)
10020 return offset + 8
10021}
10022
10023Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
10024 return writeDouble(this, value, offset, true, noAssert)
10025}
10026
10027Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
10028 return writeDouble(this, value, offset, false, noAssert)
10029}
10030
10031// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
10032Buffer.prototype.copy = function copy (target, targetStart, start, end) {
10033 if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
10034 if (!start) start = 0
10035 if (!end && end !== 0) end = this.length
10036 if (targetStart >= target.length) targetStart = target.length
10037 if (!targetStart) targetStart = 0
10038 if (end > 0 && end < start) end = start
10039
10040 // Copy 0 bytes; we're done
10041 if (end === start) return 0
10042 if (target.length === 0 || this.length === 0) return 0
10043
10044 // Fatal error conditions
10045 if (targetStart < 0) {
10046 throw new RangeError('targetStart out of bounds')
10047 }
10048 if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
10049 if (end < 0) throw new RangeError('sourceEnd out of bounds')
10050
10051 // Are we oob?
10052 if (end > this.length) end = this.length
10053 if (target.length - targetStart < end - start) {
10054 end = target.length - targetStart + start
10055 }
10056
10057 var len = end - start
10058
10059 if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
10060 // Use built-in when available, missing from IE11
10061 this.copyWithin(targetStart, start, end)
10062 } else if (this === target && start < targetStart && targetStart < end) {
10063 // descending copy from end
10064 for (var i = len - 1; i >= 0; --i) {
10065 target[i + targetStart] = this[i + start]
10066 }
10067 } else {
10068 Uint8Array.prototype.set.call(
10069 target,
10070 this.subarray(start, end),
10071 targetStart
10072 )
10073 }
10074
10075 return len
10076}
10077
10078// Usage:
10079// buffer.fill(number[, offset[, end]])
10080// buffer.fill(buffer[, offset[, end]])
10081// buffer.fill(string[, offset[, end]][, encoding])
10082Buffer.prototype.fill = function fill (val, start, end, encoding) {
10083 // Handle string cases:
10084 if (typeof val === 'string') {
10085 if (typeof start === 'string') {
10086 encoding = start
10087 start = 0
10088 end = this.length
10089 } else if (typeof end === 'string') {
10090 encoding = end
10091 end = this.length
10092 }
10093 if (encoding !== undefined && typeof encoding !== 'string') {
10094 throw new TypeError('encoding must be a string')
10095 }
10096 if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
10097 throw new TypeError('Unknown encoding: ' + encoding)
10098 }
10099 if (val.length === 1) {
10100 var code = val.charCodeAt(0)
10101 if ((encoding === 'utf8' && code < 128) ||
10102 encoding === 'latin1') {
10103 // Fast path: If `val` fits into a single byte, use that numeric value.
10104 val = code
10105 }
10106 }
10107 } else if (typeof val === 'number') {
10108 val = val & 255
10109 }
10110
10111 // Invalid ranges are not set to a default, so can range check early.
10112 if (start < 0 || this.length < start || this.length < end) {
10113 throw new RangeError('Out of range index')
10114 }
10115
10116 if (end <= start) {
10117 return this
10118 }
10119
10120 start = start >>> 0
10121 end = end === undefined ? this.length : end >>> 0
10122
10123 if (!val) val = 0
10124
10125 var i
10126 if (typeof val === 'number') {
10127 for (i = start; i < end; ++i) {
10128 this[i] = val
10129 }
10130 } else {
10131 var bytes = Buffer.isBuffer(val)
10132 ? val
10133 : Buffer.from(val, encoding)
10134 var len = bytes.length
10135 if (len === 0) {
10136 throw new TypeError('The value "' + val +
10137 '" is invalid for argument "value"')
10138 }
10139 for (i = 0; i < end - start; ++i) {
10140 this[i + start] = bytes[i % len]
10141 }
10142 }
10143
10144 return this
10145}
10146
10147// HELPER FUNCTIONS
10148// ================
10149
10150var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
10151
10152function base64clean (str) {
10153 // Node takes equal signs as end of the Base64 encoding
10154 str = str.split('=')[0]
10155 // Node strips out invalid characters like \n and \t from the string, base64-js does not
10156 str = str.trim().replace(INVALID_BASE64_RE, '')
10157 // Node converts strings with length < 2 to ''
10158 if (str.length < 2) return ''
10159 // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
10160 while (str.length % 4 !== 0) {
10161 str = str + '='
10162 }
10163 return str
10164}
10165
10166function toHex (n) {
10167 if (n < 16) return '0' + n.toString(16)
10168 return n.toString(16)
10169}
10170
10171function utf8ToBytes (string, units) {
10172 units = units || Infinity
10173 var codePoint
10174 var length = string.length
10175 var leadSurrogate = null
10176 var bytes = []
10177
10178 for (var i = 0; i < length; ++i) {
10179 codePoint = string.charCodeAt(i)
10180
10181 // is surrogate component
10182 if (codePoint > 0xD7FF && codePoint < 0xE000) {
10183 // last char was a lead
10184 if (!leadSurrogate) {
10185 // no lead yet
10186 if (codePoint > 0xDBFF) {
10187 // unexpected trail
10188 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
10189 continue
10190 } else if (i + 1 === length) {
10191 // unpaired lead
10192 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
10193 continue
10194 }
10195
10196 // valid lead
10197 leadSurrogate = codePoint
10198
10199 continue
10200 }
10201
10202 // 2 leads in a row
10203 if (codePoint < 0xDC00) {
10204 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
10205 leadSurrogate = codePoint
10206 continue
10207 }
10208
10209 // valid surrogate pair
10210 codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
10211 } else if (leadSurrogate) {
10212 // valid bmp char, but last char was a lead
10213 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
10214 }
10215
10216 leadSurrogate = null
10217
10218 // encode utf8
10219 if (codePoint < 0x80) {
10220 if ((units -= 1) < 0) break
10221 bytes.push(codePoint)
10222 } else if (codePoint < 0x800) {
10223 if ((units -= 2) < 0) break
10224 bytes.push(
10225 codePoint >> 0x6 | 0xC0,
10226 codePoint & 0x3F | 0x80
10227 )
10228 } else if (codePoint < 0x10000) {
10229 if ((units -= 3) < 0) break
10230 bytes.push(
10231 codePoint >> 0xC | 0xE0,
10232 codePoint >> 0x6 & 0x3F | 0x80,
10233 codePoint & 0x3F | 0x80
10234 )
10235 } else if (codePoint < 0x110000) {
10236 if ((units -= 4) < 0) break
10237 bytes.push(
10238 codePoint >> 0x12 | 0xF0,
10239 codePoint >> 0xC & 0x3F | 0x80,
10240 codePoint >> 0x6 & 0x3F | 0x80,
10241 codePoint & 0x3F | 0x80
10242 )
10243 } else {
10244 throw new Error('Invalid code point')
10245 }
10246 }
10247
10248 return bytes
10249}
10250
10251function asciiToBytes (str) {
10252 var byteArray = []
10253 for (var i = 0; i < str.length; ++i) {
10254 // Node's code seems to be doing this and not & 0x7F..
10255 byteArray.push(str.charCodeAt(i) & 0xFF)
10256 }
10257 return byteArray
10258}
10259
10260function utf16leToBytes (str, units) {
10261 var c, hi, lo
10262 var byteArray = []
10263 for (var i = 0; i < str.length; ++i) {
10264 if ((units -= 2) < 0) break
10265
10266 c = str.charCodeAt(i)
10267 hi = c >> 8
10268 lo = c % 256
10269 byteArray.push(lo)
10270 byteArray.push(hi)
10271 }
10272
10273 return byteArray
10274}
10275
10276function base64ToBytes (str) {
10277 return base64.toByteArray(base64clean(str))
10278}
10279
10280function blitBuffer (src, dst, offset, length) {
10281 for (var i = 0; i < length; ++i) {
10282 if ((i + offset >= dst.length) || (i >= src.length)) break
10283 dst[i + offset] = src[i]
10284 }
10285 return i
10286}
10287
10288// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
10289// the `instanceof` check but they should be treated as of that type.
10290// See: https://github.com/feross/buffer/issues/166
10291function isInstance (obj, type) {
10292 return obj instanceof type ||
10293 (obj != null && obj.constructor != null && obj.constructor.name != null &&
10294 obj.constructor.name === type.name)
10295}
10296function numberIsNaN (obj) {
10297 // For IE11 support
10298 return obj !== obj // eslint-disable-line no-self-compare
10299}
10300
10301}).call(this,require("buffer").Buffer)
10302},{"base64-js":39,"buffer":43,"ieee754":55}],44:[function(require,module,exports){
10303(function (Buffer){
10304// Copyright Joyent, Inc. and other Node contributors.
10305//
10306// Permission is hereby granted, free of charge, to any person obtaining a
10307// copy of this software and associated documentation files (the
10308// "Software"), to deal in the Software without restriction, including
10309// without limitation the rights to use, copy, modify, merge, publish,
10310// distribute, sublicense, and/or sell copies of the Software, and to permit
10311// persons to whom the Software is furnished to do so, subject to the
10312// following conditions:
10313//
10314// The above copyright notice and this permission notice shall be included
10315// in all copies or substantial portions of the Software.
10316//
10317// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10318// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10319// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
10320// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
10321// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
10322// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
10323// USE OR OTHER DEALINGS IN THE SOFTWARE.
10324
10325// NOTE: These type checking functions intentionally don't use `instanceof`
10326// because it is fragile and can be easily faked with `Object.create()`.
10327
10328function isArray(arg) {
10329 if (Array.isArray) {
10330 return Array.isArray(arg);
10331 }
10332 return objectToString(arg) === '[object Array]';
10333}
10334exports.isArray = isArray;
10335
10336function isBoolean(arg) {
10337 return typeof arg === 'boolean';
10338}
10339exports.isBoolean = isBoolean;
10340
10341function isNull(arg) {
10342 return arg === null;
10343}
10344exports.isNull = isNull;
10345
10346function isNullOrUndefined(arg) {
10347 return arg == null;
10348}
10349exports.isNullOrUndefined = isNullOrUndefined;
10350
10351function isNumber(arg) {
10352 return typeof arg === 'number';
10353}
10354exports.isNumber = isNumber;
10355
10356function isString(arg) {
10357 return typeof arg === 'string';
10358}
10359exports.isString = isString;
10360
10361function isSymbol(arg) {
10362 return typeof arg === 'symbol';
10363}
10364exports.isSymbol = isSymbol;
10365
10366function isUndefined(arg) {
10367 return arg === void 0;
10368}
10369exports.isUndefined = isUndefined;
10370
10371function isRegExp(re) {
10372 return objectToString(re) === '[object RegExp]';
10373}
10374exports.isRegExp = isRegExp;
10375
10376function isObject(arg) {
10377 return typeof arg === 'object' && arg !== null;
10378}
10379exports.isObject = isObject;
10380
10381function isDate(d) {
10382 return objectToString(d) === '[object Date]';
10383}
10384exports.isDate = isDate;
10385
10386function isError(e) {
10387 return (objectToString(e) === '[object Error]' || e instanceof Error);
10388}
10389exports.isError = isError;
10390
10391function isFunction(arg) {
10392 return typeof arg === 'function';
10393}
10394exports.isFunction = isFunction;
10395
10396function isPrimitive(arg) {
10397 return arg === null ||
10398 typeof arg === 'boolean' ||
10399 typeof arg === 'number' ||
10400 typeof arg === 'string' ||
10401 typeof arg === 'symbol' || // ES6 symbol
10402 typeof arg === 'undefined';
10403}
10404exports.isPrimitive = isPrimitive;
10405
10406exports.isBuffer = Buffer.isBuffer;
10407
10408function objectToString(o) {
10409 return Object.prototype.toString.call(o);
10410}
10411
10412}).call(this,{"isBuffer":require("../../is-buffer/index.js")})
10413},{"../../is-buffer/index.js":57}],45:[function(require,module,exports){
10414(function (process){
10415"use strict";
10416
10417function _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); }
10418
10419/* eslint-env browser */
10420
10421/**
10422 * This is the web browser implementation of `debug()`.
10423 */
10424exports.log = log;
10425exports.formatArgs = formatArgs;
10426exports.save = save;
10427exports.load = load;
10428exports.useColors = useColors;
10429exports.storage = localstorage();
10430/**
10431 * Colors.
10432 */
10433
10434exports.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'];
10435/**
10436 * Currently only WebKit-based Web Inspectors, Firefox >= v31,
10437 * and the Firebug extension (any Firefox version) are known
10438 * to support "%c" CSS customizations.
10439 *
10440 * TODO: add a `localStorage` variable to explicitly enable/disable colors
10441 */
10442// eslint-disable-next-line complexity
10443
10444function useColors() {
10445 // NB: In an Electron preload script, document will be defined but not fully
10446 // initialized. Since we know we're in Chrome, we'll just detect this case
10447 // explicitly
10448 if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
10449 return true;
10450 } // Internet Explorer and Edge do not support colors.
10451
10452
10453 if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
10454 return false;
10455 } // Is webkit? http://stackoverflow.com/a/16459606/376773
10456 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
10457
10458
10459 return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
10460 typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
10461 // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
10462 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
10463 typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
10464}
10465/**
10466 * Colorize log arguments if enabled.
10467 *
10468 * @api public
10469 */
10470
10471
10472function formatArgs(args) {
10473 args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
10474
10475 if (!this.useColors) {
10476 return;
10477 }
10478
10479 var c = 'color: ' + this.color;
10480 args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
10481 // arguments passed either before or after the %c, so we need to
10482 // figure out the correct index to insert the CSS into
10483
10484 var index = 0;
10485 var lastC = 0;
10486 args[0].replace(/%[a-zA-Z%]/g, function (match) {
10487 if (match === '%%') {
10488 return;
10489 }
10490
10491 index++;
10492
10493 if (match === '%c') {
10494 // We only are interested in the *last* %c
10495 // (the user may have provided their own)
10496 lastC = index;
10497 }
10498 });
10499 args.splice(lastC, 0, c);
10500}
10501/**
10502 * Invokes `console.log()` when available.
10503 * No-op when `console.log` is not a "function".
10504 *
10505 * @api public
10506 */
10507
10508
10509function log() {
10510 var _console;
10511
10512 // This hackery is required for IE8/9, where
10513 // the `console.log` function doesn't have 'apply'
10514 return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
10515}
10516/**
10517 * Save `namespaces`.
10518 *
10519 * @param {String} namespaces
10520 * @api private
10521 */
10522
10523
10524function save(namespaces) {
10525 try {
10526 if (namespaces) {
10527 exports.storage.setItem('debug', namespaces);
10528 } else {
10529 exports.storage.removeItem('debug');
10530 }
10531 } catch (error) {// Swallow
10532 // XXX (@Qix-) should we be logging these?
10533 }
10534}
10535/**
10536 * Load `namespaces`.
10537 *
10538 * @return {String} returns the previously persisted debug modes
10539 * @api private
10540 */
10541
10542
10543function load() {
10544 var r;
10545
10546 try {
10547 r = exports.storage.getItem('debug');
10548 } catch (error) {} // Swallow
10549 // XXX (@Qix-) should we be logging these?
10550 // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
10551
10552
10553 if (!r && typeof process !== 'undefined' && 'env' in process) {
10554 r = process.env.DEBUG;
10555 }
10556
10557 return r;
10558}
10559/**
10560 * Localstorage attempts to return the localstorage.
10561 *
10562 * This is necessary because safari throws
10563 * when a user disables cookies/localstorage
10564 * and you attempt to access it.
10565 *
10566 * @return {LocalStorage}
10567 * @api private
10568 */
10569
10570
10571function localstorage() {
10572 try {
10573 // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
10574 // The Browser also has localStorage in the global context.
10575 return localStorage;
10576 } catch (error) {// Swallow
10577 // XXX (@Qix-) should we be logging these?
10578 }
10579}
10580
10581module.exports = require('./common')(exports);
10582var formatters = module.exports.formatters;
10583/**
10584 * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
10585 */
10586
10587formatters.j = function (v) {
10588 try {
10589 return JSON.stringify(v);
10590 } catch (error) {
10591 return '[UnexpectedJSONParseError]: ' + error.message;
10592 }
10593};
10594
10595
10596}).call(this,require('_process'))
10597},{"./common":46,"_process":69}],46:[function(require,module,exports){
10598"use strict";
10599
10600/**
10601 * This is the common logic for both the Node.js and web browser
10602 * implementations of `debug()`.
10603 */
10604function setup(env) {
10605 createDebug.debug = createDebug;
10606 createDebug.default = createDebug;
10607 createDebug.coerce = coerce;
10608 createDebug.disable = disable;
10609 createDebug.enable = enable;
10610 createDebug.enabled = enabled;
10611 createDebug.humanize = require('ms');
10612 Object.keys(env).forEach(function (key) {
10613 createDebug[key] = env[key];
10614 });
10615 /**
10616 * Active `debug` instances.
10617 */
10618
10619 createDebug.instances = [];
10620 /**
10621 * The currently active debug mode names, and names to skip.
10622 */
10623
10624 createDebug.names = [];
10625 createDebug.skips = [];
10626 /**
10627 * Map of special "%n" handling functions, for the debug "format" argument.
10628 *
10629 * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
10630 */
10631
10632 createDebug.formatters = {};
10633 /**
10634 * Selects a color for a debug namespace
10635 * @param {String} namespace The namespace string for the for the debug instance to be colored
10636 * @return {Number|String} An ANSI color code for the given namespace
10637 * @api private
10638 */
10639
10640 function selectColor(namespace) {
10641 var hash = 0;
10642
10643 for (var i = 0; i < namespace.length; i++) {
10644 hash = (hash << 5) - hash + namespace.charCodeAt(i);
10645 hash |= 0; // Convert to 32bit integer
10646 }
10647
10648 return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
10649 }
10650
10651 createDebug.selectColor = selectColor;
10652 /**
10653 * Create a debugger with the given `namespace`.
10654 *
10655 * @param {String} namespace
10656 * @return {Function}
10657 * @api public
10658 */
10659
10660 function createDebug(namespace) {
10661 var prevTime;
10662
10663 function debug() {
10664 // Disabled?
10665 if (!debug.enabled) {
10666 return;
10667 }
10668
10669 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
10670 args[_key] = arguments[_key];
10671 }
10672
10673 var self = debug; // Set `diff` timestamp
10674
10675 var curr = Number(new Date());
10676 var ms = curr - (prevTime || curr);
10677 self.diff = ms;
10678 self.prev = prevTime;
10679 self.curr = curr;
10680 prevTime = curr;
10681 args[0] = createDebug.coerce(args[0]);
10682
10683 if (typeof args[0] !== 'string') {
10684 // Anything else let's inspect with %O
10685 args.unshift('%O');
10686 } // Apply any `formatters` transformations
10687
10688
10689 var index = 0;
10690 args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
10691 // If we encounter an escaped % then don't increase the array index
10692 if (match === '%%') {
10693 return match;
10694 }
10695
10696 index++;
10697 var formatter = createDebug.formatters[format];
10698
10699 if (typeof formatter === 'function') {
10700 var val = args[index];
10701 match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
10702
10703 args.splice(index, 1);
10704 index--;
10705 }
10706
10707 return match;
10708 }); // Apply env-specific formatting (colors, etc.)
10709
10710 createDebug.formatArgs.call(self, args);
10711 var logFn = self.log || createDebug.log;
10712 logFn.apply(self, args);
10713 }
10714
10715 debug.namespace = namespace;
10716 debug.enabled = createDebug.enabled(namespace);
10717 debug.useColors = createDebug.useColors();
10718 debug.color = selectColor(namespace);
10719 debug.destroy = destroy;
10720 debug.extend = extend; // Debug.formatArgs = formatArgs;
10721 // debug.rawLog = rawLog;
10722 // env-specific initialization logic for debug instances
10723
10724 if (typeof createDebug.init === 'function') {
10725 createDebug.init(debug);
10726 }
10727
10728 createDebug.instances.push(debug);
10729 return debug;
10730 }
10731
10732 function destroy() {
10733 var index = createDebug.instances.indexOf(this);
10734
10735 if (index !== -1) {
10736 createDebug.instances.splice(index, 1);
10737 return true;
10738 }
10739
10740 return false;
10741 }
10742
10743 function extend(namespace, delimiter) {
10744 return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
10745 }
10746 /**
10747 * Enables a debug mode by namespaces. This can include modes
10748 * separated by a colon and wildcards.
10749 *
10750 * @param {String} namespaces
10751 * @api public
10752 */
10753
10754
10755 function enable(namespaces) {
10756 createDebug.save(namespaces);
10757 createDebug.names = [];
10758 createDebug.skips = [];
10759 var i;
10760 var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
10761 var len = split.length;
10762
10763 for (i = 0; i < len; i++) {
10764 if (!split[i]) {
10765 // ignore empty strings
10766 continue;
10767 }
10768
10769 namespaces = split[i].replace(/\*/g, '.*?');
10770
10771 if (namespaces[0] === '-') {
10772 createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
10773 } else {
10774 createDebug.names.push(new RegExp('^' + namespaces + '$'));
10775 }
10776 }
10777
10778 for (i = 0; i < createDebug.instances.length; i++) {
10779 var instance = createDebug.instances[i];
10780 instance.enabled = createDebug.enabled(instance.namespace);
10781 }
10782 }
10783 /**
10784 * Disable debug output.
10785 *
10786 * @api public
10787 */
10788
10789
10790 function disable() {
10791 createDebug.enable('');
10792 }
10793 /**
10794 * Returns true if the given mode name is enabled, false otherwise.
10795 *
10796 * @param {String} name
10797 * @return {Boolean}
10798 * @api public
10799 */
10800
10801
10802 function enabled(name) {
10803 if (name[name.length - 1] === '*') {
10804 return true;
10805 }
10806
10807 var i;
10808 var len;
10809
10810 for (i = 0, len = createDebug.skips.length; i < len; i++) {
10811 if (createDebug.skips[i].test(name)) {
10812 return false;
10813 }
10814 }
10815
10816 for (i = 0, len = createDebug.names.length; i < len; i++) {
10817 if (createDebug.names[i].test(name)) {
10818 return true;
10819 }
10820 }
10821
10822 return false;
10823 }
10824 /**
10825 * Coerce `val`.
10826 *
10827 * @param {Mixed} val
10828 * @return {Mixed}
10829 * @api private
10830 */
10831
10832
10833 function coerce(val) {
10834 if (val instanceof Error) {
10835 return val.stack || val.message;
10836 }
10837
10838 return val;
10839 }
10840
10841 createDebug.enable(createDebug.load());
10842 return createDebug;
10843}
10844
10845module.exports = setup;
10846
10847
10848},{"ms":60}],47:[function(require,module,exports){
10849'use strict';
10850
10851var keys = require('object-keys');
10852var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
10853
10854var toStr = Object.prototype.toString;
10855var concat = Array.prototype.concat;
10856var origDefineProperty = Object.defineProperty;
10857
10858var isFunction = function (fn) {
10859 return typeof fn === 'function' && toStr.call(fn) === '[object Function]';
10860};
10861
10862var arePropertyDescriptorsSupported = function () {
10863 var obj = {};
10864 try {
10865 origDefineProperty(obj, 'x', { enumerable: false, value: obj });
10866 // eslint-disable-next-line no-unused-vars, no-restricted-syntax
10867 for (var _ in obj) { // jscs:ignore disallowUnusedVariables
10868 return false;
10869 }
10870 return obj.x === obj;
10871 } catch (e) { /* this is IE 8. */
10872 return false;
10873 }
10874};
10875var supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported();
10876
10877var defineProperty = function (object, name, value, predicate) {
10878 if (name in object && (!isFunction(predicate) || !predicate())) {
10879 return;
10880 }
10881 if (supportsDescriptors) {
10882 origDefineProperty(object, name, {
10883 configurable: true,
10884 enumerable: false,
10885 value: value,
10886 writable: true
10887 });
10888 } else {
10889 object[name] = value;
10890 }
10891};
10892
10893var defineProperties = function (object, map) {
10894 var predicates = arguments.length > 2 ? arguments[2] : {};
10895 var props = keys(map);
10896 if (hasSymbols) {
10897 props = concat.call(props, Object.getOwnPropertySymbols(map));
10898 }
10899 for (var i = 0; i < props.length; i += 1) {
10900 defineProperty(object, props[i], map[props[i]], predicates[props[i]]);
10901 }
10902};
10903
10904defineProperties.supportsDescriptors = !!supportsDescriptors;
10905
10906module.exports = defineProperties;
10907
10908},{"object-keys":62}],48:[function(require,module,exports){
10909/*!
10910
10911 diff v3.5.0
10912
10913Software License Agreement (BSD License)
10914
10915Copyright (c) 2009-2015, Kevin Decker <kpdecker@gmail.com>
10916
10917All rights reserved.
10918
10919Redistribution and use of this software in source and binary forms, with or without modification,
10920are permitted provided that the following conditions are met:
10921
10922* Redistributions of source code must retain the above
10923 copyright notice, this list of conditions and the
10924 following disclaimer.
10925
10926* Redistributions in binary form must reproduce the above
10927 copyright notice, this list of conditions and the
10928 following disclaimer in the documentation and/or other
10929 materials provided with the distribution.
10930
10931* Neither the name of Kevin Decker nor the names of its
10932 contributors may be used to endorse or promote products
10933 derived from this software without specific prior
10934 written permission.
10935
10936THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
10937IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
10938FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
10939CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
10940DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10941DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
10942IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
10943OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10944@license
10945*/
10946(function webpackUniversalModuleDefinition(root, factory) {
10947 if(typeof exports === 'object' && typeof module === 'object')
10948 module.exports = factory();
10949 else if(false)
10950 define([], factory);
10951 else if(typeof exports === 'object')
10952 exports["JsDiff"] = factory();
10953 else
10954 root["JsDiff"] = factory();
10955})(this, function() {
10956return /******/ (function(modules) { // webpackBootstrap
10957/******/ // The module cache
10958/******/ var installedModules = {};
10959
10960/******/ // The require function
10961/******/ function __webpack_require__(moduleId) {
10962
10963/******/ // Check if module is in cache
10964/******/ if(installedModules[moduleId])
10965/******/ return installedModules[moduleId].exports;
10966
10967/******/ // Create a new module (and put it into the cache)
10968/******/ var module = installedModules[moduleId] = {
10969/******/ exports: {},
10970/******/ id: moduleId,
10971/******/ loaded: false
10972/******/ };
10973
10974/******/ // Execute the module function
10975/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
10976
10977/******/ // Flag the module as loaded
10978/******/ module.loaded = true;
10979
10980/******/ // Return the exports of the module
10981/******/ return module.exports;
10982/******/ }
10983
10984
10985/******/ // expose the modules object (__webpack_modules__)
10986/******/ __webpack_require__.m = modules;
10987
10988/******/ // expose the module cache
10989/******/ __webpack_require__.c = installedModules;
10990
10991/******/ // __webpack_public_path__
10992/******/ __webpack_require__.p = "";
10993
10994/******/ // Load entry module and return exports
10995/******/ return __webpack_require__(0);
10996/******/ })
10997/************************************************************************/
10998/******/ ([
10999/* 0 */
11000/***/ (function(module, exports, __webpack_require__) {
11001
11002 /*istanbul ignore start*/'use strict';
11003
11004 exports.__esModule = true;
11005 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;
11006
11007 /*istanbul ignore end*/var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11008
11009 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11010
11011 /*istanbul ignore end*/var /*istanbul ignore start*/_character = __webpack_require__(2) /*istanbul ignore end*/;
11012
11013 var /*istanbul ignore start*/_word = __webpack_require__(3) /*istanbul ignore end*/;
11014
11015 var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
11016
11017 var /*istanbul ignore start*/_sentence = __webpack_require__(6) /*istanbul ignore end*/;
11018
11019 var /*istanbul ignore start*/_css = __webpack_require__(7) /*istanbul ignore end*/;
11020
11021 var /*istanbul ignore start*/_json = __webpack_require__(8) /*istanbul ignore end*/;
11022
11023 var /*istanbul ignore start*/_array = __webpack_require__(9) /*istanbul ignore end*/;
11024
11025 var /*istanbul ignore start*/_apply = __webpack_require__(10) /*istanbul ignore end*/;
11026
11027 var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
11028
11029 var /*istanbul ignore start*/_merge = __webpack_require__(13) /*istanbul ignore end*/;
11030
11031 var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/;
11032
11033 var /*istanbul ignore start*/_dmp = __webpack_require__(16) /*istanbul ignore end*/;
11034
11035 var /*istanbul ignore start*/_xml = __webpack_require__(17) /*istanbul ignore end*/;
11036
11037 /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11038
11039 /* See LICENSE file for terms of use */
11040
11041 /*
11042 * Text diff implementation.
11043 *
11044 * This library supports the following APIS:
11045 * JsDiff.diffChars: Character by character diff
11046 * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
11047 * JsDiff.diffLines: Line based diff
11048 *
11049 * JsDiff.diffCss: Diff targeted at CSS content
11050 *
11051 * These methods are based on the implementation proposed in
11052 * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
11053 * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
11054 */
11055 exports. /*istanbul ignore end*/Diff = _base2['default'];
11056 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffChars = _character.diffChars;
11057 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWords = _word.diffWords;
11058 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = _word.diffWordsWithSpace;
11059 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffLines = _line.diffLines;
11060 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = _line.diffTrimmedLines;
11061 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffSentences = _sentence.diffSentences;
11062 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffCss = _css.diffCss;
11063 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffJson = _json.diffJson;
11064 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffArrays = _array.diffArrays;
11065 /*istanbul ignore start*/exports. /*istanbul ignore end*/structuredPatch = _create.structuredPatch;
11066 /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = _create.createTwoFilesPatch;
11067 /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = _create.createPatch;
11068 /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatch = _apply.applyPatch;
11069 /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = _apply.applyPatches;
11070 /*istanbul ignore start*/exports. /*istanbul ignore end*/parsePatch = _parse.parsePatch;
11071 /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = _merge.merge;
11072 /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToDMP = _dmp.convertChangesToDMP;
11073 /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToXML = _xml.convertChangesToXML;
11074 /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = _json.canonicalize;
11075
11076
11077
11078/***/ }),
11079/* 1 */
11080/***/ (function(module, exports) {
11081
11082 /*istanbul ignore start*/'use strict';
11083
11084 exports.__esModule = true;
11085 exports['default'] = /*istanbul ignore end*/Diff;
11086 function Diff() {}
11087
11088 Diff.prototype = {
11089 /*istanbul ignore start*/ /*istanbul ignore end*/diff: function diff(oldString, newString) {
11090 /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
11091
11092 var callback = options.callback;
11093 if (typeof options === 'function') {
11094 callback = options;
11095 options = {};
11096 }
11097 this.options = options;
11098
11099 var self = this;
11100
11101 function done(value) {
11102 if (callback) {
11103 setTimeout(function () {
11104 callback(undefined, value);
11105 }, 0);
11106 return true;
11107 } else {
11108 return value;
11109 }
11110 }
11111
11112 // Allow subclasses to massage the input prior to running
11113 oldString = this.castInput(oldString);
11114 newString = this.castInput(newString);
11115
11116 oldString = this.removeEmpty(this.tokenize(oldString));
11117 newString = this.removeEmpty(this.tokenize(newString));
11118
11119 var newLen = newString.length,
11120 oldLen = oldString.length;
11121 var editLength = 1;
11122 var maxEditLength = newLen + oldLen;
11123 var bestPath = [{ newPos: -1, components: [] }];
11124
11125 // Seed editLength = 0, i.e. the content starts with the same values
11126 var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
11127 if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
11128 // Identity per the equality and tokenizer
11129 return done([{ value: this.join(newString), count: newString.length }]);
11130 }
11131
11132 // Main worker method. checks all permutations of a given edit length for acceptance.
11133 function execEditLength() {
11134 for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
11135 var basePath = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
11136 var addPath = bestPath[diagonalPath - 1],
11137 removePath = bestPath[diagonalPath + 1],
11138 _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
11139 if (addPath) {
11140 // No one else is going to attempt to use this value, clear it
11141 bestPath[diagonalPath - 1] = undefined;
11142 }
11143
11144 var canAdd = addPath && addPath.newPos + 1 < newLen,
11145 canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
11146 if (!canAdd && !canRemove) {
11147 // If this path is a terminal then prune
11148 bestPath[diagonalPath] = undefined;
11149 continue;
11150 }
11151
11152 // Select the diagonal that we want to branch from. We select the prior
11153 // path whose position in the new string is the farthest from the origin
11154 // and does not pass the bounds of the diff graph
11155 if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
11156 basePath = clonePath(removePath);
11157 self.pushComponent(basePath.components, undefined, true);
11158 } else {
11159 basePath = addPath; // No need to clone, we've pulled it from the list
11160 basePath.newPos++;
11161 self.pushComponent(basePath.components, true, undefined);
11162 }
11163
11164 _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
11165
11166 // If we have hit the end of both strings, then we are done
11167 if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
11168 return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
11169 } else {
11170 // Otherwise track this path as a potential candidate and continue.
11171 bestPath[diagonalPath] = basePath;
11172 }
11173 }
11174
11175 editLength++;
11176 }
11177
11178 // Performs the length of edit iteration. Is a bit fugly as this has to support the
11179 // sync and async mode which is never fun. Loops over execEditLength until a value
11180 // is produced.
11181 if (callback) {
11182 (function exec() {
11183 setTimeout(function () {
11184 // This should not happen, but we want to be safe.
11185 /* istanbul ignore next */
11186 if (editLength > maxEditLength) {
11187 return callback();
11188 }
11189
11190 if (!execEditLength()) {
11191 exec();
11192 }
11193 }, 0);
11194 })();
11195 } else {
11196 while (editLength <= maxEditLength) {
11197 var ret = execEditLength();
11198 if (ret) {
11199 return ret;
11200 }
11201 }
11202 }
11203 },
11204 /*istanbul ignore start*/ /*istanbul ignore end*/pushComponent: function pushComponent(components, added, removed) {
11205 var last = components[components.length - 1];
11206 if (last && last.added === added && last.removed === removed) {
11207 // We need to clone here as the component clone operation is just
11208 // as shallow array clone
11209 components[components.length - 1] = { count: last.count + 1, added: added, removed: removed };
11210 } else {
11211 components.push({ count: 1, added: added, removed: removed });
11212 }
11213 },
11214 /*istanbul ignore start*/ /*istanbul ignore end*/extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
11215 var newLen = newString.length,
11216 oldLen = oldString.length,
11217 newPos = basePath.newPos,
11218 oldPos = newPos - diagonalPath,
11219 commonCount = 0;
11220 while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
11221 newPos++;
11222 oldPos++;
11223 commonCount++;
11224 }
11225
11226 if (commonCount) {
11227 basePath.components.push({ count: commonCount });
11228 }
11229
11230 basePath.newPos = newPos;
11231 return oldPos;
11232 },
11233 /*istanbul ignore start*/ /*istanbul ignore end*/equals: function equals(left, right) {
11234 if (this.options.comparator) {
11235 return this.options.comparator(left, right);
11236 } else {
11237 return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
11238 }
11239 },
11240 /*istanbul ignore start*/ /*istanbul ignore end*/removeEmpty: function removeEmpty(array) {
11241 var ret = [];
11242 for (var i = 0; i < array.length; i++) {
11243 if (array[i]) {
11244 ret.push(array[i]);
11245 }
11246 }
11247 return ret;
11248 },
11249 /*istanbul ignore start*/ /*istanbul ignore end*/castInput: function castInput(value) {
11250 return value;
11251 },
11252 /*istanbul ignore start*/ /*istanbul ignore end*/tokenize: function tokenize(value) {
11253 return value.split('');
11254 },
11255 /*istanbul ignore start*/ /*istanbul ignore end*/join: function join(chars) {
11256 return chars.join('');
11257 }
11258 };
11259
11260 function buildValues(diff, components, newString, oldString, useLongestToken) {
11261 var componentPos = 0,
11262 componentLen = components.length,
11263 newPos = 0,
11264 oldPos = 0;
11265
11266 for (; componentPos < componentLen; componentPos++) {
11267 var component = components[componentPos];
11268 if (!component.removed) {
11269 if (!component.added && useLongestToken) {
11270 var value = newString.slice(newPos, newPos + component.count);
11271 value = value.map(function (value, i) {
11272 var oldValue = oldString[oldPos + i];
11273 return oldValue.length > value.length ? oldValue : value;
11274 });
11275
11276 component.value = diff.join(value);
11277 } else {
11278 component.value = diff.join(newString.slice(newPos, newPos + component.count));
11279 }
11280 newPos += component.count;
11281
11282 // Common case
11283 if (!component.added) {
11284 oldPos += component.count;
11285 }
11286 } else {
11287 component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
11288 oldPos += component.count;
11289
11290 // Reverse add and remove so removes are output first to match common convention
11291 // The diffing algorithm is tied to add then remove output and this is the simplest
11292 // route to get the desired output with minimal overhead.
11293 if (componentPos && components[componentPos - 1].added) {
11294 var tmp = components[componentPos - 1];
11295 components[componentPos - 1] = components[componentPos];
11296 components[componentPos] = tmp;
11297 }
11298 }
11299 }
11300
11301 // Special case handle for when one terminal is ignored (i.e. whitespace).
11302 // For this case we merge the terminal into the prior string and drop the change.
11303 // This is only available for string mode.
11304 var lastComponent = components[componentLen - 1];
11305 if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
11306 components[componentLen - 2].value += lastComponent.value;
11307 components.pop();
11308 }
11309
11310 return components;
11311 }
11312
11313 function clonePath(path) {
11314 return { newPos: path.newPos, components: path.components.slice(0) };
11315 }
11316
11317
11318
11319/***/ }),
11320/* 2 */
11321/***/ (function(module, exports, __webpack_require__) {
11322
11323 /*istanbul ignore start*/'use strict';
11324
11325 exports.__esModule = true;
11326 exports.characterDiff = undefined;
11327 exports. /*istanbul ignore end*/diffChars = diffChars;
11328
11329 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11330
11331 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11332
11333 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11334
11335 /*istanbul ignore end*/var characterDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/characterDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11336 function diffChars(oldStr, newStr, options) {
11337 return characterDiff.diff(oldStr, newStr, options);
11338 }
11339
11340
11341
11342/***/ }),
11343/* 3 */
11344/***/ (function(module, exports, __webpack_require__) {
11345
11346 /*istanbul ignore start*/'use strict';
11347
11348 exports.__esModule = true;
11349 exports.wordDiff = undefined;
11350 exports. /*istanbul ignore end*/diffWords = diffWords;
11351 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = diffWordsWithSpace;
11352
11353 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11354
11355 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11356
11357 /*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/;
11358
11359 /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11360
11361 /*istanbul ignore end*/ // Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode
11362 //
11363 // Ranges and exceptions:
11364 // Latin-1 Supplement, 0080–00FF
11365 // - U+00D7 × Multiplication sign
11366 // - U+00F7 ÷ Division sign
11367 // Latin Extended-A, 0100–017F
11368 // Latin Extended-B, 0180–024F
11369 // IPA Extensions, 0250–02AF
11370 // Spacing Modifier Letters, 02B0–02FF
11371 // - U+02C7 ˇ &#711; Caron
11372 // - U+02D8 ˘ &#728; Breve
11373 // - U+02D9 ˙ &#729; Dot Above
11374 // - U+02DA ˚ &#730; Ring Above
11375 // - U+02DB ˛ &#731; Ogonek
11376 // - U+02DC ˜ &#732; Small Tilde
11377 // - U+02DD ˝ &#733; Double Acute Accent
11378 // Latin Extended Additional, 1E00–1EFF
11379 var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
11380
11381 var reWhitespace = /\S/;
11382
11383 var wordDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/wordDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11384 wordDiff.equals = function (left, right) {
11385 if (this.options.ignoreCase) {
11386 left = left.toLowerCase();
11387 right = right.toLowerCase();
11388 }
11389 return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
11390 };
11391 wordDiff.tokenize = function (value) {
11392 var tokens = value.split(/(\s+|\b)/);
11393
11394 // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.
11395 for (var i = 0; i < tokens.length - 1; i++) {
11396 // If we have an empty string in the next field and we have only word chars before and after, merge
11397 if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
11398 tokens[i] += tokens[i + 2];
11399 tokens.splice(i + 1, 2);
11400 i--;
11401 }
11402 }
11403
11404 return tokens;
11405 };
11406
11407 function diffWords(oldStr, newStr, options) {
11408 options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(options, { ignoreWhitespace: true });
11409 return wordDiff.diff(oldStr, newStr, options);
11410 }
11411
11412 function diffWordsWithSpace(oldStr, newStr, options) {
11413 return wordDiff.diff(oldStr, newStr, options);
11414 }
11415
11416
11417
11418/***/ }),
11419/* 4 */
11420/***/ (function(module, exports) {
11421
11422 /*istanbul ignore start*/'use strict';
11423
11424 exports.__esModule = true;
11425 exports. /*istanbul ignore end*/generateOptions = generateOptions;
11426 function generateOptions(options, defaults) {
11427 if (typeof options === 'function') {
11428 defaults.callback = options;
11429 } else if (options) {
11430 for (var name in options) {
11431 /* istanbul ignore else */
11432 if (options.hasOwnProperty(name)) {
11433 defaults[name] = options[name];
11434 }
11435 }
11436 }
11437 return defaults;
11438 }
11439
11440
11441
11442/***/ }),
11443/* 5 */
11444/***/ (function(module, exports, __webpack_require__) {
11445
11446 /*istanbul ignore start*/'use strict';
11447
11448 exports.__esModule = true;
11449 exports.lineDiff = undefined;
11450 exports. /*istanbul ignore end*/diffLines = diffLines;
11451 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = diffTrimmedLines;
11452
11453 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11454
11455 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11456
11457 /*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/;
11458
11459 /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11460
11461 /*istanbul ignore end*/var lineDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/lineDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11462 lineDiff.tokenize = function (value) {
11463 var retLines = [],
11464 linesAndNewlines = value.split(/(\n|\r\n)/);
11465
11466 // Ignore the final empty token that occurs if the string ends with a new line
11467 if (!linesAndNewlines[linesAndNewlines.length - 1]) {
11468 linesAndNewlines.pop();
11469 }
11470
11471 // Merge the content and line separators into single tokens
11472 for (var i = 0; i < linesAndNewlines.length; i++) {
11473 var line = linesAndNewlines[i];
11474
11475 if (i % 2 && !this.options.newlineIsToken) {
11476 retLines[retLines.length - 1] += line;
11477 } else {
11478 if (this.options.ignoreWhitespace) {
11479 line = line.trim();
11480 }
11481 retLines.push(line);
11482 }
11483 }
11484
11485 return retLines;
11486 };
11487
11488 function diffLines(oldStr, newStr, callback) {
11489 return lineDiff.diff(oldStr, newStr, callback);
11490 }
11491 function diffTrimmedLines(oldStr, newStr, callback) {
11492 var options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(callback, { ignoreWhitespace: true });
11493 return lineDiff.diff(oldStr, newStr, options);
11494 }
11495
11496
11497
11498/***/ }),
11499/* 6 */
11500/***/ (function(module, exports, __webpack_require__) {
11501
11502 /*istanbul ignore start*/'use strict';
11503
11504 exports.__esModule = true;
11505 exports.sentenceDiff = undefined;
11506 exports. /*istanbul ignore end*/diffSentences = diffSentences;
11507
11508 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11509
11510 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11511
11512 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11513
11514 /*istanbul ignore end*/var sentenceDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/sentenceDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11515 sentenceDiff.tokenize = function (value) {
11516 return value.split(/(\S.+?[.!?])(?=\s+|$)/);
11517 };
11518
11519 function diffSentences(oldStr, newStr, callback) {
11520 return sentenceDiff.diff(oldStr, newStr, callback);
11521 }
11522
11523
11524
11525/***/ }),
11526/* 7 */
11527/***/ (function(module, exports, __webpack_require__) {
11528
11529 /*istanbul ignore start*/'use strict';
11530
11531 exports.__esModule = true;
11532 exports.cssDiff = undefined;
11533 exports. /*istanbul ignore end*/diffCss = diffCss;
11534
11535 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11536
11537 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11538
11539 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11540
11541 /*istanbul ignore end*/var cssDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/cssDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11542 cssDiff.tokenize = function (value) {
11543 return value.split(/([{}:;,]|\s+)/);
11544 };
11545
11546 function diffCss(oldStr, newStr, callback) {
11547 return cssDiff.diff(oldStr, newStr, callback);
11548 }
11549
11550
11551
11552/***/ }),
11553/* 8 */
11554/***/ (function(module, exports, __webpack_require__) {
11555
11556 /*istanbul ignore start*/'use strict';
11557
11558 exports.__esModule = true;
11559 exports.jsonDiff = undefined;
11560
11561 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; };
11562
11563 exports. /*istanbul ignore end*/diffJson = diffJson;
11564 /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = canonicalize;
11565
11566 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11567
11568 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11569
11570 /*istanbul ignore end*/var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
11571
11572 /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11573
11574 /*istanbul ignore end*/var objectPrototypeToString = Object.prototype.toString;
11575
11576 var jsonDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/jsonDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11577 // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
11578 // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
11579 jsonDiff.useLongestToken = true;
11580
11581 jsonDiff.tokenize = /*istanbul ignore start*/_line.lineDiff /*istanbul ignore end*/.tokenize;
11582 jsonDiff.castInput = function (value) {
11583 /*istanbul ignore start*/var _options = /*istanbul ignore end*/this.options,
11584 undefinedReplacement = _options.undefinedReplacement,
11585 _options$stringifyRep = _options.stringifyReplacer,
11586 stringifyReplacer = _options$stringifyRep === undefined ? function (k, v) /*istanbul ignore start*/{
11587 return (/*istanbul ignore end*/typeof v === 'undefined' ? undefinedReplacement : v
11588 );
11589 } : _options$stringifyRep;
11590
11591
11592 return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' ');
11593 };
11594 jsonDiff.equals = function (left, right) {
11595 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'))
11596 );
11597 };
11598
11599 function diffJson(oldObj, newObj, options) {
11600 return jsonDiff.diff(oldObj, newObj, options);
11601 }
11602
11603 // This function handles the presence of circular references by bailing out when encountering an
11604 // object that is already on the "stack" of items being processed. Accepts an optional replacer
11605 function canonicalize(obj, stack, replacementStack, replacer, key) {
11606 stack = stack || [];
11607 replacementStack = replacementStack || [];
11608
11609 if (replacer) {
11610 obj = replacer(key, obj);
11611 }
11612
11613 var i = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
11614
11615 for (i = 0; i < stack.length; i += 1) {
11616 if (stack[i] === obj) {
11617 return replacementStack[i];
11618 }
11619 }
11620
11621 var canonicalizedObj = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
11622
11623 if ('[object Array]' === objectPrototypeToString.call(obj)) {
11624 stack.push(obj);
11625 canonicalizedObj = new Array(obj.length);
11626 replacementStack.push(canonicalizedObj);
11627 for (i = 0; i < obj.length; i += 1) {
11628 canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
11629 }
11630 stack.pop();
11631 replacementStack.pop();
11632 return canonicalizedObj;
11633 }
11634
11635 if (obj && obj.toJSON) {
11636 obj = obj.toJSON();
11637 }
11638
11639 if ( /*istanbul ignore start*/(typeof /*istanbul ignore end*/obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && obj !== null) {
11640 stack.push(obj);
11641 canonicalizedObj = {};
11642 replacementStack.push(canonicalizedObj);
11643 var sortedKeys = [],
11644 _key = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
11645 for (_key in obj) {
11646 /* istanbul ignore else */
11647 if (obj.hasOwnProperty(_key)) {
11648 sortedKeys.push(_key);
11649 }
11650 }
11651 sortedKeys.sort();
11652 for (i = 0; i < sortedKeys.length; i += 1) {
11653 _key = sortedKeys[i];
11654 canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
11655 }
11656 stack.pop();
11657 replacementStack.pop();
11658 } else {
11659 canonicalizedObj = obj;
11660 }
11661 return canonicalizedObj;
11662 }
11663
11664
11665
11666/***/ }),
11667/* 9 */
11668/***/ (function(module, exports, __webpack_require__) {
11669
11670 /*istanbul ignore start*/'use strict';
11671
11672 exports.__esModule = true;
11673 exports.arrayDiff = undefined;
11674 exports. /*istanbul ignore end*/diffArrays = diffArrays;
11675
11676 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11677
11678 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11679
11680 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11681
11682 /*istanbul ignore end*/var arrayDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11683 arrayDiff.tokenize = function (value) {
11684 return value.slice();
11685 };
11686 arrayDiff.join = arrayDiff.removeEmpty = function (value) {
11687 return value;
11688 };
11689
11690 function diffArrays(oldArr, newArr, callback) {
11691 return arrayDiff.diff(oldArr, newArr, callback);
11692 }
11693
11694
11695
11696/***/ }),
11697/* 10 */
11698/***/ (function(module, exports, __webpack_require__) {
11699
11700 /*istanbul ignore start*/'use strict';
11701
11702 exports.__esModule = true;
11703 exports. /*istanbul ignore end*/applyPatch = applyPatch;
11704 /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = applyPatches;
11705
11706 var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
11707
11708 var /*istanbul ignore start*/_distanceIterator = __webpack_require__(12) /*istanbul ignore end*/;
11709
11710 /*istanbul ignore start*/var _distanceIterator2 = _interopRequireDefault(_distanceIterator);
11711
11712 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11713
11714 /*istanbul ignore end*/function applyPatch(source, uniDiff) {
11715 /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
11716
11717 if (typeof uniDiff === 'string') {
11718 uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);
11719 }
11720
11721 if (Array.isArray(uniDiff)) {
11722 if (uniDiff.length > 1) {
11723 throw new Error('applyPatch only works with a single input.');
11724 }
11725
11726 uniDiff = uniDiff[0];
11727 }
11728
11729 // Apply the diff to the input
11730 var lines = source.split(/\r\n|[\n\v\f\r\x85]/),
11731 delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [],
11732 hunks = uniDiff.hunks,
11733 compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) /*istanbul ignore start*/{
11734 return (/*istanbul ignore end*/line === patchContent
11735 );
11736 },
11737 errorCount = 0,
11738 fuzzFactor = options.fuzzFactor || 0,
11739 minLine = 0,
11740 offset = 0,
11741 removeEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
11742 addEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
11743
11744 /**
11745 * Checks if the hunk exactly fits on the provided location
11746 */
11747 function hunkFits(hunk, toPos) {
11748 for (var j = 0; j < hunk.lines.length; j++) {
11749 var line = hunk.lines[j],
11750 operation = line.length > 0 ? line[0] : ' ',
11751 content = line.length > 0 ? line.substr(1) : line;
11752
11753 if (operation === ' ' || operation === '-') {
11754 // Context sanity check
11755 if (!compareLine(toPos + 1, lines[toPos], operation, content)) {
11756 errorCount++;
11757
11758 if (errorCount > fuzzFactor) {
11759 return false;
11760 }
11761 }
11762 toPos++;
11763 }
11764 }
11765
11766 return true;
11767 }
11768
11769 // Search best fit offsets for each hunk based on the previous ones
11770 for (var i = 0; i < hunks.length; i++) {
11771 var hunk = hunks[i],
11772 maxLine = lines.length - hunk.oldLines,
11773 localOffset = 0,
11774 toPos = offset + hunk.oldStart - 1;
11775
11776 var iterator = /*istanbul ignore start*/(0, _distanceIterator2['default']) /*istanbul ignore end*/(toPos, minLine, maxLine);
11777
11778 for (; localOffset !== undefined; localOffset = iterator()) {
11779 if (hunkFits(hunk, toPos + localOffset)) {
11780 hunk.offset = offset += localOffset;
11781 break;
11782 }
11783 }
11784
11785 if (localOffset === undefined) {
11786 return false;
11787 }
11788
11789 // Set lower text limit to end of the current hunk, so next ones don't try
11790 // to fit over already patched text
11791 minLine = hunk.offset + hunk.oldStart + hunk.oldLines;
11792 }
11793
11794 // Apply patch hunks
11795 var diffOffset = 0;
11796 for (var _i = 0; _i < hunks.length; _i++) {
11797 var _hunk = hunks[_i],
11798 _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1;
11799 diffOffset += _hunk.newLines - _hunk.oldLines;
11800
11801 if (_toPos < 0) {
11802 // Creating a new file
11803 _toPos = 0;
11804 }
11805
11806 for (var j = 0; j < _hunk.lines.length; j++) {
11807 var line = _hunk.lines[j],
11808 operation = line.length > 0 ? line[0] : ' ',
11809 content = line.length > 0 ? line.substr(1) : line,
11810 delimiter = _hunk.linedelimiters[j];
11811
11812 if (operation === ' ') {
11813 _toPos++;
11814 } else if (operation === '-') {
11815 lines.splice(_toPos, 1);
11816 delimiters.splice(_toPos, 1);
11817 /* istanbul ignore else */
11818 } else if (operation === '+') {
11819 lines.splice(_toPos, 0, content);
11820 delimiters.splice(_toPos, 0, delimiter);
11821 _toPos++;
11822 } else if (operation === '\\') {
11823 var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null;
11824 if (previousOperation === '+') {
11825 removeEOFNL = true;
11826 } else if (previousOperation === '-') {
11827 addEOFNL = true;
11828 }
11829 }
11830 }
11831 }
11832
11833 // Handle EOFNL insertion/removal
11834 if (removeEOFNL) {
11835 while (!lines[lines.length - 1]) {
11836 lines.pop();
11837 delimiters.pop();
11838 }
11839 } else if (addEOFNL) {
11840 lines.push('');
11841 delimiters.push('\n');
11842 }
11843 for (var _k = 0; _k < lines.length - 1; _k++) {
11844 lines[_k] = lines[_k] + delimiters[_k];
11845 }
11846 return lines.join('');
11847 }
11848
11849 // Wrapper that supports multiple file patches via callbacks.
11850 function applyPatches(uniDiff, options) {
11851 if (typeof uniDiff === 'string') {
11852 uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);
11853 }
11854
11855 var currentIndex = 0;
11856 function processIndex() {
11857 var index = uniDiff[currentIndex++];
11858 if (!index) {
11859 return options.complete();
11860 }
11861
11862 options.loadFile(index, function (err, data) {
11863 if (err) {
11864 return options.complete(err);
11865 }
11866
11867 var updatedContent = applyPatch(data, index, options);
11868 options.patched(index, updatedContent, function (err) {
11869 if (err) {
11870 return options.complete(err);
11871 }
11872
11873 processIndex();
11874 });
11875 });
11876 }
11877 processIndex();
11878 }
11879
11880
11881
11882/***/ }),
11883/* 11 */
11884/***/ (function(module, exports) {
11885
11886 /*istanbul ignore start*/'use strict';
11887
11888 exports.__esModule = true;
11889 exports. /*istanbul ignore end*/parsePatch = parsePatch;
11890 function parsePatch(uniDiff) {
11891 /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
11892
11893 var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/),
11894 delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [],
11895 list = [],
11896 i = 0;
11897
11898 function parseIndex() {
11899 var index = {};
11900 list.push(index);
11901
11902 // Parse diff metadata
11903 while (i < diffstr.length) {
11904 var line = diffstr[i];
11905
11906 // File header found, end parsing diff metadata
11907 if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) {
11908 break;
11909 }
11910
11911 // Diff index
11912 var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
11913 if (header) {
11914 index.index = header[1];
11915 }
11916
11917 i++;
11918 }
11919
11920 // Parse file headers if they are defined. Unified diff requires them, but
11921 // there's no technical issues to have an isolated hunk without file header
11922 parseFileHeader(index);
11923 parseFileHeader(index);
11924
11925 // Parse hunks
11926 index.hunks = [];
11927
11928 while (i < diffstr.length) {
11929 var _line = diffstr[i];
11930
11931 if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) {
11932 break;
11933 } else if (/^@@/.test(_line)) {
11934 index.hunks.push(parseHunk());
11935 } else if (_line && options.strict) {
11936 // Ignore unexpected content unless in strict mode
11937 throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line));
11938 } else {
11939 i++;
11940 }
11941 }
11942 }
11943
11944 // Parses the --- and +++ headers, if none are found, no lines
11945 // are consumed.
11946 function parseFileHeader(index) {
11947 var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]);
11948 if (fileHeader) {
11949 var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
11950 var data = fileHeader[2].split('\t', 2);
11951 var fileName = data[0].replace(/\\\\/g, '\\');
11952 if (/^".*"$/.test(fileName)) {
11953 fileName = fileName.substr(1, fileName.length - 2);
11954 }
11955 index[keyPrefix + 'FileName'] = fileName;
11956 index[keyPrefix + 'Header'] = (data[1] || '').trim();
11957
11958 i++;
11959 }
11960 }
11961
11962 // Parses a hunk
11963 // This assumes that we are at the start of a hunk.
11964 function parseHunk() {
11965 var chunkHeaderIndex = i,
11966 chunkHeaderLine = diffstr[i++],
11967 chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
11968
11969 var hunk = {
11970 oldStart: +chunkHeader[1],
11971 oldLines: +chunkHeader[2] || 1,
11972 newStart: +chunkHeader[3],
11973 newLines: +chunkHeader[4] || 1,
11974 lines: [],
11975 linedelimiters: []
11976 };
11977
11978 var addCount = 0,
11979 removeCount = 0;
11980 for (; i < diffstr.length; i++) {
11981 // Lines starting with '---' could be mistaken for the "remove line" operation
11982 // But they could be the header for the next file. Therefore prune such cases out.
11983 if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) {
11984 break;
11985 }
11986 var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0];
11987
11988 if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
11989 hunk.lines.push(diffstr[i]);
11990 hunk.linedelimiters.push(delimiters[i] || '\n');
11991
11992 if (operation === '+') {
11993 addCount++;
11994 } else if (operation === '-') {
11995 removeCount++;
11996 } else if (operation === ' ') {
11997 addCount++;
11998 removeCount++;
11999 }
12000 } else {
12001 break;
12002 }
12003 }
12004
12005 // Handle the empty block count case
12006 if (!addCount && hunk.newLines === 1) {
12007 hunk.newLines = 0;
12008 }
12009 if (!removeCount && hunk.oldLines === 1) {
12010 hunk.oldLines = 0;
12011 }
12012
12013 // Perform optional sanity checking
12014 if (options.strict) {
12015 if (addCount !== hunk.newLines) {
12016 throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
12017 }
12018 if (removeCount !== hunk.oldLines) {
12019 throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
12020 }
12021 }
12022
12023 return hunk;
12024 }
12025
12026 while (i < diffstr.length) {
12027 parseIndex();
12028 }
12029
12030 return list;
12031 }
12032
12033
12034
12035/***/ }),
12036/* 12 */
12037/***/ (function(module, exports) {
12038
12039 /*istanbul ignore start*/"use strict";
12040
12041 exports.__esModule = true;
12042
12043 exports["default"] = /*istanbul ignore end*/function (start, minLine, maxLine) {
12044 var wantForward = true,
12045 backwardExhausted = false,
12046 forwardExhausted = false,
12047 localOffset = 1;
12048
12049 return function iterator() {
12050 if (wantForward && !forwardExhausted) {
12051 if (backwardExhausted) {
12052 localOffset++;
12053 } else {
12054 wantForward = false;
12055 }
12056
12057 // Check if trying to fit beyond text length, and if not, check it fits
12058 // after offset location (or desired location on first iteration)
12059 if (start + localOffset <= maxLine) {
12060 return localOffset;
12061 }
12062
12063 forwardExhausted = true;
12064 }
12065
12066 if (!backwardExhausted) {
12067 if (!forwardExhausted) {
12068 wantForward = true;
12069 }
12070
12071 // Check if trying to fit before text beginning, and if not, check it fits
12072 // before offset location
12073 if (minLine <= start - localOffset) {
12074 return -localOffset++;
12075 }
12076
12077 backwardExhausted = true;
12078 return iterator();
12079 }
12080
12081 // We tried to fit hunk before text beginning and beyond text length, then
12082 // hunk can't fit on the text. Return undefined
12083 };
12084 };
12085
12086
12087
12088/***/ }),
12089/* 13 */
12090/***/ (function(module, exports, __webpack_require__) {
12091
12092 /*istanbul ignore start*/'use strict';
12093
12094 exports.__esModule = true;
12095 exports. /*istanbul ignore end*/calcLineCount = calcLineCount;
12096 /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = merge;
12097
12098 var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/;
12099
12100 var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
12101
12102 var /*istanbul ignore start*/_array = __webpack_require__(15) /*istanbul ignore end*/;
12103
12104 /*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); } }
12105
12106 /*istanbul ignore end*/function calcLineCount(hunk) {
12107 /*istanbul ignore start*/var _calcOldNewLineCount = /*istanbul ignore end*/calcOldNewLineCount(hunk.lines),
12108 oldLines = _calcOldNewLineCount.oldLines,
12109 newLines = _calcOldNewLineCount.newLines;
12110
12111 if (oldLines !== undefined) {
12112 hunk.oldLines = oldLines;
12113 } else {
12114 delete hunk.oldLines;
12115 }
12116
12117 if (newLines !== undefined) {
12118 hunk.newLines = newLines;
12119 } else {
12120 delete hunk.newLines;
12121 }
12122 }
12123
12124 function merge(mine, theirs, base) {
12125 mine = loadPatch(mine, base);
12126 theirs = loadPatch(theirs, base);
12127
12128 var ret = {};
12129
12130 // For index we just let it pass through as it doesn't have any necessary meaning.
12131 // Leaving sanity checks on this to the API consumer that may know more about the
12132 // meaning in their own context.
12133 if (mine.index || theirs.index) {
12134 ret.index = mine.index || theirs.index;
12135 }
12136
12137 if (mine.newFileName || theirs.newFileName) {
12138 if (!fileNameChanged(mine)) {
12139 // No header or no change in ours, use theirs (and ours if theirs does not exist)
12140 ret.oldFileName = theirs.oldFileName || mine.oldFileName;
12141 ret.newFileName = theirs.newFileName || mine.newFileName;
12142 ret.oldHeader = theirs.oldHeader || mine.oldHeader;
12143 ret.newHeader = theirs.newHeader || mine.newHeader;
12144 } else if (!fileNameChanged(theirs)) {
12145 // No header or no change in theirs, use ours
12146 ret.oldFileName = mine.oldFileName;
12147 ret.newFileName = mine.newFileName;
12148 ret.oldHeader = mine.oldHeader;
12149 ret.newHeader = mine.newHeader;
12150 } else {
12151 // Both changed... figure it out
12152 ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName);
12153 ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName);
12154 ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader);
12155 ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader);
12156 }
12157 }
12158
12159 ret.hunks = [];
12160
12161 var mineIndex = 0,
12162 theirsIndex = 0,
12163 mineOffset = 0,
12164 theirsOffset = 0;
12165
12166 while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) {
12167 var mineCurrent = mine.hunks[mineIndex] || { oldStart: Infinity },
12168 theirsCurrent = theirs.hunks[theirsIndex] || { oldStart: Infinity };
12169
12170 if (hunkBefore(mineCurrent, theirsCurrent)) {
12171 // This patch does not overlap with any of the others, yay.
12172 ret.hunks.push(cloneHunk(mineCurrent, mineOffset));
12173 mineIndex++;
12174 theirsOffset += mineCurrent.newLines - mineCurrent.oldLines;
12175 } else if (hunkBefore(theirsCurrent, mineCurrent)) {
12176 // This patch does not overlap with any of the others, yay.
12177 ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset));
12178 theirsIndex++;
12179 mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines;
12180 } else {
12181 // Overlap, merge as best we can
12182 var mergedHunk = {
12183 oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart),
12184 oldLines: 0,
12185 newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset),
12186 newLines: 0,
12187 lines: []
12188 };
12189 mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines);
12190 theirsIndex++;
12191 mineIndex++;
12192
12193 ret.hunks.push(mergedHunk);
12194 }
12195 }
12196
12197 return ret;
12198 }
12199
12200 function loadPatch(param, base) {
12201 if (typeof param === 'string') {
12202 if (/^@@/m.test(param) || /^Index:/m.test(param)) {
12203 return (/*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(param)[0]
12204 );
12205 }
12206
12207 if (!base) {
12208 throw new Error('Must provide a base reference or pass in a patch');
12209 }
12210 return (/*istanbul ignore start*/(0, _create.structuredPatch) /*istanbul ignore end*/(undefined, undefined, base, param)
12211 );
12212 }
12213
12214 return param;
12215 }
12216
12217 function fileNameChanged(patch) {
12218 return patch.newFileName && patch.newFileName !== patch.oldFileName;
12219 }
12220
12221 function selectField(index, mine, theirs) {
12222 if (mine === theirs) {
12223 return mine;
12224 } else {
12225 index.conflict = true;
12226 return { mine: mine, theirs: theirs };
12227 }
12228 }
12229
12230 function hunkBefore(test, check) {
12231 return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart;
12232 }
12233
12234 function cloneHunk(hunk, offset) {
12235 return {
12236 oldStart: hunk.oldStart, oldLines: hunk.oldLines,
12237 newStart: hunk.newStart + offset, newLines: hunk.newLines,
12238 lines: hunk.lines
12239 };
12240 }
12241
12242 function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) {
12243 // This will generally result in a conflicted hunk, but there are cases where the context
12244 // is the only overlap where we can successfully merge the content here.
12245 var mine = { offset: mineOffset, lines: mineLines, index: 0 },
12246 their = { offset: theirOffset, lines: theirLines, index: 0 };
12247
12248 // Handle any leading content
12249 insertLeading(hunk, mine, their);
12250 insertLeading(hunk, their, mine);
12251
12252 // Now in the overlap content. Scan through and select the best changes from each.
12253 while (mine.index < mine.lines.length && their.index < their.lines.length) {
12254 var mineCurrent = mine.lines[mine.index],
12255 theirCurrent = their.lines[their.index];
12256
12257 if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) {
12258 // Both modified ...
12259 mutualChange(hunk, mine, their);
12260 } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') {
12261 /*istanbul ignore start*/var _hunk$lines;
12262
12263 /*istanbul ignore end*/ // Mine inserted
12264 /*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)));
12265 } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') {
12266 /*istanbul ignore start*/var _hunk$lines2;
12267
12268 /*istanbul ignore end*/ // Theirs inserted
12269 /*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)));
12270 } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') {
12271 // Mine removed or edited
12272 removal(hunk, mine, their);
12273 } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') {
12274 // Their removed or edited
12275 removal(hunk, their, mine, true);
12276 } else if (mineCurrent === theirCurrent) {
12277 // Context identity
12278 hunk.lines.push(mineCurrent);
12279 mine.index++;
12280 their.index++;
12281 } else {
12282 // Context mismatch
12283 conflict(hunk, collectChange(mine), collectChange(their));
12284 }
12285 }
12286
12287 // Now push anything that may be remaining
12288 insertTrailing(hunk, mine);
12289 insertTrailing(hunk, their);
12290
12291 calcLineCount(hunk);
12292 }
12293
12294 function mutualChange(hunk, mine, their) {
12295 var myChanges = collectChange(mine),
12296 theirChanges = collectChange(their);
12297
12298 if (allRemoves(myChanges) && allRemoves(theirChanges)) {
12299 // Special case for remove changes that are supersets of one another
12300 if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) {
12301 /*istanbul ignore start*/var _hunk$lines3;
12302
12303 /*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));
12304 return;
12305 } else if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) {
12306 /*istanbul ignore start*/var _hunk$lines4;
12307
12308 /*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));
12309 return;
12310 }
12311 } else if ( /*istanbul ignore start*/(0, _array.arrayEqual) /*istanbul ignore end*/(myChanges, theirChanges)) {
12312 /*istanbul ignore start*/var _hunk$lines5;
12313
12314 /*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));
12315 return;
12316 }
12317
12318 conflict(hunk, myChanges, theirChanges);
12319 }
12320
12321 function removal(hunk, mine, their, swap) {
12322 var myChanges = collectChange(mine),
12323 theirChanges = collectContext(their, myChanges);
12324 if (theirChanges.merged) {
12325 /*istanbul ignore start*/var _hunk$lines6;
12326
12327 /*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));
12328 } else {
12329 conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges);
12330 }
12331 }
12332
12333 function conflict(hunk, mine, their) {
12334 hunk.conflict = true;
12335 hunk.lines.push({
12336 conflict: true,
12337 mine: mine,
12338 theirs: their
12339 });
12340 }
12341
12342 function insertLeading(hunk, insert, their) {
12343 while (insert.offset < their.offset && insert.index < insert.lines.length) {
12344 var line = insert.lines[insert.index++];
12345 hunk.lines.push(line);
12346 insert.offset++;
12347 }
12348 }
12349 function insertTrailing(hunk, insert) {
12350 while (insert.index < insert.lines.length) {
12351 var line = insert.lines[insert.index++];
12352 hunk.lines.push(line);
12353 }
12354 }
12355
12356 function collectChange(state) {
12357 var ret = [],
12358 operation = state.lines[state.index][0];
12359 while (state.index < state.lines.length) {
12360 var line = state.lines[state.index];
12361
12362 // Group additions that are immediately after subtractions and treat them as one "atomic" modify change.
12363 if (operation === '-' && line[0] === '+') {
12364 operation = '+';
12365 }
12366
12367 if (operation === line[0]) {
12368 ret.push(line);
12369 state.index++;
12370 } else {
12371 break;
12372 }
12373 }
12374
12375 return ret;
12376 }
12377 function collectContext(state, matchChanges) {
12378 var changes = [],
12379 merged = [],
12380 matchIndex = 0,
12381 contextChanges = false,
12382 conflicted = false;
12383 while (matchIndex < matchChanges.length && state.index < state.lines.length) {
12384 var change = state.lines[state.index],
12385 match = matchChanges[matchIndex];
12386
12387 // Once we've hit our add, then we are done
12388 if (match[0] === '+') {
12389 break;
12390 }
12391
12392 contextChanges = contextChanges || change[0] !== ' ';
12393
12394 merged.push(match);
12395 matchIndex++;
12396
12397 // Consume any additions in the other block as a conflict to attempt
12398 // to pull in the remaining context after this
12399 if (change[0] === '+') {
12400 conflicted = true;
12401
12402 while (change[0] === '+') {
12403 changes.push(change);
12404 change = state.lines[++state.index];
12405 }
12406 }
12407
12408 if (match.substr(1) === change.substr(1)) {
12409 changes.push(change);
12410 state.index++;
12411 } else {
12412 conflicted = true;
12413 }
12414 }
12415
12416 if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) {
12417 conflicted = true;
12418 }
12419
12420 if (conflicted) {
12421 return changes;
12422 }
12423
12424 while (matchIndex < matchChanges.length) {
12425 merged.push(matchChanges[matchIndex++]);
12426 }
12427
12428 return {
12429 merged: merged,
12430 changes: changes
12431 };
12432 }
12433
12434 function allRemoves(changes) {
12435 return changes.reduce(function (prev, change) {
12436 return prev && change[0] === '-';
12437 }, true);
12438 }
12439 function skipRemoveSuperset(state, removeChanges, delta) {
12440 for (var i = 0; i < delta; i++) {
12441 var changeContent = removeChanges[removeChanges.length - delta + i].substr(1);
12442 if (state.lines[state.index + i] !== ' ' + changeContent) {
12443 return false;
12444 }
12445 }
12446
12447 state.index += delta;
12448 return true;
12449 }
12450
12451 function calcOldNewLineCount(lines) {
12452 var oldLines = 0;
12453 var newLines = 0;
12454
12455 lines.forEach(function (line) {
12456 if (typeof line !== 'string') {
12457 var myCount = calcOldNewLineCount(line.mine);
12458 var theirCount = calcOldNewLineCount(line.theirs);
12459
12460 if (oldLines !== undefined) {
12461 if (myCount.oldLines === theirCount.oldLines) {
12462 oldLines += myCount.oldLines;
12463 } else {
12464 oldLines = undefined;
12465 }
12466 }
12467
12468 if (newLines !== undefined) {
12469 if (myCount.newLines === theirCount.newLines) {
12470 newLines += myCount.newLines;
12471 } else {
12472 newLines = undefined;
12473 }
12474 }
12475 } else {
12476 if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) {
12477 newLines++;
12478 }
12479 if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) {
12480 oldLines++;
12481 }
12482 }
12483 });
12484
12485 return { oldLines: oldLines, newLines: newLines };
12486 }
12487
12488
12489
12490/***/ }),
12491/* 14 */
12492/***/ (function(module, exports, __webpack_require__) {
12493
12494 /*istanbul ignore start*/'use strict';
12495
12496 exports.__esModule = true;
12497 exports. /*istanbul ignore end*/structuredPatch = structuredPatch;
12498 /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = createTwoFilesPatch;
12499 /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = createPatch;
12500
12501 var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
12502
12503 /*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); } }
12504
12505 /*istanbul ignore end*/function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
12506 if (!options) {
12507 options = {};
12508 }
12509 if (typeof options.context === 'undefined') {
12510 options.context = 4;
12511 }
12512
12513 var diff = /*istanbul ignore start*/(0, _line.diffLines) /*istanbul ignore end*/(oldStr, newStr, options);
12514 diff.push({ value: '', lines: [] }); // Append an empty value to make cleanup easier
12515
12516 function contextLines(lines) {
12517 return lines.map(function (entry) {
12518 return ' ' + entry;
12519 });
12520 }
12521
12522 var hunks = [];
12523 var oldRangeStart = 0,
12524 newRangeStart = 0,
12525 curRange = [],
12526 oldLine = 1,
12527 newLine = 1;
12528
12529 /*istanbul ignore start*/var _loop = function _loop( /*istanbul ignore end*/i) {
12530 var current = diff[i],
12531 lines = current.lines || current.value.replace(/\n$/, '').split('\n');
12532 current.lines = lines;
12533
12534 if (current.added || current.removed) {
12535 /*istanbul ignore start*/var _curRange;
12536
12537 /*istanbul ignore end*/ // If we have previous context, start with that
12538 if (!oldRangeStart) {
12539 var prev = diff[i - 1];
12540 oldRangeStart = oldLine;
12541 newRangeStart = newLine;
12542
12543 if (prev) {
12544 curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
12545 oldRangeStart -= curRange.length;
12546 newRangeStart -= curRange.length;
12547 }
12548 }
12549
12550 // Output our changes
12551 /*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) {
12552 return (current.added ? '+' : '-') + entry;
12553 })));
12554
12555 // Track the updated file position
12556 if (current.added) {
12557 newLine += lines.length;
12558 } else {
12559 oldLine += lines.length;
12560 }
12561 } else {
12562 // Identical context lines. Track line changes
12563 if (oldRangeStart) {
12564 // Close out any changes that have been output (or join overlapping)
12565 if (lines.length <= options.context * 2 && i < diff.length - 2) {
12566 /*istanbul ignore start*/var _curRange2;
12567
12568 /*istanbul ignore end*/ // Overlapping
12569 /*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)));
12570 } else {
12571 /*istanbul ignore start*/var _curRange3;
12572
12573 /*istanbul ignore end*/ // end the range and output
12574 var contextSize = Math.min(lines.length, options.context);
12575 /*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))));
12576
12577 var hunk = {
12578 oldStart: oldRangeStart,
12579 oldLines: oldLine - oldRangeStart + contextSize,
12580 newStart: newRangeStart,
12581 newLines: newLine - newRangeStart + contextSize,
12582 lines: curRange
12583 };
12584 if (i >= diff.length - 2 && lines.length <= options.context) {
12585 // EOF is inside this hunk
12586 var oldEOFNewline = /\n$/.test(oldStr);
12587 var newEOFNewline = /\n$/.test(newStr);
12588 if (lines.length == 0 && !oldEOFNewline) {
12589 // special case: old has no eol and no trailing context; no-nl can end up before adds
12590 curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file');
12591 } else if (!oldEOFNewline || !newEOFNewline) {
12592 curRange.push('\\ No newline at end of file');
12593 }
12594 }
12595 hunks.push(hunk);
12596
12597 oldRangeStart = 0;
12598 newRangeStart = 0;
12599 curRange = [];
12600 }
12601 }
12602 oldLine += lines.length;
12603 newLine += lines.length;
12604 }
12605 };
12606
12607 for (var i = 0; i < diff.length; i++) {
12608 /*istanbul ignore start*/_loop( /*istanbul ignore end*/i);
12609 }
12610
12611 return {
12612 oldFileName: oldFileName, newFileName: newFileName,
12613 oldHeader: oldHeader, newHeader: newHeader,
12614 hunks: hunks
12615 };
12616 }
12617
12618 function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
12619 var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
12620
12621 var ret = [];
12622 if (oldFileName == newFileName) {
12623 ret.push('Index: ' + oldFileName);
12624 }
12625 ret.push('===================================================================');
12626 ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader));
12627 ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
12628
12629 for (var i = 0; i < diff.hunks.length; i++) {
12630 var hunk = diff.hunks[i];
12631 ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
12632 ret.push.apply(ret, hunk.lines);
12633 }
12634
12635 return ret.join('\n') + '\n';
12636 }
12637
12638 function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
12639 return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
12640 }
12641
12642
12643
12644/***/ }),
12645/* 15 */
12646/***/ (function(module, exports) {
12647
12648 /*istanbul ignore start*/"use strict";
12649
12650 exports.__esModule = true;
12651 exports. /*istanbul ignore end*/arrayEqual = arrayEqual;
12652 /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayStartsWith = arrayStartsWith;
12653 function arrayEqual(a, b) {
12654 if (a.length !== b.length) {
12655 return false;
12656 }
12657
12658 return arrayStartsWith(a, b);
12659 }
12660
12661 function arrayStartsWith(array, start) {
12662 if (start.length > array.length) {
12663 return false;
12664 }
12665
12666 for (var i = 0; i < start.length; i++) {
12667 if (start[i] !== array[i]) {
12668 return false;
12669 }
12670 }
12671
12672 return true;
12673 }
12674
12675
12676
12677/***/ }),
12678/* 16 */
12679/***/ (function(module, exports) {
12680
12681 /*istanbul ignore start*/"use strict";
12682
12683 exports.__esModule = true;
12684 exports. /*istanbul ignore end*/convertChangesToDMP = convertChangesToDMP;
12685 // See: http://code.google.com/p/google-diff-match-patch/wiki/API
12686 function convertChangesToDMP(changes) {
12687 var ret = [],
12688 change = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
12689 operation = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
12690 for (var i = 0; i < changes.length; i++) {
12691 change = changes[i];
12692 if (change.added) {
12693 operation = 1;
12694 } else if (change.removed) {
12695 operation = -1;
12696 } else {
12697 operation = 0;
12698 }
12699
12700 ret.push([operation, change.value]);
12701 }
12702 return ret;
12703 }
12704
12705
12706
12707/***/ }),
12708/* 17 */
12709/***/ (function(module, exports) {
12710
12711 /*istanbul ignore start*/'use strict';
12712
12713 exports.__esModule = true;
12714 exports. /*istanbul ignore end*/convertChangesToXML = convertChangesToXML;
12715 function convertChangesToXML(changes) {
12716 var ret = [];
12717 for (var i = 0; i < changes.length; i++) {
12718 var change = changes[i];
12719 if (change.added) {
12720 ret.push('<ins>');
12721 } else if (change.removed) {
12722 ret.push('<del>');
12723 }
12724
12725 ret.push(escapeHTML(change.value));
12726
12727 if (change.added) {
12728 ret.push('</ins>');
12729 } else if (change.removed) {
12730 ret.push('</del>');
12731 }
12732 }
12733 return ret.join('');
12734 }
12735
12736 function escapeHTML(s) {
12737 var n = s;
12738 n = n.replace(/&/g, '&amp;');
12739 n = n.replace(/</g, '&lt;');
12740 n = n.replace(/>/g, '&gt;');
12741 n = n.replace(/"/g, '&quot;');
12742
12743 return n;
12744 }
12745
12746
12747
12748/***/ })
12749/******/ ])
12750});
12751;
12752},{}],49:[function(require,module,exports){
12753'use strict';
12754
12755var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
12756
12757module.exports = function (str) {
12758 if (typeof str !== 'string') {
12759 throw new TypeError('Expected a string');
12760 }
12761
12762 return str.replace(matchOperatorsRe, '\\$&');
12763};
12764
12765},{}],50:[function(require,module,exports){
12766// Copyright Joyent, Inc. and other Node contributors.
12767//
12768// Permission is hereby granted, free of charge, to any person obtaining a
12769// copy of this software and associated documentation files (the
12770// "Software"), to deal in the Software without restriction, including
12771// without limitation the rights to use, copy, modify, merge, publish,
12772// distribute, sublicense, and/or sell copies of the Software, and to permit
12773// persons to whom the Software is furnished to do so, subject to the
12774// following conditions:
12775//
12776// The above copyright notice and this permission notice shall be included
12777// in all copies or substantial portions of the Software.
12778//
12779// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
12780// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
12781// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
12782// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
12783// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
12784// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
12785// USE OR OTHER DEALINGS IN THE SOFTWARE.
12786
12787var objectCreate = Object.create || objectCreatePolyfill
12788var objectKeys = Object.keys || objectKeysPolyfill
12789var bind = Function.prototype.bind || functionBindPolyfill
12790
12791function EventEmitter() {
12792 if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) {
12793 this._events = objectCreate(null);
12794 this._eventsCount = 0;
12795 }
12796
12797 this._maxListeners = this._maxListeners || undefined;
12798}
12799module.exports = EventEmitter;
12800
12801// Backwards-compat with node 0.10.x
12802EventEmitter.EventEmitter = EventEmitter;
12803
12804EventEmitter.prototype._events = undefined;
12805EventEmitter.prototype._maxListeners = undefined;
12806
12807// By default EventEmitters will print a warning if more than 10 listeners are
12808// added to it. This is a useful default which helps finding memory leaks.
12809var defaultMaxListeners = 10;
12810
12811var hasDefineProperty;
12812try {
12813 var o = {};
12814 if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 });
12815 hasDefineProperty = o.x === 0;
12816} catch (err) { hasDefineProperty = false }
12817if (hasDefineProperty) {
12818 Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
12819 enumerable: true,
12820 get: function() {
12821 return defaultMaxListeners;
12822 },
12823 set: function(arg) {
12824 // check whether the input is a positive number (whose value is zero or
12825 // greater and not a NaN).
12826 if (typeof arg !== 'number' || arg < 0 || arg !== arg)
12827 throw new TypeError('"defaultMaxListeners" must be a positive number');
12828 defaultMaxListeners = arg;
12829 }
12830 });
12831} else {
12832 EventEmitter.defaultMaxListeners = defaultMaxListeners;
12833}
12834
12835// Obviously not all Emitters should be limited to 10. This function allows
12836// that to be increased. Set to zero for unlimited.
12837EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
12838 if (typeof n !== 'number' || n < 0 || isNaN(n))
12839 throw new TypeError('"n" argument must be a positive number');
12840 this._maxListeners = n;
12841 return this;
12842};
12843
12844function $getMaxListeners(that) {
12845 if (that._maxListeners === undefined)
12846 return EventEmitter.defaultMaxListeners;
12847 return that._maxListeners;
12848}
12849
12850EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
12851 return $getMaxListeners(this);
12852};
12853
12854// These standalone emit* functions are used to optimize calling of event
12855// handlers for fast cases because emit() itself often has a variable number of
12856// arguments and can be deoptimized because of that. These functions always have
12857// the same number of arguments and thus do not get deoptimized, so the code
12858// inside them can execute faster.
12859function emitNone(handler, isFn, self) {
12860 if (isFn)
12861 handler.call(self);
12862 else {
12863 var len = handler.length;
12864 var listeners = arrayClone(handler, len);
12865 for (var i = 0; i < len; ++i)
12866 listeners[i].call(self);
12867 }
12868}
12869function emitOne(handler, isFn, self, arg1) {
12870 if (isFn)
12871 handler.call(self, arg1);
12872 else {
12873 var len = handler.length;
12874 var listeners = arrayClone(handler, len);
12875 for (var i = 0; i < len; ++i)
12876 listeners[i].call(self, arg1);
12877 }
12878}
12879function emitTwo(handler, isFn, self, arg1, arg2) {
12880 if (isFn)
12881 handler.call(self, arg1, arg2);
12882 else {
12883 var len = handler.length;
12884 var listeners = arrayClone(handler, len);
12885 for (var i = 0; i < len; ++i)
12886 listeners[i].call(self, arg1, arg2);
12887 }
12888}
12889function emitThree(handler, isFn, self, arg1, arg2, arg3) {
12890 if (isFn)
12891 handler.call(self, arg1, arg2, arg3);
12892 else {
12893 var len = handler.length;
12894 var listeners = arrayClone(handler, len);
12895 for (var i = 0; i < len; ++i)
12896 listeners[i].call(self, arg1, arg2, arg3);
12897 }
12898}
12899
12900function emitMany(handler, isFn, self, args) {
12901 if (isFn)
12902 handler.apply(self, args);
12903 else {
12904 var len = handler.length;
12905 var listeners = arrayClone(handler, len);
12906 for (var i = 0; i < len; ++i)
12907 listeners[i].apply(self, args);
12908 }
12909}
12910
12911EventEmitter.prototype.emit = function emit(type) {
12912 var er, handler, len, args, i, events;
12913 var doError = (type === 'error');
12914
12915 events = this._events;
12916 if (events)
12917 doError = (doError && events.error == null);
12918 else if (!doError)
12919 return false;
12920
12921 // If there is no 'error' event listener then throw.
12922 if (doError) {
12923 if (arguments.length > 1)
12924 er = arguments[1];
12925 if (er instanceof Error) {
12926 throw er; // Unhandled 'error' event
12927 } else {
12928 // At least give some kind of context to the user
12929 var err = new Error('Unhandled "error" event. (' + er + ')');
12930 err.context = er;
12931 throw err;
12932 }
12933 return false;
12934 }
12935
12936 handler = events[type];
12937
12938 if (!handler)
12939 return false;
12940
12941 var isFn = typeof handler === 'function';
12942 len = arguments.length;
12943 switch (len) {
12944 // fast cases
12945 case 1:
12946 emitNone(handler, isFn, this);
12947 break;
12948 case 2:
12949 emitOne(handler, isFn, this, arguments[1]);
12950 break;
12951 case 3:
12952 emitTwo(handler, isFn, this, arguments[1], arguments[2]);
12953 break;
12954 case 4:
12955 emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
12956 break;
12957 // slower
12958 default:
12959 args = new Array(len - 1);
12960 for (i = 1; i < len; i++)
12961 args[i - 1] = arguments[i];
12962 emitMany(handler, isFn, this, args);
12963 }
12964
12965 return true;
12966};
12967
12968function _addListener(target, type, listener, prepend) {
12969 var m;
12970 var events;
12971 var existing;
12972
12973 if (typeof listener !== 'function')
12974 throw new TypeError('"listener" argument must be a function');
12975
12976 events = target._events;
12977 if (!events) {
12978 events = target._events = objectCreate(null);
12979 target._eventsCount = 0;
12980 } else {
12981 // To avoid recursion in the case that type === "newListener"! Before
12982 // adding it to the listeners, first emit "newListener".
12983 if (events.newListener) {
12984 target.emit('newListener', type,
12985 listener.listener ? listener.listener : listener);
12986
12987 // Re-assign `events` because a newListener handler could have caused the
12988 // this._events to be assigned to a new object
12989 events = target._events;
12990 }
12991 existing = events[type];
12992 }
12993
12994 if (!existing) {
12995 // Optimize the case of one listener. Don't need the extra array object.
12996 existing = events[type] = listener;
12997 ++target._eventsCount;
12998 } else {
12999 if (typeof existing === 'function') {
13000 // Adding the second element, need to change to array.
13001 existing = events[type] =
13002 prepend ? [listener, existing] : [existing, listener];
13003 } else {
13004 // If we've already got an array, just append.
13005 if (prepend) {
13006 existing.unshift(listener);
13007 } else {
13008 existing.push(listener);
13009 }
13010 }
13011
13012 // Check for listener leak
13013 if (!existing.warned) {
13014 m = $getMaxListeners(target);
13015 if (m && m > 0 && existing.length > m) {
13016 existing.warned = true;
13017 var w = new Error('Possible EventEmitter memory leak detected. ' +
13018 existing.length + ' "' + String(type) + '" listeners ' +
13019 'added. Use emitter.setMaxListeners() to ' +
13020 'increase limit.');
13021 w.name = 'MaxListenersExceededWarning';
13022 w.emitter = target;
13023 w.type = type;
13024 w.count = existing.length;
13025 if (typeof console === 'object' && console.warn) {
13026 console.warn('%s: %s', w.name, w.message);
13027 }
13028 }
13029 }
13030 }
13031
13032 return target;
13033}
13034
13035EventEmitter.prototype.addListener = function addListener(type, listener) {
13036 return _addListener(this, type, listener, false);
13037};
13038
13039EventEmitter.prototype.on = EventEmitter.prototype.addListener;
13040
13041EventEmitter.prototype.prependListener =
13042 function prependListener(type, listener) {
13043 return _addListener(this, type, listener, true);
13044 };
13045
13046function onceWrapper() {
13047 if (!this.fired) {
13048 this.target.removeListener(this.type, this.wrapFn);
13049 this.fired = true;
13050 switch (arguments.length) {
13051 case 0:
13052 return this.listener.call(this.target);
13053 case 1:
13054 return this.listener.call(this.target, arguments[0]);
13055 case 2:
13056 return this.listener.call(this.target, arguments[0], arguments[1]);
13057 case 3:
13058 return this.listener.call(this.target, arguments[0], arguments[1],
13059 arguments[2]);
13060 default:
13061 var args = new Array(arguments.length);
13062 for (var i = 0; i < args.length; ++i)
13063 args[i] = arguments[i];
13064 this.listener.apply(this.target, args);
13065 }
13066 }
13067}
13068
13069function _onceWrap(target, type, listener) {
13070 var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
13071 var wrapped = bind.call(onceWrapper, state);
13072 wrapped.listener = listener;
13073 state.wrapFn = wrapped;
13074 return wrapped;
13075}
13076
13077EventEmitter.prototype.once = function once(type, listener) {
13078 if (typeof listener !== 'function')
13079 throw new TypeError('"listener" argument must be a function');
13080 this.on(type, _onceWrap(this, type, listener));
13081 return this;
13082};
13083
13084EventEmitter.prototype.prependOnceListener =
13085 function prependOnceListener(type, listener) {
13086 if (typeof listener !== 'function')
13087 throw new TypeError('"listener" argument must be a function');
13088 this.prependListener(type, _onceWrap(this, type, listener));
13089 return this;
13090 };
13091
13092// Emits a 'removeListener' event if and only if the listener was removed.
13093EventEmitter.prototype.removeListener =
13094 function removeListener(type, listener) {
13095 var list, events, position, i, originalListener;
13096
13097 if (typeof listener !== 'function')
13098 throw new TypeError('"listener" argument must be a function');
13099
13100 events = this._events;
13101 if (!events)
13102 return this;
13103
13104 list = events[type];
13105 if (!list)
13106 return this;
13107
13108 if (list === listener || list.listener === listener) {
13109 if (--this._eventsCount === 0)
13110 this._events = objectCreate(null);
13111 else {
13112 delete events[type];
13113 if (events.removeListener)
13114 this.emit('removeListener', type, list.listener || listener);
13115 }
13116 } else if (typeof list !== 'function') {
13117 position = -1;
13118
13119 for (i = list.length - 1; i >= 0; i--) {
13120 if (list[i] === listener || list[i].listener === listener) {
13121 originalListener = list[i].listener;
13122 position = i;
13123 break;
13124 }
13125 }
13126
13127 if (position < 0)
13128 return this;
13129
13130 if (position === 0)
13131 list.shift();
13132 else
13133 spliceOne(list, position);
13134
13135 if (list.length === 1)
13136 events[type] = list[0];
13137
13138 if (events.removeListener)
13139 this.emit('removeListener', type, originalListener || listener);
13140 }
13141
13142 return this;
13143 };
13144
13145EventEmitter.prototype.removeAllListeners =
13146 function removeAllListeners(type) {
13147 var listeners, events, i;
13148
13149 events = this._events;
13150 if (!events)
13151 return this;
13152
13153 // not listening for removeListener, no need to emit
13154 if (!events.removeListener) {
13155 if (arguments.length === 0) {
13156 this._events = objectCreate(null);
13157 this._eventsCount = 0;
13158 } else if (events[type]) {
13159 if (--this._eventsCount === 0)
13160 this._events = objectCreate(null);
13161 else
13162 delete events[type];
13163 }
13164 return this;
13165 }
13166
13167 // emit removeListener for all listeners on all events
13168 if (arguments.length === 0) {
13169 var keys = objectKeys(events);
13170 var key;
13171 for (i = 0; i < keys.length; ++i) {
13172 key = keys[i];
13173 if (key === 'removeListener') continue;
13174 this.removeAllListeners(key);
13175 }
13176 this.removeAllListeners('removeListener');
13177 this._events = objectCreate(null);
13178 this._eventsCount = 0;
13179 return this;
13180 }
13181
13182 listeners = events[type];
13183
13184 if (typeof listeners === 'function') {
13185 this.removeListener(type, listeners);
13186 } else if (listeners) {
13187 // LIFO order
13188 for (i = listeners.length - 1; i >= 0; i--) {
13189 this.removeListener(type, listeners[i]);
13190 }
13191 }
13192
13193 return this;
13194 };
13195
13196function _listeners(target, type, unwrap) {
13197 var events = target._events;
13198
13199 if (!events)
13200 return [];
13201
13202 var evlistener = events[type];
13203 if (!evlistener)
13204 return [];
13205
13206 if (typeof evlistener === 'function')
13207 return unwrap ? [evlistener.listener || evlistener] : [evlistener];
13208
13209 return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
13210}
13211
13212EventEmitter.prototype.listeners = function listeners(type) {
13213 return _listeners(this, type, true);
13214};
13215
13216EventEmitter.prototype.rawListeners = function rawListeners(type) {
13217 return _listeners(this, type, false);
13218};
13219
13220EventEmitter.listenerCount = function(emitter, type) {
13221 if (typeof emitter.listenerCount === 'function') {
13222 return emitter.listenerCount(type);
13223 } else {
13224 return listenerCount.call(emitter, type);
13225 }
13226};
13227
13228EventEmitter.prototype.listenerCount = listenerCount;
13229function listenerCount(type) {
13230 var events = this._events;
13231
13232 if (events) {
13233 var evlistener = events[type];
13234
13235 if (typeof evlistener === 'function') {
13236 return 1;
13237 } else if (evlistener) {
13238 return evlistener.length;
13239 }
13240 }
13241
13242 return 0;
13243}
13244
13245EventEmitter.prototype.eventNames = function eventNames() {
13246 return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
13247};
13248
13249// About 1.5x faster than the two-arg version of Array#splice().
13250function spliceOne(list, index) {
13251 for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)
13252 list[i] = list[k];
13253 list.pop();
13254}
13255
13256function arrayClone(arr, n) {
13257 var copy = new Array(n);
13258 for (var i = 0; i < n; ++i)
13259 copy[i] = arr[i];
13260 return copy;
13261}
13262
13263function unwrapListeners(arr) {
13264 var ret = new Array(arr.length);
13265 for (var i = 0; i < ret.length; ++i) {
13266 ret[i] = arr[i].listener || arr[i];
13267 }
13268 return ret;
13269}
13270
13271function objectCreatePolyfill(proto) {
13272 var F = function() {};
13273 F.prototype = proto;
13274 return new F;
13275}
13276function objectKeysPolyfill(obj) {
13277 var keys = [];
13278 for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) {
13279 keys.push(k);
13280 }
13281 return k;
13282}
13283function functionBindPolyfill(context) {
13284 var fn = this;
13285 return function () {
13286 return fn.apply(context, arguments);
13287 };
13288}
13289
13290},{}],51:[function(require,module,exports){
13291'use strict';
13292
13293/* eslint no-invalid-this: 1 */
13294
13295var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
13296var slice = Array.prototype.slice;
13297var toStr = Object.prototype.toString;
13298var funcType = '[object Function]';
13299
13300module.exports = function bind(that) {
13301 var target = this;
13302 if (typeof target !== 'function' || toStr.call(target) !== funcType) {
13303 throw new TypeError(ERROR_MESSAGE + target);
13304 }
13305 var args = slice.call(arguments, 1);
13306
13307 var bound;
13308 var binder = function () {
13309 if (this instanceof bound) {
13310 var result = target.apply(
13311 this,
13312 args.concat(slice.call(arguments))
13313 );
13314 if (Object(result) === result) {
13315 return result;
13316 }
13317 return this;
13318 } else {
13319 return target.apply(
13320 that,
13321 args.concat(slice.call(arguments))
13322 );
13323 }
13324 };
13325
13326 var boundLength = Math.max(0, target.length - args.length);
13327 var boundArgs = [];
13328 for (var i = 0; i < boundLength; i++) {
13329 boundArgs.push('$' + i);
13330 }
13331
13332 bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
13333
13334 if (target.prototype) {
13335 var Empty = function Empty() {};
13336 Empty.prototype = target.prototype;
13337 bound.prototype = new Empty();
13338 Empty.prototype = null;
13339 }
13340
13341 return bound;
13342};
13343
13344},{}],52:[function(require,module,exports){
13345'use strict';
13346
13347var implementation = require('./implementation');
13348
13349module.exports = Function.prototype.bind || implementation;
13350
13351},{"./implementation":51}],53:[function(require,module,exports){
13352'use strict';
13353
13354/* eslint complexity: [2, 17], max-statements: [2, 33] */
13355module.exports = function hasSymbols() {
13356 if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
13357 if (typeof Symbol.iterator === 'symbol') { return true; }
13358
13359 var obj = {};
13360 var sym = Symbol('test');
13361 var symObj = Object(sym);
13362 if (typeof sym === 'string') { return false; }
13363
13364 if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
13365 if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
13366
13367 // temp disabled per https://github.com/ljharb/object.assign/issues/17
13368 // if (sym instanceof Symbol) { return false; }
13369 // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
13370 // if (!(symObj instanceof Symbol)) { return false; }
13371
13372 // if (typeof Symbol.prototype.toString !== 'function') { return false; }
13373 // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
13374
13375 var symVal = 42;
13376 obj[sym] = symVal;
13377 for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax
13378 if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
13379
13380 if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
13381
13382 var syms = Object.getOwnPropertySymbols(obj);
13383 if (syms.length !== 1 || syms[0] !== sym) { return false; }
13384
13385 if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
13386
13387 if (typeof Object.getOwnPropertyDescriptor === 'function') {
13388 var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
13389 if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
13390 }
13391
13392 return true;
13393};
13394
13395},{}],54:[function(require,module,exports){
13396(function (global){
13397/*! https://mths.be/he v1.2.0 by @mathias | MIT license */
13398;(function(root) {
13399
13400 // Detect free variables `exports`.
13401 var freeExports = typeof exports == 'object' && exports;
13402
13403 // Detect free variable `module`.
13404 var freeModule = typeof module == 'object' && module &&
13405 module.exports == freeExports && module;
13406
13407 // Detect free variable `global`, from Node.js or Browserified code,
13408 // and use it as `root`.
13409 var freeGlobal = typeof global == 'object' && global;
13410 if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
13411 root = freeGlobal;
13412 }
13413
13414 /*--------------------------------------------------------------------------*/
13415
13416 // All astral symbols.
13417 var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
13418 // All ASCII symbols (not just printable ASCII) except those listed in the
13419 // first column of the overrides table.
13420 // https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides
13421 var regexAsciiWhitelist = /[\x01-\x7F]/g;
13422 // All BMP symbols that are not ASCII newlines, printable ASCII symbols, or
13423 // code points listed in the first column of the overrides table on
13424 // https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides.
13425 var regexBmpWhitelist = /[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g;
13426
13427 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;
13428 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'};
13429
13430 var regexEscape = /["&'<>`]/g;
13431 var escapeMap = {
13432 '"': '&quot;',
13433 '&': '&amp;',
13434 '\'': '&#x27;',
13435 '<': '&lt;',
13436 // See https://mathiasbynens.be/notes/ambiguous-ampersands: in HTML, the
13437 // following is not strictly necessary unless it’s part of a tag or an
13438 // unquoted attribute value. We’re only escaping it to support those
13439 // situations, and for XML support.
13440 '>': '&gt;',
13441 // In Internet Explorer ≤ 8, the backtick character can be used
13442 // to break out of (un)quoted attribute values or HTML comments.
13443 // See http://html5sec.org/#102, http://html5sec.org/#108, and
13444 // http://html5sec.org/#133.
13445 '`': '&#x60;'
13446 };
13447
13448 var regexInvalidEntity = /&#(?:[xX][^a-fA-F0-9]|[^0-9xX])/;
13449 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]/;
13450 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;
13451 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'};
13452 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'};
13453 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'};
13454 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];
13455
13456 /*--------------------------------------------------------------------------*/
13457
13458 var stringFromCharCode = String.fromCharCode;
13459
13460 var object = {};
13461 var hasOwnProperty = object.hasOwnProperty;
13462 var has = function(object, propertyName) {
13463 return hasOwnProperty.call(object, propertyName);
13464 };
13465
13466 var contains = function(array, value) {
13467 var index = -1;
13468 var length = array.length;
13469 while (++index < length) {
13470 if (array[index] == value) {
13471 return true;
13472 }
13473 }
13474 return false;
13475 };
13476
13477 var merge = function(options, defaults) {
13478 if (!options) {
13479 return defaults;
13480 }
13481 var result = {};
13482 var key;
13483 for (key in defaults) {
13484 // A `hasOwnProperty` check is not needed here, since only recognized
13485 // option names are used anyway. Any others are ignored.
13486 result[key] = has(options, key) ? options[key] : defaults[key];
13487 }
13488 return result;
13489 };
13490
13491 // Modified version of `ucs2encode`; see https://mths.be/punycode.
13492 var codePointToSymbol = function(codePoint, strict) {
13493 var output = '';
13494 if ((codePoint >= 0xD800 && codePoint <= 0xDFFF) || codePoint > 0x10FFFF) {
13495 // See issue #4:
13496 // “Otherwise, if the number is in the range 0xD800 to 0xDFFF or is
13497 // greater than 0x10FFFF, then this is a parse error. Return a U+FFFD
13498 // REPLACEMENT CHARACTER.”
13499 if (strict) {
13500 parseError('character reference outside the permissible Unicode range');
13501 }
13502 return '\uFFFD';
13503 }
13504 if (has(decodeMapNumeric, codePoint)) {
13505 if (strict) {
13506 parseError('disallowed character reference');
13507 }
13508 return decodeMapNumeric[codePoint];
13509 }
13510 if (strict && contains(invalidReferenceCodePoints, codePoint)) {
13511 parseError('disallowed character reference');
13512 }
13513 if (codePoint > 0xFFFF) {
13514 codePoint -= 0x10000;
13515 output += stringFromCharCode(codePoint >>> 10 & 0x3FF | 0xD800);
13516 codePoint = 0xDC00 | codePoint & 0x3FF;
13517 }
13518 output += stringFromCharCode(codePoint);
13519 return output;
13520 };
13521
13522 var hexEscape = function(codePoint) {
13523 return '&#x' + codePoint.toString(16).toUpperCase() + ';';
13524 };
13525
13526 var decEscape = function(codePoint) {
13527 return '&#' + codePoint + ';';
13528 };
13529
13530 var parseError = function(message) {
13531 throw Error('Parse error: ' + message);
13532 };
13533
13534 /*--------------------------------------------------------------------------*/
13535
13536 var encode = function(string, options) {
13537 options = merge(options, encode.options);
13538 var strict = options.strict;
13539 if (strict && regexInvalidRawCodePoint.test(string)) {
13540 parseError('forbidden code point');
13541 }
13542 var encodeEverything = options.encodeEverything;
13543 var useNamedReferences = options.useNamedReferences;
13544 var allowUnsafeSymbols = options.allowUnsafeSymbols;
13545 var escapeCodePoint = options.decimal ? decEscape : hexEscape;
13546
13547 var escapeBmpSymbol = function(symbol) {
13548 return escapeCodePoint(symbol.charCodeAt(0));
13549 };
13550
13551 if (encodeEverything) {
13552 // Encode ASCII symbols.
13553 string = string.replace(regexAsciiWhitelist, function(symbol) {
13554 // Use named references if requested & possible.
13555 if (useNamedReferences && has(encodeMap, symbol)) {
13556 return '&' + encodeMap[symbol] + ';';
13557 }
13558 return escapeBmpSymbol(symbol);
13559 });
13560 // Shorten a few escapes that represent two symbols, of which at least one
13561 // is within the ASCII range.
13562 if (useNamedReferences) {
13563 string = string
13564 .replace(/&gt;\u20D2/g, '&nvgt;')
13565 .replace(/&lt;\u20D2/g, '&nvlt;')
13566 .replace(/&#x66;&#x6A;/g, '&fjlig;');
13567 }
13568 // Encode non-ASCII symbols.
13569 if (useNamedReferences) {
13570 // Encode non-ASCII symbols that can be replaced with a named reference.
13571 string = string.replace(regexEncodeNonAscii, function(string) {
13572 // Note: there is no need to check `has(encodeMap, string)` here.
13573 return '&' + encodeMap[string] + ';';
13574 });
13575 }
13576 // Note: any remaining non-ASCII symbols are handled outside of the `if`.
13577 } else if (useNamedReferences) {
13578 // Apply named character references.
13579 // Encode `<>"'&` using named character references.
13580 if (!allowUnsafeSymbols) {
13581 string = string.replace(regexEscape, function(string) {
13582 return '&' + encodeMap[string] + ';'; // no need to check `has()` here
13583 });
13584 }
13585 // Shorten escapes that represent two symbols, of which at least one is
13586 // `<>"'&`.
13587 string = string
13588 .replace(/&gt;\u20D2/g, '&nvgt;')
13589 .replace(/&lt;\u20D2/g, '&nvlt;');
13590 // Encode non-ASCII symbols that can be replaced with a named reference.
13591 string = string.replace(regexEncodeNonAscii, function(string) {
13592 // Note: there is no need to check `has(encodeMap, string)` here.
13593 return '&' + encodeMap[string] + ';';
13594 });
13595 } else if (!allowUnsafeSymbols) {
13596 // Encode `<>"'&` using hexadecimal escapes, now that they’re not handled
13597 // using named character references.
13598 string = string.replace(regexEscape, escapeBmpSymbol);
13599 }
13600 return string
13601 // Encode astral symbols.
13602 .replace(regexAstralSymbols, function($0) {
13603 // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
13604 var high = $0.charCodeAt(0);
13605 var low = $0.charCodeAt(1);
13606 var codePoint = (high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000;
13607 return escapeCodePoint(codePoint);
13608 })
13609 // Encode any remaining BMP symbols that are not printable ASCII symbols
13610 // using a hexadecimal escape.
13611 .replace(regexBmpWhitelist, escapeBmpSymbol);
13612 };
13613 // Expose default options (so they can be overridden globally).
13614 encode.options = {
13615 'allowUnsafeSymbols': false,
13616 'encodeEverything': false,
13617 'strict': false,
13618 'useNamedReferences': false,
13619 'decimal' : false
13620 };
13621
13622 var decode = function(html, options) {
13623 options = merge(options, decode.options);
13624 var strict = options.strict;
13625 if (strict && regexInvalidEntity.test(html)) {
13626 parseError('malformed character reference');
13627 }
13628 return html.replace(regexDecode, function($0, $1, $2, $3, $4, $5, $6, $7, $8) {
13629 var codePoint;
13630 var semicolon;
13631 var decDigits;
13632 var hexDigits;
13633 var reference;
13634 var next;
13635
13636 if ($1) {
13637 reference = $1;
13638 // Note: there is no need to check `has(decodeMap, reference)`.
13639 return decodeMap[reference];
13640 }
13641
13642 if ($2) {
13643 // Decode named character references without trailing `;`, e.g. `&amp`.
13644 // This is only a parse error if it gets converted to `&`, or if it is
13645 // followed by `=` in an attribute context.
13646 reference = $2;
13647 next = $3;
13648 if (next && options.isAttributeValue) {
13649 if (strict && next == '=') {
13650 parseError('`&` did not start a character reference');
13651 }
13652 return $0;
13653 } else {
13654 if (strict) {
13655 parseError(
13656 'named character reference was not terminated by a semicolon'
13657 );
13658 }
13659 // Note: there is no need to check `has(decodeMapLegacy, reference)`.
13660 return decodeMapLegacy[reference] + (next || '');
13661 }
13662 }
13663
13664 if ($4) {
13665 // Decode decimal escapes, e.g. `&#119558;`.
13666 decDigits = $4;
13667 semicolon = $5;
13668 if (strict && !semicolon) {
13669 parseError('character reference was not terminated by a semicolon');
13670 }
13671 codePoint = parseInt(decDigits, 10);
13672 return codePointToSymbol(codePoint, strict);
13673 }
13674
13675 if ($6) {
13676 // Decode hexadecimal escapes, e.g. `&#x1D306;`.
13677 hexDigits = $6;
13678 semicolon = $7;
13679 if (strict && !semicolon) {
13680 parseError('character reference was not terminated by a semicolon');
13681 }
13682 codePoint = parseInt(hexDigits, 16);
13683 return codePointToSymbol(codePoint, strict);
13684 }
13685
13686 // If we’re still here, `if ($7)` is implied; it’s an ambiguous
13687 // ampersand for sure. https://mths.be/notes/ambiguous-ampersands
13688 if (strict) {
13689 parseError(
13690 'named character reference was not terminated by a semicolon'
13691 );
13692 }
13693 return $0;
13694 });
13695 };
13696 // Expose default options (so they can be overridden globally).
13697 decode.options = {
13698 'isAttributeValue': false,
13699 'strict': false
13700 };
13701
13702 var escape = function(string) {
13703 return string.replace(regexEscape, function($0) {
13704 // Note: there is no need to check `has(escapeMap, $0)` here.
13705 return escapeMap[$0];
13706 });
13707 };
13708
13709 /*--------------------------------------------------------------------------*/
13710
13711 var he = {
13712 'version': '1.2.0',
13713 'encode': encode,
13714 'decode': decode,
13715 'escape': escape,
13716 'unescape': decode
13717 };
13718
13719 // Some AMD build optimizers, like r.js, check for specific condition patterns
13720 // like the following:
13721 if (
13722 false
13723 ) {
13724 define(function() {
13725 return he;
13726 });
13727 } else if (freeExports && !freeExports.nodeType) {
13728 if (freeModule) { // in Node.js, io.js, or RingoJS v0.8.0+
13729 freeModule.exports = he;
13730 } else { // in Narwhal or RingoJS v0.7.0-
13731 for (var key in he) {
13732 has(he, key) && (freeExports[key] = he[key]);
13733 }
13734 }
13735 } else { // in Rhino or a web browser
13736 root.he = he;
13737 }
13738
13739}(this));
13740
13741}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
13742},{}],55:[function(require,module,exports){
13743exports.read = function (buffer, offset, isLE, mLen, nBytes) {
13744 var e, m
13745 var eLen = (nBytes * 8) - mLen - 1
13746 var eMax = (1 << eLen) - 1
13747 var eBias = eMax >> 1
13748 var nBits = -7
13749 var i = isLE ? (nBytes - 1) : 0
13750 var d = isLE ? -1 : 1
13751 var s = buffer[offset + i]
13752
13753 i += d
13754
13755 e = s & ((1 << (-nBits)) - 1)
13756 s >>= (-nBits)
13757 nBits += eLen
13758 for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
13759
13760 m = e & ((1 << (-nBits)) - 1)
13761 e >>= (-nBits)
13762 nBits += mLen
13763 for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
13764
13765 if (e === 0) {
13766 e = 1 - eBias
13767 } else if (e === eMax) {
13768 return m ? NaN : ((s ? -1 : 1) * Infinity)
13769 } else {
13770 m = m + Math.pow(2, mLen)
13771 e = e - eBias
13772 }
13773 return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
13774}
13775
13776exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
13777 var e, m, c
13778 var eLen = (nBytes * 8) - mLen - 1
13779 var eMax = (1 << eLen) - 1
13780 var eBias = eMax >> 1
13781 var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
13782 var i = isLE ? 0 : (nBytes - 1)
13783 var d = isLE ? 1 : -1
13784 var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
13785
13786 value = Math.abs(value)
13787
13788 if (isNaN(value) || value === Infinity) {
13789 m = isNaN(value) ? 1 : 0
13790 e = eMax
13791 } else {
13792 e = Math.floor(Math.log(value) / Math.LN2)
13793 if (value * (c = Math.pow(2, -e)) < 1) {
13794 e--
13795 c *= 2
13796 }
13797 if (e + eBias >= 1) {
13798 value += rt / c
13799 } else {
13800 value += rt * Math.pow(2, 1 - eBias)
13801 }
13802 if (value * c >= 2) {
13803 e++
13804 c /= 2
13805 }
13806
13807 if (e + eBias >= eMax) {
13808 m = 0
13809 e = eMax
13810 } else if (e + eBias >= 1) {
13811 m = ((value * c) - 1) * Math.pow(2, mLen)
13812 e = e + eBias
13813 } else {
13814 m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
13815 e = 0
13816 }
13817 }
13818
13819 for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
13820
13821 e = (e << mLen) | m
13822 eLen += mLen
13823 for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
13824
13825 buffer[offset + i - d] |= s * 128
13826}
13827
13828},{}],56:[function(require,module,exports){
13829if (typeof Object.create === 'function') {
13830 // implementation from standard node.js 'util' module
13831 module.exports = function inherits(ctor, superCtor) {
13832 ctor.super_ = superCtor
13833 ctor.prototype = Object.create(superCtor.prototype, {
13834 constructor: {
13835 value: ctor,
13836 enumerable: false,
13837 writable: true,
13838 configurable: true
13839 }
13840 });
13841 };
13842} else {
13843 // old school shim for old browsers
13844 module.exports = function inherits(ctor, superCtor) {
13845 ctor.super_ = superCtor
13846 var TempCtor = function () {}
13847 TempCtor.prototype = superCtor.prototype
13848 ctor.prototype = new TempCtor()
13849 ctor.prototype.constructor = ctor
13850 }
13851}
13852
13853},{}],57:[function(require,module,exports){
13854/*!
13855 * Determine if an object is a Buffer
13856 *
13857 * @author Feross Aboukhadijeh <https://feross.org>
13858 * @license MIT
13859 */
13860
13861// The _isBuffer check is for Safari 5-7 support, because it's missing
13862// Object.prototype.constructor. Remove this eventually
13863module.exports = function (obj) {
13864 return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
13865}
13866
13867function isBuffer (obj) {
13868 return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
13869}
13870
13871// For Node v0.10 support. Remove this eventually.
13872function isSlowBuffer (obj) {
13873 return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
13874}
13875
13876},{}],58:[function(require,module,exports){
13877var toString = {}.toString;
13878
13879module.exports = Array.isArray || function (arr) {
13880 return toString.call(arr) == '[object Array]';
13881};
13882
13883},{}],59:[function(require,module,exports){
13884(function (process){
13885var path = require('path');
13886var fs = require('fs');
13887var _0777 = parseInt('0777', 8);
13888
13889module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
13890
13891function mkdirP (p, opts, f, made) {
13892 if (typeof opts === 'function') {
13893 f = opts;
13894 opts = {};
13895 }
13896 else if (!opts || typeof opts !== 'object') {
13897 opts = { mode: opts };
13898 }
13899
13900 var mode = opts.mode;
13901 var xfs = opts.fs || fs;
13902
13903 if (mode === undefined) {
13904 mode = _0777 & (~process.umask());
13905 }
13906 if (!made) made = null;
13907
13908 var cb = f || function () {};
13909 p = path.resolve(p);
13910
13911 xfs.mkdir(p, mode, function (er) {
13912 if (!er) {
13913 made = made || p;
13914 return cb(null, made);
13915 }
13916 switch (er.code) {
13917 case 'ENOENT':
13918 mkdirP(path.dirname(p), opts, function (er, made) {
13919 if (er) cb(er, made);
13920 else mkdirP(p, opts, cb, made);
13921 });
13922 break;
13923
13924 // In the case of any other error, just see if there's a dir
13925 // there already. If so, then hooray! If not, then something
13926 // is borked.
13927 default:
13928 xfs.stat(p, function (er2, stat) {
13929 // if the stat fails, then that's super weird.
13930 // let the original error be the failure reason.
13931 if (er2 || !stat.isDirectory()) cb(er, made)
13932 else cb(null, made);
13933 });
13934 break;
13935 }
13936 });
13937}
13938
13939mkdirP.sync = function sync (p, opts, made) {
13940 if (!opts || typeof opts !== 'object') {
13941 opts = { mode: opts };
13942 }
13943
13944 var mode = opts.mode;
13945 var xfs = opts.fs || fs;
13946
13947 if (mode === undefined) {
13948 mode = _0777 & (~process.umask());
13949 }
13950 if (!made) made = null;
13951
13952 p = path.resolve(p);
13953
13954 try {
13955 xfs.mkdirSync(p, mode);
13956 made = made || p;
13957 }
13958 catch (err0) {
13959 switch (err0.code) {
13960 case 'ENOENT' :
13961 made = sync(path.dirname(p), opts, made);
13962 sync(p, opts, made);
13963 break;
13964
13965 // In the case of any other error, just see if there's a dir
13966 // there already. If so, then hooray! If not, then something
13967 // is borked.
13968 default:
13969 var stat;
13970 try {
13971 stat = xfs.statSync(p);
13972 }
13973 catch (err1) {
13974 throw err0;
13975 }
13976 if (!stat.isDirectory()) throw err0;
13977 break;
13978 }
13979 }
13980
13981 return made;
13982};
13983
13984}).call(this,require('_process'))
13985},{"_process":69,"fs":42,"path":42}],60:[function(require,module,exports){
13986/**
13987 * Helpers.
13988 */
13989
13990var s = 1000;
13991var m = s * 60;
13992var h = m * 60;
13993var d = h * 24;
13994var w = d * 7;
13995var y = d * 365.25;
13996
13997/**
13998 * Parse or format the given `val`.
13999 *
14000 * Options:
14001 *
14002 * - `long` verbose formatting [false]
14003 *
14004 * @param {String|Number} val
14005 * @param {Object} [options]
14006 * @throws {Error} throw an error if val is not a non-empty string or a number
14007 * @return {String|Number}
14008 * @api public
14009 */
14010
14011module.exports = function(val, options) {
14012 options = options || {};
14013 var type = typeof val;
14014 if (type === 'string' && val.length > 0) {
14015 return parse(val);
14016 } else if (type === 'number' && isNaN(val) === false) {
14017 return options.long ? fmtLong(val) : fmtShort(val);
14018 }
14019 throw new Error(
14020 'val is not a non-empty string or a valid number. val=' +
14021 JSON.stringify(val)
14022 );
14023};
14024
14025/**
14026 * Parse the given `str` and return milliseconds.
14027 *
14028 * @param {String} str
14029 * @return {Number}
14030 * @api private
14031 */
14032
14033function parse(str) {
14034 str = String(str);
14035 if (str.length > 100) {
14036 return;
14037 }
14038 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(
14039 str
14040 );
14041 if (!match) {
14042 return;
14043 }
14044 var n = parseFloat(match[1]);
14045 var type = (match[2] || 'ms').toLowerCase();
14046 switch (type) {
14047 case 'years':
14048 case 'year':
14049 case 'yrs':
14050 case 'yr':
14051 case 'y':
14052 return n * y;
14053 case 'weeks':
14054 case 'week':
14055 case 'w':
14056 return n * w;
14057 case 'days':
14058 case 'day':
14059 case 'd':
14060 return n * d;
14061 case 'hours':
14062 case 'hour':
14063 case 'hrs':
14064 case 'hr':
14065 case 'h':
14066 return n * h;
14067 case 'minutes':
14068 case 'minute':
14069 case 'mins':
14070 case 'min':
14071 case 'm':
14072 return n * m;
14073 case 'seconds':
14074 case 'second':
14075 case 'secs':
14076 case 'sec':
14077 case 's':
14078 return n * s;
14079 case 'milliseconds':
14080 case 'millisecond':
14081 case 'msecs':
14082 case 'msec':
14083 case 'ms':
14084 return n;
14085 default:
14086 return undefined;
14087 }
14088}
14089
14090/**
14091 * Short format for `ms`.
14092 *
14093 * @param {Number} ms
14094 * @return {String}
14095 * @api private
14096 */
14097
14098function fmtShort(ms) {
14099 var msAbs = Math.abs(ms);
14100 if (msAbs >= d) {
14101 return Math.round(ms / d) + 'd';
14102 }
14103 if (msAbs >= h) {
14104 return Math.round(ms / h) + 'h';
14105 }
14106 if (msAbs >= m) {
14107 return Math.round(ms / m) + 'm';
14108 }
14109 if (msAbs >= s) {
14110 return Math.round(ms / s) + 's';
14111 }
14112 return ms + 'ms';
14113}
14114
14115/**
14116 * Long format for `ms`.
14117 *
14118 * @param {Number} ms
14119 * @return {String}
14120 * @api private
14121 */
14122
14123function fmtLong(ms) {
14124 var msAbs = Math.abs(ms);
14125 if (msAbs >= d) {
14126 return plural(ms, msAbs, d, 'day');
14127 }
14128 if (msAbs >= h) {
14129 return plural(ms, msAbs, h, 'hour');
14130 }
14131 if (msAbs >= m) {
14132 return plural(ms, msAbs, m, 'minute');
14133 }
14134 if (msAbs >= s) {
14135 return plural(ms, msAbs, s, 'second');
14136 }
14137 return ms + ' ms';
14138}
14139
14140/**
14141 * Pluralization helper.
14142 */
14143
14144function plural(ms, msAbs, n, name) {
14145 var isPlural = msAbs >= n * 1.5;
14146 return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
14147}
14148
14149},{}],61:[function(require,module,exports){
14150'use strict';
14151
14152var keysShim;
14153if (!Object.keys) {
14154 // modified from https://github.com/es-shims/es5-shim
14155 var has = Object.prototype.hasOwnProperty;
14156 var toStr = Object.prototype.toString;
14157 var isArgs = require('./isArguments'); // eslint-disable-line global-require
14158 var isEnumerable = Object.prototype.propertyIsEnumerable;
14159 var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
14160 var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
14161 var dontEnums = [
14162 'toString',
14163 'toLocaleString',
14164 'valueOf',
14165 'hasOwnProperty',
14166 'isPrototypeOf',
14167 'propertyIsEnumerable',
14168 'constructor'
14169 ];
14170 var equalsConstructorPrototype = function (o) {
14171 var ctor = o.constructor;
14172 return ctor && ctor.prototype === o;
14173 };
14174 var excludedKeys = {
14175 $applicationCache: true,
14176 $console: true,
14177 $external: true,
14178 $frame: true,
14179 $frameElement: true,
14180 $frames: true,
14181 $innerHeight: true,
14182 $innerWidth: true,
14183 $outerHeight: true,
14184 $outerWidth: true,
14185 $pageXOffset: true,
14186 $pageYOffset: true,
14187 $parent: true,
14188 $scrollLeft: true,
14189 $scrollTop: true,
14190 $scrollX: true,
14191 $scrollY: true,
14192 $self: true,
14193 $webkitIndexedDB: true,
14194 $webkitStorageInfo: true,
14195 $window: true
14196 };
14197 var hasAutomationEqualityBug = (function () {
14198 /* global window */
14199 if (typeof window === 'undefined') { return false; }
14200 for (var k in window) {
14201 try {
14202 if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
14203 try {
14204 equalsConstructorPrototype(window[k]);
14205 } catch (e) {
14206 return true;
14207 }
14208 }
14209 } catch (e) {
14210 return true;
14211 }
14212 }
14213 return false;
14214 }());
14215 var equalsConstructorPrototypeIfNotBuggy = function (o) {
14216 /* global window */
14217 if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
14218 return equalsConstructorPrototype(o);
14219 }
14220 try {
14221 return equalsConstructorPrototype(o);
14222 } catch (e) {
14223 return false;
14224 }
14225 };
14226
14227 keysShim = function keys(object) {
14228 var isObject = object !== null && typeof object === 'object';
14229 var isFunction = toStr.call(object) === '[object Function]';
14230 var isArguments = isArgs(object);
14231 var isString = isObject && toStr.call(object) === '[object String]';
14232 var theKeys = [];
14233
14234 if (!isObject && !isFunction && !isArguments) {
14235 throw new TypeError('Object.keys called on a non-object');
14236 }
14237
14238 var skipProto = hasProtoEnumBug && isFunction;
14239 if (isString && object.length > 0 && !has.call(object, 0)) {
14240 for (var i = 0; i < object.length; ++i) {
14241 theKeys.push(String(i));
14242 }
14243 }
14244
14245 if (isArguments && object.length > 0) {
14246 for (var j = 0; j < object.length; ++j) {
14247 theKeys.push(String(j));
14248 }
14249 } else {
14250 for (var name in object) {
14251 if (!(skipProto && name === 'prototype') && has.call(object, name)) {
14252 theKeys.push(String(name));
14253 }
14254 }
14255 }
14256
14257 if (hasDontEnumBug) {
14258 var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
14259
14260 for (var k = 0; k < dontEnums.length; ++k) {
14261 if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
14262 theKeys.push(dontEnums[k]);
14263 }
14264 }
14265 }
14266 return theKeys;
14267 };
14268}
14269module.exports = keysShim;
14270
14271},{"./isArguments":63}],62:[function(require,module,exports){
14272'use strict';
14273
14274var slice = Array.prototype.slice;
14275var isArgs = require('./isArguments');
14276
14277var origKeys = Object.keys;
14278var keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation');
14279
14280var originalKeys = Object.keys;
14281
14282keysShim.shim = function shimObjectKeys() {
14283 if (Object.keys) {
14284 var keysWorksWithArguments = (function () {
14285 // Safari 5.0 bug
14286 var args = Object.keys(arguments);
14287 return args && args.length === arguments.length;
14288 }(1, 2));
14289 if (!keysWorksWithArguments) {
14290 Object.keys = function keys(object) { // eslint-disable-line func-name-matching
14291 if (isArgs(object)) {
14292 return originalKeys(slice.call(object));
14293 }
14294 return originalKeys(object);
14295 };
14296 }
14297 } else {
14298 Object.keys = keysShim;
14299 }
14300 return Object.keys || keysShim;
14301};
14302
14303module.exports = keysShim;
14304
14305},{"./implementation":61,"./isArguments":63}],63:[function(require,module,exports){
14306'use strict';
14307
14308var toStr = Object.prototype.toString;
14309
14310module.exports = function isArguments(value) {
14311 var str = toStr.call(value);
14312 var isArgs = str === '[object Arguments]';
14313 if (!isArgs) {
14314 isArgs = str !== '[object Array]' &&
14315 value !== null &&
14316 typeof value === 'object' &&
14317 typeof value.length === 'number' &&
14318 value.length >= 0 &&
14319 toStr.call(value.callee) === '[object Function]';
14320 }
14321 return isArgs;
14322};
14323
14324},{}],64:[function(require,module,exports){
14325'use strict';
14326
14327// modified from https://github.com/es-shims/es6-shim
14328var keys = require('object-keys');
14329var bind = require('function-bind');
14330var canBeObject = function (obj) {
14331 return typeof obj !== 'undefined' && obj !== null;
14332};
14333var hasSymbols = require('has-symbols/shams')();
14334var toObject = Object;
14335var push = bind.call(Function.call, Array.prototype.push);
14336var propIsEnumerable = bind.call(Function.call, Object.prototype.propertyIsEnumerable);
14337var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;
14338
14339module.exports = function assign(target, source1) {
14340 if (!canBeObject(target)) { throw new TypeError('target must be an object'); }
14341 var objTarget = toObject(target);
14342 var s, source, i, props, syms, value, key;
14343 for (s = 1; s < arguments.length; ++s) {
14344 source = toObject(arguments[s]);
14345 props = keys(source);
14346 var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);
14347 if (getSymbols) {
14348 syms = getSymbols(source);
14349 for (i = 0; i < syms.length; ++i) {
14350 key = syms[i];
14351 if (propIsEnumerable(source, key)) {
14352 push(props, key);
14353 }
14354 }
14355 }
14356 for (i = 0; i < props.length; ++i) {
14357 key = props[i];
14358 value = source[key];
14359 if (propIsEnumerable(source, key)) {
14360 objTarget[key] = value;
14361 }
14362 }
14363 }
14364 return objTarget;
14365};
14366
14367},{"function-bind":52,"has-symbols/shams":53,"object-keys":62}],65:[function(require,module,exports){
14368'use strict';
14369
14370var defineProperties = require('define-properties');
14371
14372var implementation = require('./implementation');
14373var getPolyfill = require('./polyfill');
14374var shim = require('./shim');
14375
14376var polyfill = getPolyfill();
14377
14378defineProperties(polyfill, {
14379 getPolyfill: getPolyfill,
14380 implementation: implementation,
14381 shim: shim
14382});
14383
14384module.exports = polyfill;
14385
14386},{"./implementation":64,"./polyfill":66,"./shim":67,"define-properties":47}],66:[function(require,module,exports){
14387'use strict';
14388
14389var implementation = require('./implementation');
14390
14391var lacksProperEnumerationOrder = function () {
14392 if (!Object.assign) {
14393 return false;
14394 }
14395 // v8, specifically in node 4.x, has a bug with incorrect property enumeration order
14396 // note: this does not detect the bug unless there's 20 characters
14397 var str = 'abcdefghijklmnopqrst';
14398 var letters = str.split('');
14399 var map = {};
14400 for (var i = 0; i < letters.length; ++i) {
14401 map[letters[i]] = letters[i];
14402 }
14403 var obj = Object.assign({}, map);
14404 var actual = '';
14405 for (var k in obj) {
14406 actual += k;
14407 }
14408 return str !== actual;
14409};
14410
14411var assignHasPendingExceptions = function () {
14412 if (!Object.assign || !Object.preventExtensions) {
14413 return false;
14414 }
14415 // Firefox 37 still has "pending exception" logic in its Object.assign implementation,
14416 // which is 72% slower than our shim, and Firefox 40's native implementation.
14417 var thrower = Object.preventExtensions({ 1: 2 });
14418 try {
14419 Object.assign(thrower, 'xy');
14420 } catch (e) {
14421 return thrower[1] === 'y';
14422 }
14423 return false;
14424};
14425
14426module.exports = function getPolyfill() {
14427 if (!Object.assign) {
14428 return implementation;
14429 }
14430 if (lacksProperEnumerationOrder()) {
14431 return implementation;
14432 }
14433 if (assignHasPendingExceptions()) {
14434 return implementation;
14435 }
14436 return Object.assign;
14437};
14438
14439},{"./implementation":64}],67:[function(require,module,exports){
14440'use strict';
14441
14442var define = require('define-properties');
14443var getPolyfill = require('./polyfill');
14444
14445module.exports = function shimAssign() {
14446 var polyfill = getPolyfill();
14447 define(
14448 Object,
14449 { assign: polyfill },
14450 { assign: function () { return Object.assign !== polyfill; } }
14451 );
14452 return polyfill;
14453};
14454
14455},{"./polyfill":66,"define-properties":47}],68:[function(require,module,exports){
14456(function (process){
14457'use strict';
14458
14459if (!process.version ||
14460 process.version.indexOf('v0.') === 0 ||
14461 process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
14462 module.exports = { nextTick: nextTick };
14463} else {
14464 module.exports = process
14465}
14466
14467function nextTick(fn, arg1, arg2, arg3) {
14468 if (typeof fn !== 'function') {
14469 throw new TypeError('"callback" argument must be a function');
14470 }
14471 var len = arguments.length;
14472 var args, i;
14473 switch (len) {
14474 case 0:
14475 case 1:
14476 return process.nextTick(fn);
14477 case 2:
14478 return process.nextTick(function afterTickOne() {
14479 fn.call(null, arg1);
14480 });
14481 case 3:
14482 return process.nextTick(function afterTickTwo() {
14483 fn.call(null, arg1, arg2);
14484 });
14485 case 4:
14486 return process.nextTick(function afterTickThree() {
14487 fn.call(null, arg1, arg2, arg3);
14488 });
14489 default:
14490 args = new Array(len - 1);
14491 i = 0;
14492 while (i < args.length) {
14493 args[i++] = arguments[i];
14494 }
14495 return process.nextTick(function afterTick() {
14496 fn.apply(null, args);
14497 });
14498 }
14499}
14500
14501
14502}).call(this,require('_process'))
14503},{"_process":69}],69:[function(require,module,exports){
14504// shim for using process in browser
14505var process = module.exports = {};
14506
14507// cached from whatever global is present so that test runners that stub it
14508// don't break things. But we need to wrap it in a try catch in case it is
14509// wrapped in strict mode code which doesn't define any globals. It's inside a
14510// function because try/catches deoptimize in certain engines.
14511
14512var cachedSetTimeout;
14513var cachedClearTimeout;
14514
14515function defaultSetTimout() {
14516 throw new Error('setTimeout has not been defined');
14517}
14518function defaultClearTimeout () {
14519 throw new Error('clearTimeout has not been defined');
14520}
14521(function () {
14522 try {
14523 if (typeof setTimeout === 'function') {
14524 cachedSetTimeout = setTimeout;
14525 } else {
14526 cachedSetTimeout = defaultSetTimout;
14527 }
14528 } catch (e) {
14529 cachedSetTimeout = defaultSetTimout;
14530 }
14531 try {
14532 if (typeof clearTimeout === 'function') {
14533 cachedClearTimeout = clearTimeout;
14534 } else {
14535 cachedClearTimeout = defaultClearTimeout;
14536 }
14537 } catch (e) {
14538 cachedClearTimeout = defaultClearTimeout;
14539 }
14540} ())
14541function runTimeout(fun) {
14542 if (cachedSetTimeout === setTimeout) {
14543 //normal enviroments in sane situations
14544 return setTimeout(fun, 0);
14545 }
14546 // if setTimeout wasn't available but was latter defined
14547 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
14548 cachedSetTimeout = setTimeout;
14549 return setTimeout(fun, 0);
14550 }
14551 try {
14552 // when when somebody has screwed with setTimeout but no I.E. maddness
14553 return cachedSetTimeout(fun, 0);
14554 } catch(e){
14555 try {
14556 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
14557 return cachedSetTimeout.call(null, fun, 0);
14558 } catch(e){
14559 // 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
14560 return cachedSetTimeout.call(this, fun, 0);
14561 }
14562 }
14563
14564
14565}
14566function runClearTimeout(marker) {
14567 if (cachedClearTimeout === clearTimeout) {
14568 //normal enviroments in sane situations
14569 return clearTimeout(marker);
14570 }
14571 // if clearTimeout wasn't available but was latter defined
14572 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
14573 cachedClearTimeout = clearTimeout;
14574 return clearTimeout(marker);
14575 }
14576 try {
14577 // when when somebody has screwed with setTimeout but no I.E. maddness
14578 return cachedClearTimeout(marker);
14579 } catch (e){
14580 try {
14581 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
14582 return cachedClearTimeout.call(null, marker);
14583 } catch (e){
14584 // 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.
14585 // Some versions of I.E. have different rules for clearTimeout vs setTimeout
14586 return cachedClearTimeout.call(this, marker);
14587 }
14588 }
14589
14590
14591
14592}
14593var queue = [];
14594var draining = false;
14595var currentQueue;
14596var queueIndex = -1;
14597
14598function cleanUpNextTick() {
14599 if (!draining || !currentQueue) {
14600 return;
14601 }
14602 draining = false;
14603 if (currentQueue.length) {
14604 queue = currentQueue.concat(queue);
14605 } else {
14606 queueIndex = -1;
14607 }
14608 if (queue.length) {
14609 drainQueue();
14610 }
14611}
14612
14613function drainQueue() {
14614 if (draining) {
14615 return;
14616 }
14617 var timeout = runTimeout(cleanUpNextTick);
14618 draining = true;
14619
14620 var len = queue.length;
14621 while(len) {
14622 currentQueue = queue;
14623 queue = [];
14624 while (++queueIndex < len) {
14625 if (currentQueue) {
14626 currentQueue[queueIndex].run();
14627 }
14628 }
14629 queueIndex = -1;
14630 len = queue.length;
14631 }
14632 currentQueue = null;
14633 draining = false;
14634 runClearTimeout(timeout);
14635}
14636
14637process.nextTick = function (fun) {
14638 var args = new Array(arguments.length - 1);
14639 if (arguments.length > 1) {
14640 for (var i = 1; i < arguments.length; i++) {
14641 args[i - 1] = arguments[i];
14642 }
14643 }
14644 queue.push(new Item(fun, args));
14645 if (queue.length === 1 && !draining) {
14646 runTimeout(drainQueue);
14647 }
14648};
14649
14650// v8 likes predictible objects
14651function Item(fun, array) {
14652 this.fun = fun;
14653 this.array = array;
14654}
14655Item.prototype.run = function () {
14656 this.fun.apply(null, this.array);
14657};
14658process.title = 'browser';
14659process.browser = true;
14660process.env = {};
14661process.argv = [];
14662process.version = ''; // empty string to avoid regexp issues
14663process.versions = {};
14664
14665function noop() {}
14666
14667process.on = noop;
14668process.addListener = noop;
14669process.once = noop;
14670process.off = noop;
14671process.removeListener = noop;
14672process.removeAllListeners = noop;
14673process.emit = noop;
14674process.prependListener = noop;
14675process.prependOnceListener = noop;
14676
14677process.listeners = function (name) { return [] }
14678
14679process.binding = function (name) {
14680 throw new Error('process.binding is not supported');
14681};
14682
14683process.cwd = function () { return '/' };
14684process.chdir = function (dir) {
14685 throw new Error('process.chdir is not supported');
14686};
14687process.umask = function() { return 0; };
14688
14689},{}],70:[function(require,module,exports){
14690module.exports = require('./lib/_stream_duplex.js');
14691
14692},{"./lib/_stream_duplex.js":71}],71:[function(require,module,exports){
14693// Copyright Joyent, Inc. and other Node contributors.
14694//
14695// Permission is hereby granted, free of charge, to any person obtaining a
14696// copy of this software and associated documentation files (the
14697// "Software"), to deal in the Software without restriction, including
14698// without limitation the rights to use, copy, modify, merge, publish,
14699// distribute, sublicense, and/or sell copies of the Software, and to permit
14700// persons to whom the Software is furnished to do so, subject to the
14701// following conditions:
14702//
14703// The above copyright notice and this permission notice shall be included
14704// in all copies or substantial portions of the Software.
14705//
14706// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14707// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14708// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
14709// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
14710// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
14711// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
14712// USE OR OTHER DEALINGS IN THE SOFTWARE.
14713
14714// a duplex stream is just a stream that is both readable and writable.
14715// Since JS doesn't have multiple prototypal inheritance, this class
14716// prototypally inherits from Readable, and then parasitically from
14717// Writable.
14718
14719'use strict';
14720
14721/*<replacement>*/
14722
14723var pna = require('process-nextick-args');
14724/*</replacement>*/
14725
14726/*<replacement>*/
14727var objectKeys = Object.keys || function (obj) {
14728 var keys = [];
14729 for (var key in obj) {
14730 keys.push(key);
14731 }return keys;
14732};
14733/*</replacement>*/
14734
14735module.exports = Duplex;
14736
14737/*<replacement>*/
14738var util = require('core-util-is');
14739util.inherits = require('inherits');
14740/*</replacement>*/
14741
14742var Readable = require('./_stream_readable');
14743var Writable = require('./_stream_writable');
14744
14745util.inherits(Duplex, Readable);
14746
14747{
14748 // avoid scope creep, the keys array can then be collected
14749 var keys = objectKeys(Writable.prototype);
14750 for (var v = 0; v < keys.length; v++) {
14751 var method = keys[v];
14752 if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
14753 }
14754}
14755
14756function Duplex(options) {
14757 if (!(this instanceof Duplex)) return new Duplex(options);
14758
14759 Readable.call(this, options);
14760 Writable.call(this, options);
14761
14762 if (options && options.readable === false) this.readable = false;
14763
14764 if (options && options.writable === false) this.writable = false;
14765
14766 this.allowHalfOpen = true;
14767 if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
14768
14769 this.once('end', onend);
14770}
14771
14772Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
14773 // making it explicit this property is not enumerable
14774 // because otherwise some prototype manipulation in
14775 // userland will fail
14776 enumerable: false,
14777 get: function () {
14778 return this._writableState.highWaterMark;
14779 }
14780});
14781
14782// the no-half-open enforcer
14783function onend() {
14784 // if we allow half-open state, or if the writable side ended,
14785 // then we're ok.
14786 if (this.allowHalfOpen || this._writableState.ended) return;
14787
14788 // no more data can be written.
14789 // But allow more writes to happen in this tick.
14790 pna.nextTick(onEndNT, this);
14791}
14792
14793function onEndNT(self) {
14794 self.end();
14795}
14796
14797Object.defineProperty(Duplex.prototype, 'destroyed', {
14798 get: function () {
14799 if (this._readableState === undefined || this._writableState === undefined) {
14800 return false;
14801 }
14802 return this._readableState.destroyed && this._writableState.destroyed;
14803 },
14804 set: function (value) {
14805 // we ignore the value if the stream
14806 // has not been initialized yet
14807 if (this._readableState === undefined || this._writableState === undefined) {
14808 return;
14809 }
14810
14811 // backward compatibility, the user is explicitly
14812 // managing destroyed
14813 this._readableState.destroyed = value;
14814 this._writableState.destroyed = value;
14815 }
14816});
14817
14818Duplex.prototype._destroy = function (err, cb) {
14819 this.push(null);
14820 this.end();
14821
14822 pna.nextTick(cb, err);
14823};
14824},{"./_stream_readable":73,"./_stream_writable":75,"core-util-is":44,"inherits":56,"process-nextick-args":68}],72:[function(require,module,exports){
14825// Copyright Joyent, Inc. and other Node contributors.
14826//
14827// Permission is hereby granted, free of charge, to any person obtaining a
14828// copy of this software and associated documentation files (the
14829// "Software"), to deal in the Software without restriction, including
14830// without limitation the rights to use, copy, modify, merge, publish,
14831// distribute, sublicense, and/or sell copies of the Software, and to permit
14832// persons to whom the Software is furnished to do so, subject to the
14833// following conditions:
14834//
14835// The above copyright notice and this permission notice shall be included
14836// in all copies or substantial portions of the Software.
14837//
14838// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14839// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14840// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
14841// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
14842// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
14843// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
14844// USE OR OTHER DEALINGS IN THE SOFTWARE.
14845
14846// a passthrough stream.
14847// basically just the most minimal sort of Transform stream.
14848// Every written chunk gets output as-is.
14849
14850'use strict';
14851
14852module.exports = PassThrough;
14853
14854var Transform = require('./_stream_transform');
14855
14856/*<replacement>*/
14857var util = require('core-util-is');
14858util.inherits = require('inherits');
14859/*</replacement>*/
14860
14861util.inherits(PassThrough, Transform);
14862
14863function PassThrough(options) {
14864 if (!(this instanceof PassThrough)) return new PassThrough(options);
14865
14866 Transform.call(this, options);
14867}
14868
14869PassThrough.prototype._transform = function (chunk, encoding, cb) {
14870 cb(null, chunk);
14871};
14872},{"./_stream_transform":74,"core-util-is":44,"inherits":56}],73:[function(require,module,exports){
14873(function (process,global){
14874// Copyright Joyent, Inc. and other Node contributors.
14875//
14876// Permission is hereby granted, free of charge, to any person obtaining a
14877// copy of this software and associated documentation files (the
14878// "Software"), to deal in the Software without restriction, including
14879// without limitation the rights to use, copy, modify, merge, publish,
14880// distribute, sublicense, and/or sell copies of the Software, and to permit
14881// persons to whom the Software is furnished to do so, subject to the
14882// following conditions:
14883//
14884// The above copyright notice and this permission notice shall be included
14885// in all copies or substantial portions of the Software.
14886//
14887// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14888// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14889// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
14890// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
14891// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
14892// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
14893// USE OR OTHER DEALINGS IN THE SOFTWARE.
14894
14895'use strict';
14896
14897/*<replacement>*/
14898
14899var pna = require('process-nextick-args');
14900/*</replacement>*/
14901
14902module.exports = Readable;
14903
14904/*<replacement>*/
14905var isArray = require('isarray');
14906/*</replacement>*/
14907
14908/*<replacement>*/
14909var Duplex;
14910/*</replacement>*/
14911
14912Readable.ReadableState = ReadableState;
14913
14914/*<replacement>*/
14915var EE = require('events').EventEmitter;
14916
14917var EElistenerCount = function (emitter, type) {
14918 return emitter.listeners(type).length;
14919};
14920/*</replacement>*/
14921
14922/*<replacement>*/
14923var Stream = require('./internal/streams/stream');
14924/*</replacement>*/
14925
14926/*<replacement>*/
14927
14928var Buffer = require('safe-buffer').Buffer;
14929var OurUint8Array = global.Uint8Array || function () {};
14930function _uint8ArrayToBuffer(chunk) {
14931 return Buffer.from(chunk);
14932}
14933function _isUint8Array(obj) {
14934 return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
14935}
14936
14937/*</replacement>*/
14938
14939/*<replacement>*/
14940var util = require('core-util-is');
14941util.inherits = require('inherits');
14942/*</replacement>*/
14943
14944/*<replacement>*/
14945var debugUtil = require('util');
14946var debug = void 0;
14947if (debugUtil && debugUtil.debuglog) {
14948 debug = debugUtil.debuglog('stream');
14949} else {
14950 debug = function () {};
14951}
14952/*</replacement>*/
14953
14954var BufferList = require('./internal/streams/BufferList');
14955var destroyImpl = require('./internal/streams/destroy');
14956var StringDecoder;
14957
14958util.inherits(Readable, Stream);
14959
14960var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
14961
14962function prependListener(emitter, event, fn) {
14963 // Sadly this is not cacheable as some libraries bundle their own
14964 // event emitter implementation with them.
14965 if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
14966
14967 // This is a hack to make sure that our error handler is attached before any
14968 // userland ones. NEVER DO THIS. This is here only because this code needs
14969 // to continue to work with older versions of Node.js that do not include
14970 // the prependListener() method. The goal is to eventually remove this hack.
14971 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]];
14972}
14973
14974function ReadableState(options, stream) {
14975 Duplex = Duplex || require('./_stream_duplex');
14976
14977 options = options || {};
14978
14979 // Duplex streams are both readable and writable, but share
14980 // the same options object.
14981 // However, some cases require setting options to different
14982 // values for the readable and the writable sides of the duplex stream.
14983 // These options can be provided separately as readableXXX and writableXXX.
14984 var isDuplex = stream instanceof Duplex;
14985
14986 // object stream flag. Used to make read(n) ignore n and to
14987 // make all the buffer merging and length checks go away
14988 this.objectMode = !!options.objectMode;
14989
14990 if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
14991
14992 // the point at which it stops calling _read() to fill the buffer
14993 // Note: 0 is a valid value, means "don't call _read preemptively ever"
14994 var hwm = options.highWaterMark;
14995 var readableHwm = options.readableHighWaterMark;
14996 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
14997
14998 if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
14999
15000 // cast to ints.
15001 this.highWaterMark = Math.floor(this.highWaterMark);
15002
15003 // A linked list is used to store data chunks instead of an array because the
15004 // linked list can remove elements from the beginning faster than
15005 // array.shift()
15006 this.buffer = new BufferList();
15007 this.length = 0;
15008 this.pipes = null;
15009 this.pipesCount = 0;
15010 this.flowing = null;
15011 this.ended = false;
15012 this.endEmitted = false;
15013 this.reading = false;
15014
15015 // a flag to be able to tell if the event 'readable'/'data' is emitted
15016 // immediately, or on a later tick. We set this to true at first, because
15017 // any actions that shouldn't happen until "later" should generally also
15018 // not happen before the first read call.
15019 this.sync = true;
15020
15021 // whenever we return null, then we set a flag to say
15022 // that we're awaiting a 'readable' event emission.
15023 this.needReadable = false;
15024 this.emittedReadable = false;
15025 this.readableListening = false;
15026 this.resumeScheduled = false;
15027
15028 // has it been destroyed
15029 this.destroyed = false;
15030
15031 // Crypto is kind of old and crusty. Historically, its default string
15032 // encoding is 'binary' so we have to make this configurable.
15033 // Everything else in the universe uses 'utf8', though.
15034 this.defaultEncoding = options.defaultEncoding || 'utf8';
15035
15036 // the number of writers that are awaiting a drain event in .pipe()s
15037 this.awaitDrain = 0;
15038
15039 // if true, a maybeReadMore has been scheduled
15040 this.readingMore = false;
15041
15042 this.decoder = null;
15043 this.encoding = null;
15044 if (options.encoding) {
15045 if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
15046 this.decoder = new StringDecoder(options.encoding);
15047 this.encoding = options.encoding;
15048 }
15049}
15050
15051function Readable(options) {
15052 Duplex = Duplex || require('./_stream_duplex');
15053
15054 if (!(this instanceof Readable)) return new Readable(options);
15055
15056 this._readableState = new ReadableState(options, this);
15057
15058 // legacy
15059 this.readable = true;
15060
15061 if (options) {
15062 if (typeof options.read === 'function') this._read = options.read;
15063
15064 if (typeof options.destroy === 'function') this._destroy = options.destroy;
15065 }
15066
15067 Stream.call(this);
15068}
15069
15070Object.defineProperty(Readable.prototype, 'destroyed', {
15071 get: function () {
15072 if (this._readableState === undefined) {
15073 return false;
15074 }
15075 return this._readableState.destroyed;
15076 },
15077 set: function (value) {
15078 // we ignore the value if the stream
15079 // has not been initialized yet
15080 if (!this._readableState) {
15081 return;
15082 }
15083
15084 // backward compatibility, the user is explicitly
15085 // managing destroyed
15086 this._readableState.destroyed = value;
15087 }
15088});
15089
15090Readable.prototype.destroy = destroyImpl.destroy;
15091Readable.prototype._undestroy = destroyImpl.undestroy;
15092Readable.prototype._destroy = function (err, cb) {
15093 this.push(null);
15094 cb(err);
15095};
15096
15097// Manually shove something into the read() buffer.
15098// This returns true if the highWaterMark has not been hit yet,
15099// similar to how Writable.write() returns true if you should
15100// write() some more.
15101Readable.prototype.push = function (chunk, encoding) {
15102 var state = this._readableState;
15103 var skipChunkCheck;
15104
15105 if (!state.objectMode) {
15106 if (typeof chunk === 'string') {
15107 encoding = encoding || state.defaultEncoding;
15108 if (encoding !== state.encoding) {
15109 chunk = Buffer.from(chunk, encoding);
15110 encoding = '';
15111 }
15112 skipChunkCheck = true;
15113 }
15114 } else {
15115 skipChunkCheck = true;
15116 }
15117
15118 return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
15119};
15120
15121// Unshift should *always* be something directly out of read()
15122Readable.prototype.unshift = function (chunk) {
15123 return readableAddChunk(this, chunk, null, true, false);
15124};
15125
15126function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
15127 var state = stream._readableState;
15128 if (chunk === null) {
15129 state.reading = false;
15130 onEofChunk(stream, state);
15131 } else {
15132 var er;
15133 if (!skipChunkCheck) er = chunkInvalid(state, chunk);
15134 if (er) {
15135 stream.emit('error', er);
15136 } else if (state.objectMode || chunk && chunk.length > 0) {
15137 if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
15138 chunk = _uint8ArrayToBuffer(chunk);
15139 }
15140
15141 if (addToFront) {
15142 if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
15143 } else if (state.ended) {
15144 stream.emit('error', new Error('stream.push() after EOF'));
15145 } else {
15146 state.reading = false;
15147 if (state.decoder && !encoding) {
15148 chunk = state.decoder.write(chunk);
15149 if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
15150 } else {
15151 addChunk(stream, state, chunk, false);
15152 }
15153 }
15154 } else if (!addToFront) {
15155 state.reading = false;
15156 }
15157 }
15158
15159 return needMoreData(state);
15160}
15161
15162function addChunk(stream, state, chunk, addToFront) {
15163 if (state.flowing && state.length === 0 && !state.sync) {
15164 stream.emit('data', chunk);
15165 stream.read(0);
15166 } else {
15167 // update the buffer info.
15168 state.length += state.objectMode ? 1 : chunk.length;
15169 if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
15170
15171 if (state.needReadable) emitReadable(stream);
15172 }
15173 maybeReadMore(stream, state);
15174}
15175
15176function chunkInvalid(state, chunk) {
15177 var er;
15178 if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
15179 er = new TypeError('Invalid non-string/buffer chunk');
15180 }
15181 return er;
15182}
15183
15184// if it's past the high water mark, we can push in some more.
15185// Also, if we have no data yet, we can stand some
15186// more bytes. This is to work around cases where hwm=0,
15187// such as the repl. Also, if the push() triggered a
15188// readable event, and the user called read(largeNumber) such that
15189// needReadable was set, then we ought to push more, so that another
15190// 'readable' event will be triggered.
15191function needMoreData(state) {
15192 return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
15193}
15194
15195Readable.prototype.isPaused = function () {
15196 return this._readableState.flowing === false;
15197};
15198
15199// backwards compatibility.
15200Readable.prototype.setEncoding = function (enc) {
15201 if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
15202 this._readableState.decoder = new StringDecoder(enc);
15203 this._readableState.encoding = enc;
15204 return this;
15205};
15206
15207// Don't raise the hwm > 8MB
15208var MAX_HWM = 0x800000;
15209function computeNewHighWaterMark(n) {
15210 if (n >= MAX_HWM) {
15211 n = MAX_HWM;
15212 } else {
15213 // Get the next highest power of 2 to prevent increasing hwm excessively in
15214 // tiny amounts
15215 n--;
15216 n |= n >>> 1;
15217 n |= n >>> 2;
15218 n |= n >>> 4;
15219 n |= n >>> 8;
15220 n |= n >>> 16;
15221 n++;
15222 }
15223 return n;
15224}
15225
15226// This function is designed to be inlinable, so please take care when making
15227// changes to the function body.
15228function howMuchToRead(n, state) {
15229 if (n <= 0 || state.length === 0 && state.ended) return 0;
15230 if (state.objectMode) return 1;
15231 if (n !== n) {
15232 // Only flow one buffer at a time
15233 if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
15234 }
15235 // If we're asking for more than the current hwm, then raise the hwm.
15236 if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
15237 if (n <= state.length) return n;
15238 // Don't have enough
15239 if (!state.ended) {
15240 state.needReadable = true;
15241 return 0;
15242 }
15243 return state.length;
15244}
15245
15246// you can override either this method, or the async _read(n) below.
15247Readable.prototype.read = function (n) {
15248 debug('read', n);
15249 n = parseInt(n, 10);
15250 var state = this._readableState;
15251 var nOrig = n;
15252
15253 if (n !== 0) state.emittedReadable = false;
15254
15255 // if we're doing read(0) to trigger a readable event, but we
15256 // already have a bunch of data in the buffer, then just trigger
15257 // the 'readable' event and move on.
15258 if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
15259 debug('read: emitReadable', state.length, state.ended);
15260 if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
15261 return null;
15262 }
15263
15264 n = howMuchToRead(n, state);
15265
15266 // if we've ended, and we're now clear, then finish it up.
15267 if (n === 0 && state.ended) {
15268 if (state.length === 0) endReadable(this);
15269 return null;
15270 }
15271
15272 // All the actual chunk generation logic needs to be
15273 // *below* the call to _read. The reason is that in certain
15274 // synthetic stream cases, such as passthrough streams, _read
15275 // may be a completely synchronous operation which may change
15276 // the state of the read buffer, providing enough data when
15277 // before there was *not* enough.
15278 //
15279 // So, the steps are:
15280 // 1. Figure out what the state of things will be after we do
15281 // a read from the buffer.
15282 //
15283 // 2. If that resulting state will trigger a _read, then call _read.
15284 // Note that this may be asynchronous, or synchronous. Yes, it is
15285 // deeply ugly to write APIs this way, but that still doesn't mean
15286 // that the Readable class should behave improperly, as streams are
15287 // designed to be sync/async agnostic.
15288 // Take note if the _read call is sync or async (ie, if the read call
15289 // has returned yet), so that we know whether or not it's safe to emit
15290 // 'readable' etc.
15291 //
15292 // 3. Actually pull the requested chunks out of the buffer and return.
15293
15294 // if we need a readable event, then we need to do some reading.
15295 var doRead = state.needReadable;
15296 debug('need readable', doRead);
15297
15298 // if we currently have less than the highWaterMark, then also read some
15299 if (state.length === 0 || state.length - n < state.highWaterMark) {
15300 doRead = true;
15301 debug('length less than watermark', doRead);
15302 }
15303
15304 // however, if we've ended, then there's no point, and if we're already
15305 // reading, then it's unnecessary.
15306 if (state.ended || state.reading) {
15307 doRead = false;
15308 debug('reading or ended', doRead);
15309 } else if (doRead) {
15310 debug('do read');
15311 state.reading = true;
15312 state.sync = true;
15313 // if the length is currently zero, then we *need* a readable event.
15314 if (state.length === 0) state.needReadable = true;
15315 // call internal read method
15316 this._read(state.highWaterMark);
15317 state.sync = false;
15318 // If _read pushed data synchronously, then `reading` will be false,
15319 // and we need to re-evaluate how much data we can return to the user.
15320 if (!state.reading) n = howMuchToRead(nOrig, state);
15321 }
15322
15323 var ret;
15324 if (n > 0) ret = fromList(n, state);else ret = null;
15325
15326 if (ret === null) {
15327 state.needReadable = true;
15328 n = 0;
15329 } else {
15330 state.length -= n;
15331 }
15332
15333 if (state.length === 0) {
15334 // If we have nothing in the buffer, then we want to know
15335 // as soon as we *do* get something into the buffer.
15336 if (!state.ended) state.needReadable = true;
15337
15338 // If we tried to read() past the EOF, then emit end on the next tick.
15339 if (nOrig !== n && state.ended) endReadable(this);
15340 }
15341
15342 if (ret !== null) this.emit('data', ret);
15343
15344 return ret;
15345};
15346
15347function onEofChunk(stream, state) {
15348 if (state.ended) return;
15349 if (state.decoder) {
15350 var chunk = state.decoder.end();
15351 if (chunk && chunk.length) {
15352 state.buffer.push(chunk);
15353 state.length += state.objectMode ? 1 : chunk.length;
15354 }
15355 }
15356 state.ended = true;
15357
15358 // emit 'readable' now to make sure it gets picked up.
15359 emitReadable(stream);
15360}
15361
15362// Don't emit readable right away in sync mode, because this can trigger
15363// another read() call => stack overflow. This way, it might trigger
15364// a nextTick recursion warning, but that's not so bad.
15365function emitReadable(stream) {
15366 var state = stream._readableState;
15367 state.needReadable = false;
15368 if (!state.emittedReadable) {
15369 debug('emitReadable', state.flowing);
15370 state.emittedReadable = true;
15371 if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
15372 }
15373}
15374
15375function emitReadable_(stream) {
15376 debug('emit readable');
15377 stream.emit('readable');
15378 flow(stream);
15379}
15380
15381// at this point, the user has presumably seen the 'readable' event,
15382// and called read() to consume some data. that may have triggered
15383// in turn another _read(n) call, in which case reading = true if
15384// it's in progress.
15385// However, if we're not ended, or reading, and the length < hwm,
15386// then go ahead and try to read some more preemptively.
15387function maybeReadMore(stream, state) {
15388 if (!state.readingMore) {
15389 state.readingMore = true;
15390 pna.nextTick(maybeReadMore_, stream, state);
15391 }
15392}
15393
15394function maybeReadMore_(stream, state) {
15395 var len = state.length;
15396 while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
15397 debug('maybeReadMore read 0');
15398 stream.read(0);
15399 if (len === state.length)
15400 // didn't get any data, stop spinning.
15401 break;else len = state.length;
15402 }
15403 state.readingMore = false;
15404}
15405
15406// abstract method. to be overridden in specific implementation classes.
15407// call cb(er, data) where data is <= n in length.
15408// for virtual (non-string, non-buffer) streams, "length" is somewhat
15409// arbitrary, and perhaps not very meaningful.
15410Readable.prototype._read = function (n) {
15411 this.emit('error', new Error('_read() is not implemented'));
15412};
15413
15414Readable.prototype.pipe = function (dest, pipeOpts) {
15415 var src = this;
15416 var state = this._readableState;
15417
15418 switch (state.pipesCount) {
15419 case 0:
15420 state.pipes = dest;
15421 break;
15422 case 1:
15423 state.pipes = [state.pipes, dest];
15424 break;
15425 default:
15426 state.pipes.push(dest);
15427 break;
15428 }
15429 state.pipesCount += 1;
15430 debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
15431
15432 var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
15433
15434 var endFn = doEnd ? onend : unpipe;
15435 if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
15436
15437 dest.on('unpipe', onunpipe);
15438 function onunpipe(readable, unpipeInfo) {
15439 debug('onunpipe');
15440 if (readable === src) {
15441 if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
15442 unpipeInfo.hasUnpiped = true;
15443 cleanup();
15444 }
15445 }
15446 }
15447
15448 function onend() {
15449 debug('onend');
15450 dest.end();
15451 }
15452
15453 // when the dest drains, it reduces the awaitDrain counter
15454 // on the source. This would be more elegant with a .once()
15455 // handler in flow(), but adding and removing repeatedly is
15456 // too slow.
15457 var ondrain = pipeOnDrain(src);
15458 dest.on('drain', ondrain);
15459
15460 var cleanedUp = false;
15461 function cleanup() {
15462 debug('cleanup');
15463 // cleanup event handlers once the pipe is broken
15464 dest.removeListener('close', onclose);
15465 dest.removeListener('finish', onfinish);
15466 dest.removeListener('drain', ondrain);
15467 dest.removeListener('error', onerror);
15468 dest.removeListener('unpipe', onunpipe);
15469 src.removeListener('end', onend);
15470 src.removeListener('end', unpipe);
15471 src.removeListener('data', ondata);
15472
15473 cleanedUp = true;
15474
15475 // if the reader is waiting for a drain event from this
15476 // specific writer, then it would cause it to never start
15477 // flowing again.
15478 // So, if this is awaiting a drain, then we just call it now.
15479 // If we don't know, then assume that we are waiting for one.
15480 if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
15481 }
15482
15483 // If the user pushes more data while we're writing to dest then we'll end up
15484 // in ondata again. However, we only want to increase awaitDrain once because
15485 // dest will only emit one 'drain' event for the multiple writes.
15486 // => Introduce a guard on increasing awaitDrain.
15487 var increasedAwaitDrain = false;
15488 src.on('data', ondata);
15489 function ondata(chunk) {
15490 debug('ondata');
15491 increasedAwaitDrain = false;
15492 var ret = dest.write(chunk);
15493 if (false === ret && !increasedAwaitDrain) {
15494 // If the user unpiped during `dest.write()`, it is possible
15495 // to get stuck in a permanently paused state if that write
15496 // also returned false.
15497 // => Check whether `dest` is still a piping destination.
15498 if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
15499 debug('false write response, pause', src._readableState.awaitDrain);
15500 src._readableState.awaitDrain++;
15501 increasedAwaitDrain = true;
15502 }
15503 src.pause();
15504 }
15505 }
15506
15507 // if the dest has an error, then stop piping into it.
15508 // however, don't suppress the throwing behavior for this.
15509 function onerror(er) {
15510 debug('onerror', er);
15511 unpipe();
15512 dest.removeListener('error', onerror);
15513 if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
15514 }
15515
15516 // Make sure our error handler is attached before userland ones.
15517 prependListener(dest, 'error', onerror);
15518
15519 // Both close and finish should trigger unpipe, but only once.
15520 function onclose() {
15521 dest.removeListener('finish', onfinish);
15522 unpipe();
15523 }
15524 dest.once('close', onclose);
15525 function onfinish() {
15526 debug('onfinish');
15527 dest.removeListener('close', onclose);
15528 unpipe();
15529 }
15530 dest.once('finish', onfinish);
15531
15532 function unpipe() {
15533 debug('unpipe');
15534 src.unpipe(dest);
15535 }
15536
15537 // tell the dest that it's being piped to
15538 dest.emit('pipe', src);
15539
15540 // start the flow if it hasn't been started already.
15541 if (!state.flowing) {
15542 debug('pipe resume');
15543 src.resume();
15544 }
15545
15546 return dest;
15547};
15548
15549function pipeOnDrain(src) {
15550 return function () {
15551 var state = src._readableState;
15552 debug('pipeOnDrain', state.awaitDrain);
15553 if (state.awaitDrain) state.awaitDrain--;
15554 if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
15555 state.flowing = true;
15556 flow(src);
15557 }
15558 };
15559}
15560
15561Readable.prototype.unpipe = function (dest) {
15562 var state = this._readableState;
15563 var unpipeInfo = { hasUnpiped: false };
15564
15565 // if we're not piping anywhere, then do nothing.
15566 if (state.pipesCount === 0) return this;
15567
15568 // just one destination. most common case.
15569 if (state.pipesCount === 1) {
15570 // passed in one, but it's not the right one.
15571 if (dest && dest !== state.pipes) return this;
15572
15573 if (!dest) dest = state.pipes;
15574
15575 // got a match.
15576 state.pipes = null;
15577 state.pipesCount = 0;
15578 state.flowing = false;
15579 if (dest) dest.emit('unpipe', this, unpipeInfo);
15580 return this;
15581 }
15582
15583 // slow case. multiple pipe destinations.
15584
15585 if (!dest) {
15586 // remove all.
15587 var dests = state.pipes;
15588 var len = state.pipesCount;
15589 state.pipes = null;
15590 state.pipesCount = 0;
15591 state.flowing = false;
15592
15593 for (var i = 0; i < len; i++) {
15594 dests[i].emit('unpipe', this, unpipeInfo);
15595 }return this;
15596 }
15597
15598 // try to find the right one.
15599 var index = indexOf(state.pipes, dest);
15600 if (index === -1) return this;
15601
15602 state.pipes.splice(index, 1);
15603 state.pipesCount -= 1;
15604 if (state.pipesCount === 1) state.pipes = state.pipes[0];
15605
15606 dest.emit('unpipe', this, unpipeInfo);
15607
15608 return this;
15609};
15610
15611// set up data events if they are asked for
15612// Ensure readable listeners eventually get something
15613Readable.prototype.on = function (ev, fn) {
15614 var res = Stream.prototype.on.call(this, ev, fn);
15615
15616 if (ev === 'data') {
15617 // Start flowing on next tick if stream isn't explicitly paused
15618 if (this._readableState.flowing !== false) this.resume();
15619 } else if (ev === 'readable') {
15620 var state = this._readableState;
15621 if (!state.endEmitted && !state.readableListening) {
15622 state.readableListening = state.needReadable = true;
15623 state.emittedReadable = false;
15624 if (!state.reading) {
15625 pna.nextTick(nReadingNextTick, this);
15626 } else if (state.length) {
15627 emitReadable(this);
15628 }
15629 }
15630 }
15631
15632 return res;
15633};
15634Readable.prototype.addListener = Readable.prototype.on;
15635
15636function nReadingNextTick(self) {
15637 debug('readable nexttick read 0');
15638 self.read(0);
15639}
15640
15641// pause() and resume() are remnants of the legacy readable stream API
15642// If the user uses them, then switch into old mode.
15643Readable.prototype.resume = function () {
15644 var state = this._readableState;
15645 if (!state.flowing) {
15646 debug('resume');
15647 state.flowing = true;
15648 resume(this, state);
15649 }
15650 return this;
15651};
15652
15653function resume(stream, state) {
15654 if (!state.resumeScheduled) {
15655 state.resumeScheduled = true;
15656 pna.nextTick(resume_, stream, state);
15657 }
15658}
15659
15660function resume_(stream, state) {
15661 if (!state.reading) {
15662 debug('resume read 0');
15663 stream.read(0);
15664 }
15665
15666 state.resumeScheduled = false;
15667 state.awaitDrain = 0;
15668 stream.emit('resume');
15669 flow(stream);
15670 if (state.flowing && !state.reading) stream.read(0);
15671}
15672
15673Readable.prototype.pause = function () {
15674 debug('call pause flowing=%j', this._readableState.flowing);
15675 if (false !== this._readableState.flowing) {
15676 debug('pause');
15677 this._readableState.flowing = false;
15678 this.emit('pause');
15679 }
15680 return this;
15681};
15682
15683function flow(stream) {
15684 var state = stream._readableState;
15685 debug('flow', state.flowing);
15686 while (state.flowing && stream.read() !== null) {}
15687}
15688
15689// wrap an old-style stream as the async data source.
15690// This is *not* part of the readable stream interface.
15691// It is an ugly unfortunate mess of history.
15692Readable.prototype.wrap = function (stream) {
15693 var _this = this;
15694
15695 var state = this._readableState;
15696 var paused = false;
15697
15698 stream.on('end', function () {
15699 debug('wrapped end');
15700 if (state.decoder && !state.ended) {
15701 var chunk = state.decoder.end();
15702 if (chunk && chunk.length) _this.push(chunk);
15703 }
15704
15705 _this.push(null);
15706 });
15707
15708 stream.on('data', function (chunk) {
15709 debug('wrapped data');
15710 if (state.decoder) chunk = state.decoder.write(chunk);
15711
15712 // don't skip over falsy values in objectMode
15713 if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
15714
15715 var ret = _this.push(chunk);
15716 if (!ret) {
15717 paused = true;
15718 stream.pause();
15719 }
15720 });
15721
15722 // proxy all the other methods.
15723 // important when wrapping filters and duplexes.
15724 for (var i in stream) {
15725 if (this[i] === undefined && typeof stream[i] === 'function') {
15726 this[i] = function (method) {
15727 return function () {
15728 return stream[method].apply(stream, arguments);
15729 };
15730 }(i);
15731 }
15732 }
15733
15734 // proxy certain important events.
15735 for (var n = 0; n < kProxyEvents.length; n++) {
15736 stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
15737 }
15738
15739 // when we try to consume some more bytes, simply unpause the
15740 // underlying stream.
15741 this._read = function (n) {
15742 debug('wrapped _read', n);
15743 if (paused) {
15744 paused = false;
15745 stream.resume();
15746 }
15747 };
15748
15749 return this;
15750};
15751
15752Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
15753 // making it explicit this property is not enumerable
15754 // because otherwise some prototype manipulation in
15755 // userland will fail
15756 enumerable: false,
15757 get: function () {
15758 return this._readableState.highWaterMark;
15759 }
15760});
15761
15762// exposed for testing purposes only.
15763Readable._fromList = fromList;
15764
15765// Pluck off n bytes from an array of buffers.
15766// Length is the combined lengths of all the buffers in the list.
15767// This function is designed to be inlinable, so please take care when making
15768// changes to the function body.
15769function fromList(n, state) {
15770 // nothing buffered
15771 if (state.length === 0) return null;
15772
15773 var ret;
15774 if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
15775 // read it all, truncate the list
15776 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);
15777 state.buffer.clear();
15778 } else {
15779 // read part of list
15780 ret = fromListPartial(n, state.buffer, state.decoder);
15781 }
15782
15783 return ret;
15784}
15785
15786// Extracts only enough buffered data to satisfy the amount requested.
15787// This function is designed to be inlinable, so please take care when making
15788// changes to the function body.
15789function fromListPartial(n, list, hasStrings) {
15790 var ret;
15791 if (n < list.head.data.length) {
15792 // slice is the same for buffers and strings
15793 ret = list.head.data.slice(0, n);
15794 list.head.data = list.head.data.slice(n);
15795 } else if (n === list.head.data.length) {
15796 // first chunk is a perfect match
15797 ret = list.shift();
15798 } else {
15799 // result spans more than one buffer
15800 ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
15801 }
15802 return ret;
15803}
15804
15805// Copies a specified amount of characters from the list of buffered data
15806// chunks.
15807// This function is designed to be inlinable, so please take care when making
15808// changes to the function body.
15809function copyFromBufferString(n, list) {
15810 var p = list.head;
15811 var c = 1;
15812 var ret = p.data;
15813 n -= ret.length;
15814 while (p = p.next) {
15815 var str = p.data;
15816 var nb = n > str.length ? str.length : n;
15817 if (nb === str.length) ret += str;else ret += str.slice(0, n);
15818 n -= nb;
15819 if (n === 0) {
15820 if (nb === str.length) {
15821 ++c;
15822 if (p.next) list.head = p.next;else list.head = list.tail = null;
15823 } else {
15824 list.head = p;
15825 p.data = str.slice(nb);
15826 }
15827 break;
15828 }
15829 ++c;
15830 }
15831 list.length -= c;
15832 return ret;
15833}
15834
15835// Copies a specified amount of bytes from the list of buffered data chunks.
15836// This function is designed to be inlinable, so please take care when making
15837// changes to the function body.
15838function copyFromBuffer(n, list) {
15839 var ret = Buffer.allocUnsafe(n);
15840 var p = list.head;
15841 var c = 1;
15842 p.data.copy(ret);
15843 n -= p.data.length;
15844 while (p = p.next) {
15845 var buf = p.data;
15846 var nb = n > buf.length ? buf.length : n;
15847 buf.copy(ret, ret.length - n, 0, nb);
15848 n -= nb;
15849 if (n === 0) {
15850 if (nb === buf.length) {
15851 ++c;
15852 if (p.next) list.head = p.next;else list.head = list.tail = null;
15853 } else {
15854 list.head = p;
15855 p.data = buf.slice(nb);
15856 }
15857 break;
15858 }
15859 ++c;
15860 }
15861 list.length -= c;
15862 return ret;
15863}
15864
15865function endReadable(stream) {
15866 var state = stream._readableState;
15867
15868 // If we get here before consuming all the bytes, then that is a
15869 // bug in node. Should never happen.
15870 if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
15871
15872 if (!state.endEmitted) {
15873 state.ended = true;
15874 pna.nextTick(endReadableNT, state, stream);
15875 }
15876}
15877
15878function endReadableNT(state, stream) {
15879 // Check that we didn't get one last unshift.
15880 if (!state.endEmitted && state.length === 0) {
15881 state.endEmitted = true;
15882 stream.readable = false;
15883 stream.emit('end');
15884 }
15885}
15886
15887function indexOf(xs, x) {
15888 for (var i = 0, l = xs.length; i < l; i++) {
15889 if (xs[i] === x) return i;
15890 }
15891 return -1;
15892}
15893}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
15894},{"./_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){
15895// Copyright Joyent, Inc. and other Node contributors.
15896//
15897// Permission is hereby granted, free of charge, to any person obtaining a
15898// copy of this software and associated documentation files (the
15899// "Software"), to deal in the Software without restriction, including
15900// without limitation the rights to use, copy, modify, merge, publish,
15901// distribute, sublicense, and/or sell copies of the Software, and to permit
15902// persons to whom the Software is furnished to do so, subject to the
15903// following conditions:
15904//
15905// The above copyright notice and this permission notice shall be included
15906// in all copies or substantial portions of the Software.
15907//
15908// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15909// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15910// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
15911// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
15912// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
15913// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
15914// USE OR OTHER DEALINGS IN THE SOFTWARE.
15915
15916// a transform stream is a readable/writable stream where you do
15917// something with the data. Sometimes it's called a "filter",
15918// but that's not a great name for it, since that implies a thing where
15919// some bits pass through, and others are simply ignored. (That would
15920// be a valid example of a transform, of course.)
15921//
15922// While the output is causally related to the input, it's not a
15923// necessarily symmetric or synchronous transformation. For example,
15924// a zlib stream might take multiple plain-text writes(), and then
15925// emit a single compressed chunk some time in the future.
15926//
15927// Here's how this works:
15928//
15929// The Transform stream has all the aspects of the readable and writable
15930// stream classes. When you write(chunk), that calls _write(chunk,cb)
15931// internally, and returns false if there's a lot of pending writes
15932// buffered up. When you call read(), that calls _read(n) until
15933// there's enough pending readable data buffered up.
15934//
15935// In a transform stream, the written data is placed in a buffer. When
15936// _read(n) is called, it transforms the queued up data, calling the
15937// buffered _write cb's as it consumes chunks. If consuming a single
15938// written chunk would result in multiple output chunks, then the first
15939// outputted bit calls the readcb, and subsequent chunks just go into
15940// the read buffer, and will cause it to emit 'readable' if necessary.
15941//
15942// This way, back-pressure is actually determined by the reading side,
15943// since _read has to be called to start processing a new chunk. However,
15944// a pathological inflate type of transform can cause excessive buffering
15945// here. For example, imagine a stream where every byte of input is
15946// interpreted as an integer from 0-255, and then results in that many
15947// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
15948// 1kb of data being output. In this case, you could write a very small
15949// amount of input, and end up with a very large amount of output. In
15950// such a pathological inflating mechanism, there'd be no way to tell
15951// the system to stop doing the transform. A single 4MB write could
15952// cause the system to run out of memory.
15953//
15954// However, even in such a pathological case, only a single written chunk
15955// would be consumed, and then the rest would wait (un-transformed) until
15956// the results of the previous transformed chunk were consumed.
15957
15958'use strict';
15959
15960module.exports = Transform;
15961
15962var Duplex = require('./_stream_duplex');
15963
15964/*<replacement>*/
15965var util = require('core-util-is');
15966util.inherits = require('inherits');
15967/*</replacement>*/
15968
15969util.inherits(Transform, Duplex);
15970
15971function afterTransform(er, data) {
15972 var ts = this._transformState;
15973 ts.transforming = false;
15974
15975 var cb = ts.writecb;
15976
15977 if (!cb) {
15978 return this.emit('error', new Error('write callback called multiple times'));
15979 }
15980
15981 ts.writechunk = null;
15982 ts.writecb = null;
15983
15984 if (data != null) // single equals check for both `null` and `undefined`
15985 this.push(data);
15986
15987 cb(er);
15988
15989 var rs = this._readableState;
15990 rs.reading = false;
15991 if (rs.needReadable || rs.length < rs.highWaterMark) {
15992 this._read(rs.highWaterMark);
15993 }
15994}
15995
15996function Transform(options) {
15997 if (!(this instanceof Transform)) return new Transform(options);
15998
15999 Duplex.call(this, options);
16000
16001 this._transformState = {
16002 afterTransform: afterTransform.bind(this),
16003 needTransform: false,
16004 transforming: false,
16005 writecb: null,
16006 writechunk: null,
16007 writeencoding: null
16008 };
16009
16010 // start out asking for a readable event once data is transformed.
16011 this._readableState.needReadable = true;
16012
16013 // we have implemented the _read method, and done the other things
16014 // that Readable wants before the first _read call, so unset the
16015 // sync guard flag.
16016 this._readableState.sync = false;
16017
16018 if (options) {
16019 if (typeof options.transform === 'function') this._transform = options.transform;
16020
16021 if (typeof options.flush === 'function') this._flush = options.flush;
16022 }
16023
16024 // When the writable side finishes, then flush out anything remaining.
16025 this.on('prefinish', prefinish);
16026}
16027
16028function prefinish() {
16029 var _this = this;
16030
16031 if (typeof this._flush === 'function') {
16032 this._flush(function (er, data) {
16033 done(_this, er, data);
16034 });
16035 } else {
16036 done(this, null, null);
16037 }
16038}
16039
16040Transform.prototype.push = function (chunk, encoding) {
16041 this._transformState.needTransform = false;
16042 return Duplex.prototype.push.call(this, chunk, encoding);
16043};
16044
16045// This is the part where you do stuff!
16046// override this function in implementation classes.
16047// 'chunk' is an input chunk.
16048//
16049// Call `push(newChunk)` to pass along transformed output
16050// to the readable side. You may call 'push' zero or more times.
16051//
16052// Call `cb(err)` when you are done with this chunk. If you pass
16053// an error, then that'll put the hurt on the whole operation. If you
16054// never call cb(), then you'll never get another chunk.
16055Transform.prototype._transform = function (chunk, encoding, cb) {
16056 throw new Error('_transform() is not implemented');
16057};
16058
16059Transform.prototype._write = function (chunk, encoding, cb) {
16060 var ts = this._transformState;
16061 ts.writecb = cb;
16062 ts.writechunk = chunk;
16063 ts.writeencoding = encoding;
16064 if (!ts.transforming) {
16065 var rs = this._readableState;
16066 if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
16067 }
16068};
16069
16070// Doesn't matter what the args are here.
16071// _transform does all the work.
16072// That we got here means that the readable side wants more data.
16073Transform.prototype._read = function (n) {
16074 var ts = this._transformState;
16075
16076 if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
16077 ts.transforming = true;
16078 this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
16079 } else {
16080 // mark that we need a transform, so that any data that comes in
16081 // will get processed, now that we've asked for it.
16082 ts.needTransform = true;
16083 }
16084};
16085
16086Transform.prototype._destroy = function (err, cb) {
16087 var _this2 = this;
16088
16089 Duplex.prototype._destroy.call(this, err, function (err2) {
16090 cb(err2);
16091 _this2.emit('close');
16092 });
16093};
16094
16095function done(stream, er, data) {
16096 if (er) return stream.emit('error', er);
16097
16098 if (data != null) // single equals check for both `null` and `undefined`
16099 stream.push(data);
16100
16101 // if there's nothing in the write buffer, then that means
16102 // that nothing more will ever be provided
16103 if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
16104
16105 if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
16106
16107 return stream.push(null);
16108}
16109},{"./_stream_duplex":71,"core-util-is":44,"inherits":56}],75:[function(require,module,exports){
16110(function (process,global,setImmediate){
16111// Copyright Joyent, Inc. and other Node contributors.
16112//
16113// Permission is hereby granted, free of charge, to any person obtaining a
16114// copy of this software and associated documentation files (the
16115// "Software"), to deal in the Software without restriction, including
16116// without limitation the rights to use, copy, modify, merge, publish,
16117// distribute, sublicense, and/or sell copies of the Software, and to permit
16118// persons to whom the Software is furnished to do so, subject to the
16119// following conditions:
16120//
16121// The above copyright notice and this permission notice shall be included
16122// in all copies or substantial portions of the Software.
16123//
16124// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16125// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16126// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
16127// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
16128// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16129// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
16130// USE OR OTHER DEALINGS IN THE SOFTWARE.
16131
16132// A bit simpler than readable streams.
16133// Implement an async ._write(chunk, encoding, cb), and it'll handle all
16134// the drain event emission and buffering.
16135
16136'use strict';
16137
16138/*<replacement>*/
16139
16140var pna = require('process-nextick-args');
16141/*</replacement>*/
16142
16143module.exports = Writable;
16144
16145/* <replacement> */
16146function WriteReq(chunk, encoding, cb) {
16147 this.chunk = chunk;
16148 this.encoding = encoding;
16149 this.callback = cb;
16150 this.next = null;
16151}
16152
16153// It seems a linked list but it is not
16154// there will be only 2 of these for each stream
16155function CorkedRequest(state) {
16156 var _this = this;
16157
16158 this.next = null;
16159 this.entry = null;
16160 this.finish = function () {
16161 onCorkedFinish(_this, state);
16162 };
16163}
16164/* </replacement> */
16165
16166/*<replacement>*/
16167var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
16168/*</replacement>*/
16169
16170/*<replacement>*/
16171var Duplex;
16172/*</replacement>*/
16173
16174Writable.WritableState = WritableState;
16175
16176/*<replacement>*/
16177var util = require('core-util-is');
16178util.inherits = require('inherits');
16179/*</replacement>*/
16180
16181/*<replacement>*/
16182var internalUtil = {
16183 deprecate: require('util-deprecate')
16184};
16185/*</replacement>*/
16186
16187/*<replacement>*/
16188var Stream = require('./internal/streams/stream');
16189/*</replacement>*/
16190
16191/*<replacement>*/
16192
16193var Buffer = require('safe-buffer').Buffer;
16194var OurUint8Array = global.Uint8Array || function () {};
16195function _uint8ArrayToBuffer(chunk) {
16196 return Buffer.from(chunk);
16197}
16198function _isUint8Array(obj) {
16199 return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
16200}
16201
16202/*</replacement>*/
16203
16204var destroyImpl = require('./internal/streams/destroy');
16205
16206util.inherits(Writable, Stream);
16207
16208function nop() {}
16209
16210function WritableState(options, stream) {
16211 Duplex = Duplex || require('./_stream_duplex');
16212
16213 options = options || {};
16214
16215 // Duplex streams are both readable and writable, but share
16216 // the same options object.
16217 // However, some cases require setting options to different
16218 // values for the readable and the writable sides of the duplex stream.
16219 // These options can be provided separately as readableXXX and writableXXX.
16220 var isDuplex = stream instanceof Duplex;
16221
16222 // object stream flag to indicate whether or not this stream
16223 // contains buffers or objects.
16224 this.objectMode = !!options.objectMode;
16225
16226 if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
16227
16228 // the point at which write() starts returning false
16229 // Note: 0 is a valid value, means that we always return false if
16230 // the entire buffer is not flushed immediately on write()
16231 var hwm = options.highWaterMark;
16232 var writableHwm = options.writableHighWaterMark;
16233 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
16234
16235 if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
16236
16237 // cast to ints.
16238 this.highWaterMark = Math.floor(this.highWaterMark);
16239
16240 // if _final has been called
16241 this.finalCalled = false;
16242
16243 // drain event flag.
16244 this.needDrain = false;
16245 // at the start of calling end()
16246 this.ending = false;
16247 // when end() has been called, and returned
16248 this.ended = false;
16249 // when 'finish' is emitted
16250 this.finished = false;
16251
16252 // has it been destroyed
16253 this.destroyed = false;
16254
16255 // should we decode strings into buffers before passing to _write?
16256 // this is here so that some node-core streams can optimize string
16257 // handling at a lower level.
16258 var noDecode = options.decodeStrings === false;
16259 this.decodeStrings = !noDecode;
16260
16261 // Crypto is kind of old and crusty. Historically, its default string
16262 // encoding is 'binary' so we have to make this configurable.
16263 // Everything else in the universe uses 'utf8', though.
16264 this.defaultEncoding = options.defaultEncoding || 'utf8';
16265
16266 // not an actual buffer we keep track of, but a measurement
16267 // of how much we're waiting to get pushed to some underlying
16268 // socket or file.
16269 this.length = 0;
16270
16271 // a flag to see when we're in the middle of a write.
16272 this.writing = false;
16273
16274 // when true all writes will be buffered until .uncork() call
16275 this.corked = 0;
16276
16277 // a flag to be able to tell if the onwrite cb is called immediately,
16278 // or on a later tick. We set this to true at first, because any
16279 // actions that shouldn't happen until "later" should generally also
16280 // not happen before the first write call.
16281 this.sync = true;
16282
16283 // a flag to know if we're processing previously buffered items, which
16284 // may call the _write() callback in the same tick, so that we don't
16285 // end up in an overlapped onwrite situation.
16286 this.bufferProcessing = false;
16287
16288 // the callback that's passed to _write(chunk,cb)
16289 this.onwrite = function (er) {
16290 onwrite(stream, er);
16291 };
16292
16293 // the callback that the user supplies to write(chunk,encoding,cb)
16294 this.writecb = null;
16295
16296 // the amount that is being written when _write is called.
16297 this.writelen = 0;
16298
16299 this.bufferedRequest = null;
16300 this.lastBufferedRequest = null;
16301
16302 // number of pending user-supplied write callbacks
16303 // this must be 0 before 'finish' can be emitted
16304 this.pendingcb = 0;
16305
16306 // emit prefinish if the only thing we're waiting for is _write cbs
16307 // This is relevant for synchronous Transform streams
16308 this.prefinished = false;
16309
16310 // True if the error was already emitted and should not be thrown again
16311 this.errorEmitted = false;
16312
16313 // count buffered requests
16314 this.bufferedRequestCount = 0;
16315
16316 // allocate the first CorkedRequest, there is always
16317 // one allocated and free to use, and we maintain at most two
16318 this.corkedRequestsFree = new CorkedRequest(this);
16319}
16320
16321WritableState.prototype.getBuffer = function getBuffer() {
16322 var current = this.bufferedRequest;
16323 var out = [];
16324 while (current) {
16325 out.push(current);
16326 current = current.next;
16327 }
16328 return out;
16329};
16330
16331(function () {
16332 try {
16333 Object.defineProperty(WritableState.prototype, 'buffer', {
16334 get: internalUtil.deprecate(function () {
16335 return this.getBuffer();
16336 }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
16337 });
16338 } catch (_) {}
16339})();
16340
16341// Test _writableState for inheritance to account for Duplex streams,
16342// whose prototype chain only points to Readable.
16343var realHasInstance;
16344if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
16345 realHasInstance = Function.prototype[Symbol.hasInstance];
16346 Object.defineProperty(Writable, Symbol.hasInstance, {
16347 value: function (object) {
16348 if (realHasInstance.call(this, object)) return true;
16349 if (this !== Writable) return false;
16350
16351 return object && object._writableState instanceof WritableState;
16352 }
16353 });
16354} else {
16355 realHasInstance = function (object) {
16356 return object instanceof this;
16357 };
16358}
16359
16360function Writable(options) {
16361 Duplex = Duplex || require('./_stream_duplex');
16362
16363 // Writable ctor is applied to Duplexes, too.
16364 // `realHasInstance` is necessary because using plain `instanceof`
16365 // would return false, as no `_writableState` property is attached.
16366
16367 // Trying to use the custom `instanceof` for Writable here will also break the
16368 // Node.js LazyTransform implementation, which has a non-trivial getter for
16369 // `_writableState` that would lead to infinite recursion.
16370 if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
16371 return new Writable(options);
16372 }
16373
16374 this._writableState = new WritableState(options, this);
16375
16376 // legacy.
16377 this.writable = true;
16378
16379 if (options) {
16380 if (typeof options.write === 'function') this._write = options.write;
16381
16382 if (typeof options.writev === 'function') this._writev = options.writev;
16383
16384 if (typeof options.destroy === 'function') this._destroy = options.destroy;
16385
16386 if (typeof options.final === 'function') this._final = options.final;
16387 }
16388
16389 Stream.call(this);
16390}
16391
16392// Otherwise people can pipe Writable streams, which is just wrong.
16393Writable.prototype.pipe = function () {
16394 this.emit('error', new Error('Cannot pipe, not readable'));
16395};
16396
16397function writeAfterEnd(stream, cb) {
16398 var er = new Error('write after end');
16399 // TODO: defer error events consistently everywhere, not just the cb
16400 stream.emit('error', er);
16401 pna.nextTick(cb, er);
16402}
16403
16404// Checks that a user-supplied chunk is valid, especially for the particular
16405// mode the stream is in. Currently this means that `null` is never accepted
16406// and undefined/non-string values are only allowed in object mode.
16407function validChunk(stream, state, chunk, cb) {
16408 var valid = true;
16409 var er = false;
16410
16411 if (chunk === null) {
16412 er = new TypeError('May not write null values to stream');
16413 } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
16414 er = new TypeError('Invalid non-string/buffer chunk');
16415 }
16416 if (er) {
16417 stream.emit('error', er);
16418 pna.nextTick(cb, er);
16419 valid = false;
16420 }
16421 return valid;
16422}
16423
16424Writable.prototype.write = function (chunk, encoding, cb) {
16425 var state = this._writableState;
16426 var ret = false;
16427 var isBuf = !state.objectMode && _isUint8Array(chunk);
16428
16429 if (isBuf && !Buffer.isBuffer(chunk)) {
16430 chunk = _uint8ArrayToBuffer(chunk);
16431 }
16432
16433 if (typeof encoding === 'function') {
16434 cb = encoding;
16435 encoding = null;
16436 }
16437
16438 if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
16439
16440 if (typeof cb !== 'function') cb = nop;
16441
16442 if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
16443 state.pendingcb++;
16444 ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
16445 }
16446
16447 return ret;
16448};
16449
16450Writable.prototype.cork = function () {
16451 var state = this._writableState;
16452
16453 state.corked++;
16454};
16455
16456Writable.prototype.uncork = function () {
16457 var state = this._writableState;
16458
16459 if (state.corked) {
16460 state.corked--;
16461
16462 if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
16463 }
16464};
16465
16466Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
16467 // node::ParseEncoding() requires lower case.
16468 if (typeof encoding === 'string') encoding = encoding.toLowerCase();
16469 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);
16470 this._writableState.defaultEncoding = encoding;
16471 return this;
16472};
16473
16474function decodeChunk(state, chunk, encoding) {
16475 if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
16476 chunk = Buffer.from(chunk, encoding);
16477 }
16478 return chunk;
16479}
16480
16481Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
16482 // making it explicit this property is not enumerable
16483 // because otherwise some prototype manipulation in
16484 // userland will fail
16485 enumerable: false,
16486 get: function () {
16487 return this._writableState.highWaterMark;
16488 }
16489});
16490
16491// if we're already writing something, then just put this
16492// in the queue, and wait our turn. Otherwise, call _write
16493// If we return false, then we need a drain event, so set that flag.
16494function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
16495 if (!isBuf) {
16496 var newChunk = decodeChunk(state, chunk, encoding);
16497 if (chunk !== newChunk) {
16498 isBuf = true;
16499 encoding = 'buffer';
16500 chunk = newChunk;
16501 }
16502 }
16503 var len = state.objectMode ? 1 : chunk.length;
16504
16505 state.length += len;
16506
16507 var ret = state.length < state.highWaterMark;
16508 // we must ensure that previous needDrain will not be reset to false.
16509 if (!ret) state.needDrain = true;
16510
16511 if (state.writing || state.corked) {
16512 var last = state.lastBufferedRequest;
16513 state.lastBufferedRequest = {
16514 chunk: chunk,
16515 encoding: encoding,
16516 isBuf: isBuf,
16517 callback: cb,
16518 next: null
16519 };
16520 if (last) {
16521 last.next = state.lastBufferedRequest;
16522 } else {
16523 state.bufferedRequest = state.lastBufferedRequest;
16524 }
16525 state.bufferedRequestCount += 1;
16526 } else {
16527 doWrite(stream, state, false, len, chunk, encoding, cb);
16528 }
16529
16530 return ret;
16531}
16532
16533function doWrite(stream, state, writev, len, chunk, encoding, cb) {
16534 state.writelen = len;
16535 state.writecb = cb;
16536 state.writing = true;
16537 state.sync = true;
16538 if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
16539 state.sync = false;
16540}
16541
16542function onwriteError(stream, state, sync, er, cb) {
16543 --state.pendingcb;
16544
16545 if (sync) {
16546 // defer the callback if we are being called synchronously
16547 // to avoid piling up things on the stack
16548 pna.nextTick(cb, er);
16549 // this can emit finish, and it will always happen
16550 // after error
16551 pna.nextTick(finishMaybe, stream, state);
16552 stream._writableState.errorEmitted = true;
16553 stream.emit('error', er);
16554 } else {
16555 // the caller expect this to happen before if
16556 // it is async
16557 cb(er);
16558 stream._writableState.errorEmitted = true;
16559 stream.emit('error', er);
16560 // this can emit finish, but finish must
16561 // always follow error
16562 finishMaybe(stream, state);
16563 }
16564}
16565
16566function onwriteStateUpdate(state) {
16567 state.writing = false;
16568 state.writecb = null;
16569 state.length -= state.writelen;
16570 state.writelen = 0;
16571}
16572
16573function onwrite(stream, er) {
16574 var state = stream._writableState;
16575 var sync = state.sync;
16576 var cb = state.writecb;
16577
16578 onwriteStateUpdate(state);
16579
16580 if (er) onwriteError(stream, state, sync, er, cb);else {
16581 // Check if we're actually ready to finish, but don't emit yet
16582 var finished = needFinish(state);
16583
16584 if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
16585 clearBuffer(stream, state);
16586 }
16587
16588 if (sync) {
16589 /*<replacement>*/
16590 asyncWrite(afterWrite, stream, state, finished, cb);
16591 /*</replacement>*/
16592 } else {
16593 afterWrite(stream, state, finished, cb);
16594 }
16595 }
16596}
16597
16598function afterWrite(stream, state, finished, cb) {
16599 if (!finished) onwriteDrain(stream, state);
16600 state.pendingcb--;
16601 cb();
16602 finishMaybe(stream, state);
16603}
16604
16605// Must force callback to be called on nextTick, so that we don't
16606// emit 'drain' before the write() consumer gets the 'false' return
16607// value, and has a chance to attach a 'drain' listener.
16608function onwriteDrain(stream, state) {
16609 if (state.length === 0 && state.needDrain) {
16610 state.needDrain = false;
16611 stream.emit('drain');
16612 }
16613}
16614
16615// if there's something in the buffer waiting, then process it
16616function clearBuffer(stream, state) {
16617 state.bufferProcessing = true;
16618 var entry = state.bufferedRequest;
16619
16620 if (stream._writev && entry && entry.next) {
16621 // Fast case, write everything using _writev()
16622 var l = state.bufferedRequestCount;
16623 var buffer = new Array(l);
16624 var holder = state.corkedRequestsFree;
16625 holder.entry = entry;
16626
16627 var count = 0;
16628 var allBuffers = true;
16629 while (entry) {
16630 buffer[count] = entry;
16631 if (!entry.isBuf) allBuffers = false;
16632 entry = entry.next;
16633 count += 1;
16634 }
16635 buffer.allBuffers = allBuffers;
16636
16637 doWrite(stream, state, true, state.length, buffer, '', holder.finish);
16638
16639 // doWrite is almost always async, defer these to save a bit of time
16640 // as the hot path ends with doWrite
16641 state.pendingcb++;
16642 state.lastBufferedRequest = null;
16643 if (holder.next) {
16644 state.corkedRequestsFree = holder.next;
16645 holder.next = null;
16646 } else {
16647 state.corkedRequestsFree = new CorkedRequest(state);
16648 }
16649 state.bufferedRequestCount = 0;
16650 } else {
16651 // Slow case, write chunks one-by-one
16652 while (entry) {
16653 var chunk = entry.chunk;
16654 var encoding = entry.encoding;
16655 var cb = entry.callback;
16656 var len = state.objectMode ? 1 : chunk.length;
16657
16658 doWrite(stream, state, false, len, chunk, encoding, cb);
16659 entry = entry.next;
16660 state.bufferedRequestCount--;
16661 // if we didn't call the onwrite immediately, then
16662 // it means that we need to wait until it does.
16663 // also, that means that the chunk and cb are currently
16664 // being processed, so move the buffer counter past them.
16665 if (state.writing) {
16666 break;
16667 }
16668 }
16669
16670 if (entry === null) state.lastBufferedRequest = null;
16671 }
16672
16673 state.bufferedRequest = entry;
16674 state.bufferProcessing = false;
16675}
16676
16677Writable.prototype._write = function (chunk, encoding, cb) {
16678 cb(new Error('_write() is not implemented'));
16679};
16680
16681Writable.prototype._writev = null;
16682
16683Writable.prototype.end = function (chunk, encoding, cb) {
16684 var state = this._writableState;
16685
16686 if (typeof chunk === 'function') {
16687 cb = chunk;
16688 chunk = null;
16689 encoding = null;
16690 } else if (typeof encoding === 'function') {
16691 cb = encoding;
16692 encoding = null;
16693 }
16694
16695 if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
16696
16697 // .end() fully uncorks
16698 if (state.corked) {
16699 state.corked = 1;
16700 this.uncork();
16701 }
16702
16703 // ignore unnecessary end() calls.
16704 if (!state.ending && !state.finished) endWritable(this, state, cb);
16705};
16706
16707function needFinish(state) {
16708 return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
16709}
16710function callFinal(stream, state) {
16711 stream._final(function (err) {
16712 state.pendingcb--;
16713 if (err) {
16714 stream.emit('error', err);
16715 }
16716 state.prefinished = true;
16717 stream.emit('prefinish');
16718 finishMaybe(stream, state);
16719 });
16720}
16721function prefinish(stream, state) {
16722 if (!state.prefinished && !state.finalCalled) {
16723 if (typeof stream._final === 'function') {
16724 state.pendingcb++;
16725 state.finalCalled = true;
16726 pna.nextTick(callFinal, stream, state);
16727 } else {
16728 state.prefinished = true;
16729 stream.emit('prefinish');
16730 }
16731 }
16732}
16733
16734function finishMaybe(stream, state) {
16735 var need = needFinish(state);
16736 if (need) {
16737 prefinish(stream, state);
16738 if (state.pendingcb === 0) {
16739 state.finished = true;
16740 stream.emit('finish');
16741 }
16742 }
16743 return need;
16744}
16745
16746function endWritable(stream, state, cb) {
16747 state.ending = true;
16748 finishMaybe(stream, state);
16749 if (cb) {
16750 if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
16751 }
16752 state.ended = true;
16753 stream.writable = false;
16754}
16755
16756function onCorkedFinish(corkReq, state, err) {
16757 var entry = corkReq.entry;
16758 corkReq.entry = null;
16759 while (entry) {
16760 var cb = entry.callback;
16761 state.pendingcb--;
16762 cb(err);
16763 entry = entry.next;
16764 }
16765 if (state.corkedRequestsFree) {
16766 state.corkedRequestsFree.next = corkReq;
16767 } else {
16768 state.corkedRequestsFree = corkReq;
16769 }
16770}
16771
16772Object.defineProperty(Writable.prototype, 'destroyed', {
16773 get: function () {
16774 if (this._writableState === undefined) {
16775 return false;
16776 }
16777 return this._writableState.destroyed;
16778 },
16779 set: function (value) {
16780 // we ignore the value if the stream
16781 // has not been initialized yet
16782 if (!this._writableState) {
16783 return;
16784 }
16785
16786 // backward compatibility, the user is explicitly
16787 // managing destroyed
16788 this._writableState.destroyed = value;
16789 }
16790});
16791
16792Writable.prototype.destroy = destroyImpl.destroy;
16793Writable.prototype._undestroy = destroyImpl.undestroy;
16794Writable.prototype._destroy = function (err, cb) {
16795 this.end();
16796 cb(err);
16797};
16798}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate)
16799},{"./_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){
16800'use strict';
16801
16802function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16803
16804var Buffer = require('safe-buffer').Buffer;
16805var util = require('util');
16806
16807function copyBuffer(src, target, offset) {
16808 src.copy(target, offset);
16809}
16810
16811module.exports = function () {
16812 function BufferList() {
16813 _classCallCheck(this, BufferList);
16814
16815 this.head = null;
16816 this.tail = null;
16817 this.length = 0;
16818 }
16819
16820 BufferList.prototype.push = function push(v) {
16821 var entry = { data: v, next: null };
16822 if (this.length > 0) this.tail.next = entry;else this.head = entry;
16823 this.tail = entry;
16824 ++this.length;
16825 };
16826
16827 BufferList.prototype.unshift = function unshift(v) {
16828 var entry = { data: v, next: this.head };
16829 if (this.length === 0) this.tail = entry;
16830 this.head = entry;
16831 ++this.length;
16832 };
16833
16834 BufferList.prototype.shift = function shift() {
16835 if (this.length === 0) return;
16836 var ret = this.head.data;
16837 if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
16838 --this.length;
16839 return ret;
16840 };
16841
16842 BufferList.prototype.clear = function clear() {
16843 this.head = this.tail = null;
16844 this.length = 0;
16845 };
16846
16847 BufferList.prototype.join = function join(s) {
16848 if (this.length === 0) return '';
16849 var p = this.head;
16850 var ret = '' + p.data;
16851 while (p = p.next) {
16852 ret += s + p.data;
16853 }return ret;
16854 };
16855
16856 BufferList.prototype.concat = function concat(n) {
16857 if (this.length === 0) return Buffer.alloc(0);
16858 if (this.length === 1) return this.head.data;
16859 var ret = Buffer.allocUnsafe(n >>> 0);
16860 var p = this.head;
16861 var i = 0;
16862 while (p) {
16863 copyBuffer(p.data, ret, i);
16864 i += p.data.length;
16865 p = p.next;
16866 }
16867 return ret;
16868 };
16869
16870 return BufferList;
16871}();
16872
16873if (util && util.inspect && util.inspect.custom) {
16874 module.exports.prototype[util.inspect.custom] = function () {
16875 var obj = util.inspect({ length: this.length });
16876 return this.constructor.name + ' ' + obj;
16877 };
16878}
16879},{"safe-buffer":83,"util":40}],77:[function(require,module,exports){
16880'use strict';
16881
16882/*<replacement>*/
16883
16884var pna = require('process-nextick-args');
16885/*</replacement>*/
16886
16887// undocumented cb() API, needed for core, not for public API
16888function destroy(err, cb) {
16889 var _this = this;
16890
16891 var readableDestroyed = this._readableState && this._readableState.destroyed;
16892 var writableDestroyed = this._writableState && this._writableState.destroyed;
16893
16894 if (readableDestroyed || writableDestroyed) {
16895 if (cb) {
16896 cb(err);
16897 } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
16898 pna.nextTick(emitErrorNT, this, err);
16899 }
16900 return this;
16901 }
16902
16903 // we set destroyed to true before firing error callbacks in order
16904 // to make it re-entrance safe in case destroy() is called within callbacks
16905
16906 if (this._readableState) {
16907 this._readableState.destroyed = true;
16908 }
16909
16910 // if this is a duplex stream mark the writable part as destroyed as well
16911 if (this._writableState) {
16912 this._writableState.destroyed = true;
16913 }
16914
16915 this._destroy(err || null, function (err) {
16916 if (!cb && err) {
16917 pna.nextTick(emitErrorNT, _this, err);
16918 if (_this._writableState) {
16919 _this._writableState.errorEmitted = true;
16920 }
16921 } else if (cb) {
16922 cb(err);
16923 }
16924 });
16925
16926 return this;
16927}
16928
16929function undestroy() {
16930 if (this._readableState) {
16931 this._readableState.destroyed = false;
16932 this._readableState.reading = false;
16933 this._readableState.ended = false;
16934 this._readableState.endEmitted = false;
16935 }
16936
16937 if (this._writableState) {
16938 this._writableState.destroyed = false;
16939 this._writableState.ended = false;
16940 this._writableState.ending = false;
16941 this._writableState.finished = false;
16942 this._writableState.errorEmitted = false;
16943 }
16944}
16945
16946function emitErrorNT(self, err) {
16947 self.emit('error', err);
16948}
16949
16950module.exports = {
16951 destroy: destroy,
16952 undestroy: undestroy
16953};
16954},{"process-nextick-args":68}],78:[function(require,module,exports){
16955module.exports = require('events').EventEmitter;
16956
16957},{"events":50}],79:[function(require,module,exports){
16958module.exports = require('./readable').PassThrough
16959
16960},{"./readable":80}],80:[function(require,module,exports){
16961exports = module.exports = require('./lib/_stream_readable.js');
16962exports.Stream = exports;
16963exports.Readable = exports;
16964exports.Writable = require('./lib/_stream_writable.js');
16965exports.Duplex = require('./lib/_stream_duplex.js');
16966exports.Transform = require('./lib/_stream_transform.js');
16967exports.PassThrough = require('./lib/_stream_passthrough.js');
16968
16969},{"./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){
16970module.exports = require('./readable').Transform
16971
16972},{"./readable":80}],82:[function(require,module,exports){
16973module.exports = require('./lib/_stream_writable.js');
16974
16975},{"./lib/_stream_writable.js":75}],83:[function(require,module,exports){
16976/* eslint-disable node/no-deprecated-api */
16977var buffer = require('buffer')
16978var Buffer = buffer.Buffer
16979
16980// alternative to using Object.keys for old browsers
16981function copyProps (src, dst) {
16982 for (var key in src) {
16983 dst[key] = src[key]
16984 }
16985}
16986if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
16987 module.exports = buffer
16988} else {
16989 // Copy properties from require('buffer')
16990 copyProps(buffer, exports)
16991 exports.Buffer = SafeBuffer
16992}
16993
16994function SafeBuffer (arg, encodingOrOffset, length) {
16995 return Buffer(arg, encodingOrOffset, length)
16996}
16997
16998// Copy static methods from Buffer
16999copyProps(Buffer, SafeBuffer)
17000
17001SafeBuffer.from = function (arg, encodingOrOffset, length) {
17002 if (typeof arg === 'number') {
17003 throw new TypeError('Argument must not be a number')
17004 }
17005 return Buffer(arg, encodingOrOffset, length)
17006}
17007
17008SafeBuffer.alloc = function (size, fill, encoding) {
17009 if (typeof size !== 'number') {
17010 throw new TypeError('Argument must be a number')
17011 }
17012 var buf = Buffer(size)
17013 if (fill !== undefined) {
17014 if (typeof encoding === 'string') {
17015 buf.fill(fill, encoding)
17016 } else {
17017 buf.fill(fill)
17018 }
17019 } else {
17020 buf.fill(0)
17021 }
17022 return buf
17023}
17024
17025SafeBuffer.allocUnsafe = function (size) {
17026 if (typeof size !== 'number') {
17027 throw new TypeError('Argument must be a number')
17028 }
17029 return Buffer(size)
17030}
17031
17032SafeBuffer.allocUnsafeSlow = function (size) {
17033 if (typeof size !== 'number') {
17034 throw new TypeError('Argument must be a number')
17035 }
17036 return buffer.SlowBuffer(size)
17037}
17038
17039},{"buffer":43}],84:[function(require,module,exports){
17040// Copyright Joyent, Inc. and other Node contributors.
17041//
17042// Permission is hereby granted, free of charge, to any person obtaining a
17043// copy of this software and associated documentation files (the
17044// "Software"), to deal in the Software without restriction, including
17045// without limitation the rights to use, copy, modify, merge, publish,
17046// distribute, sublicense, and/or sell copies of the Software, and to permit
17047// persons to whom the Software is furnished to do so, subject to the
17048// following conditions:
17049//
17050// The above copyright notice and this permission notice shall be included
17051// in all copies or substantial portions of the Software.
17052//
17053// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17054// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17055// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17056// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17057// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17058// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
17059// USE OR OTHER DEALINGS IN THE SOFTWARE.
17060
17061module.exports = Stream;
17062
17063var EE = require('events').EventEmitter;
17064var inherits = require('inherits');
17065
17066inherits(Stream, EE);
17067Stream.Readable = require('readable-stream/readable.js');
17068Stream.Writable = require('readable-stream/writable.js');
17069Stream.Duplex = require('readable-stream/duplex.js');
17070Stream.Transform = require('readable-stream/transform.js');
17071Stream.PassThrough = require('readable-stream/passthrough.js');
17072
17073// Backwards-compat with node 0.4.x
17074Stream.Stream = Stream;
17075
17076
17077
17078// old-style streams. Note that the pipe method (the only relevant
17079// part of this class) is overridden in the Readable class.
17080
17081function Stream() {
17082 EE.call(this);
17083}
17084
17085Stream.prototype.pipe = function(dest, options) {
17086 var source = this;
17087
17088 function ondata(chunk) {
17089 if (dest.writable) {
17090 if (false === dest.write(chunk) && source.pause) {
17091 source.pause();
17092 }
17093 }
17094 }
17095
17096 source.on('data', ondata);
17097
17098 function ondrain() {
17099 if (source.readable && source.resume) {
17100 source.resume();
17101 }
17102 }
17103
17104 dest.on('drain', ondrain);
17105
17106 // If the 'end' option is not supplied, dest.end() will be called when
17107 // source gets the 'end' or 'close' events. Only dest.end() once.
17108 if (!dest._isStdio && (!options || options.end !== false)) {
17109 source.on('end', onend);
17110 source.on('close', onclose);
17111 }
17112
17113 var didOnEnd = false;
17114 function onend() {
17115 if (didOnEnd) return;
17116 didOnEnd = true;
17117
17118 dest.end();
17119 }
17120
17121
17122 function onclose() {
17123 if (didOnEnd) return;
17124 didOnEnd = true;
17125
17126 if (typeof dest.destroy === 'function') dest.destroy();
17127 }
17128
17129 // don't leave dangling pipes when there are errors.
17130 function onerror(er) {
17131 cleanup();
17132 if (EE.listenerCount(this, 'error') === 0) {
17133 throw er; // Unhandled stream error in pipe.
17134 }
17135 }
17136
17137 source.on('error', onerror);
17138 dest.on('error', onerror);
17139
17140 // remove all the event listeners that were added.
17141 function cleanup() {
17142 source.removeListener('data', ondata);
17143 dest.removeListener('drain', ondrain);
17144
17145 source.removeListener('end', onend);
17146 source.removeListener('close', onclose);
17147
17148 source.removeListener('error', onerror);
17149 dest.removeListener('error', onerror);
17150
17151 source.removeListener('end', cleanup);
17152 source.removeListener('close', cleanup);
17153
17154 dest.removeListener('close', cleanup);
17155 }
17156
17157 source.on('end', cleanup);
17158 source.on('close', cleanup);
17159
17160 dest.on('close', cleanup);
17161
17162 dest.emit('pipe', source);
17163
17164 // Allow for unix-like usage: A.pipe(B).pipe(C)
17165 return dest;
17166};
17167
17168},{"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){
17169// Copyright Joyent, Inc. and other Node contributors.
17170//
17171// Permission is hereby granted, free of charge, to any person obtaining a
17172// copy of this software and associated documentation files (the
17173// "Software"), to deal in the Software without restriction, including
17174// without limitation the rights to use, copy, modify, merge, publish,
17175// distribute, sublicense, and/or sell copies of the Software, and to permit
17176// persons to whom the Software is furnished to do so, subject to the
17177// following conditions:
17178//
17179// The above copyright notice and this permission notice shall be included
17180// in all copies or substantial portions of the Software.
17181//
17182// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17183// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17184// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17185// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17186// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17187// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
17188// USE OR OTHER DEALINGS IN THE SOFTWARE.
17189
17190'use strict';
17191
17192/*<replacement>*/
17193
17194var Buffer = require('safe-buffer').Buffer;
17195/*</replacement>*/
17196
17197var isEncoding = Buffer.isEncoding || function (encoding) {
17198 encoding = '' + encoding;
17199 switch (encoding && encoding.toLowerCase()) {
17200 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':
17201 return true;
17202 default:
17203 return false;
17204 }
17205};
17206
17207function _normalizeEncoding(enc) {
17208 if (!enc) return 'utf8';
17209 var retried;
17210 while (true) {
17211 switch (enc) {
17212 case 'utf8':
17213 case 'utf-8':
17214 return 'utf8';
17215 case 'ucs2':
17216 case 'ucs-2':
17217 case 'utf16le':
17218 case 'utf-16le':
17219 return 'utf16le';
17220 case 'latin1':
17221 case 'binary':
17222 return 'latin1';
17223 case 'base64':
17224 case 'ascii':
17225 case 'hex':
17226 return enc;
17227 default:
17228 if (retried) return; // undefined
17229 enc = ('' + enc).toLowerCase();
17230 retried = true;
17231 }
17232 }
17233};
17234
17235// Do not cache `Buffer.isEncoding` when checking encoding names as some
17236// modules monkey-patch it to support additional encodings
17237function normalizeEncoding(enc) {
17238 var nenc = _normalizeEncoding(enc);
17239 if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
17240 return nenc || enc;
17241}
17242
17243// StringDecoder provides an interface for efficiently splitting a series of
17244// buffers into a series of JS strings without breaking apart multi-byte
17245// characters.
17246exports.StringDecoder = StringDecoder;
17247function StringDecoder(encoding) {
17248 this.encoding = normalizeEncoding(encoding);
17249 var nb;
17250 switch (this.encoding) {
17251 case 'utf16le':
17252 this.text = utf16Text;
17253 this.end = utf16End;
17254 nb = 4;
17255 break;
17256 case 'utf8':
17257 this.fillLast = utf8FillLast;
17258 nb = 4;
17259 break;
17260 case 'base64':
17261 this.text = base64Text;
17262 this.end = base64End;
17263 nb = 3;
17264 break;
17265 default:
17266 this.write = simpleWrite;
17267 this.end = simpleEnd;
17268 return;
17269 }
17270 this.lastNeed = 0;
17271 this.lastTotal = 0;
17272 this.lastChar = Buffer.allocUnsafe(nb);
17273}
17274
17275StringDecoder.prototype.write = function (buf) {
17276 if (buf.length === 0) return '';
17277 var r;
17278 var i;
17279 if (this.lastNeed) {
17280 r = this.fillLast(buf);
17281 if (r === undefined) return '';
17282 i = this.lastNeed;
17283 this.lastNeed = 0;
17284 } else {
17285 i = 0;
17286 }
17287 if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
17288 return r || '';
17289};
17290
17291StringDecoder.prototype.end = utf8End;
17292
17293// Returns only complete characters in a Buffer
17294StringDecoder.prototype.text = utf8Text;
17295
17296// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
17297StringDecoder.prototype.fillLast = function (buf) {
17298 if (this.lastNeed <= buf.length) {
17299 buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
17300 return this.lastChar.toString(this.encoding, 0, this.lastTotal);
17301 }
17302 buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
17303 this.lastNeed -= buf.length;
17304};
17305
17306// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
17307// continuation byte. If an invalid byte is detected, -2 is returned.
17308function utf8CheckByte(byte) {
17309 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;
17310 return byte >> 6 === 0x02 ? -1 : -2;
17311}
17312
17313// Checks at most 3 bytes at the end of a Buffer in order to detect an
17314// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
17315// needed to complete the UTF-8 character (if applicable) are returned.
17316function utf8CheckIncomplete(self, buf, i) {
17317 var j = buf.length - 1;
17318 if (j < i) return 0;
17319 var nb = utf8CheckByte(buf[j]);
17320 if (nb >= 0) {
17321 if (nb > 0) self.lastNeed = nb - 1;
17322 return nb;
17323 }
17324 if (--j < i || nb === -2) return 0;
17325 nb = utf8CheckByte(buf[j]);
17326 if (nb >= 0) {
17327 if (nb > 0) self.lastNeed = nb - 2;
17328 return nb;
17329 }
17330 if (--j < i || nb === -2) return 0;
17331 nb = utf8CheckByte(buf[j]);
17332 if (nb >= 0) {
17333 if (nb > 0) {
17334 if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
17335 }
17336 return nb;
17337 }
17338 return 0;
17339}
17340
17341// Validates as many continuation bytes for a multi-byte UTF-8 character as
17342// needed or are available. If we see a non-continuation byte where we expect
17343// one, we "replace" the validated continuation bytes we've seen so far with
17344// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
17345// behavior. The continuation byte check is included three times in the case
17346// where all of the continuation bytes for a character exist in the same buffer.
17347// It is also done this way as a slight performance increase instead of using a
17348// loop.
17349function utf8CheckExtraBytes(self, buf, p) {
17350 if ((buf[0] & 0xC0) !== 0x80) {
17351 self.lastNeed = 0;
17352 return '\ufffd';
17353 }
17354 if (self.lastNeed > 1 && buf.length > 1) {
17355 if ((buf[1] & 0xC0) !== 0x80) {
17356 self.lastNeed = 1;
17357 return '\ufffd';
17358 }
17359 if (self.lastNeed > 2 && buf.length > 2) {
17360 if ((buf[2] & 0xC0) !== 0x80) {
17361 self.lastNeed = 2;
17362 return '\ufffd';
17363 }
17364 }
17365 }
17366}
17367
17368// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
17369function utf8FillLast(buf) {
17370 var p = this.lastTotal - this.lastNeed;
17371 var r = utf8CheckExtraBytes(this, buf, p);
17372 if (r !== undefined) return r;
17373 if (this.lastNeed <= buf.length) {
17374 buf.copy(this.lastChar, p, 0, this.lastNeed);
17375 return this.lastChar.toString(this.encoding, 0, this.lastTotal);
17376 }
17377 buf.copy(this.lastChar, p, 0, buf.length);
17378 this.lastNeed -= buf.length;
17379}
17380
17381// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
17382// partial character, the character's bytes are buffered until the required
17383// number of bytes are available.
17384function utf8Text(buf, i) {
17385 var total = utf8CheckIncomplete(this, buf, i);
17386 if (!this.lastNeed) return buf.toString('utf8', i);
17387 this.lastTotal = total;
17388 var end = buf.length - (total - this.lastNeed);
17389 buf.copy(this.lastChar, 0, end);
17390 return buf.toString('utf8', i, end);
17391}
17392
17393// For UTF-8, a replacement character is added when ending on a partial
17394// character.
17395function utf8End(buf) {
17396 var r = buf && buf.length ? this.write(buf) : '';
17397 if (this.lastNeed) return r + '\ufffd';
17398 return r;
17399}
17400
17401// UTF-16LE typically needs two bytes per character, but even if we have an even
17402// number of bytes available, we need to check if we end on a leading/high
17403// surrogate. In that case, we need to wait for the next two bytes in order to
17404// decode the last character properly.
17405function utf16Text(buf, i) {
17406 if ((buf.length - i) % 2 === 0) {
17407 var r = buf.toString('utf16le', i);
17408 if (r) {
17409 var c = r.charCodeAt(r.length - 1);
17410 if (c >= 0xD800 && c <= 0xDBFF) {
17411 this.lastNeed = 2;
17412 this.lastTotal = 4;
17413 this.lastChar[0] = buf[buf.length - 2];
17414 this.lastChar[1] = buf[buf.length - 1];
17415 return r.slice(0, -1);
17416 }
17417 }
17418 return r;
17419 }
17420 this.lastNeed = 1;
17421 this.lastTotal = 2;
17422 this.lastChar[0] = buf[buf.length - 1];
17423 return buf.toString('utf16le', i, buf.length - 1);
17424}
17425
17426// For UTF-16LE we do not explicitly append special replacement characters if we
17427// end on a partial character, we simply let v8 handle that.
17428function utf16End(buf) {
17429 var r = buf && buf.length ? this.write(buf) : '';
17430 if (this.lastNeed) {
17431 var end = this.lastTotal - this.lastNeed;
17432 return r + this.lastChar.toString('utf16le', 0, end);
17433 }
17434 return r;
17435}
17436
17437function base64Text(buf, i) {
17438 var n = (buf.length - i) % 3;
17439 if (n === 0) return buf.toString('base64', i);
17440 this.lastNeed = 3 - n;
17441 this.lastTotal = 3;
17442 if (n === 1) {
17443 this.lastChar[0] = buf[buf.length - 1];
17444 } else {
17445 this.lastChar[0] = buf[buf.length - 2];
17446 this.lastChar[1] = buf[buf.length - 1];
17447 }
17448 return buf.toString('base64', i, buf.length - n);
17449}
17450
17451function base64End(buf) {
17452 var r = buf && buf.length ? this.write(buf) : '';
17453 if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
17454 return r;
17455}
17456
17457// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
17458function simpleWrite(buf) {
17459 return buf.toString(this.encoding);
17460}
17461
17462function simpleEnd(buf) {
17463 return buf && buf.length ? this.write(buf) : '';
17464}
17465},{"safe-buffer":83}],86:[function(require,module,exports){
17466(function (setImmediate,clearImmediate){
17467var nextTick = require('process/browser.js').nextTick;
17468var apply = Function.prototype.apply;
17469var slice = Array.prototype.slice;
17470var immediateIds = {};
17471var nextImmediateId = 0;
17472
17473// DOM APIs, for completeness
17474
17475exports.setTimeout = function() {
17476 return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
17477};
17478exports.setInterval = function() {
17479 return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
17480};
17481exports.clearTimeout =
17482exports.clearInterval = function(timeout) { timeout.close(); };
17483
17484function Timeout(id, clearFn) {
17485 this._id = id;
17486 this._clearFn = clearFn;
17487}
17488Timeout.prototype.unref = Timeout.prototype.ref = function() {};
17489Timeout.prototype.close = function() {
17490 this._clearFn.call(window, this._id);
17491};
17492
17493// Does not start the time, just sets up the members needed.
17494exports.enroll = function(item, msecs) {
17495 clearTimeout(item._idleTimeoutId);
17496 item._idleTimeout = msecs;
17497};
17498
17499exports.unenroll = function(item) {
17500 clearTimeout(item._idleTimeoutId);
17501 item._idleTimeout = -1;
17502};
17503
17504exports._unrefActive = exports.active = function(item) {
17505 clearTimeout(item._idleTimeoutId);
17506
17507 var msecs = item._idleTimeout;
17508 if (msecs >= 0) {
17509 item._idleTimeoutId = setTimeout(function onTimeout() {
17510 if (item._onTimeout)
17511 item._onTimeout();
17512 }, msecs);
17513 }
17514};
17515
17516// That's not how node.js implements it but the exposed api is the same.
17517exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
17518 var id = nextImmediateId++;
17519 var args = arguments.length < 2 ? false : slice.call(arguments, 1);
17520
17521 immediateIds[id] = true;
17522
17523 nextTick(function onNextTick() {
17524 if (immediateIds[id]) {
17525 // fn.call() is faster so we optimize for the common use-case
17526 // @see http://jsperf.com/call-apply-segu
17527 if (args) {
17528 fn.apply(null, args);
17529 } else {
17530 fn.call(null);
17531 }
17532 // Prevent ids from leaking
17533 exports.clearImmediate(id);
17534 }
17535 });
17536
17537 return id;
17538};
17539
17540exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {
17541 delete immediateIds[id];
17542};
17543}).call(this,require("timers").setImmediate,require("timers").clearImmediate)
17544},{"process/browser.js":69,"timers":86}],87:[function(require,module,exports){
17545(function (global){
17546
17547/**
17548 * Module exports.
17549 */
17550
17551module.exports = deprecate;
17552
17553/**
17554 * Mark that a method should not be used.
17555 * Returns a modified function which warns once by default.
17556 *
17557 * If `localStorage.noDeprecation = true` is set, then it is a no-op.
17558 *
17559 * If `localStorage.throwDeprecation = true` is set, then deprecated functions
17560 * will throw an Error when invoked.
17561 *
17562 * If `localStorage.traceDeprecation = true` is set, then deprecated functions
17563 * will invoke `console.trace()` instead of `console.error()`.
17564 *
17565 * @param {Function} fn - the function to deprecate
17566 * @param {String} msg - the string to print to the console when `fn` is invoked
17567 * @returns {Function} a new "deprecated" version of `fn`
17568 * @api public
17569 */
17570
17571function deprecate (fn, msg) {
17572 if (config('noDeprecation')) {
17573 return fn;
17574 }
17575
17576 var warned = false;
17577 function deprecated() {
17578 if (!warned) {
17579 if (config('throwDeprecation')) {
17580 throw new Error(msg);
17581 } else if (config('traceDeprecation')) {
17582 console.trace(msg);
17583 } else {
17584 console.warn(msg);
17585 }
17586 warned = true;
17587 }
17588 return fn.apply(this, arguments);
17589 }
17590
17591 return deprecated;
17592}
17593
17594/**
17595 * Checks `localStorage` for boolean values for the given `name`.
17596 *
17597 * @param {String} name
17598 * @returns {Boolean}
17599 * @api private
17600 */
17601
17602function config (name) {
17603 // accessing global.localStorage can trigger a DOMException in sandboxed iframes
17604 try {
17605 if (!global.localStorage) return false;
17606 } catch (_) {
17607 return false;
17608 }
17609 var val = global.localStorage[name];
17610 if (null == val) return false;
17611 return String(val).toLowerCase() === 'true';
17612}
17613
17614}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
17615},{}],88:[function(require,module,exports){
17616module.exports = function isBuffer(arg) {
17617 return arg && typeof arg === 'object'
17618 && typeof arg.copy === 'function'
17619 && typeof arg.fill === 'function'
17620 && typeof arg.readUInt8 === 'function';
17621}
17622},{}],89:[function(require,module,exports){
17623(function (process,global){
17624// Copyright Joyent, Inc. and other Node contributors.
17625//
17626// Permission is hereby granted, free of charge, to any person obtaining a
17627// copy of this software and associated documentation files (the
17628// "Software"), to deal in the Software without restriction, including
17629// without limitation the rights to use, copy, modify, merge, publish,
17630// distribute, sublicense, and/or sell copies of the Software, and to permit
17631// persons to whom the Software is furnished to do so, subject to the
17632// following conditions:
17633//
17634// The above copyright notice and this permission notice shall be included
17635// in all copies or substantial portions of the Software.
17636//
17637// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17638// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17639// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17640// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17641// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17642// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
17643// USE OR OTHER DEALINGS IN THE SOFTWARE.
17644
17645var formatRegExp = /%[sdj%]/g;
17646exports.format = function(f) {
17647 if (!isString(f)) {
17648 var objects = [];
17649 for (var i = 0; i < arguments.length; i++) {
17650 objects.push(inspect(arguments[i]));
17651 }
17652 return objects.join(' ');
17653 }
17654
17655 var i = 1;
17656 var args = arguments;
17657 var len = args.length;
17658 var str = String(f).replace(formatRegExp, function(x) {
17659 if (x === '%%') return '%';
17660 if (i >= len) return x;
17661 switch (x) {
17662 case '%s': return String(args[i++]);
17663 case '%d': return Number(args[i++]);
17664 case '%j':
17665 try {
17666 return JSON.stringify(args[i++]);
17667 } catch (_) {
17668 return '[Circular]';
17669 }
17670 default:
17671 return x;
17672 }
17673 });
17674 for (var x = args[i]; i < len; x = args[++i]) {
17675 if (isNull(x) || !isObject(x)) {
17676 str += ' ' + x;
17677 } else {
17678 str += ' ' + inspect(x);
17679 }
17680 }
17681 return str;
17682};
17683
17684
17685// Mark that a method should not be used.
17686// Returns a modified function which warns once by default.
17687// If --no-deprecation is set, then it is a no-op.
17688exports.deprecate = function(fn, msg) {
17689 // Allow for deprecating things in the process of starting up.
17690 if (isUndefined(global.process)) {
17691 return function() {
17692 return exports.deprecate(fn, msg).apply(this, arguments);
17693 };
17694 }
17695
17696 if (process.noDeprecation === true) {
17697 return fn;
17698 }
17699
17700 var warned = false;
17701 function deprecated() {
17702 if (!warned) {
17703 if (process.throwDeprecation) {
17704 throw new Error(msg);
17705 } else if (process.traceDeprecation) {
17706 console.trace(msg);
17707 } else {
17708 console.error(msg);
17709 }
17710 warned = true;
17711 }
17712 return fn.apply(this, arguments);
17713 }
17714
17715 return deprecated;
17716};
17717
17718
17719var debugs = {};
17720var debugEnviron;
17721exports.debuglog = function(set) {
17722 if (isUndefined(debugEnviron))
17723 debugEnviron = process.env.NODE_DEBUG || '';
17724 set = set.toUpperCase();
17725 if (!debugs[set]) {
17726 if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
17727 var pid = process.pid;
17728 debugs[set] = function() {
17729 var msg = exports.format.apply(exports, arguments);
17730 console.error('%s %d: %s', set, pid, msg);
17731 };
17732 } else {
17733 debugs[set] = function() {};
17734 }
17735 }
17736 return debugs[set];
17737};
17738
17739
17740/**
17741 * Echos the value of a value. Trys to print the value out
17742 * in the best way possible given the different types.
17743 *
17744 * @param {Object} obj The object to print out.
17745 * @param {Object} opts Optional options object that alters the output.
17746 */
17747/* legacy: obj, showHidden, depth, colors*/
17748function inspect(obj, opts) {
17749 // default options
17750 var ctx = {
17751 seen: [],
17752 stylize: stylizeNoColor
17753 };
17754 // legacy...
17755 if (arguments.length >= 3) ctx.depth = arguments[2];
17756 if (arguments.length >= 4) ctx.colors = arguments[3];
17757 if (isBoolean(opts)) {
17758 // legacy...
17759 ctx.showHidden = opts;
17760 } else if (opts) {
17761 // got an "options" object
17762 exports._extend(ctx, opts);
17763 }
17764 // set default options
17765 if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
17766 if (isUndefined(ctx.depth)) ctx.depth = 2;
17767 if (isUndefined(ctx.colors)) ctx.colors = false;
17768 if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
17769 if (ctx.colors) ctx.stylize = stylizeWithColor;
17770 return formatValue(ctx, obj, ctx.depth);
17771}
17772exports.inspect = inspect;
17773
17774
17775// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
17776inspect.colors = {
17777 'bold' : [1, 22],
17778 'italic' : [3, 23],
17779 'underline' : [4, 24],
17780 'inverse' : [7, 27],
17781 'white' : [37, 39],
17782 'grey' : [90, 39],
17783 'black' : [30, 39],
17784 'blue' : [34, 39],
17785 'cyan' : [36, 39],
17786 'green' : [32, 39],
17787 'magenta' : [35, 39],
17788 'red' : [31, 39],
17789 'yellow' : [33, 39]
17790};
17791
17792// Don't use 'blue' not visible on cmd.exe
17793inspect.styles = {
17794 'special': 'cyan',
17795 'number': 'yellow',
17796 'boolean': 'yellow',
17797 'undefined': 'grey',
17798 'null': 'bold',
17799 'string': 'green',
17800 'date': 'magenta',
17801 // "name": intentionally not styling
17802 'regexp': 'red'
17803};
17804
17805
17806function stylizeWithColor(str, styleType) {
17807 var style = inspect.styles[styleType];
17808
17809 if (style) {
17810 return '\u001b[' + inspect.colors[style][0] + 'm' + str +
17811 '\u001b[' + inspect.colors[style][1] + 'm';
17812 } else {
17813 return str;
17814 }
17815}
17816
17817
17818function stylizeNoColor(str, styleType) {
17819 return str;
17820}
17821
17822
17823function arrayToHash(array) {
17824 var hash = {};
17825
17826 array.forEach(function(val, idx) {
17827 hash[val] = true;
17828 });
17829
17830 return hash;
17831}
17832
17833
17834function formatValue(ctx, value, recurseTimes) {
17835 // Provide a hook for user-specified inspect functions.
17836 // Check that value is an object with an inspect function on it
17837 if (ctx.customInspect &&
17838 value &&
17839 isFunction(value.inspect) &&
17840 // Filter out the util module, it's inspect function is special
17841 value.inspect !== exports.inspect &&
17842 // Also filter out any prototype objects using the circular check.
17843 !(value.constructor && value.constructor.prototype === value)) {
17844 var ret = value.inspect(recurseTimes, ctx);
17845 if (!isString(ret)) {
17846 ret = formatValue(ctx, ret, recurseTimes);
17847 }
17848 return ret;
17849 }
17850
17851 // Primitive types cannot have properties
17852 var primitive = formatPrimitive(ctx, value);
17853 if (primitive) {
17854 return primitive;
17855 }
17856
17857 // Look up the keys of the object.
17858 var keys = Object.keys(value);
17859 var visibleKeys = arrayToHash(keys);
17860
17861 if (ctx.showHidden) {
17862 keys = Object.getOwnPropertyNames(value);
17863 }
17864
17865 // IE doesn't make error fields non-enumerable
17866 // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
17867 if (isError(value)
17868 && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
17869 return formatError(value);
17870 }
17871
17872 // Some type of object without properties can be shortcutted.
17873 if (keys.length === 0) {
17874 if (isFunction(value)) {
17875 var name = value.name ? ': ' + value.name : '';
17876 return ctx.stylize('[Function' + name + ']', 'special');
17877 }
17878 if (isRegExp(value)) {
17879 return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
17880 }
17881 if (isDate(value)) {
17882 return ctx.stylize(Date.prototype.toString.call(value), 'date');
17883 }
17884 if (isError(value)) {
17885 return formatError(value);
17886 }
17887 }
17888
17889 var base = '', array = false, braces = ['{', '}'];
17890
17891 // Make Array say that they are Array
17892 if (isArray(value)) {
17893 array = true;
17894 braces = ['[', ']'];
17895 }
17896
17897 // Make functions say that they are functions
17898 if (isFunction(value)) {
17899 var n = value.name ? ': ' + value.name : '';
17900 base = ' [Function' + n + ']';
17901 }
17902
17903 // Make RegExps say that they are RegExps
17904 if (isRegExp(value)) {
17905 base = ' ' + RegExp.prototype.toString.call(value);
17906 }
17907
17908 // Make dates with properties first say the date
17909 if (isDate(value)) {
17910 base = ' ' + Date.prototype.toUTCString.call(value);
17911 }
17912
17913 // Make error with message first say the error
17914 if (isError(value)) {
17915 base = ' ' + formatError(value);
17916 }
17917
17918 if (keys.length === 0 && (!array || value.length == 0)) {
17919 return braces[0] + base + braces[1];
17920 }
17921
17922 if (recurseTimes < 0) {
17923 if (isRegExp(value)) {
17924 return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
17925 } else {
17926 return ctx.stylize('[Object]', 'special');
17927 }
17928 }
17929
17930 ctx.seen.push(value);
17931
17932 var output;
17933 if (array) {
17934 output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
17935 } else {
17936 output = keys.map(function(key) {
17937 return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
17938 });
17939 }
17940
17941 ctx.seen.pop();
17942
17943 return reduceToSingleString(output, base, braces);
17944}
17945
17946
17947function formatPrimitive(ctx, value) {
17948 if (isUndefined(value))
17949 return ctx.stylize('undefined', 'undefined');
17950 if (isString(value)) {
17951 var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
17952 .replace(/'/g, "\\'")
17953 .replace(/\\"/g, '"') + '\'';
17954 return ctx.stylize(simple, 'string');
17955 }
17956 if (isNumber(value))
17957 return ctx.stylize('' + value, 'number');
17958 if (isBoolean(value))
17959 return ctx.stylize('' + value, 'boolean');
17960 // For some reason typeof null is "object", so special case here.
17961 if (isNull(value))
17962 return ctx.stylize('null', 'null');
17963}
17964
17965
17966function formatError(value) {
17967 return '[' + Error.prototype.toString.call(value) + ']';
17968}
17969
17970
17971function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
17972 var output = [];
17973 for (var i = 0, l = value.length; i < l; ++i) {
17974 if (hasOwnProperty(value, String(i))) {
17975 output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
17976 String(i), true));
17977 } else {
17978 output.push('');
17979 }
17980 }
17981 keys.forEach(function(key) {
17982 if (!key.match(/^\d+$/)) {
17983 output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
17984 key, true));
17985 }
17986 });
17987 return output;
17988}
17989
17990
17991function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
17992 var name, str, desc;
17993 desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
17994 if (desc.get) {
17995 if (desc.set) {
17996 str = ctx.stylize('[Getter/Setter]', 'special');
17997 } else {
17998 str = ctx.stylize('[Getter]', 'special');
17999 }
18000 } else {
18001 if (desc.set) {
18002 str = ctx.stylize('[Setter]', 'special');
18003 }
18004 }
18005 if (!hasOwnProperty(visibleKeys, key)) {
18006 name = '[' + key + ']';
18007 }
18008 if (!str) {
18009 if (ctx.seen.indexOf(desc.value) < 0) {
18010 if (isNull(recurseTimes)) {
18011 str = formatValue(ctx, desc.value, null);
18012 } else {
18013 str = formatValue(ctx, desc.value, recurseTimes - 1);
18014 }
18015 if (str.indexOf('\n') > -1) {
18016 if (array) {
18017 str = str.split('\n').map(function(line) {
18018 return ' ' + line;
18019 }).join('\n').substr(2);
18020 } else {
18021 str = '\n' + str.split('\n').map(function(line) {
18022 return ' ' + line;
18023 }).join('\n');
18024 }
18025 }
18026 } else {
18027 str = ctx.stylize('[Circular]', 'special');
18028 }
18029 }
18030 if (isUndefined(name)) {
18031 if (array && key.match(/^\d+$/)) {
18032 return str;
18033 }
18034 name = JSON.stringify('' + key);
18035 if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
18036 name = name.substr(1, name.length - 2);
18037 name = ctx.stylize(name, 'name');
18038 } else {
18039 name = name.replace(/'/g, "\\'")
18040 .replace(/\\"/g, '"')
18041 .replace(/(^"|"$)/g, "'");
18042 name = ctx.stylize(name, 'string');
18043 }
18044 }
18045
18046 return name + ': ' + str;
18047}
18048
18049
18050function reduceToSingleString(output, base, braces) {
18051 var numLinesEst = 0;
18052 var length = output.reduce(function(prev, cur) {
18053 numLinesEst++;
18054 if (cur.indexOf('\n') >= 0) numLinesEst++;
18055 return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
18056 }, 0);
18057
18058 if (length > 60) {
18059 return braces[0] +
18060 (base === '' ? '' : base + '\n ') +
18061 ' ' +
18062 output.join(',\n ') +
18063 ' ' +
18064 braces[1];
18065 }
18066
18067 return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
18068}
18069
18070
18071// NOTE: These type checking functions intentionally don't use `instanceof`
18072// because it is fragile and can be easily faked with `Object.create()`.
18073function isArray(ar) {
18074 return Array.isArray(ar);
18075}
18076exports.isArray = isArray;
18077
18078function isBoolean(arg) {
18079 return typeof arg === 'boolean';
18080}
18081exports.isBoolean = isBoolean;
18082
18083function isNull(arg) {
18084 return arg === null;
18085}
18086exports.isNull = isNull;
18087
18088function isNullOrUndefined(arg) {
18089 return arg == null;
18090}
18091exports.isNullOrUndefined = isNullOrUndefined;
18092
18093function isNumber(arg) {
18094 return typeof arg === 'number';
18095}
18096exports.isNumber = isNumber;
18097
18098function isString(arg) {
18099 return typeof arg === 'string';
18100}
18101exports.isString = isString;
18102
18103function isSymbol(arg) {
18104 return typeof arg === 'symbol';
18105}
18106exports.isSymbol = isSymbol;
18107
18108function isUndefined(arg) {
18109 return arg === void 0;
18110}
18111exports.isUndefined = isUndefined;
18112
18113function isRegExp(re) {
18114 return isObject(re) && objectToString(re) === '[object RegExp]';
18115}
18116exports.isRegExp = isRegExp;
18117
18118function isObject(arg) {
18119 return typeof arg === 'object' && arg !== null;
18120}
18121exports.isObject = isObject;
18122
18123function isDate(d) {
18124 return isObject(d) && objectToString(d) === '[object Date]';
18125}
18126exports.isDate = isDate;
18127
18128function isError(e) {
18129 return isObject(e) &&
18130 (objectToString(e) === '[object Error]' || e instanceof Error);
18131}
18132exports.isError = isError;
18133
18134function isFunction(arg) {
18135 return typeof arg === 'function';
18136}
18137exports.isFunction = isFunction;
18138
18139function isPrimitive(arg) {
18140 return arg === null ||
18141 typeof arg === 'boolean' ||
18142 typeof arg === 'number' ||
18143 typeof arg === 'string' ||
18144 typeof arg === 'symbol' || // ES6 symbol
18145 typeof arg === 'undefined';
18146}
18147exports.isPrimitive = isPrimitive;
18148
18149exports.isBuffer = require('./support/isBuffer');
18150
18151function objectToString(o) {
18152 return Object.prototype.toString.call(o);
18153}
18154
18155
18156function pad(n) {
18157 return n < 10 ? '0' + n.toString(10) : n.toString(10);
18158}
18159
18160
18161var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
18162 'Oct', 'Nov', 'Dec'];
18163
18164// 26 Feb 16:19:34
18165function timestamp() {
18166 var d = new Date();
18167 var time = [pad(d.getHours()),
18168 pad(d.getMinutes()),
18169 pad(d.getSeconds())].join(':');
18170 return [d.getDate(), months[d.getMonth()], time].join(' ');
18171}
18172
18173
18174// log is just a thin wrapper to console.log that prepends a timestamp
18175exports.log = function() {
18176 console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
18177};
18178
18179
18180/**
18181 * Inherit the prototype methods from one constructor into another.
18182 *
18183 * The Function.prototype.inherits from lang.js rewritten as a standalone
18184 * function (not on Function.prototype). NOTE: If this file is to be loaded
18185 * during bootstrapping this function needs to be rewritten using some native
18186 * functions as prototype setup using normal JavaScript does not work as
18187 * expected during bootstrapping (see mirror.js in r114903).
18188 *
18189 * @param {function} ctor Constructor function which needs to inherit the
18190 * prototype.
18191 * @param {function} superCtor Constructor function to inherit prototype from.
18192 */
18193exports.inherits = require('inherits');
18194
18195exports._extend = function(origin, add) {
18196 // Don't do anything if add isn't an object
18197 if (!add || !isObject(add)) return origin;
18198
18199 var keys = Object.keys(add);
18200 var i = keys.length;
18201 while (i--) {
18202 origin[keys[i]] = add[keys[i]];
18203 }
18204 return origin;
18205};
18206
18207function hasOwnProperty(obj, prop) {
18208 return Object.prototype.hasOwnProperty.call(obj, prop);
18209}
18210
18211}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
18212},{"./support/isBuffer":88,"_process":69,"inherits":56}],90:[function(require,module,exports){
18213module.exports={
18214 "name": "mocha",
18215 "version": "7.0.0-esm1",
18216 "homepage": "https://mochajs.org/",
18217 "notifyLogo": "https://ibin.co/4QuRuGjXvl36.png"
18218}
18219},{}]},{},[1]);