voterunner

quick and dirty votes and discussions
git clone https://git.ce9e.org/voterunner.git

commit
d2e3efe9d94dc1ff47300fc2f788b120b9c0dd61
parent
f5e79d90f3dfbebcb31ac86e8cc20986ade1df6c
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2020-10-17 08:13
rm compiled files

Diffstat

M .gitignore 2 ++
M README.md 7 +++----
D static/style.css 300 ------------------------------------------------------------
D static/voterunner.js 16436 ------------------------------------------------------------

4 files changed, 5 insertions, 16740 deletions


diff --git a/.gitignore b/.gitignore

@@ -1,3 +1,5 @@
    1     1 node_modules
    2     2 data
    3     3 db.sqlite3
   -1     4 static/style.css
   -1     5 static/voterunner.js

diff --git a/README.md b/README.md

@@ -84,10 +84,9 @@ lines will bring it up:
   84    84 Development
   85    85 -----------
   86    86 
   87    -1 The repository contains all necessary compiled files. If you want to edit the
   88    -1 code yourself you will need to install [sassc](https://github.com/sass/sassc)
   89    -1 and [browserify](https://www.npmjs.com/package/browserify). Once these
   90    -1 requirements are met, you can simply run `make`.
   -1    87 You will need to install [sassc](https://github.com/sass/sassc) and
   -1    88 [browserify](https://www.npmjs.com/package/browserify). Once these
   -1    89 requirements are met, you can simply run `make` to build all files.
   91    90 
   92    91 
   93    92 API

diff --git a/static/style.css b/static/style.css

@@ -1,300 +0,0 @@
    1    -1 @viewport {
    2    -1   width: device-width; }
    3    -1 
    4    -1 *,
    5    -1 *::before,
    6    -1 *::after {
    7    -1   box-sizing: inherit; }
    8    -1 
    9    -1 img {
   10    -1   max-width: 100%; }
   11    -1 
   12    -1 p, address, blockquote, pre, table, dl, ul, ol, figure, fieldset {
   13    -1   margin-top: 0;
   14    -1   margin-bottom: 1em; }
   15    -1 
   16    -1 html {
   17    -1   overflow-y: scroll;
   18    -1   background-color: #fff;
   19    -1   box-sizing: border-box;
   20    -1   color: #111;
   21    -1   font-size: 1.2em;
   22    -1   font-family: sans-serif;
   23    -1   line-height: 1.5; }
   24    -1 
   25    -1 h1, h2, h3, h4, h5, h6 {
   26    -1   line-height: 1.2;
   27    -1   margin-bottom: 0.8rem;
   28    -1   margin-top: 1.5em; }
   29    -1 
   30    -1 a {
   31    -1   color: #336DBE;
   32    -1   text-decoration: underline; }
   33    -1   a:hover, a:focus, a:active {
   34    -1     color: #223f68; }
   35    -1 
   36    -1 a:not([href]) {
   37    -1   color: inherit;
   38    -1   text-decoration: inherit; }
   39    -1   a:not([href]):hover, a:not([href]):focus, a:not([href]):active {
   40    -1     color: inherit; }
   41    -1 
   42    -1 *::selection {
   43    -1   background: #336DBE;
   44    -1   color: #fff; }
   45    -1 
   46    -1 hr {
   47    -1   border: 0;
   48    -1   border-bottom: 1px solid #c0c0c0;
   49    -1   margin: 1em 0; }
   50    -1 
   51    -1 pre, code {
   52    -1   font-size: 90%;
   53    -1   font-family: monospace;
   54    -1   background-color: #ccdbef; }
   55    -1 
   56    -1 code {
   57    -1   padding: 0 0.25em; }
   58    -1 
   59    -1 pre {
   60    -1   padding: 0.4em;
   61    -1   overflow: auto;
   62    -1   border: 1px solid #c0c0c0; }
   63    -1   pre code {
   64    -1     background: none;
   65    -1     font-size: 100%;
   66    -1     padding: 0; }
   67    -1 
   68    -1 ol, ul {
   69    -1   padding-left: 1.5rem; }
   70    -1 
   71    -1 dt {
   72    -1   font-weight: bold; }
   73    -1 
   74    -1 dd {
   75    -1   margin-left: 1.5rem; }
   76    -1 
   77    -1 blockquote {
   78    -1   font-style: italic;
   79    -1   margin-left: 1.5rem;
   80    -1   margin-right: 0; }
   81    -1 
   82    -1 table {
   83    -1   border-collapse: collapse;
   84    -1   border-spacing: 0; }
   85    -1 
   86    -1 tr {
   87    -1   border-bottom: 1px solid #c0c0c0; }
   88    -1 
   89    -1 td, th {
   90    -1   text-align: start;
   91    -1   padding: 0.2em;
   92    -1   vertical-align: top; }
   93    -1 
   94    -1 textarea {
   95    -1   resize: vertical; }
   96    -1 
   97    -1 fieldset {
   98    -1   border: 1px solid #c0c0c0; }
   99    -1 
  100    -1 sub, sup {
  101    -1   line-height: 0; }
  102    -1 
  103    -1 @media print {
  104    -1   html {
  105    -1     background: transparent;
  106    -1     color: #000; }
  107    -1   h2, h3 {
  108    -1     page-break-after: avoid; } }
  109    -1 
  110    -1 body {
  111    -1   margin: 2em auto;
  112    -1   max-width: 38em;
  113    -1   padding: 0 0.4em; }
  114    -1 
  115    -1 [id^="json-"] {
  116    -1   display: none; }
  117    -1 
  118    -1 input[type="text"],
  119    -1 textarea {
  120    -1   background-color: #fff; }
  121    -1 
  122    -1 textarea {
  123    -1   font-family: inherit;
  124    -1   font-size: inherit; }
  125    -1 
  126    -1 @media screen {
  127    -1   html.voterunner {
  128    -1     background: #eee;
  129    -1     font-size: 80%; } }
  130    -1 
  131    -1 body,
  132    -1 html {
  133    -1   height: 100%; }
  134    -1 
  135    -1 body {
  136    -1   margin: 0 auto;
  137    -1   position: relative; }
  138    -1   body > div {
  139    -1     padding: 3em 0 1em;
  140    -1     height: 100%;
  141    -1     min-height: 37em; }
  142    -1     body > div > div {
  143    -1       position: relative;
  144    -1       height: 100%;
  145    -1       min-height: 33em; }
  146    -1 
  147    -1 .voterunner body {
  148    -1   max-width: 90em; }
  149    -1 
  150    -1 body > header {
  151    -1   background: #336DBE;
  152    -1   text-align: center;
  153    -1   border-radius: 0 0 0.4em 0.4em;
  154    -1   margin: 0;
  155    -1   position: absolute;
  156    -1   top: 0;
  157    -1   left: 0.4em;
  158    -1   right: 0.4em; }
  159    -1   body > header h1 {
  160    -1     margin: 0;
  161    -1     font-size: 200%;
  162    -1     color: #fff; }
  163    -1     body > header h1 span {
  164    -1       color: #ccdbef; }
  165    -1 
  166    -1 #tree,
  167    -1 .user,
  168    -1 .node__body {
  169    -1   border: 1px solid #c0c0c0;
  170    -1   border-radius: 0.2em 0.2em 0 0; }
  171    -1 
  172    -1 @media print {
  173    -1   #tree, #user {
  174    -1     border: 0; } }
  175    -1 
  176    -1 #tree {
  177    -1   background: #fff;
  178    -1   padding: 0.4em;
  179    -1   margin-top: 0.4em; }
  180    -1 
  181    -1 @media screen and (min-width: 40em) {
  182    -1   html {
  183    -1     overflow: auto; }
  184    -1   #tree {
  185    -1     position: absolute;
  186    -1     top: 0;
  187    -1     left: 0;
  188    -1     width: 57%;
  189    -1     height: 100%;
  190    -1     overflow: auto;
  191    -1     margin-top: 0; }
  192    -1   #sidebar {
  193    -1     position: absolute;
  194    -1     top: 0;
  195    -1     right: 0;
  196    -1     width: 42%; } }
  197    -1 
  198    -1 .bar {
  199    -1   display: flex; }
  200    -1 
  201    -1 .bar__item {
  202    -1   padding: 0.4em;
  203    -1   white-space: nowrap;
  204    -1   overflow: hidden;
  205    -1   text-overflow: ellipsis;
  206    -1   flex: 0 0 auto; }
  207    -1 
  208    -1 .bar__item--button {
  209    -1   appearance: none;
  210    -1   background: none;
  211    -1   border: 0;
  212    -1   cursor: pointer;
  213    -1   font: inherit;
  214    -1   color: inherit;
  215    -1   text-align: center;
  216    -1   min-width: 2.3em; }
  217    -1   .bar__item--button:focus, .bar__item--button:hover {
  218    -1     background-color: rgba(255, 255, 255, 0.2); }
  219    -1   @media print {
  220    -1     .bar__item--button {
  221    -1       display: none; } }
  222    -1 
  223    -1 .bar__item--grow {
  224    -1   flex: 1 1 auto; }
  225    -1 
  226    -1 .bar__item--left {
  227    -1   border-right: 1px solid #c0c0c0;
  228    -1   order: 0; }
  229    -1 
  230    -1 .bar__item--right {
  231    -1   border-left: 1px solid #c0c0c0;
  232    -1   order: 100; }
  233    -1 
  234    -1 .tree {
  235    -1   padding: 0;
  236    -1   margin: 0;
  237    -1   list-style: none; }
  238    -1   .tree .tree {
  239    -1     margin-left: 2em; }
  240    -1 
  241    -1 .node {
  242    -1   margin: 1em 0; }
  243    -1   .node:target > .node__body {
  244    -1     outline: 5px auto #336DBE;
  245    -1     outline-offset: -2px; }
  246    -1   .node.node--self .node__delegate {
  247    -1     display: none; }
  248    -1   @media screen {
  249    -1     .node.node--self > .node__body .node__header {
  250    -1       background-color: #336DBE;
  251    -1       color: #fff; } }
  252    -1   @media print {
  253    -1     .node.node--self > .node__body .node__header {
  254    -1       font-weight: bold; } }
  255    -1   .node:not(.is-expanded) > .tree {
  256    -1     display: none; }
  257    -1   .node.is-expanded > .node__body .node__header {
  258    -1     border-bottom: 1px solid #c0c0c0; }
  259    -1 
  260    -1 .node__body {
  261    -1   background: #fff;
  262    -1   break-inside: avoid;
  263    -1   overflow: hidden; }
  264    -1 
  265    -1 @media screen {
  266    -1   .node__header {
  267    -1     background-color: #ccdbef; } }
  268    -1 
  269    -1 .node__preview {
  270    -1   opacity: 0.7; }
  271    -1 
  272    -1 .node__comment {
  273    -1   padding: 0.4em; }
  274    -1   .node__comment > :first-child {
  275    -1     margin-top: 0; }
  276    -1   .node__comment > :last-child {
  277    -1     margin-bottom: 0; }
  278    -1 
  279    -1 .user {
  280    -1   background: #ccdbef; }
  281    -1   .user .bar {
  282    -1     border-bottom: 1px solid #c0c0c0; }
  283    -1   @media print {
  284    -1     .user {
  285    -1       display: none; } }
  286    -1 
  287    -1 .user__name input {
  288    -1   font-size: 120%;
  289    -1   height: 1.6em; }
  290    -1 
  291    -1 .user__rm {
  292    -1   font-size: 120%;
  293    -1   padding: 0.4em;
  294    -1   line-height: 1.6; }
  295    -1 
  296    -1 .user__comment textarea {
  297    -1   width: 100%;
  298    -1   min-height: 15em;
  299    -1   border: none;
  300    -1   padding: 0.4em; }

diff --git a/static/voterunner.js b/static/voterunner.js

@@ -1,16436 +0,0 @@
    1    -1 (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
    2    -1 
    3    -1 },{}],2:[function(require,module,exports){
    4    -1 // shim for using process in browser
    5    -1 var process = module.exports = {};
    6    -1 
    7    -1 // cached from whatever global is present so that test runners that stub it
    8    -1 // don't break things.  But we need to wrap it in a try catch in case it is
    9    -1 // wrapped in strict mode code which doesn't define any globals.  It's inside a
   10    -1 // function because try/catches deoptimize in certain engines.
   11    -1 
   12    -1 var cachedSetTimeout;
   13    -1 var cachedClearTimeout;
   14    -1 
   15    -1 function defaultSetTimout() {
   16    -1     throw new Error('setTimeout has not been defined');
   17    -1 }
   18    -1 function defaultClearTimeout () {
   19    -1     throw new Error('clearTimeout has not been defined');
   20    -1 }
   21    -1 (function () {
   22    -1     try {
   23    -1         if (typeof setTimeout === 'function') {
   24    -1             cachedSetTimeout = setTimeout;
   25    -1         } else {
   26    -1             cachedSetTimeout = defaultSetTimout;
   27    -1         }
   28    -1     } catch (e) {
   29    -1         cachedSetTimeout = defaultSetTimout;
   30    -1     }
   31    -1     try {
   32    -1         if (typeof clearTimeout === 'function') {
   33    -1             cachedClearTimeout = clearTimeout;
   34    -1         } else {
   35    -1             cachedClearTimeout = defaultClearTimeout;
   36    -1         }
   37    -1     } catch (e) {
   38    -1         cachedClearTimeout = defaultClearTimeout;
   39    -1     }
   40    -1 } ())
   41    -1 function runTimeout(fun) {
   42    -1     if (cachedSetTimeout === setTimeout) {
   43    -1         //normal enviroments in sane situations
   44    -1         return setTimeout(fun, 0);
   45    -1     }
   46    -1     // if setTimeout wasn't available but was latter defined
   47    -1     if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
   48    -1         cachedSetTimeout = setTimeout;
   49    -1         return setTimeout(fun, 0);
   50    -1     }
   51    -1     try {
   52    -1         // when when somebody has screwed with setTimeout but no I.E. maddness
   53    -1         return cachedSetTimeout(fun, 0);
   54    -1     } catch(e){
   55    -1         try {
   56    -1             // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
   57    -1             return cachedSetTimeout.call(null, fun, 0);
   58    -1         } catch(e){
   59    -1             // 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
   60    -1             return cachedSetTimeout.call(this, fun, 0);
   61    -1         }
   62    -1     }
   63    -1 
   64    -1 
   65    -1 }
   66    -1 function runClearTimeout(marker) {
   67    -1     if (cachedClearTimeout === clearTimeout) {
   68    -1         //normal enviroments in sane situations
   69    -1         return clearTimeout(marker);
   70    -1     }
   71    -1     // if clearTimeout wasn't available but was latter defined
   72    -1     if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
   73    -1         cachedClearTimeout = clearTimeout;
   74    -1         return clearTimeout(marker);
   75    -1     }
   76    -1     try {
   77    -1         // when when somebody has screwed with setTimeout but no I.E. maddness
   78    -1         return cachedClearTimeout(marker);
   79    -1     } catch (e){
   80    -1         try {
   81    -1             // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally
   82    -1             return cachedClearTimeout.call(null, marker);
   83    -1         } catch (e){
   84    -1             // 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.
   85    -1             // Some versions of I.E. have different rules for clearTimeout vs setTimeout
   86    -1             return cachedClearTimeout.call(this, marker);
   87    -1         }
   88    -1     }
   89    -1 
   90    -1 
   91    -1 
   92    -1 }
   93    -1 var queue = [];
   94    -1 var draining = false;
   95    -1 var currentQueue;
   96    -1 var queueIndex = -1;
   97    -1 
   98    -1 function cleanUpNextTick() {
   99    -1     if (!draining || !currentQueue) {
  100    -1         return;
  101    -1     }
  102    -1     draining = false;
  103    -1     if (currentQueue.length) {
  104    -1         queue = currentQueue.concat(queue);
  105    -1     } else {
  106    -1         queueIndex = -1;
  107    -1     }
  108    -1     if (queue.length) {
  109    -1         drainQueue();
  110    -1     }
  111    -1 }
  112    -1 
  113    -1 function drainQueue() {
  114    -1     if (draining) {
  115    -1         return;
  116    -1     }
  117    -1     var timeout = runTimeout(cleanUpNextTick);
  118    -1     draining = true;
  119    -1 
  120    -1     var len = queue.length;
  121    -1     while(len) {
  122    -1         currentQueue = queue;
  123    -1         queue = [];
  124    -1         while (++queueIndex < len) {
  125    -1             if (currentQueue) {
  126    -1                 currentQueue[queueIndex].run();
  127    -1             }
  128    -1         }
  129    -1         queueIndex = -1;
  130    -1         len = queue.length;
  131    -1     }
  132    -1     currentQueue = null;
  133    -1     draining = false;
  134    -1     runClearTimeout(timeout);
  135    -1 }
  136    -1 
  137    -1 process.nextTick = function (fun) {
  138    -1     var args = new Array(arguments.length - 1);
  139    -1     if (arguments.length > 1) {
  140    -1         for (var i = 1; i < arguments.length; i++) {
  141    -1             args[i - 1] = arguments[i];
  142    -1         }
  143    -1     }
  144    -1     queue.push(new Item(fun, args));
  145    -1     if (queue.length === 1 && !draining) {
  146    -1         runTimeout(drainQueue);
  147    -1     }
  148    -1 };
  149    -1 
  150    -1 // v8 likes predictible objects
  151    -1 function Item(fun, array) {
  152    -1     this.fun = fun;
  153    -1     this.array = array;
  154    -1 }
  155    -1 Item.prototype.run = function () {
  156    -1     this.fun.apply(null, this.array);
  157    -1 };
  158    -1 process.title = 'browser';
  159    -1 process.browser = true;
  160    -1 process.env = {};
  161    -1 process.argv = [];
  162    -1 process.version = ''; // empty string to avoid regexp issues
  163    -1 process.versions = {};
  164    -1 
  165    -1 function noop() {}
  166    -1 
  167    -1 process.on = noop;
  168    -1 process.addListener = noop;
  169    -1 process.once = noop;
  170    -1 process.off = noop;
  171    -1 process.removeListener = noop;
  172    -1 process.removeAllListeners = noop;
  173    -1 process.emit = noop;
  174    -1 process.prependListener = noop;
  175    -1 process.prependOnceListener = noop;
  176    -1 
  177    -1 process.listeners = function (name) { return [] }
  178    -1 
  179    -1 process.binding = function (name) {
  180    -1     throw new Error('process.binding is not supported');
  181    -1 };
  182    -1 
  183    -1 process.cwd = function () { return '/' };
  184    -1 process.chdir = function (dir) {
  185    -1     throw new Error('process.chdir is not supported');
  186    -1 };
  187    -1 process.umask = function() { return 0; };
  188    -1 
  189    -1 },{}],3:[function(require,module,exports){
  190    -1 (function (global){
  191    -1 /*! https://mths.be/punycode v1.4.1 by @mathias */
  192    -1 ;(function(root) {
  193    -1 
  194    -1 	/** Detect free variables */
  195    -1 	var freeExports = typeof exports == 'object' && exports &&
  196    -1 		!exports.nodeType && exports;
  197    -1 	var freeModule = typeof module == 'object' && module &&
  198    -1 		!module.nodeType && module;
  199    -1 	var freeGlobal = typeof global == 'object' && global;
  200    -1 	if (
  201    -1 		freeGlobal.global === freeGlobal ||
  202    -1 		freeGlobal.window === freeGlobal ||
  203    -1 		freeGlobal.self === freeGlobal
  204    -1 	) {
  205    -1 		root = freeGlobal;
  206    -1 	}
  207    -1 
  208    -1 	/**
  209    -1 	 * The `punycode` object.
  210    -1 	 * @name punycode
  211    -1 	 * @type Object
  212    -1 	 */
  213    -1 	var punycode,
  214    -1 
  215    -1 	/** Highest positive signed 32-bit float value */
  216    -1 	maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
  217    -1 
  218    -1 	/** Bootstring parameters */
  219    -1 	base = 36,
  220    -1 	tMin = 1,
  221    -1 	tMax = 26,
  222    -1 	skew = 38,
  223    -1 	damp = 700,
  224    -1 	initialBias = 72,
  225    -1 	initialN = 128, // 0x80
  226    -1 	delimiter = '-', // '\x2D'
  227    -1 
  228    -1 	/** Regular expressions */
  229    -1 	regexPunycode = /^xn--/,
  230    -1 	regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
  231    -1 	regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
  232    -1 
  233    -1 	/** Error messages */
  234    -1 	errors = {
  235    -1 		'overflow': 'Overflow: input needs wider integers to process',
  236    -1 		'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
  237    -1 		'invalid-input': 'Invalid input'
  238    -1 	},
  239    -1 
  240    -1 	/** Convenience shortcuts */
  241    -1 	baseMinusTMin = base - tMin,
  242    -1 	floor = Math.floor,
  243    -1 	stringFromCharCode = String.fromCharCode,
  244    -1 
  245    -1 	/** Temporary variable */
  246    -1 	key;
  247    -1 
  248    -1 	/*--------------------------------------------------------------------------*/
  249    -1 
  250    -1 	/**
  251    -1 	 * A generic error utility function.
  252    -1 	 * @private
  253    -1 	 * @param {String} type The error type.
  254    -1 	 * @returns {Error} Throws a `RangeError` with the applicable error message.
  255    -1 	 */
  256    -1 	function error(type) {
  257    -1 		throw new RangeError(errors[type]);
  258    -1 	}
  259    -1 
  260    -1 	/**
  261    -1 	 * A generic `Array#map` utility function.
  262    -1 	 * @private
  263    -1 	 * @param {Array} array The array to iterate over.
  264    -1 	 * @param {Function} callback The function that gets called for every array
  265    -1 	 * item.
  266    -1 	 * @returns {Array} A new array of values returned by the callback function.
  267    -1 	 */
  268    -1 	function map(array, fn) {
  269    -1 		var length = array.length;
  270    -1 		var result = [];
  271    -1 		while (length--) {
  272    -1 			result[length] = fn(array[length]);
  273    -1 		}
  274    -1 		return result;
  275    -1 	}
  276    -1 
  277    -1 	/**
  278    -1 	 * A simple `Array#map`-like wrapper to work with domain name strings or email
  279    -1 	 * addresses.
  280    -1 	 * @private
  281    -1 	 * @param {String} domain The domain name or email address.
  282    -1 	 * @param {Function} callback The function that gets called for every
  283    -1 	 * character.
  284    -1 	 * @returns {Array} A new string of characters returned by the callback
  285    -1 	 * function.
  286    -1 	 */
  287    -1 	function mapDomain(string, fn) {
  288    -1 		var parts = string.split('@');
  289    -1 		var result = '';
  290    -1 		if (parts.length > 1) {
  291    -1 			// In email addresses, only the domain name should be punycoded. Leave
  292    -1 			// the local part (i.e. everything up to `@`) intact.
  293    -1 			result = parts[0] + '@';
  294    -1 			string = parts[1];
  295    -1 		}
  296    -1 		// Avoid `split(regex)` for IE8 compatibility. See #17.
  297    -1 		string = string.replace(regexSeparators, '\x2E');
  298    -1 		var labels = string.split('.');
  299    -1 		var encoded = map(labels, fn).join('.');
  300    -1 		return result + encoded;
  301    -1 	}
  302    -1 
  303    -1 	/**
  304    -1 	 * Creates an array containing the numeric code points of each Unicode
  305    -1 	 * character in the string. While JavaScript uses UCS-2 internally,
  306    -1 	 * this function will convert a pair of surrogate halves (each of which
  307    -1 	 * UCS-2 exposes as separate characters) into a single code point,
  308    -1 	 * matching UTF-16.
  309    -1 	 * @see `punycode.ucs2.encode`
  310    -1 	 * @see <https://mathiasbynens.be/notes/javascript-encoding>
  311    -1 	 * @memberOf punycode.ucs2
  312    -1 	 * @name decode
  313    -1 	 * @param {String} string The Unicode input string (UCS-2).
  314    -1 	 * @returns {Array} The new array of code points.
  315    -1 	 */
  316    -1 	function ucs2decode(string) {
  317    -1 		var output = [],
  318    -1 		    counter = 0,
  319    -1 		    length = string.length,
  320    -1 		    value,
  321    -1 		    extra;
  322    -1 		while (counter < length) {
  323    -1 			value = string.charCodeAt(counter++);
  324    -1 			if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
  325    -1 				// high surrogate, and there is a next character
  326    -1 				extra = string.charCodeAt(counter++);
  327    -1 				if ((extra & 0xFC00) == 0xDC00) { // low surrogate
  328    -1 					output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
  329    -1 				} else {
  330    -1 					// unmatched surrogate; only append this code unit, in case the next
  331    -1 					// code unit is the high surrogate of a surrogate pair
  332    -1 					output.push(value);
  333    -1 					counter--;
  334    -1 				}
  335    -1 			} else {
  336    -1 				output.push(value);
  337    -1 			}
  338    -1 		}
  339    -1 		return output;
  340    -1 	}
  341    -1 
  342    -1 	/**
  343    -1 	 * Creates a string based on an array of numeric code points.
  344    -1 	 * @see `punycode.ucs2.decode`
  345    -1 	 * @memberOf punycode.ucs2
  346    -1 	 * @name encode
  347    -1 	 * @param {Array} codePoints The array of numeric code points.
  348    -1 	 * @returns {String} The new Unicode string (UCS-2).
  349    -1 	 */
  350    -1 	function ucs2encode(array) {
  351    -1 		return map(array, function(value) {
  352    -1 			var output = '';
  353    -1 			if (value > 0xFFFF) {
  354    -1 				value -= 0x10000;
  355    -1 				output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
  356    -1 				value = 0xDC00 | value & 0x3FF;
  357    -1 			}
  358    -1 			output += stringFromCharCode(value);
  359    -1 			return output;
  360    -1 		}).join('');
  361    -1 	}
  362    -1 
  363    -1 	/**
  364    -1 	 * Converts a basic code point into a digit/integer.
  365    -1 	 * @see `digitToBasic()`
  366    -1 	 * @private
  367    -1 	 * @param {Number} codePoint The basic numeric code point value.
  368    -1 	 * @returns {Number} The numeric value of a basic code point (for use in
  369    -1 	 * representing integers) in the range `0` to `base - 1`, or `base` if
  370    -1 	 * the code point does not represent a value.
  371    -1 	 */
  372    -1 	function basicToDigit(codePoint) {
  373    -1 		if (codePoint - 48 < 10) {
  374    -1 			return codePoint - 22;
  375    -1 		}
  376    -1 		if (codePoint - 65 < 26) {
  377    -1 			return codePoint - 65;
  378    -1 		}
  379    -1 		if (codePoint - 97 < 26) {
  380    -1 			return codePoint - 97;
  381    -1 		}
  382    -1 		return base;
  383    -1 	}
  384    -1 
  385    -1 	/**
  386    -1 	 * Converts a digit/integer into a basic code point.
  387    -1 	 * @see `basicToDigit()`
  388    -1 	 * @private
  389    -1 	 * @param {Number} digit The numeric value of a basic code point.
  390    -1 	 * @returns {Number} The basic code point whose value (when used for
  391    -1 	 * representing integers) is `digit`, which needs to be in the range
  392    -1 	 * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
  393    -1 	 * used; else, the lowercase form is used. The behavior is undefined
  394    -1 	 * if `flag` is non-zero and `digit` has no uppercase form.
  395    -1 	 */
  396    -1 	function digitToBasic(digit, flag) {
  397    -1 		//  0..25 map to ASCII a..z or A..Z
  398    -1 		// 26..35 map to ASCII 0..9
  399    -1 		return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
  400    -1 	}
  401    -1 
  402    -1 	/**
  403    -1 	 * Bias adaptation function as per section 3.4 of RFC 3492.
  404    -1 	 * https://tools.ietf.org/html/rfc3492#section-3.4
  405    -1 	 * @private
  406    -1 	 */
  407    -1 	function adapt(delta, numPoints, firstTime) {
  408    -1 		var k = 0;
  409    -1 		delta = firstTime ? floor(delta / damp) : delta >> 1;
  410    -1 		delta += floor(delta / numPoints);
  411    -1 		for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
  412    -1 			delta = floor(delta / baseMinusTMin);
  413    -1 		}
  414    -1 		return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
  415    -1 	}
  416    -1 
  417    -1 	/**
  418    -1 	 * Converts a Punycode string of ASCII-only symbols to a string of Unicode
  419    -1 	 * symbols.
  420    -1 	 * @memberOf punycode
  421    -1 	 * @param {String} input The Punycode string of ASCII-only symbols.
  422    -1 	 * @returns {String} The resulting string of Unicode symbols.
  423    -1 	 */
  424    -1 	function decode(input) {
  425    -1 		// Don't use UCS-2
  426    -1 		var output = [],
  427    -1 		    inputLength = input.length,
  428    -1 		    out,
  429    -1 		    i = 0,
  430    -1 		    n = initialN,
  431    -1 		    bias = initialBias,
  432    -1 		    basic,
  433    -1 		    j,
  434    -1 		    index,
  435    -1 		    oldi,
  436    -1 		    w,
  437    -1 		    k,
  438    -1 		    digit,
  439    -1 		    t,
  440    -1 		    /** Cached calculation results */
  441    -1 		    baseMinusT;
  442    -1 
  443    -1 		// Handle the basic code points: let `basic` be the number of input code
  444    -1 		// points before the last delimiter, or `0` if there is none, then copy
  445    -1 		// the first basic code points to the output.
  446    -1 
  447    -1 		basic = input.lastIndexOf(delimiter);
  448    -1 		if (basic < 0) {
  449    -1 			basic = 0;
  450    -1 		}
  451    -1 
  452    -1 		for (j = 0; j < basic; ++j) {
  453    -1 			// if it's not a basic code point
  454    -1 			if (input.charCodeAt(j) >= 0x80) {
  455    -1 				error('not-basic');
  456    -1 			}
  457    -1 			output.push(input.charCodeAt(j));
  458    -1 		}
  459    -1 
  460    -1 		// Main decoding loop: start just after the last delimiter if any basic code
  461    -1 		// points were copied; start at the beginning otherwise.
  462    -1 
  463    -1 		for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
  464    -1 
  465    -1 			// `index` is the index of the next character to be consumed.
  466    -1 			// Decode a generalized variable-length integer into `delta`,
  467    -1 			// which gets added to `i`. The overflow checking is easier
  468    -1 			// if we increase `i` as we go, then subtract off its starting
  469    -1 			// value at the end to obtain `delta`.
  470    -1 			for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
  471    -1 
  472    -1 				if (index >= inputLength) {
  473    -1 					error('invalid-input');
  474    -1 				}
  475    -1 
  476    -1 				digit = basicToDigit(input.charCodeAt(index++));
  477    -1 
  478    -1 				if (digit >= base || digit > floor((maxInt - i) / w)) {
  479    -1 					error('overflow');
  480    -1 				}
  481    -1 
  482    -1 				i += digit * w;
  483    -1 				t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
  484    -1 
  485    -1 				if (digit < t) {
  486    -1 					break;
  487    -1 				}
  488    -1 
  489    -1 				baseMinusT = base - t;
  490    -1 				if (w > floor(maxInt / baseMinusT)) {
  491    -1 					error('overflow');
  492    -1 				}
  493    -1 
  494    -1 				w *= baseMinusT;
  495    -1 
  496    -1 			}
  497    -1 
  498    -1 			out = output.length + 1;
  499    -1 			bias = adapt(i - oldi, out, oldi == 0);
  500    -1 
  501    -1 			// `i` was supposed to wrap around from `out` to `0`,
  502    -1 			// incrementing `n` each time, so we'll fix that now:
  503    -1 			if (floor(i / out) > maxInt - n) {
  504    -1 				error('overflow');
  505    -1 			}
  506    -1 
  507    -1 			n += floor(i / out);
  508    -1 			i %= out;
  509    -1 
  510    -1 			// Insert `n` at position `i` of the output
  511    -1 			output.splice(i++, 0, n);
  512    -1 
  513    -1 		}
  514    -1 
  515    -1 		return ucs2encode(output);
  516    -1 	}
  517    -1 
  518    -1 	/**
  519    -1 	 * Converts a string of Unicode symbols (e.g. a domain name label) to a
  520    -1 	 * Punycode string of ASCII-only symbols.
  521    -1 	 * @memberOf punycode
  522    -1 	 * @param {String} input The string of Unicode symbols.
  523    -1 	 * @returns {String} The resulting Punycode string of ASCII-only symbols.
  524    -1 	 */
  525    -1 	function encode(input) {
  526    -1 		var n,
  527    -1 		    delta,
  528    -1 		    handledCPCount,
  529    -1 		    basicLength,
  530    -1 		    bias,
  531    -1 		    j,
  532    -1 		    m,
  533    -1 		    q,
  534    -1 		    k,
  535    -1 		    t,
  536    -1 		    currentValue,
  537    -1 		    output = [],
  538    -1 		    /** `inputLength` will hold the number of code points in `input`. */
  539    -1 		    inputLength,
  540    -1 		    /** Cached calculation results */
  541    -1 		    handledCPCountPlusOne,
  542    -1 		    baseMinusT,
  543    -1 		    qMinusT;
  544    -1 
  545    -1 		// Convert the input in UCS-2 to Unicode
  546    -1 		input = ucs2decode(input);
  547    -1 
  548    -1 		// Cache the length
  549    -1 		inputLength = input.length;
  550    -1 
  551    -1 		// Initialize the state
  552    -1 		n = initialN;
  553    -1 		delta = 0;
  554    -1 		bias = initialBias;
  555    -1 
  556    -1 		// Handle the basic code points
  557    -1 		for (j = 0; j < inputLength; ++j) {
  558    -1 			currentValue = input[j];
  559    -1 			if (currentValue < 0x80) {
  560    -1 				output.push(stringFromCharCode(currentValue));
  561    -1 			}
  562    -1 		}
  563    -1 
  564    -1 		handledCPCount = basicLength = output.length;
  565    -1 
  566    -1 		// `handledCPCount` is the number of code points that have been handled;
  567    -1 		// `basicLength` is the number of basic code points.
  568    -1 
  569    -1 		// Finish the basic string - if it is not empty - with a delimiter
  570    -1 		if (basicLength) {
  571    -1 			output.push(delimiter);
  572    -1 		}
  573    -1 
  574    -1 		// Main encoding loop:
  575    -1 		while (handledCPCount < inputLength) {
  576    -1 
  577    -1 			// All non-basic code points < n have been handled already. Find the next
  578    -1 			// larger one:
  579    -1 			for (m = maxInt, j = 0; j < inputLength; ++j) {
  580    -1 				currentValue = input[j];
  581    -1 				if (currentValue >= n && currentValue < m) {
  582    -1 					m = currentValue;
  583    -1 				}
  584    -1 			}
  585    -1 
  586    -1 			// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
  587    -1 			// but guard against overflow
  588    -1 			handledCPCountPlusOne = handledCPCount + 1;
  589    -1 			if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
  590    -1 				error('overflow');
  591    -1 			}
  592    -1 
  593    -1 			delta += (m - n) * handledCPCountPlusOne;
  594    -1 			n = m;
  595    -1 
  596    -1 			for (j = 0; j < inputLength; ++j) {
  597    -1 				currentValue = input[j];
  598    -1 
  599    -1 				if (currentValue < n && ++delta > maxInt) {
  600    -1 					error('overflow');
  601    -1 				}
  602    -1 
  603    -1 				if (currentValue == n) {
  604    -1 					// Represent delta as a generalized variable-length integer
  605    -1 					for (q = delta, k = base; /* no condition */; k += base) {
  606    -1 						t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
  607    -1 						if (q < t) {
  608    -1 							break;
  609    -1 						}
  610    -1 						qMinusT = q - t;
  611    -1 						baseMinusT = base - t;
  612    -1 						output.push(
  613    -1 							stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
  614    -1 						);
  615    -1 						q = floor(qMinusT / baseMinusT);
  616    -1 					}
  617    -1 
  618    -1 					output.push(stringFromCharCode(digitToBasic(q, 0)));
  619    -1 					bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
  620    -1 					delta = 0;
  621    -1 					++handledCPCount;
  622    -1 				}
  623    -1 			}
  624    -1 
  625    -1 			++delta;
  626    -1 			++n;
  627    -1 
  628    -1 		}
  629    -1 		return output.join('');
  630    -1 	}
  631    -1 
  632    -1 	/**
  633    -1 	 * Converts a Punycode string representing a domain name or an email address
  634    -1 	 * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
  635    -1 	 * it doesn't matter if you call it on a string that has already been
  636    -1 	 * converted to Unicode.
  637    -1 	 * @memberOf punycode
  638    -1 	 * @param {String} input The Punycoded domain name or email address to
  639    -1 	 * convert to Unicode.
  640    -1 	 * @returns {String} The Unicode representation of the given Punycode
  641    -1 	 * string.
  642    -1 	 */
  643    -1 	function toUnicode(input) {
  644    -1 		return mapDomain(input, function(string) {
  645    -1 			return regexPunycode.test(string)
  646    -1 				? decode(string.slice(4).toLowerCase())
  647    -1 				: string;
  648    -1 		});
  649    -1 	}
  650    -1 
  651    -1 	/**
  652    -1 	 * Converts a Unicode string representing a domain name or an email address to
  653    -1 	 * Punycode. Only the non-ASCII parts of the domain name will be converted,
  654    -1 	 * i.e. it doesn't matter if you call it with a domain that's already in
  655    -1 	 * ASCII.
  656    -1 	 * @memberOf punycode
  657    -1 	 * @param {String} input The domain name or email address to convert, as a
  658    -1 	 * Unicode string.
  659    -1 	 * @returns {String} The Punycode representation of the given domain name or
  660    -1 	 * email address.
  661    -1 	 */
  662    -1 	function toASCII(input) {
  663    -1 		return mapDomain(input, function(string) {
  664    -1 			return regexNonASCII.test(string)
  665    -1 				? 'xn--' + encode(string)
  666    -1 				: string;
  667    -1 		});
  668    -1 	}
  669    -1 
  670    -1 	/*--------------------------------------------------------------------------*/
  671    -1 
  672    -1 	/** Define the public API */
  673    -1 	punycode = {
  674    -1 		/**
  675    -1 		 * A string representing the current Punycode.js version number.
  676    -1 		 * @memberOf punycode
  677    -1 		 * @type String
  678    -1 		 */
  679    -1 		'version': '1.4.1',
  680    -1 		/**
  681    -1 		 * An object of methods to convert from JavaScript's internal character
  682    -1 		 * representation (UCS-2) to Unicode code points, and back.
  683    -1 		 * @see <https://mathiasbynens.be/notes/javascript-encoding>
  684    -1 		 * @memberOf punycode
  685    -1 		 * @type Object
  686    -1 		 */
  687    -1 		'ucs2': {
  688    -1 			'decode': ucs2decode,
  689    -1 			'encode': ucs2encode
  690    -1 		},
  691    -1 		'decode': decode,
  692    -1 		'encode': encode,
  693    -1 		'toASCII': toASCII,
  694    -1 		'toUnicode': toUnicode
  695    -1 	};
  696    -1 
  697    -1 	/** Expose `punycode` */
  698    -1 	// Some AMD build optimizers, like r.js, check for specific condition patterns
  699    -1 	// like the following:
  700    -1 	if (
  701    -1 		typeof define == 'function' &&
  702    -1 		typeof define.amd == 'object' &&
  703    -1 		define.amd
  704    -1 	) {
  705    -1 		define('punycode', function() {
  706    -1 			return punycode;
  707    -1 		});
  708    -1 	} else if (freeExports && freeModule) {
  709    -1 		if (module.exports == freeExports) {
  710    -1 			// in Node.js, io.js, or RingoJS v0.8.0+
  711    -1 			freeModule.exports = punycode;
  712    -1 		} else {
  713    -1 			// in Narwhal or RingoJS v0.7.0-
  714    -1 			for (key in punycode) {
  715    -1 				punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
  716    -1 			}
  717    -1 		}
  718    -1 	} else {
  719    -1 		// in Rhino or a web browser
  720    -1 		root.punycode = punycode;
  721    -1 	}
  722    -1 
  723    -1 }(this));
  724    -1 
  725    -1 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  726    -1 },{}],4:[function(require,module,exports){
  727    -1 module.exports = after
  728    -1 
  729    -1 function after(count, callback, err_cb) {
  730    -1     var bail = false
  731    -1     err_cb = err_cb || noop
  732    -1     proxy.count = count
  733    -1 
  734    -1     return (count === 0) ? callback() : proxy
  735    -1 
  736    -1     function proxy(err, result) {
  737    -1         if (proxy.count <= 0) {
  738    -1             throw new Error('after called too many times')
  739    -1         }
  740    -1         --proxy.count
  741    -1 
  742    -1         // after first error, rest are passed to err_cb
  743    -1         if (err) {
  744    -1             bail = true
  745    -1             callback(err)
  746    -1             // future error callbacks will go to error handler
  747    -1             callback = err_cb
  748    -1         } else if (proxy.count === 0 && !bail) {
  749    -1             callback(null, result)
  750    -1         }
  751    -1     }
  752    -1 }
  753    -1 
  754    -1 function noop() {}
  755    -1 
  756    -1 },{}],5:[function(require,module,exports){
  757    -1 /**
  758    -1  * An abstraction for slicing an arraybuffer even when
  759    -1  * ArrayBuffer.prototype.slice is not supported
  760    -1  *
  761    -1  * @api public
  762    -1  */
  763    -1 
  764    -1 module.exports = function(arraybuffer, start, end) {
  765    -1   var bytes = arraybuffer.byteLength;
  766    -1   start = start || 0;
  767    -1   end = end || bytes;
  768    -1 
  769    -1   if (arraybuffer.slice) { return arraybuffer.slice(start, end); }
  770    -1 
  771    -1   if (start < 0) { start += bytes; }
  772    -1   if (end < 0) { end += bytes; }
  773    -1   if (end > bytes) { end = bytes; }
  774    -1 
  775    -1   if (start >= bytes || start >= end || bytes === 0) {
  776    -1     return new ArrayBuffer(0);
  777    -1   }
  778    -1 
  779    -1   var abv = new Uint8Array(arraybuffer);
  780    -1   var result = new Uint8Array(end - start);
  781    -1   for (var i = start, ii = 0; i < end; i++, ii++) {
  782    -1     result[ii] = abv[i];
  783    -1   }
  784    -1   return result.buffer;
  785    -1 };
  786    -1 
  787    -1 },{}],6:[function(require,module,exports){
  788    -1 
  789    -1 /**
  790    -1  * Expose `Backoff`.
  791    -1  */
  792    -1 
  793    -1 module.exports = Backoff;
  794    -1 
  795    -1 /**
  796    -1  * Initialize backoff timer with `opts`.
  797    -1  *
  798    -1  * - `min` initial timeout in milliseconds [100]
  799    -1  * - `max` max timeout [10000]
  800    -1  * - `jitter` [0]
  801    -1  * - `factor` [2]
  802    -1  *
  803    -1  * @param {Object} opts
  804    -1  * @api public
  805    -1  */
  806    -1 
  807    -1 function Backoff(opts) {
  808    -1   opts = opts || {};
  809    -1   this.ms = opts.min || 100;
  810    -1   this.max = opts.max || 10000;
  811    -1   this.factor = opts.factor || 2;
  812    -1   this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0;
  813    -1   this.attempts = 0;
  814    -1 }
  815    -1 
  816    -1 /**
  817    -1  * Return the backoff duration.
  818    -1  *
  819    -1  * @return {Number}
  820    -1  * @api public
  821    -1  */
  822    -1 
  823    -1 Backoff.prototype.duration = function(){
  824    -1   var ms = this.ms * Math.pow(this.factor, this.attempts++);
  825    -1   if (this.jitter) {
  826    -1     var rand =  Math.random();
  827    -1     var deviation = Math.floor(rand * this.jitter * ms);
  828    -1     ms = (Math.floor(rand * 10) & 1) == 0  ? ms - deviation : ms + deviation;
  829    -1   }
  830    -1   return Math.min(ms, this.max) | 0;
  831    -1 };
  832    -1 
  833    -1 /**
  834    -1  * Reset the number of attempts.
  835    -1  *
  836    -1  * @api public
  837    -1  */
  838    -1 
  839    -1 Backoff.prototype.reset = function(){
  840    -1   this.attempts = 0;
  841    -1 };
  842    -1 
  843    -1 /**
  844    -1  * Set the minimum duration
  845    -1  *
  846    -1  * @api public
  847    -1  */
  848    -1 
  849    -1 Backoff.prototype.setMin = function(min){
  850    -1   this.ms = min;
  851    -1 };
  852    -1 
  853    -1 /**
  854    -1  * Set the maximum duration
  855    -1  *
  856    -1  * @api public
  857    -1  */
  858    -1 
  859    -1 Backoff.prototype.setMax = function(max){
  860    -1   this.max = max;
  861    -1 };
  862    -1 
  863    -1 /**
  864    -1  * Set the jitter
  865    -1  *
  866    -1  * @api public
  867    -1  */
  868    -1 
  869    -1 Backoff.prototype.setJitter = function(jitter){
  870    -1   this.jitter = jitter;
  871    -1 };
  872    -1 
  873    -1 
  874    -1 },{}],7:[function(require,module,exports){
  875    -1 /*
  876    -1  * base64-arraybuffer
  877    -1  * https://github.com/niklasvh/base64-arraybuffer
  878    -1  *
  879    -1  * Copyright (c) 2012 Niklas von Hertzen
  880    -1  * Licensed under the MIT license.
  881    -1  */
  882    -1 (function(){
  883    -1   "use strict";
  884    -1 
  885    -1   var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  886    -1 
  887    -1   // Use a lookup table to find the index.
  888    -1   var lookup = new Uint8Array(256);
  889    -1   for (var i = 0; i < chars.length; i++) {
  890    -1     lookup[chars.charCodeAt(i)] = i;
  891    -1   }
  892    -1 
  893    -1   exports.encode = function(arraybuffer) {
  894    -1     var bytes = new Uint8Array(arraybuffer),
  895    -1     i, len = bytes.length, base64 = "";
  896    -1 
  897    -1     for (i = 0; i < len; i+=3) {
  898    -1       base64 += chars[bytes[i] >> 2];
  899    -1       base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
  900    -1       base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
  901    -1       base64 += chars[bytes[i + 2] & 63];
  902    -1     }
  903    -1 
  904    -1     if ((len % 3) === 2) {
  905    -1       base64 = base64.substring(0, base64.length - 1) + "=";
  906    -1     } else if (len % 3 === 1) {
  907    -1       base64 = base64.substring(0, base64.length - 2) + "==";
  908    -1     }
  909    -1 
  910    -1     return base64;
  911    -1   };
  912    -1 
  913    -1   exports.decode =  function(base64) {
  914    -1     var bufferLength = base64.length * 0.75,
  915    -1     len = base64.length, i, p = 0,
  916    -1     encoded1, encoded2, encoded3, encoded4;
  917    -1 
  918    -1     if (base64[base64.length - 1] === "=") {
  919    -1       bufferLength--;
  920    -1       if (base64[base64.length - 2] === "=") {
  921    -1         bufferLength--;
  922    -1       }
  923    -1     }
  924    -1 
  925    -1     var arraybuffer = new ArrayBuffer(bufferLength),
  926    -1     bytes = new Uint8Array(arraybuffer);
  927    -1 
  928    -1     for (i = 0; i < len; i+=4) {
  929    -1       encoded1 = lookup[base64.charCodeAt(i)];
  930    -1       encoded2 = lookup[base64.charCodeAt(i+1)];
  931    -1       encoded3 = lookup[base64.charCodeAt(i+2)];
  932    -1       encoded4 = lookup[base64.charCodeAt(i+3)];
  933    -1 
  934    -1       bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
  935    -1       bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
  936    -1       bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
  937    -1     }
  938    -1 
  939    -1     return arraybuffer;
  940    -1   };
  941    -1 })();
  942    -1 
  943    -1 },{}],8:[function(require,module,exports){
  944    -1 (function (global){
  945    -1 /**
  946    -1  * Create a blob builder even when vendor prefixes exist
  947    -1  */
  948    -1 
  949    -1 var BlobBuilder = global.BlobBuilder
  950    -1   || global.WebKitBlobBuilder
  951    -1   || global.MSBlobBuilder
  952    -1   || global.MozBlobBuilder;
  953    -1 
  954    -1 /**
  955    -1  * Check if Blob constructor is supported
  956    -1  */
  957    -1 
  958    -1 var blobSupported = (function() {
  959    -1   try {
  960    -1     var a = new Blob(['hi']);
  961    -1     return a.size === 2;
  962    -1   } catch(e) {
  963    -1     return false;
  964    -1   }
  965    -1 })();
  966    -1 
  967    -1 /**
  968    -1  * Check if Blob constructor supports ArrayBufferViews
  969    -1  * Fails in Safari 6, so we need to map to ArrayBuffers there.
  970    -1  */
  971    -1 
  972    -1 var blobSupportsArrayBufferView = blobSupported && (function() {
  973    -1   try {
  974    -1     var b = new Blob([new Uint8Array([1,2])]);
  975    -1     return b.size === 2;
  976    -1   } catch(e) {
  977    -1     return false;
  978    -1   }
  979    -1 })();
  980    -1 
  981    -1 /**
  982    -1  * Check if BlobBuilder is supported
  983    -1  */
  984    -1 
  985    -1 var blobBuilderSupported = BlobBuilder
  986    -1   && BlobBuilder.prototype.append
  987    -1   && BlobBuilder.prototype.getBlob;
  988    -1 
  989    -1 /**
  990    -1  * Helper function that maps ArrayBufferViews to ArrayBuffers
  991    -1  * Used by BlobBuilder constructor and old browsers that didn't
  992    -1  * support it in the Blob constructor.
  993    -1  */
  994    -1 
  995    -1 function mapArrayBufferViews(ary) {
  996    -1   for (var i = 0; i < ary.length; i++) {
  997    -1     var chunk = ary[i];
  998    -1     if (chunk.buffer instanceof ArrayBuffer) {
  999    -1       var buf = chunk.buffer;
 1000    -1 
 1001    -1       // if this is a subarray, make a copy so we only
 1002    -1       // include the subarray region from the underlying buffer
 1003    -1       if (chunk.byteLength !== buf.byteLength) {
 1004    -1         var copy = new Uint8Array(chunk.byteLength);
 1005    -1         copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength));
 1006    -1         buf = copy.buffer;
 1007    -1       }
 1008    -1 
 1009    -1       ary[i] = buf;
 1010    -1     }
 1011    -1   }
 1012    -1 }
 1013    -1 
 1014    -1 function BlobBuilderConstructor(ary, options) {
 1015    -1   options = options || {};
 1016    -1 
 1017    -1   var bb = new BlobBuilder();
 1018    -1   mapArrayBufferViews(ary);
 1019    -1 
 1020    -1   for (var i = 0; i < ary.length; i++) {
 1021    -1     bb.append(ary[i]);
 1022    -1   }
 1023    -1 
 1024    -1   return (options.type) ? bb.getBlob(options.type) : bb.getBlob();
 1025    -1 };
 1026    -1 
 1027    -1 function BlobConstructor(ary, options) {
 1028    -1   mapArrayBufferViews(ary);
 1029    -1   return new Blob(ary, options || {});
 1030    -1 };
 1031    -1 
 1032    -1 module.exports = (function() {
 1033    -1   if (blobSupported) {
 1034    -1     return blobSupportsArrayBufferView ? global.Blob : BlobConstructor;
 1035    -1   } else if (blobBuilderSupported) {
 1036    -1     return BlobBuilderConstructor;
 1037    -1   } else {
 1038    -1     return undefined;
 1039    -1   }
 1040    -1 })();
 1041    -1 
 1042    -1 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 1043    -1 },{}],9:[function(require,module,exports){
 1044    -1 /**
 1045    -1  * Slice reference.
 1046    -1  */
 1047    -1 
 1048    -1 var slice = [].slice;
 1049    -1 
 1050    -1 /**
 1051    -1  * Bind `obj` to `fn`.
 1052    -1  *
 1053    -1  * @param {Object} obj
 1054    -1  * @param {Function|String} fn or string
 1055    -1  * @return {Function}
 1056    -1  * @api public
 1057    -1  */
 1058    -1 
 1059    -1 module.exports = function(obj, fn){
 1060    -1   if ('string' == typeof fn) fn = obj[fn];
 1061    -1   if ('function' != typeof fn) throw new Error('bind() requires a function');
 1062    -1   var args = slice.call(arguments, 2);
 1063    -1   return function(){
 1064    -1     return fn.apply(obj, args.concat(slice.call(arguments)));
 1065    -1   }
 1066    -1 };
 1067    -1 
 1068    -1 },{}],10:[function(require,module,exports){
 1069    -1 
 1070    -1 /**
 1071    -1  * Expose `Emitter`.
 1072    -1  */
 1073    -1 
 1074    -1 module.exports = Emitter;
 1075    -1 
 1076    -1 /**
 1077    -1  * Initialize a new `Emitter`.
 1078    -1  *
 1079    -1  * @api public
 1080    -1  */
 1081    -1 
 1082    -1 function Emitter(obj) {
 1083    -1   if (obj) return mixin(obj);
 1084    -1 };
 1085    -1 
 1086    -1 /**
 1087    -1  * Mixin the emitter properties.
 1088    -1  *
 1089    -1  * @param {Object} obj
 1090    -1  * @return {Object}
 1091    -1  * @api private
 1092    -1  */
 1093    -1 
 1094    -1 function mixin(obj) {
 1095    -1   for (var key in Emitter.prototype) {
 1096    -1     obj[key] = Emitter.prototype[key];
 1097    -1   }
 1098    -1   return obj;
 1099    -1 }
 1100    -1 
 1101    -1 /**
 1102    -1  * Listen on the given `event` with `fn`.
 1103    -1  *
 1104    -1  * @param {String} event
 1105    -1  * @param {Function} fn
 1106    -1  * @return {Emitter}
 1107    -1  * @api public
 1108    -1  */
 1109    -1 
 1110    -1 Emitter.prototype.on =
 1111    -1 Emitter.prototype.addEventListener = function(event, fn){
 1112    -1   this._callbacks = this._callbacks || {};
 1113    -1   (this._callbacks[event] = this._callbacks[event] || [])
 1114    -1     .push(fn);
 1115    -1   return this;
 1116    -1 };
 1117    -1 
 1118    -1 /**
 1119    -1  * Adds an `event` listener that will be invoked a single
 1120    -1  * time then automatically removed.
 1121    -1  *
 1122    -1  * @param {String} event
 1123    -1  * @param {Function} fn
 1124    -1  * @return {Emitter}
 1125    -1  * @api public
 1126    -1  */
 1127    -1 
 1128    -1 Emitter.prototype.once = function(event, fn){
 1129    -1   var self = this;
 1130    -1   this._callbacks = this._callbacks || {};
 1131    -1 
 1132    -1   function on() {
 1133    -1     self.off(event, on);
 1134    -1     fn.apply(this, arguments);
 1135    -1   }
 1136    -1 
 1137    -1   on.fn = fn;
 1138    -1   this.on(event, on);
 1139    -1   return this;
 1140    -1 };
 1141    -1 
 1142    -1 /**
 1143    -1  * Remove the given callback for `event` or all
 1144    -1  * registered callbacks.
 1145    -1  *
 1146    -1  * @param {String} event
 1147    -1  * @param {Function} fn
 1148    -1  * @return {Emitter}
 1149    -1  * @api public
 1150    -1  */
 1151    -1 
 1152    -1 Emitter.prototype.off =
 1153    -1 Emitter.prototype.removeListener =
 1154    -1 Emitter.prototype.removeAllListeners =
 1155    -1 Emitter.prototype.removeEventListener = function(event, fn){
 1156    -1   this._callbacks = this._callbacks || {};
 1157    -1 
 1158    -1   // all
 1159    -1   if (0 == arguments.length) {
 1160    -1     this._callbacks = {};
 1161    -1     return this;
 1162    -1   }
 1163    -1 
 1164    -1   // specific event
 1165    -1   var callbacks = this._callbacks[event];
 1166    -1   if (!callbacks) return this;
 1167    -1 
 1168    -1   // remove all handlers
 1169    -1   if (1 == arguments.length) {
 1170    -1     delete this._callbacks[event];
 1171    -1     return this;
 1172    -1   }
 1173    -1 
 1174    -1   // remove specific handler
 1175    -1   var cb;
 1176    -1   for (var i = 0; i < callbacks.length; i++) {
 1177    -1     cb = callbacks[i];
 1178    -1     if (cb === fn || cb.fn === fn) {
 1179    -1       callbacks.splice(i, 1);
 1180    -1       break;
 1181    -1     }
 1182    -1   }
 1183    -1   return this;
 1184    -1 };
 1185    -1 
 1186    -1 /**
 1187    -1  * Emit `event` with the given args.
 1188    -1  *
 1189    -1  * @param {String} event
 1190    -1  * @param {Mixed} ...
 1191    -1  * @return {Emitter}
 1192    -1  */
 1193    -1 
 1194    -1 Emitter.prototype.emit = function(event){
 1195    -1   this._callbacks = this._callbacks || {};
 1196    -1   var args = [].slice.call(arguments, 1)
 1197    -1     , callbacks = this._callbacks[event];
 1198    -1 
 1199    -1   if (callbacks) {
 1200    -1     callbacks = callbacks.slice(0);
 1201    -1     for (var i = 0, len = callbacks.length; i < len; ++i) {
 1202    -1       callbacks[i].apply(this, args);
 1203    -1     }
 1204    -1   }
 1205    -1 
 1206    -1   return this;
 1207    -1 };
 1208    -1 
 1209    -1 /**
 1210    -1  * Return array of callbacks for `event`.
 1211    -1  *
 1212    -1  * @param {String} event
 1213    -1  * @return {Array}
 1214    -1  * @api public
 1215    -1  */
 1216    -1 
 1217    -1 Emitter.prototype.listeners = function(event){
 1218    -1   this._callbacks = this._callbacks || {};
 1219    -1   return this._callbacks[event] || [];
 1220    -1 };
 1221    -1 
 1222    -1 /**
 1223    -1  * Check if this emitter has `event` handlers.
 1224    -1  *
 1225    -1  * @param {String} event
 1226    -1  * @return {Boolean}
 1227    -1  * @api public
 1228    -1  */
 1229    -1 
 1230    -1 Emitter.prototype.hasListeners = function(event){
 1231    -1   return !! this.listeners(event).length;
 1232    -1 };
 1233    -1 
 1234    -1 },{}],11:[function(require,module,exports){
 1235    -1 
 1236    -1 module.exports = function(a, b){
 1237    -1   var fn = function(){};
 1238    -1   fn.prototype = b.prototype;
 1239    -1   a.prototype = new fn;
 1240    -1   a.prototype.constructor = a;
 1241    -1 };
 1242    -1 },{}],12:[function(require,module,exports){
 1243    -1 
 1244    -1 module.exports = require('./lib/index');
 1245    -1 
 1246    -1 },{"./lib/index":13}],13:[function(require,module,exports){
 1247    -1 
 1248    -1 module.exports = require('./socket');
 1249    -1 
 1250    -1 /**
 1251    -1  * Exports parser
 1252    -1  *
 1253    -1  * @api public
 1254    -1  *
 1255    -1  */
 1256    -1 module.exports.parser = require('engine.io-parser');
 1257    -1 
 1258    -1 },{"./socket":14,"engine.io-parser":26}],14:[function(require,module,exports){
 1259    -1 (function (global){
 1260    -1 /**
 1261    -1  * Module dependencies.
 1262    -1  */
 1263    -1 
 1264    -1 var transports = require('./transports/index');
 1265    -1 var Emitter = require('component-emitter');
 1266    -1 var debug = require('debug')('engine.io-client:socket');
 1267    -1 var index = require('indexof');
 1268    -1 var parser = require('engine.io-parser');
 1269    -1 var parseuri = require('parseuri');
 1270    -1 var parsejson = require('parsejson');
 1271    -1 var parseqs = require('parseqs');
 1272    -1 
 1273    -1 /**
 1274    -1  * Module exports.
 1275    -1  */
 1276    -1 
 1277    -1 module.exports = Socket;
 1278    -1 
 1279    -1 /**
 1280    -1  * Socket constructor.
 1281    -1  *
 1282    -1  * @param {String|Object} uri or options
 1283    -1  * @param {Object} options
 1284    -1  * @api public
 1285    -1  */
 1286    -1 
 1287    -1 function Socket (uri, opts) {
 1288    -1   if (!(this instanceof Socket)) return new Socket(uri, opts);
 1289    -1 
 1290    -1   opts = opts || {};
 1291    -1 
 1292    -1   if (uri && 'object' === typeof uri) {
 1293    -1     opts = uri;
 1294    -1     uri = null;
 1295    -1   }
 1296    -1 
 1297    -1   if (uri) {
 1298    -1     uri = parseuri(uri);
 1299    -1     opts.hostname = uri.host;
 1300    -1     opts.secure = uri.protocol === 'https' || uri.protocol === 'wss';
 1301    -1     opts.port = uri.port;
 1302    -1     if (uri.query) opts.query = uri.query;
 1303    -1   } else if (opts.host) {
 1304    -1     opts.hostname = parseuri(opts.host).host;
 1305    -1   }
 1306    -1 
 1307    -1   this.secure = null != opts.secure ? opts.secure
 1308    -1     : (global.location && 'https:' === location.protocol);
 1309    -1 
 1310    -1   if (opts.hostname && !opts.port) {
 1311    -1     // if no port is specified manually, use the protocol default
 1312    -1     opts.port = this.secure ? '443' : '80';
 1313    -1   }
 1314    -1 
 1315    -1   this.agent = opts.agent || false;
 1316    -1   this.hostname = opts.hostname ||
 1317    -1     (global.location ? location.hostname : 'localhost');
 1318    -1   this.port = opts.port || (global.location && location.port
 1319    -1       ? location.port
 1320    -1       : (this.secure ? 443 : 80));
 1321    -1   this.query = opts.query || {};
 1322    -1   if ('string' === typeof this.query) this.query = parseqs.decode(this.query);
 1323    -1   this.upgrade = false !== opts.upgrade;
 1324    -1   this.path = (opts.path || '/engine.io').replace(/\/$/, '') + '/';
 1325    -1   this.forceJSONP = !!opts.forceJSONP;
 1326    -1   this.jsonp = false !== opts.jsonp;
 1327    -1   this.forceBase64 = !!opts.forceBase64;
 1328    -1   this.enablesXDR = !!opts.enablesXDR;
 1329    -1   this.timestampParam = opts.timestampParam || 't';
 1330    -1   this.timestampRequests = opts.timestampRequests;
 1331    -1   this.transports = opts.transports || ['polling', 'websocket'];
 1332    -1   this.readyState = '';
 1333    -1   this.writeBuffer = [];
 1334    -1   this.prevBufferLen = 0;
 1335    -1   this.policyPort = opts.policyPort || 843;
 1336    -1   this.rememberUpgrade = opts.rememberUpgrade || false;
 1337    -1   this.binaryType = null;
 1338    -1   this.onlyBinaryUpgrades = opts.onlyBinaryUpgrades;
 1339    -1   this.perMessageDeflate = false !== opts.perMessageDeflate ? (opts.perMessageDeflate || {}) : false;
 1340    -1 
 1341    -1   if (true === this.perMessageDeflate) this.perMessageDeflate = {};
 1342    -1   if (this.perMessageDeflate && null == this.perMessageDeflate.threshold) {
 1343    -1     this.perMessageDeflate.threshold = 1024;
 1344    -1   }
 1345    -1 
 1346    -1   // SSL options for Node.js client
 1347    -1   this.pfx = opts.pfx || null;
 1348    -1   this.key = opts.key || null;
 1349    -1   this.passphrase = opts.passphrase || null;
 1350    -1   this.cert = opts.cert || null;
 1351    -1   this.ca = opts.ca || null;
 1352    -1   this.ciphers = opts.ciphers || null;
 1353    -1   this.rejectUnauthorized = opts.rejectUnauthorized === undefined ? null : opts.rejectUnauthorized;
 1354    -1   this.forceNode = !!opts.forceNode;
 1355    -1 
 1356    -1   // other options for Node.js client
 1357    -1   var freeGlobal = typeof global === 'object' && global;
 1358    -1   if (freeGlobal.global === freeGlobal) {
 1359    -1     if (opts.extraHeaders && Object.keys(opts.extraHeaders).length > 0) {
 1360    -1       this.extraHeaders = opts.extraHeaders;
 1361    -1     }
 1362    -1 
 1363    -1     if (opts.localAddress) {
 1364    -1       this.localAddress = opts.localAddress;
 1365    -1     }
 1366    -1   }
 1367    -1 
 1368    -1   // set on handshake
 1369    -1   this.id = null;
 1370    -1   this.upgrades = null;
 1371    -1   this.pingInterval = null;
 1372    -1   this.pingTimeout = null;
 1373    -1 
 1374    -1   // set on heartbeat
 1375    -1   this.pingIntervalTimer = null;
 1376    -1   this.pingTimeoutTimer = null;
 1377    -1 
 1378    -1   this.open();
 1379    -1 }
 1380    -1 
 1381    -1 Socket.priorWebsocketSuccess = false;
 1382    -1 
 1383    -1 /**
 1384    -1  * Mix in `Emitter`.
 1385    -1  */
 1386    -1 
 1387    -1 Emitter(Socket.prototype);
 1388    -1 
 1389    -1 /**
 1390    -1  * Protocol version.
 1391    -1  *
 1392    -1  * @api public
 1393    -1  */
 1394    -1 
 1395    -1 Socket.protocol = parser.protocol; // this is an int
 1396    -1 
 1397    -1 /**
 1398    -1  * Expose deps for legacy compatibility
 1399    -1  * and standalone browser access.
 1400    -1  */
 1401    -1 
 1402    -1 Socket.Socket = Socket;
 1403    -1 Socket.Transport = require('./transport');
 1404    -1 Socket.transports = require('./transports/index');
 1405    -1 Socket.parser = require('engine.io-parser');
 1406    -1 
 1407    -1 /**
 1408    -1  * Creates transport of the given type.
 1409    -1  *
 1410    -1  * @param {String} transport name
 1411    -1  * @return {Transport}
 1412    -1  * @api private
 1413    -1  */
 1414    -1 
 1415    -1 Socket.prototype.createTransport = function (name) {
 1416    -1   debug('creating transport "%s"', name);
 1417    -1   var query = clone(this.query);
 1418    -1 
 1419    -1   // append engine.io protocol identifier
 1420    -1   query.EIO = parser.protocol;
 1421    -1 
 1422    -1   // transport name
 1423    -1   query.transport = name;
 1424    -1 
 1425    -1   // session id if we already have one
 1426    -1   if (this.id) query.sid = this.id;
 1427    -1 
 1428    -1   var transport = new transports[name]({
 1429    -1     agent: this.agent,
 1430    -1     hostname: this.hostname,
 1431    -1     port: this.port,
 1432    -1     secure: this.secure,
 1433    -1     path: this.path,
 1434    -1     query: query,
 1435    -1     forceJSONP: this.forceJSONP,
 1436    -1     jsonp: this.jsonp,
 1437    -1     forceBase64: this.forceBase64,
 1438    -1     enablesXDR: this.enablesXDR,
 1439    -1     timestampRequests: this.timestampRequests,
 1440    -1     timestampParam: this.timestampParam,
 1441    -1     policyPort: this.policyPort,
 1442    -1     socket: this,
 1443    -1     pfx: this.pfx,
 1444    -1     key: this.key,
 1445    -1     passphrase: this.passphrase,
 1446    -1     cert: this.cert,
 1447    -1     ca: this.ca,
 1448    -1     ciphers: this.ciphers,
 1449    -1     rejectUnauthorized: this.rejectUnauthorized,
 1450    -1     perMessageDeflate: this.perMessageDeflate,
 1451    -1     extraHeaders: this.extraHeaders,
 1452    -1     forceNode: this.forceNode,
 1453    -1     localAddress: this.localAddress
 1454    -1   });
 1455    -1 
 1456    -1   return transport;
 1457    -1 };
 1458    -1 
 1459    -1 function clone (obj) {
 1460    -1   var o = {};
 1461    -1   for (var i in obj) {
 1462    -1     if (obj.hasOwnProperty(i)) {
 1463    -1       o[i] = obj[i];
 1464    -1     }
 1465    -1   }
 1466    -1   return o;
 1467    -1 }
 1468    -1 
 1469    -1 /**
 1470    -1  * Initializes transport to use and starts probe.
 1471    -1  *
 1472    -1  * @api private
 1473    -1  */
 1474    -1 Socket.prototype.open = function () {
 1475    -1   var transport;
 1476    -1   if (this.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf('websocket') !== -1) {
 1477    -1     transport = 'websocket';
 1478    -1   } else if (0 === this.transports.length) {
 1479    -1     // Emit error on next tick so it can be listened to
 1480    -1     var self = this;
 1481    -1     setTimeout(function () {
 1482    -1       self.emit('error', 'No transports available');
 1483    -1     }, 0);
 1484    -1     return;
 1485    -1   } else {
 1486    -1     transport = this.transports[0];
 1487    -1   }
 1488    -1   this.readyState = 'opening';
 1489    -1 
 1490    -1   // Retry with the next transport if the transport is disabled (jsonp: false)
 1491    -1   try {
 1492    -1     transport = this.createTransport(transport);
 1493    -1   } catch (e) {
 1494    -1     this.transports.shift();
 1495    -1     this.open();
 1496    -1     return;
 1497    -1   }
 1498    -1 
 1499    -1   transport.open();
 1500    -1   this.setTransport(transport);
 1501    -1 };
 1502    -1 
 1503    -1 /**
 1504    -1  * Sets the current transport. Disables the existing one (if any).
 1505    -1  *
 1506    -1  * @api private
 1507    -1  */
 1508    -1 
 1509    -1 Socket.prototype.setTransport = function (transport) {
 1510    -1   debug('setting transport %s', transport.name);
 1511    -1   var self = this;
 1512    -1 
 1513    -1   if (this.transport) {
 1514    -1     debug('clearing existing transport %s', this.transport.name);
 1515    -1     this.transport.removeAllListeners();
 1516    -1   }
 1517    -1 
 1518    -1   // set up transport
 1519    -1   this.transport = transport;
 1520    -1 
 1521    -1   // set up transport listeners
 1522    -1   transport
 1523    -1   .on('drain', function () {
 1524    -1     self.onDrain();
 1525    -1   })
 1526    -1   .on('packet', function (packet) {
 1527    -1     self.onPacket(packet);
 1528    -1   })
 1529    -1   .on('error', function (e) {
 1530    -1     self.onError(e);
 1531    -1   })
 1532    -1   .on('close', function () {
 1533    -1     self.onClose('transport close');
 1534    -1   });
 1535    -1 };
 1536    -1 
 1537    -1 /**
 1538    -1  * Probes a transport.
 1539    -1  *
 1540    -1  * @param {String} transport name
 1541    -1  * @api private
 1542    -1  */
 1543    -1 
 1544    -1 Socket.prototype.probe = function (name) {
 1545    -1   debug('probing transport "%s"', name);
 1546    -1   var transport = this.createTransport(name, { probe: 1 });
 1547    -1   var failed = false;
 1548    -1   var self = this;
 1549    -1 
 1550    -1   Socket.priorWebsocketSuccess = false;
 1551    -1 
 1552    -1   function onTransportOpen () {
 1553    -1     if (self.onlyBinaryUpgrades) {
 1554    -1       var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary;
 1555    -1       failed = failed || upgradeLosesBinary;
 1556    -1     }
 1557    -1     if (failed) return;
 1558    -1 
 1559    -1     debug('probe transport "%s" opened', name);
 1560    -1     transport.send([{ type: 'ping', data: 'probe' }]);
 1561    -1     transport.once('packet', function (msg) {
 1562    -1       if (failed) return;
 1563    -1       if ('pong' === msg.type && 'probe' === msg.data) {
 1564    -1         debug('probe transport "%s" pong', name);
 1565    -1         self.upgrading = true;
 1566    -1         self.emit('upgrading', transport);
 1567    -1         if (!transport) return;
 1568    -1         Socket.priorWebsocketSuccess = 'websocket' === transport.name;
 1569    -1 
 1570    -1         debug('pausing current transport "%s"', self.transport.name);
 1571    -1         self.transport.pause(function () {
 1572    -1           if (failed) return;
 1573    -1           if ('closed' === self.readyState) return;
 1574    -1           debug('changing transport and sending upgrade packet');
 1575    -1 
 1576    -1           cleanup();
 1577    -1 
 1578    -1           self.setTransport(transport);
 1579    -1           transport.send([{ type: 'upgrade' }]);
 1580    -1           self.emit('upgrade', transport);
 1581    -1           transport = null;
 1582    -1           self.upgrading = false;
 1583    -1           self.flush();
 1584    -1         });
 1585    -1       } else {
 1586    -1         debug('probe transport "%s" failed', name);
 1587    -1         var err = new Error('probe error');
 1588    -1         err.transport = transport.name;
 1589    -1         self.emit('upgradeError', err);
 1590    -1       }
 1591    -1     });
 1592    -1   }
 1593    -1 
 1594    -1   function freezeTransport () {
 1595    -1     if (failed) return;
 1596    -1 
 1597    -1     // Any callback called by transport should be ignored since now
 1598    -1     failed = true;
 1599    -1 
 1600    -1     cleanup();
 1601    -1 
 1602    -1     transport.close();
 1603    -1     transport = null;
 1604    -1   }
 1605    -1 
 1606    -1   // Handle any error that happens while probing
 1607    -1   function onerror (err) {
 1608    -1     var error = new Error('probe error: ' + err);
 1609    -1     error.transport = transport.name;
 1610    -1 
 1611    -1     freezeTransport();
 1612    -1 
 1613    -1     debug('probe transport "%s" failed because of error: %s', name, err);
 1614    -1 
 1615    -1     self.emit('upgradeError', error);
 1616    -1   }
 1617    -1 
 1618    -1   function onTransportClose () {
 1619    -1     onerror('transport closed');
 1620    -1   }
 1621    -1 
 1622    -1   // When the socket is closed while we're probing
 1623    -1   function onclose () {
 1624    -1     onerror('socket closed');
 1625    -1   }
 1626    -1 
 1627    -1   // When the socket is upgraded while we're probing
 1628    -1   function onupgrade (to) {
 1629    -1     if (transport && to.name !== transport.name) {
 1630    -1       debug('"%s" works - aborting "%s"', to.name, transport.name);
 1631    -1       freezeTransport();
 1632    -1     }
 1633    -1   }
 1634    -1 
 1635    -1   // Remove all listeners on the transport and on self
 1636    -1   function cleanup () {
 1637    -1     transport.removeListener('open', onTransportOpen);
 1638    -1     transport.removeListener('error', onerror);
 1639    -1     transport.removeListener('close', onTransportClose);
 1640    -1     self.removeListener('close', onclose);
 1641    -1     self.removeListener('upgrading', onupgrade);
 1642    -1   }
 1643    -1 
 1644    -1   transport.once('open', onTransportOpen);
 1645    -1   transport.once('error', onerror);
 1646    -1   transport.once('close', onTransportClose);
 1647    -1 
 1648    -1   this.once('close', onclose);
 1649    -1   this.once('upgrading', onupgrade);
 1650    -1 
 1651    -1   transport.open();
 1652    -1 };
 1653    -1 
 1654    -1 /**
 1655    -1  * Called when connection is deemed open.
 1656    -1  *
 1657    -1  * @api public
 1658    -1  */
 1659    -1 
 1660    -1 Socket.prototype.onOpen = function () {
 1661    -1   debug('socket open');
 1662    -1   this.readyState = 'open';
 1663    -1   Socket.priorWebsocketSuccess = 'websocket' === this.transport.name;
 1664    -1   this.emit('open');
 1665    -1   this.flush();
 1666    -1 
 1667    -1   // we check for `readyState` in case an `open`
 1668    -1   // listener already closed the socket
 1669    -1   if ('open' === this.readyState && this.upgrade && this.transport.pause) {
 1670    -1     debug('starting upgrade probes');
 1671    -1     for (var i = 0, l = this.upgrades.length; i < l; i++) {
 1672    -1       this.probe(this.upgrades[i]);
 1673    -1     }
 1674    -1   }
 1675    -1 };
 1676    -1 
 1677    -1 /**
 1678    -1  * Handles a packet.
 1679    -1  *
 1680    -1  * @api private
 1681    -1  */
 1682    -1 
 1683    -1 Socket.prototype.onPacket = function (packet) {
 1684    -1   if ('opening' === this.readyState || 'open' === this.readyState ||
 1685    -1       'closing' === this.readyState) {
 1686    -1     debug('socket receive: type "%s", data "%s"', packet.type, packet.data);
 1687    -1 
 1688    -1     this.emit('packet', packet);
 1689    -1 
 1690    -1     // Socket is live - any packet counts
 1691    -1     this.emit('heartbeat');
 1692    -1 
 1693    -1     switch (packet.type) {
 1694    -1       case 'open':
 1695    -1         this.onHandshake(parsejson(packet.data));
 1696    -1         break;
 1697    -1 
 1698    -1       case 'pong':
 1699    -1         this.setPing();
 1700    -1         this.emit('pong');
 1701    -1         break;
 1702    -1 
 1703    -1       case 'error':
 1704    -1         var err = new Error('server error');
 1705    -1         err.code = packet.data;
 1706    -1         this.onError(err);
 1707    -1         break;
 1708    -1 
 1709    -1       case 'message':
 1710    -1         this.emit('data', packet.data);
 1711    -1         this.emit('message', packet.data);
 1712    -1         break;
 1713    -1     }
 1714    -1   } else {
 1715    -1     debug('packet received with socket readyState "%s"', this.readyState);
 1716    -1   }
 1717    -1 };
 1718    -1 
 1719    -1 /**
 1720    -1  * Called upon handshake completion.
 1721    -1  *
 1722    -1  * @param {Object} handshake obj
 1723    -1  * @api private
 1724    -1  */
 1725    -1 
 1726    -1 Socket.prototype.onHandshake = function (data) {
 1727    -1   this.emit('handshake', data);
 1728    -1   this.id = data.sid;
 1729    -1   this.transport.query.sid = data.sid;
 1730    -1   this.upgrades = this.filterUpgrades(data.upgrades);
 1731    -1   this.pingInterval = data.pingInterval;
 1732    -1   this.pingTimeout = data.pingTimeout;
 1733    -1   this.onOpen();
 1734    -1   // In case open handler closes socket
 1735    -1   if ('closed' === this.readyState) return;
 1736    -1   this.setPing();
 1737    -1 
 1738    -1   // Prolong liveness of socket on heartbeat
 1739    -1   this.removeListener('heartbeat', this.onHeartbeat);
 1740    -1   this.on('heartbeat', this.onHeartbeat);
 1741    -1 };
 1742    -1 
 1743    -1 /**
 1744    -1  * Resets ping timeout.
 1745    -1  *
 1746    -1  * @api private
 1747    -1  */
 1748    -1 
 1749    -1 Socket.prototype.onHeartbeat = function (timeout) {
 1750    -1   clearTimeout(this.pingTimeoutTimer);
 1751    -1   var self = this;
 1752    -1   self.pingTimeoutTimer = setTimeout(function () {
 1753    -1     if ('closed' === self.readyState) return;
 1754    -1     self.onClose('ping timeout');
 1755    -1   }, timeout || (self.pingInterval + self.pingTimeout));
 1756    -1 };
 1757    -1 
 1758    -1 /**
 1759    -1  * Pings server every `this.pingInterval` and expects response
 1760    -1  * within `this.pingTimeout` or closes connection.
 1761    -1  *
 1762    -1  * @api private
 1763    -1  */
 1764    -1 
 1765    -1 Socket.prototype.setPing = function () {
 1766    -1   var self = this;
 1767    -1   clearTimeout(self.pingIntervalTimer);
 1768    -1   self.pingIntervalTimer = setTimeout(function () {
 1769    -1     debug('writing ping packet - expecting pong within %sms', self.pingTimeout);
 1770    -1     self.ping();
 1771    -1     self.onHeartbeat(self.pingTimeout);
 1772    -1   }, self.pingInterval);
 1773    -1 };
 1774    -1 
 1775    -1 /**
 1776    -1 * Sends a ping packet.
 1777    -1 *
 1778    -1 * @api private
 1779    -1 */
 1780    -1 
 1781    -1 Socket.prototype.ping = function () {
 1782    -1   var self = this;
 1783    -1   this.sendPacket('ping', function () {
 1784    -1     self.emit('ping');
 1785    -1   });
 1786    -1 };
 1787    -1 
 1788    -1 /**
 1789    -1  * Called on `drain` event
 1790    -1  *
 1791    -1  * @api private
 1792    -1  */
 1793    -1 
 1794    -1 Socket.prototype.onDrain = function () {
 1795    -1   this.writeBuffer.splice(0, this.prevBufferLen);
 1796    -1 
 1797    -1   // setting prevBufferLen = 0 is very important
 1798    -1   // for example, when upgrading, upgrade packet is sent over,
 1799    -1   // and a nonzero prevBufferLen could cause problems on `drain`
 1800    -1   this.prevBufferLen = 0;
 1801    -1 
 1802    -1   if (0 === this.writeBuffer.length) {
 1803    -1     this.emit('drain');
 1804    -1   } else {
 1805    -1     this.flush();
 1806    -1   }
 1807    -1 };
 1808    -1 
 1809    -1 /**
 1810    -1  * Flush write buffers.
 1811    -1  *
 1812    -1  * @api private
 1813    -1  */
 1814    -1 
 1815    -1 Socket.prototype.flush = function () {
 1816    -1   if ('closed' !== this.readyState && this.transport.writable &&
 1817    -1     !this.upgrading && this.writeBuffer.length) {
 1818    -1     debug('flushing %d packets in socket', this.writeBuffer.length);
 1819    -1     this.transport.send(this.writeBuffer);
 1820    -1     // keep track of current length of writeBuffer
 1821    -1     // splice writeBuffer and callbackBuffer on `drain`
 1822    -1     this.prevBufferLen = this.writeBuffer.length;
 1823    -1     this.emit('flush');
 1824    -1   }
 1825    -1 };
 1826    -1 
 1827    -1 /**
 1828    -1  * Sends a message.
 1829    -1  *
 1830    -1  * @param {String} message.
 1831    -1  * @param {Function} callback function.
 1832    -1  * @param {Object} options.
 1833    -1  * @return {Socket} for chaining.
 1834    -1  * @api public
 1835    -1  */
 1836    -1 
 1837    -1 Socket.prototype.write =
 1838    -1 Socket.prototype.send = function (msg, options, fn) {
 1839    -1   this.sendPacket('message', msg, options, fn);
 1840    -1   return this;
 1841    -1 };
 1842    -1 
 1843    -1 /**
 1844    -1  * Sends a packet.
 1845    -1  *
 1846    -1  * @param {String} packet type.
 1847    -1  * @param {String} data.
 1848    -1  * @param {Object} options.
 1849    -1  * @param {Function} callback function.
 1850    -1  * @api private
 1851    -1  */
 1852    -1 
 1853    -1 Socket.prototype.sendPacket = function (type, data, options, fn) {
 1854    -1   if ('function' === typeof data) {
 1855    -1     fn = data;
 1856    -1     data = undefined;
 1857    -1   }
 1858    -1 
 1859    -1   if ('function' === typeof options) {
 1860    -1     fn = options;
 1861    -1     options = null;
 1862    -1   }
 1863    -1 
 1864    -1   if ('closing' === this.readyState || 'closed' === this.readyState) {
 1865    -1     return;
 1866    -1   }
 1867    -1 
 1868    -1   options = options || {};
 1869    -1   options.compress = false !== options.compress;
 1870    -1 
 1871    -1   var packet = {
 1872    -1     type: type,
 1873    -1     data: data,
 1874    -1     options: options
 1875    -1   };
 1876    -1   this.emit('packetCreate', packet);
 1877    -1   this.writeBuffer.push(packet);
 1878    -1   if (fn) this.once('flush', fn);
 1879    -1   this.flush();
 1880    -1 };
 1881    -1 
 1882    -1 /**
 1883    -1  * Closes the connection.
 1884    -1  *
 1885    -1  * @api private
 1886    -1  */
 1887    -1 
 1888    -1 Socket.prototype.close = function () {
 1889    -1   if ('opening' === this.readyState || 'open' === this.readyState) {
 1890    -1     this.readyState = 'closing';
 1891    -1 
 1892    -1     var self = this;
 1893    -1 
 1894    -1     if (this.writeBuffer.length) {
 1895    -1       this.once('drain', function () {
 1896    -1         if (this.upgrading) {
 1897    -1           waitForUpgrade();
 1898    -1         } else {
 1899    -1           close();
 1900    -1         }
 1901    -1       });
 1902    -1     } else if (this.upgrading) {
 1903    -1       waitForUpgrade();
 1904    -1     } else {
 1905    -1       close();
 1906    -1     }
 1907    -1   }
 1908    -1 
 1909    -1   function close () {
 1910    -1     self.onClose('forced close');
 1911    -1     debug('socket closing - telling transport to close');
 1912    -1     self.transport.close();
 1913    -1   }
 1914    -1 
 1915    -1   function cleanupAndClose () {
 1916    -1     self.removeListener('upgrade', cleanupAndClose);
 1917    -1     self.removeListener('upgradeError', cleanupAndClose);
 1918    -1     close();
 1919    -1   }
 1920    -1 
 1921    -1   function waitForUpgrade () {
 1922    -1     // wait for upgrade to finish since we can't send packets while pausing a transport
 1923    -1     self.once('upgrade', cleanupAndClose);
 1924    -1     self.once('upgradeError', cleanupAndClose);
 1925    -1   }
 1926    -1 
 1927    -1   return this;
 1928    -1 };
 1929    -1 
 1930    -1 /**
 1931    -1  * Called upon transport error
 1932    -1  *
 1933    -1  * @api private
 1934    -1  */
 1935    -1 
 1936    -1 Socket.prototype.onError = function (err) {
 1937    -1   debug('socket error %j', err);
 1938    -1   Socket.priorWebsocketSuccess = false;
 1939    -1   this.emit('error', err);
 1940    -1   this.onClose('transport error', err);
 1941    -1 };
 1942    -1 
 1943    -1 /**
 1944    -1  * Called upon transport close.
 1945    -1  *
 1946    -1  * @api private
 1947    -1  */
 1948    -1 
 1949    -1 Socket.prototype.onClose = function (reason, desc) {
 1950    -1   if ('opening' === this.readyState || 'open' === this.readyState || 'closing' === this.readyState) {
 1951    -1     debug('socket close with reason: "%s"', reason);
 1952    -1     var self = this;
 1953    -1 
 1954    -1     // clear timers
 1955    -1     clearTimeout(this.pingIntervalTimer);
 1956    -1     clearTimeout(this.pingTimeoutTimer);
 1957    -1 
 1958    -1     // stop event from firing again for transport
 1959    -1     this.transport.removeAllListeners('close');
 1960    -1 
 1961    -1     // ensure transport won't stay open
 1962    -1     this.transport.close();
 1963    -1 
 1964    -1     // ignore further transport communication
 1965    -1     this.transport.removeAllListeners();
 1966    -1 
 1967    -1     // set ready state
 1968    -1     this.readyState = 'closed';
 1969    -1 
 1970    -1     // clear session id
 1971    -1     this.id = null;
 1972    -1 
 1973    -1     // emit close event
 1974    -1     this.emit('close', reason, desc);
 1975    -1 
 1976    -1     // clean buffers after, so users can still
 1977    -1     // grab the buffers on `close` event
 1978    -1     self.writeBuffer = [];
 1979    -1     self.prevBufferLen = 0;
 1980    -1   }
 1981    -1 };
 1982    -1 
 1983    -1 /**
 1984    -1  * Filters upgrades, returning only those matching client transports.
 1985    -1  *
 1986    -1  * @param {Array} server upgrades
 1987    -1  * @api private
 1988    -1  *
 1989    -1  */
 1990    -1 
 1991    -1 Socket.prototype.filterUpgrades = function (upgrades) {
 1992    -1   var filteredUpgrades = [];
 1993    -1   for (var i = 0, j = upgrades.length; i < j; i++) {
 1994    -1     if (~index(this.transports, upgrades[i])) filteredUpgrades.push(upgrades[i]);
 1995    -1   }
 1996    -1   return filteredUpgrades;
 1997    -1 };
 1998    -1 
 1999    -1 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 2000    -1 },{"./transport":15,"./transports/index":16,"component-emitter":22,"debug":23,"engine.io-parser":26,"indexof":31,"parsejson":93,"parseqs":94,"parseuri":95}],15:[function(require,module,exports){
 2001    -1 /**
 2002    -1  * Module dependencies.
 2003    -1  */
 2004    -1 
 2005    -1 var parser = require('engine.io-parser');
 2006    -1 var Emitter = require('component-emitter');
 2007    -1 
 2008    -1 /**
 2009    -1  * Module exports.
 2010    -1  */
 2011    -1 
 2012    -1 module.exports = Transport;
 2013    -1 
 2014    -1 /**
 2015    -1  * Transport abstract constructor.
 2016    -1  *
 2017    -1  * @param {Object} options.
 2018    -1  * @api private
 2019    -1  */
 2020    -1 
 2021    -1 function Transport (opts) {
 2022    -1   this.path = opts.path;
 2023    -1   this.hostname = opts.hostname;
 2024    -1   this.port = opts.port;
 2025    -1   this.secure = opts.secure;
 2026    -1   this.query = opts.query;
 2027    -1   this.timestampParam = opts.timestampParam;
 2028    -1   this.timestampRequests = opts.timestampRequests;
 2029    -1   this.readyState = '';
 2030    -1   this.agent = opts.agent || false;
 2031    -1   this.socket = opts.socket;
 2032    -1   this.enablesXDR = opts.enablesXDR;
 2033    -1 
 2034    -1   // SSL options for Node.js client
 2035    -1   this.pfx = opts.pfx;
 2036    -1   this.key = opts.key;
 2037    -1   this.passphrase = opts.passphrase;
 2038    -1   this.cert = opts.cert;
 2039    -1   this.ca = opts.ca;
 2040    -1   this.ciphers = opts.ciphers;
 2041    -1   this.rejectUnauthorized = opts.rejectUnauthorized;
 2042    -1   this.forceNode = opts.forceNode;
 2043    -1 
 2044    -1   // other options for Node.js client
 2045    -1   this.extraHeaders = opts.extraHeaders;
 2046    -1   this.localAddress = opts.localAddress;
 2047    -1 }
 2048    -1 
 2049    -1 /**
 2050    -1  * Mix in `Emitter`.
 2051    -1  */
 2052    -1 
 2053    -1 Emitter(Transport.prototype);
 2054    -1 
 2055    -1 /**
 2056    -1  * Emits an error.
 2057    -1  *
 2058    -1  * @param {String} str
 2059    -1  * @return {Transport} for chaining
 2060    -1  * @api public
 2061    -1  */
 2062    -1 
 2063    -1 Transport.prototype.onError = function (msg, desc) {
 2064    -1   var err = new Error(msg);
 2065    -1   err.type = 'TransportError';
 2066    -1   err.description = desc;
 2067    -1   this.emit('error', err);
 2068    -1   return this;
 2069    -1 };
 2070    -1 
 2071    -1 /**
 2072    -1  * Opens the transport.
 2073    -1  *
 2074    -1  * @api public
 2075    -1  */
 2076    -1 
 2077    -1 Transport.prototype.open = function () {
 2078    -1   if ('closed' === this.readyState || '' === this.readyState) {
 2079    -1     this.readyState = 'opening';
 2080    -1     this.doOpen();
 2081    -1   }
 2082    -1 
 2083    -1   return this;
 2084    -1 };
 2085    -1 
 2086    -1 /**
 2087    -1  * Closes the transport.
 2088    -1  *
 2089    -1  * @api private
 2090    -1  */
 2091    -1 
 2092    -1 Transport.prototype.close = function () {
 2093    -1   if ('opening' === this.readyState || 'open' === this.readyState) {
 2094    -1     this.doClose();
 2095    -1     this.onClose();
 2096    -1   }
 2097    -1 
 2098    -1   return this;
 2099    -1 };
 2100    -1 
 2101    -1 /**
 2102    -1  * Sends multiple packets.
 2103    -1  *
 2104    -1  * @param {Array} packets
 2105    -1  * @api private
 2106    -1  */
 2107    -1 
 2108    -1 Transport.prototype.send = function (packets) {
 2109    -1   if ('open' === this.readyState) {
 2110    -1     this.write(packets);
 2111    -1   } else {
 2112    -1     throw new Error('Transport not open');
 2113    -1   }
 2114    -1 };
 2115    -1 
 2116    -1 /**
 2117    -1  * Called upon open
 2118    -1  *
 2119    -1  * @api private
 2120    -1  */
 2121    -1 
 2122    -1 Transport.prototype.onOpen = function () {
 2123    -1   this.readyState = 'open';
 2124    -1   this.writable = true;
 2125    -1   this.emit('open');
 2126    -1 };
 2127    -1 
 2128    -1 /**
 2129    -1  * Called with data.
 2130    -1  *
 2131    -1  * @param {String} data
 2132    -1  * @api private
 2133    -1  */
 2134    -1 
 2135    -1 Transport.prototype.onData = function (data) {
 2136    -1   var packet = parser.decodePacket(data, this.socket.binaryType);
 2137    -1   this.onPacket(packet);
 2138    -1 };
 2139    -1 
 2140    -1 /**
 2141    -1  * Called with a decoded packet.
 2142    -1  */
 2143    -1 
 2144    -1 Transport.prototype.onPacket = function (packet) {
 2145    -1   this.emit('packet', packet);
 2146    -1 };
 2147    -1 
 2148    -1 /**
 2149    -1  * Called upon close.
 2150    -1  *
 2151    -1  * @api private
 2152    -1  */
 2153    -1 
 2154    -1 Transport.prototype.onClose = function () {
 2155    -1   this.readyState = 'closed';
 2156    -1   this.emit('close');
 2157    -1 };
 2158    -1 
 2159    -1 },{"component-emitter":22,"engine.io-parser":26}],16:[function(require,module,exports){
 2160    -1 (function (global){
 2161    -1 /**
 2162    -1  * Module dependencies
 2163    -1  */
 2164    -1 
 2165    -1 var XMLHttpRequest = require('xmlhttprequest-ssl');
 2166    -1 var XHR = require('./polling-xhr');
 2167    -1 var JSONP = require('./polling-jsonp');
 2168    -1 var websocket = require('./websocket');
 2169    -1 
 2170    -1 /**
 2171    -1  * Export transports.
 2172    -1  */
 2173    -1 
 2174    -1 exports.polling = polling;
 2175    -1 exports.websocket = websocket;
 2176    -1 
 2177    -1 /**
 2178    -1  * Polling transport polymorphic constructor.
 2179    -1  * Decides on xhr vs jsonp based on feature detection.
 2180    -1  *
 2181    -1  * @api private
 2182    -1  */
 2183    -1 
 2184    -1 function polling (opts) {
 2185    -1   var xhr;
 2186    -1   var xd = false;
 2187    -1   var xs = false;
 2188    -1   var jsonp = false !== opts.jsonp;
 2189    -1 
 2190    -1   if (global.location) {
 2191    -1     var isSSL = 'https:' === location.protocol;
 2192    -1     var port = location.port;
 2193    -1 
 2194    -1     // some user agents have empty `location.port`
 2195    -1     if (!port) {
 2196    -1       port = isSSL ? 443 : 80;
 2197    -1     }
 2198    -1 
 2199    -1     xd = opts.hostname !== location.hostname || port !== opts.port;
 2200    -1     xs = opts.secure !== isSSL;
 2201    -1   }
 2202    -1 
 2203    -1   opts.xdomain = xd;
 2204    -1   opts.xscheme = xs;
 2205    -1   xhr = new XMLHttpRequest(opts);
 2206    -1 
 2207    -1   if ('open' in xhr && !opts.forceJSONP) {
 2208    -1     return new XHR(opts);
 2209    -1   } else {
 2210    -1     if (!jsonp) throw new Error('JSONP disabled');
 2211    -1     return new JSONP(opts);
 2212    -1   }
 2213    -1 }
 2214    -1 
 2215    -1 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 2216    -1 },{"./polling-jsonp":17,"./polling-xhr":18,"./websocket":20,"xmlhttprequest-ssl":21}],17:[function(require,module,exports){
 2217    -1 (function (global){
 2218    -1 
 2219    -1 /**
 2220    -1  * Module requirements.
 2221    -1  */
 2222    -1 
 2223    -1 var Polling = require('./polling');
 2224    -1 var inherit = require('component-inherit');
 2225    -1 
 2226    -1 /**
 2227    -1  * Module exports.
 2228    -1  */
 2229    -1 
 2230    -1 module.exports = JSONPPolling;
 2231    -1 
 2232    -1 /**
 2233    -1  * Cached regular expressions.
 2234    -1  */
 2235    -1 
 2236    -1 var rNewline = /\n/g;
 2237    -1 var rEscapedNewline = /\\n/g;
 2238    -1 
 2239    -1 /**
 2240    -1  * Global JSONP callbacks.
 2241    -1  */
 2242    -1 
 2243    -1 var callbacks;
 2244    -1 
 2245    -1 /**
 2246    -1  * Noop.
 2247    -1  */
 2248    -1 
 2249    -1 function empty () { }
 2250    -1 
 2251    -1 /**
 2252    -1  * JSONP Polling constructor.
 2253    -1  *
 2254    -1  * @param {Object} opts.
 2255    -1  * @api public
 2256    -1  */
 2257    -1 
 2258    -1 function JSONPPolling (opts) {
 2259    -1   Polling.call(this, opts);
 2260    -1 
 2261    -1   this.query = this.query || {};
 2262    -1 
 2263    -1   // define global callbacks array if not present
 2264    -1   // we do this here (lazily) to avoid unneeded global pollution
 2265    -1   if (!callbacks) {
 2266    -1     // we need to consider multiple engines in the same page
 2267    -1     if (!global.___eio) global.___eio = [];
 2268    -1     callbacks = global.___eio;
 2269    -1   }
 2270    -1 
 2271    -1   // callback identifier
 2272    -1   this.index = callbacks.length;
 2273    -1 
 2274    -1   // add callback to jsonp global
 2275    -1   var self = this;
 2276    -1   callbacks.push(function (msg) {
 2277    -1     self.onData(msg);
 2278    -1   });
 2279    -1 
 2280    -1   // append to query string
 2281    -1   this.query.j = this.index;
 2282    -1 
 2283    -1   // prevent spurious errors from being emitted when the window is unloaded
 2284    -1   if (global.document && global.addEventListener) {
 2285    -1     global.addEventListener('beforeunload', function () {
 2286    -1       if (self.script) self.script.onerror = empty;
 2287    -1     }, false);
 2288    -1   }
 2289    -1 }
 2290    -1 
 2291    -1 /**
 2292    -1  * Inherits from Polling.
 2293    -1  */
 2294    -1 
 2295    -1 inherit(JSONPPolling, Polling);
 2296    -1 
 2297    -1 /*
 2298    -1  * JSONP only supports binary as base64 encoded strings
 2299    -1  */
 2300    -1 
 2301    -1 JSONPPolling.prototype.supportsBinary = false;
 2302    -1 
 2303    -1 /**
 2304    -1  * Closes the socket.
 2305    -1  *
 2306    -1  * @api private
 2307    -1  */
 2308    -1 
 2309    -1 JSONPPolling.prototype.doClose = function () {
 2310    -1   if (this.script) {
 2311    -1     this.script.parentNode.removeChild(this.script);
 2312    -1     this.script = null;
 2313    -1   }
 2314    -1 
 2315    -1   if (this.form) {
 2316    -1     this.form.parentNode.removeChild(this.form);
 2317    -1     this.form = null;
 2318    -1     this.iframe = null;
 2319    -1   }
 2320    -1 
 2321    -1   Polling.prototype.doClose.call(this);
 2322    -1 };
 2323    -1 
 2324    -1 /**
 2325    -1  * Starts a poll cycle.
 2326    -1  *
 2327    -1  * @api private
 2328    -1  */
 2329    -1 
 2330    -1 JSONPPolling.prototype.doPoll = function () {
 2331    -1   var self = this;
 2332    -1   var script = document.createElement('script');
 2333    -1 
 2334    -1   if (this.script) {
 2335    -1     this.script.parentNode.removeChild(this.script);
 2336    -1     this.script = null;
 2337    -1   }
 2338    -1 
 2339    -1   script.async = true;
 2340    -1   script.src = this.uri();
 2341    -1   script.onerror = function (e) {
 2342    -1     self.onError('jsonp poll error', e);
 2343    -1   };
 2344    -1 
 2345    -1   var insertAt = document.getElementsByTagName('script')[0];
 2346    -1   if (insertAt) {
 2347    -1     insertAt.parentNode.insertBefore(script, insertAt);
 2348    -1   } else {
 2349    -1     (document.head || document.body).appendChild(script);
 2350    -1   }
 2351    -1   this.script = script;
 2352    -1 
 2353    -1   var isUAgecko = 'undefined' !== typeof navigator && /gecko/i.test(navigator.userAgent);
 2354    -1 
 2355    -1   if (isUAgecko) {
 2356    -1     setTimeout(function () {
 2357    -1       var iframe = document.createElement('iframe');
 2358    -1       document.body.appendChild(iframe);
 2359    -1       document.body.removeChild(iframe);
 2360    -1     }, 100);
 2361    -1   }
 2362    -1 };
 2363    -1 
 2364    -1 /**
 2365    -1  * Writes with a hidden iframe.
 2366    -1  *
 2367    -1  * @param {String} data to send
 2368    -1  * @param {Function} called upon flush.
 2369    -1  * @api private
 2370    -1  */
 2371    -1 
 2372    -1 JSONPPolling.prototype.doWrite = function (data, fn) {
 2373    -1   var self = this;
 2374    -1 
 2375    -1   if (!this.form) {
 2376    -1     var form = document.createElement('form');
 2377    -1     var area = document.createElement('textarea');
 2378    -1     var id = this.iframeId = 'eio_iframe_' + this.index;
 2379    -1     var iframe;
 2380    -1 
 2381    -1     form.className = 'socketio';
 2382    -1     form.style.position = 'absolute';
 2383    -1     form.style.top = '-1000px';
 2384    -1     form.style.left = '-1000px';
 2385    -1     form.target = id;
 2386    -1     form.method = 'POST';
 2387    -1     form.setAttribute('accept-charset', 'utf-8');
 2388    -1     area.name = 'd';
 2389    -1     form.appendChild(area);
 2390    -1     document.body.appendChild(form);
 2391    -1 
 2392    -1     this.form = form;
 2393    -1     this.area = area;
 2394    -1   }
 2395    -1 
 2396    -1   this.form.action = this.uri();
 2397    -1 
 2398    -1   function complete () {
 2399    -1     initIframe();
 2400    -1     fn();
 2401    -1   }
 2402    -1 
 2403    -1   function initIframe () {
 2404    -1     if (self.iframe) {
 2405    -1       try {
 2406    -1         self.form.removeChild(self.iframe);
 2407    -1       } catch (e) {
 2408    -1         self.onError('jsonp polling iframe removal error', e);
 2409    -1       }
 2410    -1     }
 2411    -1 
 2412    -1     try {
 2413    -1       // ie6 dynamic iframes with target="" support (thanks Chris Lambacher)
 2414    -1       var html = '<iframe src="javascript:0" name="' + self.iframeId + '">';
 2415    -1       iframe = document.createElement(html);
 2416    -1     } catch (e) {
 2417    -1       iframe = document.createElement('iframe');
 2418    -1       iframe.name = self.iframeId;
 2419    -1       iframe.src = 'javascript:0';
 2420    -1     }
 2421    -1 
 2422    -1     iframe.id = self.iframeId;
 2423    -1 
 2424    -1     self.form.appendChild(iframe);
 2425    -1     self.iframe = iframe;
 2426    -1   }
 2427    -1 
 2428    -1   initIframe();
 2429    -1 
 2430    -1   // escape \n to prevent it from being converted into \r\n by some UAs
 2431    -1   // double escaping is required for escaped new lines because unescaping of new lines can be done safely on server-side
 2432    -1   data = data.replace(rEscapedNewline, '\\\n');
 2433    -1   this.area.value = data.replace(rNewline, '\\n');
 2434    -1 
 2435    -1   try {
 2436    -1     this.form.submit();
 2437    -1   } catch (e) {}
 2438    -1 
 2439    -1   if (this.iframe.attachEvent) {
 2440    -1     this.iframe.onreadystatechange = function () {
 2441    -1       if (self.iframe.readyState === 'complete') {
 2442    -1         complete();
 2443    -1       }
 2444    -1     };
 2445    -1   } else {
 2446    -1     this.iframe.onload = complete;
 2447    -1   }
 2448    -1 };
 2449    -1 
 2450    -1 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 2451    -1 },{"./polling":19,"component-inherit":11}],18:[function(require,module,exports){
 2452    -1 (function (global){
 2453    -1 /**
 2454    -1  * Module requirements.
 2455    -1  */
 2456    -1 
 2457    -1 var XMLHttpRequest = require('xmlhttprequest-ssl');
 2458    -1 var Polling = require('./polling');
 2459    -1 var Emitter = require('component-emitter');
 2460    -1 var inherit = require('component-inherit');
 2461    -1 var debug = require('debug')('engine.io-client:polling-xhr');
 2462    -1 
 2463    -1 /**
 2464    -1  * Module exports.
 2465    -1  */
 2466    -1 
 2467    -1 module.exports = XHR;
 2468    -1 module.exports.Request = Request;
 2469    -1 
 2470    -1 /**
 2471    -1  * Empty function
 2472    -1  */
 2473    -1 
 2474    -1 function empty () {}
 2475    -1 
 2476    -1 /**
 2477    -1  * XHR Polling constructor.
 2478    -1  *
 2479    -1  * @param {Object} opts
 2480    -1  * @api public
 2481    -1  */
 2482    -1 
 2483    -1 function XHR (opts) {
 2484    -1   Polling.call(this, opts);
 2485    -1   this.requestTimeout = opts.requestTimeout;
 2486    -1 
 2487    -1   if (global.location) {
 2488    -1     var isSSL = 'https:' === location.protocol;
 2489    -1     var port = location.port;
 2490    -1 
 2491    -1     // some user agents have empty `location.port`
 2492    -1     if (!port) {
 2493    -1       port = isSSL ? 443 : 80;
 2494    -1     }
 2495    -1 
 2496    -1     this.xd = opts.hostname !== global.location.hostname ||
 2497    -1       port !== opts.port;
 2498    -1     this.xs = opts.secure !== isSSL;
 2499    -1   } else {
 2500    -1     this.extraHeaders = opts.extraHeaders;
 2501    -1   }
 2502    -1 }
 2503    -1 
 2504    -1 /**
 2505    -1  * Inherits from Polling.
 2506    -1  */
 2507    -1 
 2508    -1 inherit(XHR, Polling);
 2509    -1 
 2510    -1 /**
 2511    -1  * XHR supports binary
 2512    -1  */
 2513    -1 
 2514    -1 XHR.prototype.supportsBinary = true;
 2515    -1 
 2516    -1 /**
 2517    -1  * Creates a request.
 2518    -1  *
 2519    -1  * @param {String} method
 2520    -1  * @api private
 2521    -1  */
 2522    -1 
 2523    -1 XHR.prototype.request = function (opts) {
 2524    -1   opts = opts || {};
 2525    -1   opts.uri = this.uri();
 2526    -1   opts.xd = this.xd;
 2527    -1   opts.xs = this.xs;
 2528    -1   opts.agent = this.agent || false;
 2529    -1   opts.supportsBinary = this.supportsBinary;
 2530    -1   opts.enablesXDR = this.enablesXDR;
 2531    -1 
 2532    -1   // SSL options for Node.js client
 2533    -1   opts.pfx = this.pfx;
 2534    -1   opts.key = this.key;
 2535    -1   opts.passphrase = this.passphrase;
 2536    -1   opts.cert = this.cert;
 2537    -1   opts.ca = this.ca;
 2538    -1   opts.ciphers = this.ciphers;
 2539    -1   opts.rejectUnauthorized = this.rejectUnauthorized;
 2540    -1   opts.requestTimeout = this.requestTimeout;
 2541    -1 
 2542    -1   // other options for Node.js client
 2543    -1   opts.extraHeaders = this.extraHeaders;
 2544    -1 
 2545    -1   return new Request(opts);
 2546    -1 };
 2547    -1 
 2548    -1 /**
 2549    -1  * Sends data.
 2550    -1  *
 2551    -1  * @param {String} data to send.
 2552    -1  * @param {Function} called upon flush.
 2553    -1  * @api private
 2554    -1  */
 2555    -1 
 2556    -1 XHR.prototype.doWrite = function (data, fn) {
 2557    -1   var isBinary = typeof data !== 'string' && data !== undefined;
 2558    -1   var req = this.request({ method: 'POST', data: data, isBinary: isBinary });
 2559    -1   var self = this;
 2560    -1   req.on('success', fn);
 2561    -1   req.on('error', function (err) {
 2562    -1     self.onError('xhr post error', err);
 2563    -1   });
 2564    -1   this.sendXhr = req;
 2565    -1 };
 2566    -1 
 2567    -1 /**
 2568    -1  * Starts a poll cycle.
 2569    -1  *
 2570    -1  * @api private
 2571    -1  */
 2572    -1 
 2573    -1 XHR.prototype.doPoll = function () {
 2574    -1   debug('xhr poll');
 2575    -1   var req = this.request();
 2576    -1   var self = this;
 2577    -1   req.on('data', function (data) {
 2578    -1     self.onData(data);
 2579    -1   });
 2580    -1   req.on('error', function (err) {
 2581    -1     self.onError('xhr poll error', err);
 2582    -1   });
 2583    -1   this.pollXhr = req;
 2584    -1 };
 2585    -1 
 2586    -1 /**
 2587    -1  * Request constructor
 2588    -1  *
 2589    -1  * @param {Object} options
 2590    -1  * @api public
 2591    -1  */
 2592    -1 
 2593    -1 function Request (opts) {
 2594    -1   this.method = opts.method || 'GET';
 2595    -1   this.uri = opts.uri;
 2596    -1   this.xd = !!opts.xd;
 2597    -1   this.xs = !!opts.xs;
 2598    -1   this.async = false !== opts.async;
 2599    -1   this.data = undefined !== opts.data ? opts.data : null;
 2600    -1   this.agent = opts.agent;
 2601    -1   this.isBinary = opts.isBinary;
 2602    -1   this.supportsBinary = opts.supportsBinary;
 2603    -1   this.enablesXDR = opts.enablesXDR;
 2604    -1   this.requestTimeout = opts.requestTimeout;
 2605    -1 
 2606    -1   // SSL options for Node.js client
 2607    -1   this.pfx = opts.pfx;
 2608    -1   this.key = opts.key;
 2609    -1   this.passphrase = opts.passphrase;
 2610    -1   this.cert = opts.cert;
 2611    -1   this.ca = opts.ca;
 2612    -1   this.ciphers = opts.ciphers;
 2613    -1   this.rejectUnauthorized = opts.rejectUnauthorized;
 2614    -1 
 2615    -1   // other options for Node.js client
 2616    -1   this.extraHeaders = opts.extraHeaders;
 2617    -1 
 2618    -1   this.create();
 2619    -1 }
 2620    -1 
 2621    -1 /**
 2622    -1  * Mix in `Emitter`.
 2623    -1  */
 2624    -1 
 2625    -1 Emitter(Request.prototype);
 2626    -1 
 2627    -1 /**
 2628    -1  * Creates the XHR object and sends the request.
 2629    -1  *
 2630    -1  * @api private
 2631    -1  */
 2632    -1 
 2633    -1 Request.prototype.create = function () {
 2634    -1   var opts = { agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR };
 2635    -1 
 2636    -1   // SSL options for Node.js client
 2637    -1   opts.pfx = this.pfx;
 2638    -1   opts.key = this.key;
 2639    -1   opts.passphrase = this.passphrase;
 2640    -1   opts.cert = this.cert;
 2641    -1   opts.ca = this.ca;
 2642    -1   opts.ciphers = this.ciphers;
 2643    -1   opts.rejectUnauthorized = this.rejectUnauthorized;
 2644    -1 
 2645    -1   var xhr = this.xhr = new XMLHttpRequest(opts);
 2646    -1   var self = this;
 2647    -1 
 2648    -1   try {
 2649    -1     debug('xhr open %s: %s', this.method, this.uri);
 2650    -1     xhr.open(this.method, this.uri, this.async);
 2651    -1     try {
 2652    -1       if (this.extraHeaders) {
 2653    -1         xhr.setDisableHeaderCheck(true);
 2654    -1         for (var i in this.extraHeaders) {
 2655    -1           if (this.extraHeaders.hasOwnProperty(i)) {
 2656    -1             xhr.setRequestHeader(i, this.extraHeaders[i]);
 2657    -1           }
 2658    -1         }
 2659    -1       }
 2660    -1     } catch (e) {}
 2661    -1     if (this.supportsBinary) {
 2662    -1       // This has to be done after open because Firefox is stupid
 2663    -1       // http://stackoverflow.com/questions/13216903/get-binary-data-with-xmlhttprequest-in-a-firefox-extension
 2664    -1       xhr.responseType = 'arraybuffer';
 2665    -1     }
 2666    -1 
 2667    -1     if ('POST' === this.method) {
 2668    -1       try {
 2669    -1         if (this.isBinary) {
 2670    -1           xhr.setRequestHeader('Content-type', 'application/octet-stream');
 2671    -1         } else {
 2672    -1           xhr.setRequestHeader('Content-type', 'text/plain;charset=UTF-8');
 2673    -1         }
 2674    -1       } catch (e) {}
 2675    -1     }
 2676    -1 
 2677    -1     try {
 2678    -1       xhr.setRequestHeader('Accept', '*/*');
 2679    -1     } catch (e) {}
 2680    -1 
 2681    -1     // ie6 check
 2682    -1     if ('withCredentials' in xhr) {
 2683    -1       xhr.withCredentials = true;
 2684    -1     }
 2685    -1 
 2686    -1     if (this.requestTimeout) {
 2687    -1       xhr.timeout = this.requestTimeout;
 2688    -1     }
 2689    -1 
 2690    -1     if (this.hasXDR()) {
 2691    -1       xhr.onload = function () {
 2692    -1         self.onLoad();
 2693    -1       };
 2694    -1       xhr.onerror = function () {
 2695    -1         self.onError(xhr.responseText);
 2696    -1       };
 2697    -1     } else {
 2698    -1       xhr.onreadystatechange = function () {
 2699    -1         if (4 !== xhr.readyState) return;
 2700    -1         if (200 === xhr.status || 1223 === xhr.status) {
 2701    -1           self.onLoad();
 2702    -1         } else {
 2703    -1           // make sure the `error` event handler that's user-set
 2704    -1           // does not throw in the same tick and gets caught here
 2705    -1           setTimeout(function () {
 2706    -1             self.onError(xhr.status);
 2707    -1           }, 0);
 2708    -1         }
 2709    -1       };
 2710    -1     }
 2711    -1 
 2712    -1     debug('xhr data %s', this.data);
 2713    -1     xhr.send(this.data);
 2714    -1   } catch (e) {
 2715    -1     // Need to defer since .create() is called directly fhrom the constructor
 2716    -1     // and thus the 'error' event can only be only bound *after* this exception
 2717    -1     // occurs.  Therefore, also, we cannot throw here at all.
 2718    -1     setTimeout(function () {
 2719    -1       self.onError(e);
 2720    -1     }, 0);
 2721    -1     return;
 2722    -1   }
 2723    -1 
 2724    -1   if (global.document) {
 2725    -1     this.index = Request.requestsCount++;
 2726    -1     Request.requests[this.index] = this;
 2727    -1   }
 2728    -1 };
 2729    -1 
 2730    -1 /**
 2731    -1  * Called upon successful response.
 2732    -1  *
 2733    -1  * @api private
 2734    -1  */
 2735    -1 
 2736    -1 Request.prototype.onSuccess = function () {
 2737    -1   this.emit('success');
 2738    -1   this.cleanup();
 2739    -1 };
 2740    -1 
 2741    -1 /**
 2742    -1  * Called if we have data.
 2743    -1  *
 2744    -1  * @api private
 2745    -1  */
 2746    -1 
 2747    -1 Request.prototype.onData = function (data) {
 2748    -1   this.emit('data', data);
 2749    -1   this.onSuccess();
 2750    -1 };
 2751    -1 
 2752    -1 /**
 2753    -1  * Called upon error.
 2754    -1  *
 2755    -1  * @api private
 2756    -1  */
 2757    -1 
 2758    -1 Request.prototype.onError = function (err) {
 2759    -1   this.emit('error', err);
 2760    -1   this.cleanup(true);
 2761    -1 };
 2762    -1 
 2763    -1 /**
 2764    -1  * Cleans up house.
 2765    -1  *
 2766    -1  * @api private
 2767    -1  */
 2768    -1 
 2769    -1 Request.prototype.cleanup = function (fromError) {
 2770    -1   if ('undefined' === typeof this.xhr || null === this.xhr) {
 2771    -1     return;
 2772    -1   }
 2773    -1   // xmlhttprequest
 2774    -1   if (this.hasXDR()) {
 2775    -1     this.xhr.onload = this.xhr.onerror = empty;
 2776    -1   } else {
 2777    -1     this.xhr.onreadystatechange = empty;
 2778    -1   }
 2779    -1 
 2780    -1   if (fromError) {
 2781    -1     try {
 2782    -1       this.xhr.abort();
 2783    -1     } catch (e) {}
 2784    -1   }
 2785    -1 
 2786    -1   if (global.document) {
 2787    -1     delete Request.requests[this.index];
 2788    -1   }
 2789    -1 
 2790    -1   this.xhr = null;
 2791    -1 };
 2792    -1 
 2793    -1 /**
 2794    -1  * Called upon load.
 2795    -1  *
 2796    -1  * @api private
 2797    -1  */
 2798    -1 
 2799    -1 Request.prototype.onLoad = function () {
 2800    -1   var data;
 2801    -1   try {
 2802    -1     var contentType;
 2803    -1     try {
 2804    -1       contentType = this.xhr.getResponseHeader('Content-Type').split(';')[0];
 2805    -1     } catch (e) {}
 2806    -1     if (contentType === 'application/octet-stream') {
 2807    -1       data = this.xhr.response || this.xhr.responseText;
 2808    -1     } else {
 2809    -1       if (!this.supportsBinary) {
 2810    -1         data = this.xhr.responseText;
 2811    -1       } else {
 2812    -1         try {
 2813    -1           data = String.fromCharCode.apply(null, new Uint8Array(this.xhr.response));
 2814    -1         } catch (e) {
 2815    -1           var ui8Arr = new Uint8Array(this.xhr.response);
 2816    -1           var dataArray = [];
 2817    -1           for (var idx = 0, length = ui8Arr.length; idx < length; idx++) {
 2818    -1             dataArray.push(ui8Arr[idx]);
 2819    -1           }
 2820    -1 
 2821    -1           data = String.fromCharCode.apply(null, dataArray);
 2822    -1         }
 2823    -1       }
 2824    -1     }
 2825    -1   } catch (e) {
 2826    -1     this.onError(e);
 2827    -1   }
 2828    -1   if (null != data) {
 2829    -1     this.onData(data);
 2830    -1   }
 2831    -1 };
 2832    -1 
 2833    -1 /**
 2834    -1  * Check if it has XDomainRequest.
 2835    -1  *
 2836    -1  * @api private
 2837    -1  */
 2838    -1 
 2839    -1 Request.prototype.hasXDR = function () {
 2840    -1   return 'undefined' !== typeof global.XDomainRequest && !this.xs && this.enablesXDR;
 2841    -1 };
 2842    -1 
 2843    -1 /**
 2844    -1  * Aborts the request.
 2845    -1  *
 2846    -1  * @api public
 2847    -1  */
 2848    -1 
 2849    -1 Request.prototype.abort = function () {
 2850    -1   this.cleanup();
 2851    -1 };
 2852    -1 
 2853    -1 /**
 2854    -1  * Aborts pending requests when unloading the window. This is needed to prevent
 2855    -1  * memory leaks (e.g. when using IE) and to ensure that no spurious error is
 2856    -1  * emitted.
 2857    -1  */
 2858    -1 
 2859    -1 Request.requestsCount = 0;
 2860    -1 Request.requests = {};
 2861    -1 
 2862    -1 if (global.document) {
 2863    -1   if (global.attachEvent) {
 2864    -1     global.attachEvent('onunload', unloadHandler);
 2865    -1   } else if (global.addEventListener) {
 2866    -1     global.addEventListener('beforeunload', unloadHandler, false);
 2867    -1   }
 2868    -1 }
 2869    -1 
 2870    -1 function unloadHandler () {
 2871    -1   for (var i in Request.requests) {
 2872    -1     if (Request.requests.hasOwnProperty(i)) {
 2873    -1       Request.requests[i].abort();
 2874    -1     }
 2875    -1   }
 2876    -1 }
 2877    -1 
 2878    -1 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 2879    -1 },{"./polling":19,"component-emitter":22,"component-inherit":11,"debug":23,"xmlhttprequest-ssl":21}],19:[function(require,module,exports){
 2880    -1 /**
 2881    -1  * Module dependencies.
 2882    -1  */
 2883    -1 
 2884    -1 var Transport = require('../transport');
 2885    -1 var parseqs = require('parseqs');
 2886    -1 var parser = require('engine.io-parser');
 2887    -1 var inherit = require('component-inherit');
 2888    -1 var yeast = require('yeast');
 2889    -1 var debug = require('debug')('engine.io-client:polling');
 2890    -1 
 2891    -1 /**
 2892    -1  * Module exports.
 2893    -1  */
 2894    -1 
 2895    -1 module.exports = Polling;
 2896    -1 
 2897    -1 /**
 2898    -1  * Is XHR2 supported?
 2899    -1  */
 2900    -1 
 2901    -1 var hasXHR2 = (function () {
 2902    -1   var XMLHttpRequest = require('xmlhttprequest-ssl');
 2903    -1   var xhr = new XMLHttpRequest({ xdomain: false });
 2904    -1   return null != xhr.responseType;
 2905    -1 })();
 2906    -1 
 2907    -1 /**
 2908    -1  * Polling interface.
 2909    -1  *
 2910    -1  * @param {Object} opts
 2911    -1  * @api private
 2912    -1  */
 2913    -1 
 2914    -1 function Polling (opts) {
 2915    -1   var forceBase64 = (opts && opts.forceBase64);
 2916    -1   if (!hasXHR2 || forceBase64) {
 2917    -1     this.supportsBinary = false;
 2918    -1   }
 2919    -1   Transport.call(this, opts);
 2920    -1 }
 2921    -1 
 2922    -1 /**
 2923    -1  * Inherits from Transport.
 2924    -1  */
 2925    -1 
 2926    -1 inherit(Polling, Transport);
 2927    -1 
 2928    -1 /**
 2929    -1  * Transport name.
 2930    -1  */
 2931    -1 
 2932    -1 Polling.prototype.name = 'polling';
 2933    -1 
 2934    -1 /**
 2935    -1  * Opens the socket (triggers polling). We write a PING message to determine
 2936    -1  * when the transport is open.
 2937    -1  *
 2938    -1  * @api private
 2939    -1  */
 2940    -1 
 2941    -1 Polling.prototype.doOpen = function () {
 2942    -1   this.poll();
 2943    -1 };
 2944    -1 
 2945    -1 /**
 2946    -1  * Pauses polling.
 2947    -1  *
 2948    -1  * @param {Function} callback upon buffers are flushed and transport is paused
 2949    -1  * @api private
 2950    -1  */
 2951    -1 
 2952    -1 Polling.prototype.pause = function (onPause) {
 2953    -1   var self = this;
 2954    -1 
 2955    -1   this.readyState = 'pausing';
 2956    -1 
 2957    -1   function pause () {
 2958    -1     debug('paused');
 2959    -1     self.readyState = 'paused';
 2960    -1     onPause();
 2961    -1   }
 2962    -1 
 2963    -1   if (this.polling || !this.writable) {
 2964    -1     var total = 0;
 2965    -1 
 2966    -1     if (this.polling) {
 2967    -1       debug('we are currently polling - waiting to pause');
 2968    -1       total++;
 2969    -1       this.once('pollComplete', function () {
 2970    -1         debug('pre-pause polling complete');
 2971    -1         --total || pause();
 2972    -1       });
 2973    -1     }
 2974    -1 
 2975    -1     if (!this.writable) {
 2976    -1       debug('we are currently writing - waiting to pause');
 2977    -1       total++;
 2978    -1       this.once('drain', function () {
 2979    -1         debug('pre-pause writing complete');
 2980    -1         --total || pause();
 2981    -1       });
 2982    -1     }
 2983    -1   } else {
 2984    -1     pause();
 2985    -1   }
 2986    -1 };
 2987    -1 
 2988    -1 /**
 2989    -1  * Starts polling cycle.
 2990    -1  *
 2991    -1  * @api public
 2992    -1  */
 2993    -1 
 2994    -1 Polling.prototype.poll = function () {
 2995    -1   debug('polling');
 2996    -1   this.polling = true;
 2997    -1   this.doPoll();
 2998    -1   this.emit('poll');
 2999    -1 };
 3000    -1 
 3001    -1 /**
 3002    -1  * Overloads onData to detect payloads.
 3003    -1  *
 3004    -1  * @api private
 3005    -1  */
 3006    -1 
 3007    -1 Polling.prototype.onData = function (data) {
 3008    -1   var self = this;
 3009    -1   debug('polling got data %s', data);
 3010    -1   var callback = function (packet, index, total) {
 3011    -1     // if its the first message we consider the transport open
 3012    -1     if ('opening' === self.readyState) {
 3013    -1       self.onOpen();
 3014    -1     }
 3015    -1 
 3016    -1     // if its a close packet, we close the ongoing requests
 3017    -1     if ('close' === packet.type) {
 3018    -1       self.onClose();
 3019    -1       return false;
 3020    -1     }
 3021    -1 
 3022    -1     // otherwise bypass onData and handle the message
 3023    -1     self.onPacket(packet);
 3024    -1   };
 3025    -1 
 3026    -1   // decode payload
 3027    -1   parser.decodePayload(data, this.socket.binaryType, callback);
 3028    -1 
 3029    -1   // if an event did not trigger closing
 3030    -1   if ('closed' !== this.readyState) {
 3031    -1     // if we got data we're not polling
 3032    -1     this.polling = false;
 3033    -1     this.emit('pollComplete');
 3034    -1 
 3035    -1     if ('open' === this.readyState) {
 3036    -1       this.poll();
 3037    -1     } else {
 3038    -1       debug('ignoring poll - transport state "%s"', this.readyState);
 3039    -1     }
 3040    -1   }
 3041    -1 };
 3042    -1 
 3043    -1 /**
 3044    -1  * For polling, send a close packet.
 3045    -1  *
 3046    -1  * @api private
 3047    -1  */
 3048    -1 
 3049    -1 Polling.prototype.doClose = function () {
 3050    -1   var self = this;
 3051    -1 
 3052    -1   function close () {
 3053    -1     debug('writing close packet');
 3054    -1     self.write([{ type: 'close' }]);
 3055    -1   }
 3056    -1 
 3057    -1   if ('open' === this.readyState) {
 3058    -1     debug('transport open - closing');
 3059    -1     close();
 3060    -1   } else {
 3061    -1     // in case we're trying to close while
 3062    -1     // handshaking is in progress (GH-164)
 3063    -1     debug('transport not open - deferring close');
 3064    -1     this.once('open', close);
 3065    -1   }
 3066    -1 };
 3067    -1 
 3068    -1 /**
 3069    -1  * Writes a packets payload.
 3070    -1  *
 3071    -1  * @param {Array} data packets
 3072    -1  * @param {Function} drain callback
 3073    -1  * @api private
 3074    -1  */
 3075    -1 
 3076    -1 Polling.prototype.write = function (packets) {
 3077    -1   var self = this;
 3078    -1   this.writable = false;
 3079    -1   var callbackfn = function () {
 3080    -1     self.writable = true;
 3081    -1     self.emit('drain');
 3082    -1   };
 3083    -1 
 3084    -1   parser.encodePayload(packets, this.supportsBinary, function (data) {
 3085    -1     self.doWrite(data, callbackfn);
 3086    -1   });
 3087    -1 };
 3088    -1 
 3089    -1 /**
 3090    -1  * Generates uri for connection.
 3091    -1  *
 3092    -1  * @api private
 3093    -1  */
 3094    -1 
 3095    -1 Polling.prototype.uri = function () {
 3096    -1   var query = this.query || {};
 3097    -1   var schema = this.secure ? 'https' : 'http';
 3098    -1   var port = '';
 3099    -1 
 3100    -1   // cache busting is forced
 3101    -1   if (false !== this.timestampRequests) {
 3102    -1     query[this.timestampParam] = yeast();
 3103    -1   }
 3104    -1 
 3105    -1   if (!this.supportsBinary && !query.sid) {
 3106    -1     query.b64 = 1;
 3107    -1   }
 3108    -1 
 3109    -1   query = parseqs.encode(query);
 3110    -1 
 3111    -1   // avoid port if default for schema
 3112    -1   if (this.port && (('https' === schema && Number(this.port) !== 443) ||
 3113    -1      ('http' === schema && Number(this.port) !== 80))) {
 3114    -1     port = ':' + this.port;
 3115    -1   }
 3116    -1 
 3117    -1   // prepend ? to query
 3118    -1   if (query.length) {
 3119    -1     query = '?' + query;
 3120    -1   }
 3121    -1 
 3122    -1   var ipv6 = this.hostname.indexOf(':') !== -1;
 3123    -1   return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;
 3124    -1 };
 3125    -1 
 3126    -1 },{"../transport":15,"component-inherit":11,"debug":23,"engine.io-parser":26,"parseqs":94,"xmlhttprequest-ssl":21,"yeast":120}],20:[function(require,module,exports){
 3127    -1 (function (global){
 3128    -1 /**
 3129    -1  * Module dependencies.
 3130    -1  */
 3131    -1 
 3132    -1 var Transport = require('../transport');
 3133    -1 var parser = require('engine.io-parser');
 3134    -1 var parseqs = require('parseqs');
 3135    -1 var inherit = require('component-inherit');
 3136    -1 var yeast = require('yeast');
 3137    -1 var debug = require('debug')('engine.io-client:websocket');
 3138    -1 var BrowserWebSocket = global.WebSocket || global.MozWebSocket;
 3139    -1 var NodeWebSocket;
 3140    -1 if (typeof window === 'undefined') {
 3141    -1   try {
 3142    -1     NodeWebSocket = require('ws');
 3143    -1   } catch (e) { }
 3144    -1 }
 3145    -1 
 3146    -1 /**
 3147    -1  * Get either the `WebSocket` or `MozWebSocket` globals
 3148    -1  * in the browser or try to resolve WebSocket-compatible
 3149    -1  * interface exposed by `ws` for Node-like environment.
 3150    -1  */
 3151    -1 
 3152    -1 var WebSocket = BrowserWebSocket;
 3153    -1 if (!WebSocket && typeof window === 'undefined') {
 3154    -1   WebSocket = NodeWebSocket;
 3155    -1 }
 3156    -1 
 3157    -1 /**
 3158    -1  * Module exports.
 3159    -1  */
 3160    -1 
 3161    -1 module.exports = WS;
 3162    -1 
 3163    -1 /**
 3164    -1  * WebSocket transport constructor.
 3165    -1  *
 3166    -1  * @api {Object} connection options
 3167    -1  * @api public
 3168    -1  */
 3169    -1 
 3170    -1 function WS (opts) {
 3171    -1   var forceBase64 = (opts && opts.forceBase64);
 3172    -1   if (forceBase64) {
 3173    -1     this.supportsBinary = false;
 3174    -1   }
 3175    -1   this.perMessageDeflate = opts.perMessageDeflate;
 3176    -1   this.usingBrowserWebSocket = BrowserWebSocket && !opts.forceNode;
 3177    -1   if (!this.usingBrowserWebSocket) {
 3178    -1     WebSocket = NodeWebSocket;
 3179    -1   }
 3180    -1   Transport.call(this, opts);
 3181    -1 }
 3182    -1 
 3183    -1 /**
 3184    -1  * Inherits from Transport.
 3185    -1  */
 3186    -1 
 3187    -1 inherit(WS, Transport);
 3188    -1 
 3189    -1 /**
 3190    -1  * Transport name.
 3191    -1  *
 3192    -1  * @api public
 3193    -1  */
 3194    -1 
 3195    -1 WS.prototype.name = 'websocket';
 3196    -1 
 3197    -1 /*
 3198    -1  * WebSockets support binary
 3199    -1  */
 3200    -1 
 3201    -1 WS.prototype.supportsBinary = true;
 3202    -1 
 3203    -1 /**
 3204    -1  * Opens socket.
 3205    -1  *
 3206    -1  * @api private
 3207    -1  */
 3208    -1 
 3209    -1 WS.prototype.doOpen = function () {
 3210    -1   if (!this.check()) {
 3211    -1     // let probe timeout
 3212    -1     return;
 3213    -1   }
 3214    -1 
 3215    -1   var uri = this.uri();
 3216    -1   var protocols = void (0);
 3217    -1   var opts = {
 3218    -1     agent: this.agent,
 3219    -1     perMessageDeflate: this.perMessageDeflate
 3220    -1   };
 3221    -1 
 3222    -1   // SSL options for Node.js client
 3223    -1   opts.pfx = this.pfx;
 3224    -1   opts.key = this.key;
 3225    -1   opts.passphrase = this.passphrase;
 3226    -1   opts.cert = this.cert;
 3227    -1   opts.ca = this.ca;
 3228    -1   opts.ciphers = this.ciphers;
 3229    -1   opts.rejectUnauthorized = this.rejectUnauthorized;
 3230    -1   if (this.extraHeaders) {
 3231    -1     opts.headers = this.extraHeaders;
 3232    -1   }
 3233    -1   if (this.localAddress) {
 3234    -1     opts.localAddress = this.localAddress;
 3235    -1   }
 3236    -1 
 3237    -1   try {
 3238    -1     this.ws = this.usingBrowserWebSocket ? new WebSocket(uri) : new WebSocket(uri, protocols, opts);
 3239    -1   } catch (err) {
 3240    -1     return this.emit('error', err);
 3241    -1   }
 3242    -1 
 3243    -1   if (this.ws.binaryType === undefined) {
 3244    -1     this.supportsBinary = false;
 3245    -1   }
 3246    -1 
 3247    -1   if (this.ws.supports && this.ws.supports.binary) {
 3248    -1     this.supportsBinary = true;
 3249    -1     this.ws.binaryType = 'nodebuffer';
 3250    -1   } else {
 3251    -1     this.ws.binaryType = 'arraybuffer';
 3252    -1   }
 3253    -1 
 3254    -1   this.addEventListeners();
 3255    -1 };
 3256    -1 
 3257    -1 /**
 3258    -1  * Adds event listeners to the socket
 3259    -1  *
 3260    -1  * @api private
 3261    -1  */
 3262    -1 
 3263    -1 WS.prototype.addEventListeners = function () {
 3264    -1   var self = this;
 3265    -1 
 3266    -1   this.ws.onopen = function () {
 3267    -1     self.onOpen();
 3268    -1   };
 3269    -1   this.ws.onclose = function () {
 3270    -1     self.onClose();
 3271    -1   };
 3272    -1   this.ws.onmessage = function (ev) {
 3273    -1     self.onData(ev.data);
 3274    -1   };
 3275    -1   this.ws.onerror = function (e) {
 3276    -1     self.onError('websocket error', e);
 3277    -1   };
 3278    -1 };
 3279    -1 
 3280    -1 /**
 3281    -1  * Writes data to socket.
 3282    -1  *
 3283    -1  * @param {Array} array of packets.
 3284    -1  * @api private
 3285    -1  */
 3286    -1 
 3287    -1 WS.prototype.write = function (packets) {
 3288    -1   var self = this;
 3289    -1   this.writable = false;
 3290    -1 
 3291    -1   // encodePacket efficient as it uses WS framing
 3292    -1   // no need for encodePayload
 3293    -1   var total = packets.length;
 3294    -1   for (var i = 0, l = total; i < l; i++) {
 3295    -1     (function (packet) {
 3296    -1       parser.encodePacket(packet, self.supportsBinary, function (data) {
 3297    -1         if (!self.usingBrowserWebSocket) {
 3298    -1           // always create a new object (GH-437)
 3299    -1           var opts = {};
 3300    -1           if (packet.options) {
 3301    -1             opts.compress = packet.options.compress;
 3302    -1           }
 3303    -1 
 3304    -1           if (self.perMessageDeflate) {
 3305    -1             var len = 'string' === typeof data ? global.Buffer.byteLength(data) : data.length;
 3306    -1             if (len < self.perMessageDeflate.threshold) {
 3307    -1               opts.compress = false;
 3308    -1             }
 3309    -1           }
 3310    -1         }
 3311    -1 
 3312    -1         // Sometimes the websocket has already been closed but the browser didn't
 3313    -1         // have a chance of informing us about it yet, in that case send will
 3314    -1         // throw an error
 3315    -1         try {
 3316    -1           if (self.usingBrowserWebSocket) {
 3317    -1             // TypeError is thrown when passing the second argument on Safari
 3318    -1             self.ws.send(data);
 3319    -1           } else {
 3320    -1             self.ws.send(data, opts);
 3321    -1           }
 3322    -1         } catch (e) {
 3323    -1           debug('websocket closed before onclose event');
 3324    -1         }
 3325    -1 
 3326    -1         --total || done();
 3327    -1       });
 3328    -1     })(packets[i]);
 3329    -1   }
 3330    -1 
 3331    -1   function done () {
 3332    -1     self.emit('flush');
 3333    -1 
 3334    -1     // fake drain
 3335    -1     // defer to next tick to allow Socket to clear writeBuffer
 3336    -1     setTimeout(function () {
 3337    -1       self.writable = true;
 3338    -1       self.emit('drain');
 3339    -1     }, 0);
 3340    -1   }
 3341    -1 };
 3342    -1 
 3343    -1 /**
 3344    -1  * Called upon close
 3345    -1  *
 3346    -1  * @api private
 3347    -1  */
 3348    -1 
 3349    -1 WS.prototype.onClose = function () {
 3350    -1   Transport.prototype.onClose.call(this);
 3351    -1 };
 3352    -1 
 3353    -1 /**
 3354    -1  * Closes socket.
 3355    -1  *
 3356    -1  * @api private
 3357    -1  */
 3358    -1 
 3359    -1 WS.prototype.doClose = function () {
 3360    -1   if (typeof this.ws !== 'undefined') {
 3361    -1     this.ws.close();
 3362    -1   }
 3363    -1 };
 3364    -1 
 3365    -1 /**
 3366    -1  * Generates uri for connection.
 3367    -1  *
 3368    -1  * @api private
 3369    -1  */
 3370    -1 
 3371    -1 WS.prototype.uri = function () {
 3372    -1   var query = this.query || {};
 3373    -1   var schema = this.secure ? 'wss' : 'ws';
 3374    -1   var port = '';
 3375    -1 
 3376    -1   // avoid port if default for schema
 3377    -1   if (this.port && (('wss' === schema && Number(this.port) !== 443) ||
 3378    -1     ('ws' === schema && Number(this.port) !== 80))) {
 3379    -1     port = ':' + this.port;
 3380    -1   }
 3381    -1 
 3382    -1   // append timestamp to URI
 3383    -1   if (this.timestampRequests) {
 3384    -1     query[this.timestampParam] = yeast();
 3385    -1   }
 3386    -1 
 3387    -1   // communicate binary support capabilities
 3388    -1   if (!this.supportsBinary) {
 3389    -1     query.b64 = 1;
 3390    -1   }
 3391    -1 
 3392    -1   query = parseqs.encode(query);
 3393    -1 
 3394    -1   // prepend ? to query
 3395    -1   if (query.length) {
 3396    -1     query = '?' + query;
 3397    -1   }
 3398    -1 
 3399    -1   var ipv6 = this.hostname.indexOf(':') !== -1;
 3400    -1   return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;
 3401    -1 };
 3402    -1 
 3403    -1 /**
 3404    -1  * Feature detection for WebSocket.
 3405    -1  *
 3406    -1  * @return {Boolean} whether this transport is available.
 3407    -1  * @api public
 3408    -1  */
 3409    -1 
 3410    -1 WS.prototype.check = function () {
 3411    -1   return !!WebSocket && !('__initialize' in WebSocket && this.name === WS.prototype.name);
 3412    -1 };
 3413    -1 
 3414    -1 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 3415    -1 },{"../transport":15,"component-inherit":11,"debug":23,"engine.io-parser":26,"parseqs":94,"ws":1,"yeast":120}],21:[function(require,module,exports){
 3416    -1 (function (global){
 3417    -1 // browser shim for xmlhttprequest module
 3418    -1 
 3419    -1 var hasCORS = require('has-cors');
 3420    -1 
 3421    -1 module.exports = function (opts) {
 3422    -1   var xdomain = opts.xdomain;
 3423    -1 
 3424    -1   // scheme must be same when usign XDomainRequest
 3425    -1   // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx
 3426    -1   var xscheme = opts.xscheme;
 3427    -1 
 3428    -1   // XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default.
 3429    -1   // https://github.com/Automattic/engine.io-client/pull/217
 3430    -1   var enablesXDR = opts.enablesXDR;
 3431    -1 
 3432    -1   // XMLHttpRequest can be disabled on IE
 3433    -1   try {
 3434    -1     if ('undefined' !== typeof XMLHttpRequest && (!xdomain || hasCORS)) {
 3435    -1       return new XMLHttpRequest();
 3436    -1     }
 3437    -1   } catch (e) { }
 3438    -1 
 3439    -1   // Use XDomainRequest for IE8 if enablesXDR is true
 3440    -1   // because loading bar keeps flashing when using jsonp-polling
 3441    -1   // https://github.com/yujiosaka/socke.io-ie8-loading-example
 3442    -1   try {
 3443    -1     if ('undefined' !== typeof XDomainRequest && !xscheme && enablesXDR) {
 3444    -1       return new XDomainRequest();
 3445    -1     }
 3446    -1   } catch (e) { }
 3447    -1 
 3448    -1   if (!xdomain) {
 3449    -1     try {
 3450    -1       return new global[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP');
 3451    -1     } catch (e) { }
 3452    -1   }
 3453    -1 };
 3454    -1 
 3455    -1 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 3456    -1 },{"has-cors":30}],22:[function(require,module,exports){
 3457    -1 

 3458    -1 /**

 3459    -1  * Expose `Emitter`.

 3460    -1  */

 3461    -1 

 3462    -1 if (typeof module !== 'undefined') {

 3463    -1   module.exports = Emitter;

 3464    -1 }

 3465    -1 

 3466    -1 /**

 3467    -1  * Initialize a new `Emitter`.

 3468    -1  *

 3469    -1  * @api public

 3470    -1  */

 3471    -1 

 3472    -1 function Emitter(obj) {

 3473    -1   if (obj) return mixin(obj);

 3474    -1 };

 3475    -1 

 3476    -1 /**

 3477    -1  * Mixin the emitter properties.

 3478    -1  *

 3479    -1  * @param {Object} obj

 3480    -1  * @return {Object}

 3481    -1  * @api private

 3482    -1  */

 3483    -1 

 3484    -1 function mixin(obj) {

 3485    -1   for (var key in Emitter.prototype) {

 3486    -1     obj[key] = Emitter.prototype[key];

 3487    -1   }

 3488    -1   return obj;

 3489    -1 }

 3490    -1 

 3491    -1 /**

 3492    -1  * Listen on the given `event` with `fn`.

 3493    -1  *

 3494    -1  * @param {String} event

 3495    -1  * @param {Function} fn

 3496    -1  * @return {Emitter}

 3497    -1  * @api public

 3498    -1  */

 3499    -1 

 3500    -1 Emitter.prototype.on =

 3501    -1 Emitter.prototype.addEventListener = function(event, fn){

 3502    -1   this._callbacks = this._callbacks || {};

 3503    -1   (this._callbacks['$' + event] = this._callbacks['$' + event] || [])

 3504    -1     .push(fn);

 3505    -1   return this;

 3506    -1 };

 3507    -1 

 3508    -1 /**

 3509    -1  * Adds an `event` listener that will be invoked a single

 3510    -1  * time then automatically removed.

 3511    -1  *

 3512    -1  * @param {String} event

 3513    -1  * @param {Function} fn

 3514    -1  * @return {Emitter}

 3515    -1  * @api public

 3516    -1  */

 3517    -1 

 3518    -1 Emitter.prototype.once = function(event, fn){

 3519    -1   function on() {

 3520    -1     this.off(event, on);

 3521    -1     fn.apply(this, arguments);

 3522    -1   }

 3523    -1 

 3524    -1   on.fn = fn;

 3525    -1   this.on(event, on);

 3526    -1   return this;

 3527    -1 };

 3528    -1 

 3529    -1 /**

 3530    -1  * Remove the given callback for `event` or all

 3531    -1  * registered callbacks.

 3532    -1  *

 3533    -1  * @param {String} event

 3534    -1  * @param {Function} fn

 3535    -1  * @return {Emitter}

 3536    -1  * @api public

 3537    -1  */

 3538    -1 

 3539    -1 Emitter.prototype.off =

 3540    -1 Emitter.prototype.removeListener =

 3541    -1 Emitter.prototype.removeAllListeners =

 3542    -1 Emitter.prototype.removeEventListener = function(event, fn){

 3543    -1   this._callbacks = this._callbacks || {};

 3544    -1 

 3545    -1   // all

 3546    -1   if (0 == arguments.length) {

 3547    -1     this._callbacks = {};

 3548    -1     return this;

 3549    -1   }

 3550    -1 

 3551    -1   // specific event

 3552    -1   var callbacks = this._callbacks['$' + event];

 3553    -1   if (!callbacks) return this;

 3554    -1 

 3555    -1   // remove all handlers

 3556    -1   if (1 == arguments.length) {

 3557    -1     delete this._callbacks['$' + event];

 3558    -1     return this;

 3559    -1   }

 3560    -1 

 3561    -1   // remove specific handler

 3562    -1   var cb;

 3563    -1   for (var i = 0; i < callbacks.length; i++) {

 3564    -1     cb = callbacks[i];

 3565    -1     if (cb === fn || cb.fn === fn) {

 3566    -1       callbacks.splice(i, 1);

 3567    -1       break;

 3568    -1     }

 3569    -1   }

 3570    -1   return this;

 3571    -1 };

 3572    -1 

 3573    -1 /**

 3574    -1  * Emit `event` with the given args.

 3575    -1  *

 3576    -1  * @param {String} event

 3577    -1  * @param {Mixed} ...

 3578    -1  * @return {Emitter}

 3579    -1  */

 3580    -1 

 3581    -1 Emitter.prototype.emit = function(event){

 3582    -1   this._callbacks = this._callbacks || {};

 3583    -1   var args = [].slice.call(arguments, 1)

 3584    -1     , callbacks = this._callbacks['$' + event];

 3585    -1 

 3586    -1   if (callbacks) {

 3587    -1     callbacks = callbacks.slice(0);

 3588    -1     for (var i = 0, len = callbacks.length; i < len; ++i) {

 3589    -1       callbacks[i].apply(this, args);

 3590    -1     }

 3591    -1   }

 3592    -1 

 3593    -1   return this;

 3594    -1 };

 3595    -1 

 3596    -1 /**

 3597    -1  * Return array of callbacks for `event`.

 3598    -1  *

 3599    -1  * @param {String} event

 3600    -1  * @return {Array}

 3601    -1  * @api public

 3602    -1  */

 3603    -1 

 3604    -1 Emitter.prototype.listeners = function(event){

 3605    -1   this._callbacks = this._callbacks || {};

 3606    -1   return this._callbacks['$' + event] || [];

 3607    -1 };

 3608    -1 

 3609    -1 /**

 3610    -1  * Check if this emitter has `event` handlers.

 3611    -1  *

 3612    -1  * @param {String} event

 3613    -1  * @return {Boolean}

 3614    -1  * @api public

 3615    -1  */

 3616    -1 

 3617    -1 Emitter.prototype.hasListeners = function(event){

 3618    -1   return !! this.listeners(event).length;

 3619    -1 };

 3620    -1 
 3621    -1 },{}],23:[function(require,module,exports){
 3622    -1 (function (process){
 3623    -1 
 3624    -1 /**
 3625    -1  * This is the web browser implementation of `debug()`.
 3626    -1  *
 3627    -1  * Expose `debug()` as the module.
 3628    -1  */
 3629    -1 
 3630    -1 exports = module.exports = require('./debug');
 3631    -1 exports.log = log;
 3632    -1 exports.formatArgs = formatArgs;
 3633    -1 exports.save = save;
 3634    -1 exports.load = load;
 3635    -1 exports.useColors = useColors;
 3636    -1 exports.storage = 'undefined' != typeof chrome
 3637    -1                && 'undefined' != typeof chrome.storage
 3638    -1                   ? chrome.storage.local
 3639    -1                   : localstorage();
 3640    -1 
 3641    -1 /**
 3642    -1  * Colors.
 3643    -1  */
 3644    -1 
 3645    -1 exports.colors = [
 3646    -1   'lightseagreen',
 3647    -1   'forestgreen',
 3648    -1   'goldenrod',
 3649    -1   'dodgerblue',
 3650    -1   'darkorchid',
 3651    -1   'crimson'
 3652    -1 ];
 3653    -1 
 3654    -1 /**
 3655    -1  * Currently only WebKit-based Web Inspectors, Firefox >= v31,
 3656    -1  * and the Firebug extension (any Firefox version) are known
 3657    -1  * to support "%c" CSS customizations.
 3658    -1  *
 3659    -1  * TODO: add a `localStorage` variable to explicitly enable/disable colors
 3660    -1  */
 3661    -1 
 3662    -1 function useColors() {
 3663    -1   // is webkit? http://stackoverflow.com/a/16459606/376773
 3664    -1   // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
 3665    -1   return (typeof document !== 'undefined' && 'WebkitAppearance' in document.documentElement.style) ||
 3666    -1     // is firebug? http://stackoverflow.com/a/398120/376773
 3667    -1     (window.console && (console.firebug || (console.exception && console.table))) ||
 3668    -1     // is firefox >= v31?
 3669    -1     // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
 3670    -1     (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31);
 3671    -1 }
 3672    -1 
 3673    -1 /**
 3674    -1  * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
 3675    -1  */
 3676    -1 
 3677    -1 exports.formatters.j = function(v) {
 3678    -1   try {
 3679    -1     return JSON.stringify(v);
 3680    -1   } catch (err) {
 3681    -1     return '[UnexpectedJSONParseError]: ' + err.message;
 3682    -1   }
 3683    -1 };
 3684    -1 
 3685    -1 
 3686    -1 /**
 3687    -1  * Colorize log arguments if enabled.
 3688    -1  *
 3689    -1  * @api public
 3690    -1  */
 3691    -1 
 3692    -1 function formatArgs() {
 3693    -1   var args = arguments;
 3694    -1   var useColors = this.useColors;
 3695    -1 
 3696    -1   args[0] = (useColors ? '%c' : '')
 3697    -1     + this.namespace
 3698    -1     + (useColors ? ' %c' : ' ')
 3699    -1     + args[0]
 3700    -1     + (useColors ? '%c ' : ' ')
 3701    -1     + '+' + exports.humanize(this.diff);
 3702    -1 
 3703    -1   if (!useColors) return args;
 3704    -1 
 3705    -1   var c = 'color: ' + this.color;
 3706    -1   args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1));
 3707    -1 
 3708    -1   // the final "%c" is somewhat tricky, because there could be other
 3709    -1   // arguments passed either before or after the %c, so we need to
 3710    -1   // figure out the correct index to insert the CSS into
 3711    -1   var index = 0;
 3712    -1   var lastC = 0;
 3713    -1   args[0].replace(/%[a-z%]/g, function(match) {
 3714    -1     if ('%%' === match) return;
 3715    -1     index++;
 3716    -1     if ('%c' === match) {
 3717    -1       // we only are interested in the *last* %c
 3718    -1       // (the user may have provided their own)
 3719    -1       lastC = index;
 3720    -1     }
 3721    -1   });
 3722    -1 
 3723    -1   args.splice(lastC, 0, c);
 3724    -1   return args;
 3725    -1 }
 3726    -1 
 3727    -1 /**
 3728    -1  * Invokes `console.log()` when available.
 3729    -1  * No-op when `console.log` is not a "function".
 3730    -1  *
 3731    -1  * @api public
 3732    -1  */
 3733    -1 
 3734    -1 function log() {
 3735    -1   // this hackery is required for IE8/9, where
 3736    -1   // the `console.log` function doesn't have 'apply'
 3737    -1   return 'object' === typeof console
 3738    -1     && console.log
 3739    -1     && Function.prototype.apply.call(console.log, console, arguments);
 3740    -1 }
 3741    -1 
 3742    -1 /**
 3743    -1  * Save `namespaces`.
 3744    -1  *
 3745    -1  * @param {String} namespaces
 3746    -1  * @api private
 3747    -1  */
 3748    -1 
 3749    -1 function save(namespaces) {
 3750    -1   try {
 3751    -1     if (null == namespaces) {
 3752    -1       exports.storage.removeItem('debug');
 3753    -1     } else {
 3754    -1       exports.storage.debug = namespaces;
 3755    -1     }
 3756    -1   } catch(e) {}
 3757    -1 }
 3758    -1 
 3759    -1 /**
 3760    -1  * Load `namespaces`.
 3761    -1  *
 3762    -1  * @return {String} returns the previously persisted debug modes
 3763    -1  * @api private
 3764    -1  */
 3765    -1 
 3766    -1 function load() {
 3767    -1   var r;
 3768    -1   try {
 3769    -1     return exports.storage.debug;
 3770    -1   } catch(e) {}
 3771    -1 
 3772    -1   // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
 3773    -1   if (typeof process !== 'undefined' && 'env' in process) {
 3774    -1     return process.env.DEBUG;
 3775    -1   }
 3776    -1 }
 3777    -1 
 3778    -1 /**
 3779    -1  * Enable namespaces listed in `localStorage.debug` initially.
 3780    -1  */
 3781    -1 
 3782    -1 exports.enable(load());
 3783    -1 
 3784    -1 /**
 3785    -1  * Localstorage attempts to return the localstorage.
 3786    -1  *
 3787    -1  * This is necessary because safari throws
 3788    -1  * when a user disables cookies/localstorage
 3789    -1  * and you attempt to access it.
 3790    -1  *
 3791    -1  * @return {LocalStorage}
 3792    -1  * @api private
 3793    -1  */
 3794    -1 
 3795    -1 function localstorage(){
 3796    -1   try {
 3797    -1     return window.localStorage;
 3798    -1   } catch (e) {}
 3799    -1 }
 3800    -1 
 3801    -1 }).call(this,require('_process'))
 3802    -1 },{"./debug":24,"_process":2}],24:[function(require,module,exports){
 3803    -1 
 3804    -1 /**
 3805    -1  * This is the common logic for both the Node.js and web browser
 3806    -1  * implementations of `debug()`.
 3807    -1  *
 3808    -1  * Expose `debug()` as the module.
 3809    -1  */
 3810    -1 
 3811    -1 exports = module.exports = debug.debug = debug;
 3812    -1 exports.coerce = coerce;
 3813    -1 exports.disable = disable;
 3814    -1 exports.enable = enable;
 3815    -1 exports.enabled = enabled;
 3816    -1 exports.humanize = require('ms');
 3817    -1 
 3818    -1 /**
 3819    -1  * The currently active debug mode names, and names to skip.
 3820    -1  */
 3821    -1 
 3822    -1 exports.names = [];
 3823    -1 exports.skips = [];
 3824    -1 
 3825    -1 /**
 3826    -1  * Map of special "%n" handling functions, for the debug "format" argument.
 3827    -1  *
 3828    -1  * Valid key names are a single, lowercased letter, i.e. "n".
 3829    -1  */
 3830    -1 
 3831    -1 exports.formatters = {};
 3832    -1 
 3833    -1 /**
 3834    -1  * Previously assigned color.
 3835    -1  */
 3836    -1 
 3837    -1 var prevColor = 0;
 3838    -1 
 3839    -1 /**
 3840    -1  * Previous log timestamp.
 3841    -1  */
 3842    -1 
 3843    -1 var prevTime;
 3844    -1 
 3845    -1 /**
 3846    -1  * Select a color.
 3847    -1  *
 3848    -1  * @return {Number}
 3849    -1  * @api private
 3850    -1  */
 3851    -1 
 3852    -1 function selectColor() {
 3853    -1   return exports.colors[prevColor++ % exports.colors.length];
 3854    -1 }
 3855    -1 
 3856    -1 /**
 3857    -1  * Create a debugger with the given `namespace`.
 3858    -1  *
 3859    -1  * @param {String} namespace
 3860    -1  * @return {Function}
 3861    -1  * @api public
 3862    -1  */
 3863    -1 
 3864    -1 function debug(namespace) {
 3865    -1 
 3866    -1   // define the `disabled` version
 3867    -1   function disabled() {
 3868    -1   }
 3869    -1   disabled.enabled = false;
 3870    -1 
 3871    -1   // define the `enabled` version
 3872    -1   function enabled() {
 3873    -1 
 3874    -1     var self = enabled;
 3875    -1 
 3876    -1     // set `diff` timestamp
 3877    -1     var curr = +new Date();
 3878    -1     var ms = curr - (prevTime || curr);
 3879    -1     self.diff = ms;
 3880    -1     self.prev = prevTime;
 3881    -1     self.curr = curr;
 3882    -1     prevTime = curr;
 3883    -1 
 3884    -1     // add the `color` if not set
 3885    -1     if (null == self.useColors) self.useColors = exports.useColors();
 3886    -1     if (null == self.color && self.useColors) self.color = selectColor();
 3887    -1 
 3888    -1     var args = new Array(arguments.length);
 3889    -1     for (var i = 0; i < args.length; i++) {
 3890    -1       args[i] = arguments[i];
 3891    -1     }
 3892    -1 
 3893    -1     args[0] = exports.coerce(args[0]);
 3894    -1 
 3895    -1     if ('string' !== typeof args[0]) {
 3896    -1       // anything else let's inspect with %o
 3897    -1       args = ['%o'].concat(args);
 3898    -1     }
 3899    -1 
 3900    -1     // apply any `formatters` transformations
 3901    -1     var index = 0;
 3902    -1     args[0] = args[0].replace(/%([a-z%])/g, function(match, format) {
 3903    -1       // if we encounter an escaped % then don't increase the array index
 3904    -1       if (match === '%%') return match;
 3905    -1       index++;
 3906    -1       var formatter = exports.formatters[format];
 3907    -1       if ('function' === typeof formatter) {
 3908    -1         var val = args[index];
 3909    -1         match = formatter.call(self, val);
 3910    -1 
 3911    -1         // now we need to remove `args[index]` since it's inlined in the `format`
 3912    -1         args.splice(index, 1);
 3913    -1         index--;
 3914    -1       }
 3915    -1       return match;
 3916    -1     });
 3917    -1 
 3918    -1     // apply env-specific formatting
 3919    -1     args = exports.formatArgs.apply(self, args);
 3920    -1 
 3921    -1     var logFn = enabled.log || exports.log || console.log.bind(console);
 3922    -1     logFn.apply(self, args);
 3923    -1   }
 3924    -1   enabled.enabled = true;
 3925    -1 
 3926    -1   var fn = exports.enabled(namespace) ? enabled : disabled;
 3927    -1 
 3928    -1   fn.namespace = namespace;
 3929    -1 
 3930    -1   return fn;
 3931    -1 }
 3932    -1 
 3933    -1 /**
 3934    -1  * Enables a debug mode by namespaces. This can include modes
 3935    -1  * separated by a colon and wildcards.
 3936    -1  *
 3937    -1  * @param {String} namespaces
 3938    -1  * @api public
 3939    -1  */
 3940    -1 
 3941    -1 function enable(namespaces) {
 3942    -1   exports.save(namespaces);
 3943    -1 
 3944    -1   var split = (namespaces || '').split(/[\s,]+/);
 3945    -1   var len = split.length;
 3946    -1 
 3947    -1   for (var i = 0; i < len; i++) {
 3948    -1     if (!split[i]) continue; // ignore empty strings
 3949    -1     namespaces = split[i].replace(/[\\^$+?.()|[\]{}]/g, '\\$&').replace(/\*/g, '.*?');
 3950    -1     if (namespaces[0] === '-') {
 3951    -1       exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
 3952    -1     } else {
 3953    -1       exports.names.push(new RegExp('^' + namespaces + '$'));
 3954    -1     }
 3955    -1   }
 3956    -1 }
 3957    -1 
 3958    -1 /**
 3959    -1  * Disable debug output.
 3960    -1  *
 3961    -1  * @api public
 3962    -1  */
 3963    -1 
 3964    -1 function disable() {
 3965    -1   exports.enable('');
 3966    -1 }
 3967    -1 
 3968    -1 /**
 3969    -1  * Returns true if the given mode name is enabled, false otherwise.
 3970    -1  *
 3971    -1  * @param {String} name
 3972    -1  * @return {Boolean}
 3973    -1  * @api public
 3974    -1  */
 3975    -1 
 3976    -1 function enabled(name) {
 3977    -1   var i, len;
 3978    -1   for (i = 0, len = exports.skips.length; i < len; i++) {
 3979    -1     if (exports.skips[i].test(name)) {
 3980    -1       return false;
 3981    -1     }
 3982    -1   }
 3983    -1   for (i = 0, len = exports.names.length; i < len; i++) {
 3984    -1     if (exports.names[i].test(name)) {
 3985    -1       return true;
 3986    -1     }
 3987    -1   }
 3988    -1   return false;
 3989    -1 }
 3990    -1 
 3991    -1 /**
 3992    -1  * Coerce `val`.
 3993    -1  *
 3994    -1  * @param {Mixed} val
 3995    -1  * @return {Mixed}
 3996    -1  * @api private
 3997    -1  */
 3998    -1 
 3999    -1 function coerce(val) {
 4000    -1   if (val instanceof Error) return val.stack || val.message;
 4001    -1   return val;
 4002    -1 }
 4003    -1 
 4004    -1 },{"ms":25}],25:[function(require,module,exports){
 4005    -1 /**
 4006    -1  * Helpers.
 4007    -1  */
 4008    -1 
 4009    -1 var s = 1000
 4010    -1 var m = s * 60
 4011    -1 var h = m * 60
 4012    -1 var d = h * 24
 4013    -1 var y = d * 365.25
 4014    -1 
 4015    -1 /**
 4016    -1  * Parse or format the given `val`.
 4017    -1  *
 4018    -1  * Options:
 4019    -1  *
 4020    -1  *  - `long` verbose formatting [false]
 4021    -1  *
 4022    -1  * @param {String|Number} val
 4023    -1  * @param {Object} options
 4024    -1  * @throws {Error} throw an error if val is not a non-empty string or a number
 4025    -1  * @return {String|Number}
 4026    -1  * @api public
 4027    -1  */
 4028    -1 
 4029    -1 module.exports = function (val, options) {
 4030    -1   options = options || {}
 4031    -1   var type = typeof val
 4032    -1   if (type === 'string' && val.length > 0) {
 4033    -1     return parse(val)
 4034    -1   } else if (type === 'number' && isNaN(val) === false) {
 4035    -1     return options.long ?
 4036    -1 			fmtLong(val) :
 4037    -1 			fmtShort(val)
 4038    -1   }
 4039    -1   throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val))
 4040    -1 }
 4041    -1 
 4042    -1 /**
 4043    -1  * Parse the given `str` and return milliseconds.
 4044    -1  *
 4045    -1  * @param {String} str
 4046    -1  * @return {Number}
 4047    -1  * @api private
 4048    -1  */
 4049    -1 
 4050    -1 function parse(str) {
 4051    -1   str = String(str)
 4052    -1   if (str.length > 10000) {
 4053    -1     return
 4054    -1   }
 4055    -1   var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str)
 4056    -1   if (!match) {
 4057    -1     return
 4058    -1   }
 4059    -1   var n = parseFloat(match[1])
 4060    -1   var type = (match[2] || 'ms').toLowerCase()
 4061    -1   switch (type) {
 4062    -1     case 'years':
 4063    -1     case 'year':
 4064    -1     case 'yrs':
 4065    -1     case 'yr':
 4066    -1     case 'y':
 4067    -1       return n * y
 4068    -1     case 'days':
 4069    -1     case 'day':
 4070    -1     case 'd':
 4071    -1       return n * d
 4072    -1     case 'hours':
 4073    -1     case 'hour':
 4074    -1     case 'hrs':
 4075    -1     case 'hr':
 4076    -1     case 'h':
 4077    -1       return n * h
 4078    -1     case 'minutes':
 4079    -1     case 'minute':
 4080    -1     case 'mins':
 4081    -1     case 'min':
 4082    -1     case 'm':
 4083    -1       return n * m
 4084    -1     case 'seconds':
 4085    -1     case 'second':
 4086    -1     case 'secs':
 4087    -1     case 'sec':
 4088    -1     case 's':
 4089    -1       return n * s
 4090    -1     case 'milliseconds':
 4091    -1     case 'millisecond':
 4092    -1     case 'msecs':
 4093    -1     case 'msec':
 4094    -1     case 'ms':
 4095    -1       return n
 4096    -1     default:
 4097    -1       return undefined
 4098    -1   }
 4099    -1 }
 4100    -1 
 4101    -1 /**
 4102    -1  * Short format for `ms`.
 4103    -1  *
 4104    -1  * @param {Number} ms
 4105    -1  * @return {String}
 4106    -1  * @api private
 4107    -1  */
 4108    -1 
 4109    -1 function fmtShort(ms) {
 4110    -1   if (ms >= d) {
 4111    -1     return Math.round(ms / d) + 'd'
 4112    -1   }
 4113    -1   if (ms >= h) {
 4114    -1     return Math.round(ms / h) + 'h'
 4115    -1   }
 4116    -1   if (ms >= m) {
 4117    -1     return Math.round(ms / m) + 'm'
 4118    -1   }
 4119    -1   if (ms >= s) {
 4120    -1     return Math.round(ms / s) + 's'
 4121    -1   }
 4122    -1   return ms + 'ms'
 4123    -1 }
 4124    -1 
 4125    -1 /**
 4126    -1  * Long format for `ms`.
 4127    -1  *
 4128    -1  * @param {Number} ms
 4129    -1  * @return {String}
 4130    -1  * @api private
 4131    -1  */
 4132    -1 
 4133    -1 function fmtLong(ms) {
 4134    -1   return plural(ms, d, 'day') ||
 4135    -1     plural(ms, h, 'hour') ||
 4136    -1     plural(ms, m, 'minute') ||
 4137    -1     plural(ms, s, 'second') ||
 4138    -1     ms + ' ms'
 4139    -1 }
 4140    -1 
 4141    -1 /**
 4142    -1  * Pluralization helper.
 4143    -1  */
 4144    -1 
 4145    -1 function plural(ms, n, name) {
 4146    -1   if (ms < n) {
 4147    -1     return
 4148    -1   }
 4149    -1   if (ms < n * 1.5) {
 4150    -1     return Math.floor(ms / n) + ' ' + name
 4151    -1   }
 4152    -1   return Math.ceil(ms / n) + ' ' + name + 's'
 4153    -1 }
 4154    -1 
 4155    -1 },{}],26:[function(require,module,exports){
 4156    -1 (function (global){
 4157    -1 /**
 4158    -1  * Module dependencies.
 4159    -1  */
 4160    -1 
 4161    -1 var keys = require('./keys');
 4162    -1 var hasBinary = require('has-binary');
 4163    -1 var sliceBuffer = require('arraybuffer.slice');
 4164    -1 var after = require('after');
 4165    -1 var utf8 = require('wtf-8');
 4166    -1 
 4167    -1 var base64encoder;
 4168    -1 if (global && global.ArrayBuffer) {
 4169    -1   base64encoder = require('base64-arraybuffer');
 4170    -1 }
 4171    -1 
 4172    -1 /**
 4173    -1  * Check if we are running an android browser. That requires us to use
 4174    -1  * ArrayBuffer with polling transports...
 4175    -1  *
 4176    -1  * http://ghinda.net/jpeg-blob-ajax-android/
 4177    -1  */
 4178    -1 
 4179    -1 var isAndroid = typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent);
 4180    -1 
 4181    -1 /**
 4182    -1  * Check if we are running in PhantomJS.
 4183    -1  * Uploading a Blob with PhantomJS does not work correctly, as reported here:
 4184    -1  * https://github.com/ariya/phantomjs/issues/11395
 4185    -1  * @type boolean
 4186    -1  */
 4187    -1 var isPhantomJS = typeof navigator !== 'undefined' && /PhantomJS/i.test(navigator.userAgent);
 4188    -1 
 4189    -1 /**
 4190    -1  * When true, avoids using Blobs to encode payloads.
 4191    -1  * @type boolean
 4192    -1  */
 4193    -1 var dontSendBlobs = isAndroid || isPhantomJS;
 4194    -1 
 4195    -1 /**
 4196    -1  * Current protocol version.
 4197    -1  */
 4198    -1 
 4199    -1 exports.protocol = 3;
 4200    -1 
 4201    -1 /**
 4202    -1  * Packet types.
 4203    -1  */
 4204    -1 
 4205    -1 var packets = exports.packets = {
 4206    -1     open:     0    // non-ws
 4207    -1   , close:    1    // non-ws
 4208    -1   , ping:     2
 4209    -1   , pong:     3
 4210    -1   , message:  4
 4211    -1   , upgrade:  5
 4212    -1   , noop:     6
 4213    -1 };
 4214    -1 
 4215    -1 var packetslist = keys(packets);
 4216    -1 
 4217    -1 /**
 4218    -1  * Premade error packet.
 4219    -1  */
 4220    -1 
 4221    -1 var err = { type: 'error', data: 'parser error' };
 4222    -1 
 4223    -1 /**
 4224    -1  * Create a blob api even for blob builder when vendor prefixes exist
 4225    -1  */
 4226    -1 
 4227    -1 var Blob = require('blob');
 4228    -1 
 4229    -1 /**
 4230    -1  * Encodes a packet.
 4231    -1  *
 4232    -1  *     <packet type id> [ <data> ]
 4233    -1  *
 4234    -1  * Example:
 4235    -1  *
 4236    -1  *     5hello world
 4237    -1  *     3
 4238    -1  *     4
 4239    -1  *
 4240    -1  * Binary is encoded in an identical principle
 4241    -1  *
 4242    -1  * @api private
 4243    -1  */
 4244    -1 
 4245    -1 exports.encodePacket = function (packet, supportsBinary, utf8encode, callback) {
 4246    -1   if ('function' == typeof supportsBinary) {
 4247    -1     callback = supportsBinary;
 4248    -1     supportsBinary = false;
 4249    -1   }
 4250    -1 
 4251    -1   if ('function' == typeof utf8encode) {
 4252    -1     callback = utf8encode;
 4253    -1     utf8encode = null;
 4254    -1   }
 4255    -1 
 4256    -1   var data = (packet.data === undefined)
 4257    -1     ? undefined
 4258    -1     : packet.data.buffer || packet.data;
 4259    -1 
 4260    -1   if (global.ArrayBuffer && data instanceof ArrayBuffer) {
 4261    -1     return encodeArrayBuffer(packet, supportsBinary, callback);
 4262    -1   } else if (Blob && data instanceof global.Blob) {
 4263    -1     return encodeBlob(packet, supportsBinary, callback);
 4264    -1   }
 4265    -1 
 4266    -1   // might be an object with { base64: true, data: dataAsBase64String }
 4267    -1   if (data && data.base64) {
 4268    -1     return encodeBase64Object(packet, callback);
 4269    -1   }
 4270    -1 
 4271    -1   // Sending data as a utf-8 string
 4272    -1   var encoded = packets[packet.type];
 4273    -1 
 4274    -1   // data fragment is optional
 4275    -1   if (undefined !== packet.data) {
 4276    -1     encoded += utf8encode ? utf8.encode(String(packet.data)) : String(packet.data);
 4277    -1   }
 4278    -1 
 4279    -1   return callback('' + encoded);
 4280    -1 
 4281    -1 };
 4282    -1 
 4283    -1 function encodeBase64Object(packet, callback) {
 4284    -1   // packet data is an object { base64: true, data: dataAsBase64String }
 4285    -1   var message = 'b' + exports.packets[packet.type] + packet.data.data;
 4286    -1   return callback(message);
 4287    -1 }
 4288    -1 
 4289    -1 /**
 4290    -1  * Encode packet helpers for binary types
 4291    -1  */
 4292    -1 
 4293    -1 function encodeArrayBuffer(packet, supportsBinary, callback) {
 4294    -1   if (!supportsBinary) {
 4295    -1     return exports.encodeBase64Packet(packet, callback);
 4296    -1   }
 4297    -1 
 4298    -1   var data = packet.data;
 4299    -1   var contentArray = new Uint8Array(data);
 4300    -1   var resultBuffer = new Uint8Array(1 + data.byteLength);
 4301    -1 
 4302    -1   resultBuffer[0] = packets[packet.type];
 4303    -1   for (var i = 0; i < contentArray.length; i++) {
 4304    -1     resultBuffer[i+1] = contentArray[i];
 4305    -1   }
 4306    -1 
 4307    -1   return callback(resultBuffer.buffer);
 4308    -1 }
 4309    -1 
 4310    -1 function encodeBlobAsArrayBuffer(packet, supportsBinary, callback) {
 4311    -1   if (!supportsBinary) {
 4312    -1     return exports.encodeBase64Packet(packet, callback);
 4313    -1   }
 4314    -1 
 4315    -1   var fr = new FileReader();
 4316    -1   fr.onload = function() {
 4317    -1     packet.data = fr.result;
 4318    -1     exports.encodePacket(packet, supportsBinary, true, callback);
 4319    -1   };
 4320    -1   return fr.readAsArrayBuffer(packet.data);
 4321    -1 }
 4322    -1 
 4323    -1 function encodeBlob(packet, supportsBinary, callback) {
 4324    -1   if (!supportsBinary) {
 4325    -1     return exports.encodeBase64Packet(packet, callback);
 4326    -1   }
 4327    -1 
 4328    -1   if (dontSendBlobs) {
 4329    -1     return encodeBlobAsArrayBuffer(packet, supportsBinary, callback);
 4330    -1   }
 4331    -1 
 4332    -1   var length = new Uint8Array(1);
 4333    -1   length[0] = packets[packet.type];
 4334    -1   var blob = new Blob([length.buffer, packet.data]);
 4335    -1 
 4336    -1   return callback(blob);
 4337    -1 }
 4338    -1 
 4339    -1 /**
 4340    -1  * Encodes a packet with binary data in a base64 string
 4341    -1  *
 4342    -1  * @param {Object} packet, has `type` and `data`
 4343    -1  * @return {String} base64 encoded message
 4344    -1  */
 4345    -1 
 4346    -1 exports.encodeBase64Packet = function(packet, callback) {
 4347    -1   var message = 'b' + exports.packets[packet.type];
 4348    -1   if (Blob && packet.data instanceof global.Blob) {
 4349    -1     var fr = new FileReader();
 4350    -1     fr.onload = function() {
 4351    -1       var b64 = fr.result.split(',')[1];
 4352    -1       callback(message + b64);
 4353    -1     };
 4354    -1     return fr.readAsDataURL(packet.data);
 4355    -1   }
 4356    -1 
 4357    -1   var b64data;
 4358    -1   try {
 4359    -1     b64data = String.fromCharCode.apply(null, new Uint8Array(packet.data));
 4360    -1   } catch (e) {
 4361    -1     // iPhone Safari doesn't let you apply with typed arrays
 4362    -1     var typed = new Uint8Array(packet.data);
 4363    -1     var basic = new Array(typed.length);
 4364    -1     for (var i = 0; i < typed.length; i++) {
 4365    -1       basic[i] = typed[i];
 4366    -1     }
 4367    -1     b64data = String.fromCharCode.apply(null, basic);
 4368    -1   }
 4369    -1   message += global.btoa(b64data);
 4370    -1   return callback(message);
 4371    -1 };
 4372    -1 
 4373    -1 /**
 4374    -1  * Decodes a packet. Changes format to Blob if requested.
 4375    -1  *
 4376    -1  * @return {Object} with `type` and `data` (if any)
 4377    -1  * @api private
 4378    -1  */
 4379    -1 
 4380    -1 exports.decodePacket = function (data, binaryType, utf8decode) {
 4381    -1   if (data === undefined) {
 4382    -1     return err;
 4383    -1   }
 4384    -1   // String data
 4385    -1   if (typeof data == 'string') {
 4386    -1     if (data.charAt(0) == 'b') {
 4387    -1       return exports.decodeBase64Packet(data.substr(1), binaryType);
 4388    -1     }
 4389    -1 
 4390    -1     if (utf8decode) {
 4391    -1       data = tryDecode(data);
 4392    -1       if (data === false) {
 4393    -1         return err;
 4394    -1       }
 4395    -1     }
 4396    -1     var type = data.charAt(0);
 4397    -1 
 4398    -1     if (Number(type) != type || !packetslist[type]) {
 4399    -1       return err;
 4400    -1     }
 4401    -1 
 4402    -1     if (data.length > 1) {
 4403    -1       return { type: packetslist[type], data: data.substring(1) };
 4404    -1     } else {
 4405    -1       return { type: packetslist[type] };
 4406    -1     }
 4407    -1   }
 4408    -1 
 4409    -1   var asArray = new Uint8Array(data);
 4410    -1   var type = asArray[0];
 4411    -1   var rest = sliceBuffer(data, 1);
 4412    -1   if (Blob && binaryType === 'blob') {
 4413    -1     rest = new Blob([rest]);
 4414    -1   }
 4415    -1   return { type: packetslist[type], data: rest };
 4416    -1 };
 4417    -1 
 4418    -1 function tryDecode(data) {
 4419    -1   try {
 4420    -1     data = utf8.decode(data);
 4421    -1   } catch (e) {
 4422    -1     return false;
 4423    -1   }
 4424    -1   return data;
 4425    -1 }
 4426    -1 
 4427    -1 /**
 4428    -1  * Decodes a packet encoded in a base64 string
 4429    -1  *
 4430    -1  * @param {String} base64 encoded message
 4431    -1  * @return {Object} with `type` and `data` (if any)
 4432    -1  */
 4433    -1 
 4434    -1 exports.decodeBase64Packet = function(msg, binaryType) {
 4435    -1   var type = packetslist[msg.charAt(0)];
 4436    -1   if (!base64encoder) {
 4437    -1     return { type: type, data: { base64: true, data: msg.substr(1) } };
 4438    -1   }
 4439    -1 
 4440    -1   var data = base64encoder.decode(msg.substr(1));
 4441    -1 
 4442    -1   if (binaryType === 'blob' && Blob) {
 4443    -1     data = new Blob([data]);
 4444    -1   }
 4445    -1 
 4446    -1   return { type: type, data: data };
 4447    -1 };
 4448    -1 
 4449    -1 /**
 4450    -1  * Encodes multiple messages (payload).
 4451    -1  *
 4452    -1  *     <length>:data
 4453    -1  *
 4454    -1  * Example:
 4455    -1  *
 4456    -1  *     11:hello world2:hi
 4457    -1  *
 4458    -1  * If any contents are binary, they will be encoded as base64 strings. Base64
 4459    -1  * encoded strings are marked with a b before the length specifier
 4460    -1  *
 4461    -1  * @param {Array} packets
 4462    -1  * @api private
 4463    -1  */
 4464    -1 
 4465    -1 exports.encodePayload = function (packets, supportsBinary, callback) {
 4466    -1   if (typeof supportsBinary == 'function') {
 4467    -1     callback = supportsBinary;
 4468    -1     supportsBinary = null;
 4469    -1   }
 4470    -1 
 4471    -1   var isBinary = hasBinary(packets);
 4472    -1 
 4473    -1   if (supportsBinary && isBinary) {
 4474    -1     if (Blob && !dontSendBlobs) {
 4475    -1       return exports.encodePayloadAsBlob(packets, callback);
 4476    -1     }
 4477    -1 
 4478    -1     return exports.encodePayloadAsArrayBuffer(packets, callback);
 4479    -1   }
 4480    -1 
 4481    -1   if (!packets.length) {
 4482    -1     return callback('0:');
 4483    -1   }
 4484    -1 
 4485    -1   function setLengthHeader(message) {
 4486    -1     return message.length + ':' + message;
 4487    -1   }
 4488    -1 
 4489    -1   function encodeOne(packet, doneCallback) {
 4490    -1     exports.encodePacket(packet, !isBinary ? false : supportsBinary, true, function(message) {
 4491    -1       doneCallback(null, setLengthHeader(message));
 4492    -1     });
 4493    -1   }
 4494    -1 
 4495    -1   map(packets, encodeOne, function(err, results) {
 4496    -1     return callback(results.join(''));
 4497    -1   });
 4498    -1 };
 4499    -1 
 4500    -1 /**
 4501    -1  * Async array map using after
 4502    -1  */
 4503    -1 
 4504    -1 function map(ary, each, done) {
 4505    -1   var result = new Array(ary.length);
 4506    -1   var next = after(ary.length, done);
 4507    -1 
 4508    -1   var eachWithIndex = function(i, el, cb) {
 4509    -1     each(el, function(error, msg) {
 4510    -1       result[i] = msg;
 4511    -1       cb(error, result);
 4512    -1     });
 4513    -1   };
 4514    -1 
 4515    -1   for (var i = 0; i < ary.length; i++) {
 4516    -1     eachWithIndex(i, ary[i], next);
 4517    -1   }
 4518    -1 }
 4519    -1 
 4520    -1 /*
 4521    -1  * Decodes data when a payload is maybe expected. Possible binary contents are
 4522    -1  * decoded from their base64 representation
 4523    -1  *
 4524    -1  * @param {String} data, callback method
 4525    -1  * @api public
 4526    -1  */
 4527    -1 
 4528    -1 exports.decodePayload = function (data, binaryType, callback) {
 4529    -1   if (typeof data != 'string') {
 4530    -1     return exports.decodePayloadAsBinary(data, binaryType, callback);
 4531    -1   }
 4532    -1 
 4533    -1   if (typeof binaryType === 'function') {
 4534    -1     callback = binaryType;
 4535    -1     binaryType = null;
 4536    -1   }
 4537    -1 
 4538    -1   var packet;
 4539    -1   if (data == '') {
 4540    -1     // parser error - ignoring payload
 4541    -1     return callback(err, 0, 1);
 4542    -1   }
 4543    -1 
 4544    -1   var length = ''
 4545    -1     , n, msg;
 4546    -1 
 4547    -1   for (var i = 0, l = data.length; i < l; i++) {
 4548    -1     var chr = data.charAt(i);
 4549    -1 
 4550    -1     if (':' != chr) {
 4551    -1       length += chr;
 4552    -1     } else {
 4553    -1       if ('' == length || (length != (n = Number(length)))) {
 4554    -1         // parser error - ignoring payload
 4555    -1         return callback(err, 0, 1);
 4556    -1       }
 4557    -1 
 4558    -1       msg = data.substr(i + 1, n);
 4559    -1 
 4560    -1       if (length != msg.length) {
 4561    -1         // parser error - ignoring payload
 4562    -1         return callback(err, 0, 1);
 4563    -1       }
 4564    -1 
 4565    -1       if (msg.length) {
 4566    -1         packet = exports.decodePacket(msg, binaryType, true);
 4567    -1 
 4568    -1         if (err.type == packet.type && err.data == packet.data) {
 4569    -1           // parser error in individual packet - ignoring payload
 4570    -1           return callback(err, 0, 1);
 4571    -1         }
 4572    -1 
 4573    -1         var ret = callback(packet, i + n, l);
 4574    -1         if (false === ret) return;
 4575    -1       }
 4576    -1 
 4577    -1       // advance cursor
 4578    -1       i += n;
 4579    -1       length = '';
 4580    -1     }
 4581    -1   }
 4582    -1 
 4583    -1   if (length != '') {
 4584    -1     // parser error - ignoring payload
 4585    -1     return callback(err, 0, 1);
 4586    -1   }
 4587    -1 
 4588    -1 };
 4589    -1 
 4590    -1 /**
 4591    -1  * Encodes multiple messages (payload) as binary.
 4592    -1  *
 4593    -1  * <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number
 4594    -1  * 255><data>
 4595    -1  *
 4596    -1  * Example:
 4597    -1  * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers
 4598    -1  *
 4599    -1  * @param {Array} packets
 4600    -1  * @return {ArrayBuffer} encoded payload
 4601    -1  * @api private
 4602    -1  */
 4603    -1 
 4604    -1 exports.encodePayloadAsArrayBuffer = function(packets, callback) {
 4605    -1   if (!packets.length) {
 4606    -1     return callback(new ArrayBuffer(0));
 4607    -1   }
 4608    -1 
 4609    -1   function encodeOne(packet, doneCallback) {
 4610    -1     exports.encodePacket(packet, true, true, function(data) {
 4611    -1       return doneCallback(null, data);
 4612    -1     });
 4613    -1   }
 4614    -1 
 4615    -1   map(packets, encodeOne, function(err, encodedPackets) {
 4616    -1     var totalLength = encodedPackets.reduce(function(acc, p) {
 4617    -1       var len;
 4618    -1       if (typeof p === 'string'){
 4619    -1         len = p.length;
 4620    -1       } else {
 4621    -1         len = p.byteLength;
 4622    -1       }
 4623    -1       return acc + len.toString().length + len + 2; // string/binary identifier + separator = 2
 4624    -1     }, 0);
 4625    -1 
 4626    -1     var resultArray = new Uint8Array(totalLength);
 4627    -1 
 4628    -1     var bufferIndex = 0;
 4629    -1     encodedPackets.forEach(function(p) {
 4630    -1       var isString = typeof p === 'string';
 4631    -1       var ab = p;
 4632    -1       if (isString) {
 4633    -1         var view = new Uint8Array(p.length);
 4634    -1         for (var i = 0; i < p.length; i++) {
 4635    -1           view[i] = p.charCodeAt(i);
 4636    -1         }
 4637    -1         ab = view.buffer;
 4638    -1       }
 4639    -1 
 4640    -1       if (isString) { // not true binary
 4641    -1         resultArray[bufferIndex++] = 0;
 4642    -1       } else { // true binary
 4643    -1         resultArray[bufferIndex++] = 1;
 4644    -1       }
 4645    -1 
 4646    -1       var lenStr = ab.byteLength.toString();
 4647    -1       for (var i = 0; i < lenStr.length; i++) {
 4648    -1         resultArray[bufferIndex++] = parseInt(lenStr[i]);
 4649    -1       }
 4650    -1       resultArray[bufferIndex++] = 255;
 4651    -1 
 4652    -1       var view = new Uint8Array(ab);
 4653    -1       for (var i = 0; i < view.length; i++) {
 4654    -1         resultArray[bufferIndex++] = view[i];
 4655    -1       }
 4656    -1     });
 4657    -1 
 4658    -1     return callback(resultArray.buffer);
 4659    -1   });
 4660    -1 };
 4661    -1 
 4662    -1 /**
 4663    -1  * Encode as Blob
 4664    -1  */
 4665    -1 
 4666    -1 exports.encodePayloadAsBlob = function(packets, callback) {
 4667    -1   function encodeOne(packet, doneCallback) {
 4668    -1     exports.encodePacket(packet, true, true, function(encoded) {
 4669    -1       var binaryIdentifier = new Uint8Array(1);
 4670    -1       binaryIdentifier[0] = 1;
 4671    -1       if (typeof encoded === 'string') {
 4672    -1         var view = new Uint8Array(encoded.length);
 4673    -1         for (var i = 0; i < encoded.length; i++) {
 4674    -1           view[i] = encoded.charCodeAt(i);
 4675    -1         }
 4676    -1         encoded = view.buffer;
 4677    -1         binaryIdentifier[0] = 0;
 4678    -1       }
 4679    -1 
 4680    -1       var len = (encoded instanceof ArrayBuffer)
 4681    -1         ? encoded.byteLength
 4682    -1         : encoded.size;
 4683    -1 
 4684    -1       var lenStr = len.toString();
 4685    -1       var lengthAry = new Uint8Array(lenStr.length + 1);
 4686    -1       for (var i = 0; i < lenStr.length; i++) {
 4687    -1         lengthAry[i] = parseInt(lenStr[i]);
 4688    -1       }
 4689    -1       lengthAry[lenStr.length] = 255;
 4690    -1 
 4691    -1       if (Blob) {
 4692    -1         var blob = new Blob([binaryIdentifier.buffer, lengthAry.buffer, encoded]);
 4693    -1         doneCallback(null, blob);
 4694    -1       }
 4695    -1     });
 4696    -1   }
 4697    -1 
 4698    -1   map(packets, encodeOne, function(err, results) {
 4699    -1     return callback(new Blob(results));
 4700    -1   });
 4701    -1 };
 4702    -1 
 4703    -1 /*
 4704    -1  * Decodes data when a payload is maybe expected. Strings are decoded by
 4705    -1  * interpreting each byte as a key code for entries marked to start with 0. See
 4706    -1  * description of encodePayloadAsBinary
 4707    -1  *
 4708    -1  * @param {ArrayBuffer} data, callback method
 4709    -1  * @api public
 4710    -1  */
 4711    -1 
 4712    -1 exports.decodePayloadAsBinary = function (data, binaryType, callback) {
 4713    -1   if (typeof binaryType === 'function') {
 4714    -1     callback = binaryType;
 4715    -1     binaryType = null;
 4716    -1   }
 4717    -1 
 4718    -1   var bufferTail = data;
 4719    -1   var buffers = [];
 4720    -1 
 4721    -1   var numberTooLong = false;
 4722    -1   while (bufferTail.byteLength > 0) {
 4723    -1     var tailArray = new Uint8Array(bufferTail);
 4724    -1     var isString = tailArray[0] === 0;
 4725    -1     var msgLength = '';
 4726    -1 
 4727    -1     for (var i = 1; ; i++) {
 4728    -1       if (tailArray[i] == 255) break;
 4729    -1 
 4730    -1       if (msgLength.length > 310) {
 4731    -1         numberTooLong = true;
 4732    -1         break;
 4733    -1       }
 4734    -1 
 4735    -1       msgLength += tailArray[i];
 4736    -1     }
 4737    -1 
 4738    -1     if(numberTooLong) return callback(err, 0, 1);
 4739    -1 
 4740    -1     bufferTail = sliceBuffer(bufferTail, 2 + msgLength.length);
 4741    -1     msgLength = parseInt(msgLength);
 4742    -1 
 4743    -1     var msg = sliceBuffer(bufferTail, 0, msgLength);
 4744    -1     if (isString) {
 4745    -1       try {
 4746    -1         msg = String.fromCharCode.apply(null, new Uint8Array(msg));
 4747    -1       } catch (e) {
 4748    -1         // iPhone Safari doesn't let you apply to typed arrays
 4749    -1         var typed = new Uint8Array(msg);
 4750    -1         msg = '';
 4751    -1         for (var i = 0; i < typed.length; i++) {
 4752    -1           msg += String.fromCharCode(typed[i]);
 4753    -1         }
 4754    -1       }
 4755    -1     }
 4756    -1 
 4757    -1     buffers.push(msg);
 4758    -1     bufferTail = sliceBuffer(bufferTail, msgLength);
 4759    -1   }
 4760    -1 
 4761    -1   var total = buffers.length;
 4762    -1   buffers.forEach(function(buffer, i) {
 4763    -1     callback(exports.decodePacket(buffer, binaryType, true), i, total);
 4764    -1   });
 4765    -1 };
 4766    -1 
 4767    -1 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 4768    -1 },{"./keys":27,"after":4,"arraybuffer.slice":5,"base64-arraybuffer":7,"blob":8,"has-binary":29,"wtf-8":119}],27:[function(require,module,exports){
 4769    -1 
 4770    -1 /**
 4771    -1  * Gets the keys for an object.
 4772    -1  *
 4773    -1  * @return {Array} keys
 4774    -1  * @api private
 4775    -1  */
 4776    -1 
 4777    -1 module.exports = Object.keys || function keys (obj){
 4778    -1   var arr = [];
 4779    -1   var has = Object.prototype.hasOwnProperty;
 4780    -1 
 4781    -1   for (var i in obj) {
 4782    -1     if (has.call(obj, i)) {
 4783    -1       arr.push(i);
 4784    -1     }
 4785    -1   }
 4786    -1   return arr;
 4787    -1 };
 4788    -1 
 4789    -1 },{}],28:[function(require,module,exports){
 4790    -1 module.exports={"Aacute":"\u00C1","aacute":"\u00E1","Abreve":"\u0102","abreve":"\u0103","ac":"\u223E","acd":"\u223F","acE":"\u223E\u0333","Acirc":"\u00C2","acirc":"\u00E2","acute":"\u00B4","Acy":"\u0410","acy":"\u0430","AElig":"\u00C6","aelig":"\u00E6","af":"\u2061","Afr":"\uD835\uDD04","afr":"\uD835\uDD1E","Agrave":"\u00C0","agrave":"\u00E0","alefsym":"\u2135","aleph":"\u2135","Alpha":"\u0391","alpha":"\u03B1","Amacr":"\u0100","amacr":"\u0101","amalg":"\u2A3F","amp":"&","AMP":"&","andand":"\u2A55","And":"\u2A53","and":"\u2227","andd":"\u2A5C","andslope":"\u2A58","andv":"\u2A5A","ang":"\u2220","ange":"\u29A4","angle":"\u2220","angmsdaa":"\u29A8","angmsdab":"\u29A9","angmsdac":"\u29AA","angmsdad":"\u29AB","angmsdae":"\u29AC","angmsdaf":"\u29AD","angmsdag":"\u29AE","angmsdah":"\u29AF","angmsd":"\u2221","angrt":"\u221F","angrtvb":"\u22BE","angrtvbd":"\u299D","angsph":"\u2222","angst":"\u00C5","angzarr":"\u237C","Aogon":"\u0104","aogon":"\u0105","Aopf":"\uD835\uDD38","aopf":"\uD835\uDD52","apacir":"\u2A6F","ap":"\u2248","apE":"\u2A70","ape":"\u224A","apid":"\u224B","apos":"'","ApplyFunction":"\u2061","approx":"\u2248","approxeq":"\u224A","Aring":"\u00C5","aring":"\u00E5","Ascr":"\uD835\uDC9C","ascr":"\uD835\uDCB6","Assign":"\u2254","ast":"*","asymp":"\u2248","asympeq":"\u224D","Atilde":"\u00C3","atilde":"\u00E3","Auml":"\u00C4","auml":"\u00E4","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":"\u0411","bcy":"\u0431","bdquo":"\u201E","becaus":"\u2235","because":"\u2235","Because":"\u2235","bemptyv":"\u29B0","bepsi":"\u03F6","bernou":"\u212C","Bernoullis":"\u212C","Beta":"\u0392","beta":"\u03B2","beth":"\u2136","between":"\u226C","Bfr":"\uD835\uDD05","bfr":"\uD835\uDD1F","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":"\u2AED","bnot":"\u2310","Bopf":"\uD835\uDD39","bopf":"\uD835\uDD53","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":"\u2564","boxhD":"\u2565","boxHD":"\u2566","boxhu":"\u2534","boxHu":"\u2567","boxhU":"\u2568","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":"\u00A6","bscr":"\uD835\uDCB7","Bscr":"\u212C","bsemi":"\u204F","bsim":"\u223D","bsime":"\u22CD","bsolb":"\u29C5","bsol":"\\","bsolhsub":"\u27C8","bull":"\u2022","bullet":"\u2022","bump":"\u224E","bumpE":"\u2AAE","bumpe":"\u224F","Bumpeq":"\u224E","bumpeq":"\u224F","Cacute":"\u0106","cacute":"\u0107","capand":"\u2A44","capbrcup":"\u2A49","capcap":"\u2A4B","cap":"\u2229","Cap":"\u22D2","capcup":"\u2A47","capdot":"\u2A40","CapitalDifferentialD":"\u2145","caps":"\u2229\uFE00","caret":"\u2041","caron":"\u02C7","Cayleys":"\u212D","ccaps":"\u2A4D","Ccaron":"\u010C","ccaron":"\u010D","Ccedil":"\u00C7","ccedil":"\u00E7","Ccirc":"\u0108","ccirc":"\u0109","Cconint":"\u2230","ccups":"\u2A4C","ccupssm":"\u2A50","Cdot":"\u010A","cdot":"\u010B","cedil":"\u00B8","Cedilla":"\u00B8","cemptyv":"\u29B2","cent":"\u00A2","centerdot":"\u00B7","CenterDot":"\u00B7","cfr":"\uD835\uDD20","Cfr":"\u212D","CHcy":"\u0427","chcy":"\u0447","check":"\u2713","checkmark":"\u2713","Chi":"\u03A7","chi":"\u03C7","circ":"\u02C6","circeq":"\u2257","circlearrowleft":"\u21BA","circlearrowright":"\u21BB","circledast":"\u229B","circledcirc":"\u229A","circleddash":"\u229D","CircleDot":"\u2299","circledR":"\u00AE","circledS":"\u24C8","CircleMinus":"\u2296","CirclePlus":"\u2295","CircleTimes":"\u2297","cir":"\u25CB","cirE":"\u29C3","cire":"\u2257","cirfnint":"\u2A10","cirmid":"\u2AEF","cirscir":"\u29C2","ClockwiseContourIntegral":"\u2232","CloseCurlyDoubleQuote":"\u201D","CloseCurlyQuote":"\u2019","clubs":"\u2663","clubsuit":"\u2663","colon":":","Colon":"\u2237","Colone":"\u2A74","colone":"\u2254","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":"\u00A9","COPY":"\u00A9","copysr":"\u2117","CounterClockwiseContourIntegral":"\u2233","crarr":"\u21B5","cross":"\u2717","Cross":"\u2A2F","Cscr":"\uD835\uDC9E","cscr":"\uD835\uDCB8","csub":"\u2ACF","csube":"\u2AD1","csup":"\u2AD0","csupe":"\u2AD2","ctdot":"\u22EF","cudarrl":"\u2938","cudarrr":"\u2935","cuepr":"\u22DE","cuesc":"\u22DF","cularr":"\u21B6","cularrp":"\u293D","cupbrcap":"\u2A48","cupcap":"\u2A46","CupCap":"\u224D","cup":"\u222A","Cup":"\u22D3","cupcup":"\u2A4A","cupdot":"\u228D","cupor":"\u2A45","cups":"\u222A\uFE00","curarr":"\u21B7","curarrm":"\u293C","curlyeqprec":"\u22DE","curlyeqsucc":"\u22DF","curlyvee":"\u22CE","curlywedge":"\u22CF","curren":"\u00A4","curvearrowleft":"\u21B6","curvearrowright":"\u21B7","cuvee":"\u22CE","cuwed":"\u22CF","cwconint":"\u2232","cwint":"\u2231","cylcty":"\u232D","dagger":"\u2020","Dagger":"\u2021","daleth":"\u2138","darr":"\u2193","Darr":"\u21A1","dArr":"\u21D3","dash":"\u2010","Dashv":"\u2AE4","dashv":"\u22A3","dbkarow":"\u290F","dblac":"\u02DD","Dcaron":"\u010E","dcaron":"\u010F","Dcy":"\u0414","dcy":"\u0434","ddagger":"\u2021","ddarr":"\u21CA","DD":"\u2145","dd":"\u2146","DDotrahd":"\u2911","ddotseq":"\u2A77","deg":"\u00B0","Del":"\u2207","Delta":"\u0394","delta":"\u03B4","demptyv":"\u29B1","dfisht":"\u297F","Dfr":"\uD835\uDD07","dfr":"\uD835\uDD21","dHar":"\u2965","dharl":"\u21C3","dharr":"\u21C2","DiacriticalAcute":"\u00B4","DiacriticalDot":"\u02D9","DiacriticalDoubleAcute":"\u02DD","DiacriticalGrave":"`","DiacriticalTilde":"\u02DC","diam":"\u22C4","diamond":"\u22C4","Diamond":"\u22C4","diamondsuit":"\u2666","diams":"\u2666","die":"\u00A8","DifferentialD":"\u2146","digamma":"\u03DD","disin":"\u22F2","div":"\u00F7","divide":"\u00F7","divideontimes":"\u22C7","divonx":"\u22C7","DJcy":"\u0402","djcy":"\u0452","dlcorn":"\u231E","dlcrop":"\u230D","dollar":"$","Dopf":"\uD835\uDD3B","dopf":"\uD835\uDD55","Dot":"\u00A8","dot":"\u02D9","DotDot":"\u20DC","doteq":"\u2250","doteqdot":"\u2251","DotEqual":"\u2250","dotminus":"\u2238","dotplus":"\u2214","dotsquare":"\u22A1","doublebarwedge":"\u2306","DoubleContourIntegral":"\u222F","DoubleDot":"\u00A8","DoubleDownArrow":"\u21D3","DoubleLeftArrow":"\u21D0","DoubleLeftRightArrow":"\u21D4","DoubleLeftTee":"\u2AE4","DoubleLongLeftArrow":"\u27F8","DoubleLongLeftRightArrow":"\u27FA","DoubleLongRightArrow":"\u27F9","DoubleRightArrow":"\u21D2","DoubleRightTee":"\u22A8","DoubleUpArrow":"\u21D1","DoubleUpDownArrow":"\u21D5","DoubleVerticalBar":"\u2225","DownArrowBar":"\u2913","downarrow":"\u2193","DownArrow":"\u2193","Downarrow":"\u21D3","DownArrowUpArrow":"\u21F5","DownBreve":"\u0311","downdownarrows":"\u21CA","downharpoonleft":"\u21C3","downharpoonright":"\u21C2","DownLeftRightVector":"\u2950","DownLeftTeeVector":"\u295E","DownLeftVectorBar":"\u2956","DownLeftVector":"\u21BD","DownRightTeeVector":"\u295F","DownRightVectorBar":"\u2957","DownRightVector":"\u21C1","DownTeeArrow":"\u21A7","DownTee":"\u22A4","drbkarow":"\u2910","drcorn":"\u231F","drcrop":"\u230C","Dscr":"\uD835\uDC9F","dscr":"\uD835\uDCB9","DScy":"\u0405","dscy":"\u0455","dsol":"\u29F6","Dstrok":"\u0110","dstrok":"\u0111","dtdot":"\u22F1","dtri":"\u25BF","dtrif":"\u25BE","duarr":"\u21F5","duhar":"\u296F","dwangle":"\u29A6","DZcy":"\u040F","dzcy":"\u045F","dzigrarr":"\u27FF","Eacute":"\u00C9","eacute":"\u00E9","easter":"\u2A6E","Ecaron":"\u011A","ecaron":"\u011B","Ecirc":"\u00CA","ecirc":"\u00EA","ecir":"\u2256","ecolon":"\u2255","Ecy":"\u042D","ecy":"\u044D","eDDot":"\u2A77","Edot":"\u0116","edot":"\u0117","eDot":"\u2251","ee":"\u2147","efDot":"\u2252","Efr":"\uD835\uDD08","efr":"\uD835\uDD22","eg":"\u2A9A","Egrave":"\u00C8","egrave":"\u00E8","egs":"\u2A96","egsdot":"\u2A98","el":"\u2A99","Element":"\u2208","elinters":"\u23E7","ell":"\u2113","els":"\u2A95","elsdot":"\u2A97","Emacr":"\u0112","emacr":"\u0113","empty":"\u2205","emptyset":"\u2205","EmptySmallSquare":"\u25FB","emptyv":"\u2205","EmptyVerySmallSquare":"\u25AB","emsp13":"\u2004","emsp14":"\u2005","emsp":"\u2003","ENG":"\u014A","eng":"\u014B","ensp":"\u2002","Eogon":"\u0118","eogon":"\u0119","Eopf":"\uD835\uDD3C","eopf":"\uD835\uDD56","epar":"\u22D5","eparsl":"\u29E3","eplus":"\u2A71","epsi":"\u03B5","Epsilon":"\u0395","epsilon":"\u03B5","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":"\u2A73","esim":"\u2242","Eta":"\u0397","eta":"\u03B7","ETH":"\u00D0","eth":"\u00F0","Euml":"\u00CB","euml":"\u00EB","euro":"\u20AC","excl":"!","exist":"\u2203","Exists":"\u2203","expectation":"\u2130","exponentiale":"\u2147","ExponentialE":"\u2147","fallingdotseq":"\u2252","Fcy":"\u0424","fcy":"\u0444","female":"\u2640","ffilig":"\uFB03","fflig":"\uFB00","ffllig":"\uFB04","Ffr":"\uD835\uDD09","ffr":"\uD835\uDD23","filig":"\uFB01","FilledSmallSquare":"\u25FC","FilledVerySmallSquare":"\u25AA","fjlig":"fj","flat":"\u266D","fllig":"\uFB02","fltns":"\u25B1","fnof":"\u0192","Fopf":"\uD835\uDD3D","fopf":"\uD835\uDD57","forall":"\u2200","ForAll":"\u2200","fork":"\u22D4","forkv":"\u2AD9","Fouriertrf":"\u2131","fpartint":"\u2A0D","frac12":"\u00BD","frac13":"\u2153","frac14":"\u00BC","frac15":"\u2155","frac16":"\u2159","frac18":"\u215B","frac23":"\u2154","frac25":"\u2156","frac34":"\u00BE","frac35":"\u2157","frac38":"\u215C","frac45":"\u2158","frac56":"\u215A","frac58":"\u215D","frac78":"\u215E","frasl":"\u2044","frown":"\u2322","fscr":"\uD835\uDCBB","Fscr":"\u2131","gacute":"\u01F5","Gamma":"\u0393","gamma":"\u03B3","Gammad":"\u03DC","gammad":"\u03DD","gap":"\u2A86","Gbreve":"\u011E","gbreve":"\u011F","Gcedil":"\u0122","Gcirc":"\u011C","gcirc":"\u011D","Gcy":"\u0413","gcy":"\u0433","Gdot":"\u0120","gdot":"\u0121","ge":"\u2265","gE":"\u2267","gEl":"\u2A8C","gel":"\u22DB","geq":"\u2265","geqq":"\u2267","geqslant":"\u2A7E","gescc":"\u2AA9","ges":"\u2A7E","gesdot":"\u2A80","gesdoto":"\u2A82","gesdotol":"\u2A84","gesl":"\u22DB\uFE00","gesles":"\u2A94","Gfr":"\uD835\uDD0A","gfr":"\uD835\uDD24","gg":"\u226B","Gg":"\u22D9","ggg":"\u22D9","gimel":"\u2137","GJcy":"\u0403","gjcy":"\u0453","gla":"\u2AA5","gl":"\u2277","glE":"\u2A92","glj":"\u2AA4","gnap":"\u2A8A","gnapprox":"\u2A8A","gne":"\u2A88","gnE":"\u2269","gneq":"\u2A88","gneqq":"\u2269","gnsim":"\u22E7","Gopf":"\uD835\uDD3E","gopf":"\uD835\uDD58","grave":"`","GreaterEqual":"\u2265","GreaterEqualLess":"\u22DB","GreaterFullEqual":"\u2267","GreaterGreater":"\u2AA2","GreaterLess":"\u2277","GreaterSlantEqual":"\u2A7E","GreaterTilde":"\u2273","Gscr":"\uD835\uDCA2","gscr":"\u210A","gsim":"\u2273","gsime":"\u2A8E","gsiml":"\u2A90","gtcc":"\u2AA7","gtcir":"\u2A7A","gt":">","GT":">","Gt":"\u226B","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":"\u00BD","hamilt":"\u210B","HARDcy":"\u042A","hardcy":"\u044A","harrcir":"\u2948","harr":"\u2194","hArr":"\u21D4","harrw":"\u21AD","Hat":"^","hbar":"\u210F","Hcirc":"\u0124","hcirc":"\u0125","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":"\u0126","hstrok":"\u0127","HumpDownHump":"\u224E","HumpEqual":"\u224F","hybull":"\u2043","hyphen":"\u2010","Iacute":"\u00CD","iacute":"\u00ED","ic":"\u2063","Icirc":"\u00CE","icirc":"\u00EE","Icy":"\u0418","icy":"\u0438","Idot":"\u0130","IEcy":"\u0415","iecy":"\u0435","iexcl":"\u00A1","iff":"\u21D4","ifr":"\uD835\uDD26","Ifr":"\u2111","Igrave":"\u00CC","igrave":"\u00EC","ii":"\u2148","iiiint":"\u2A0C","iiint":"\u222D","iinfin":"\u29DC","iiota":"\u2129","IJlig":"\u0132","ijlig":"\u0133","Imacr":"\u012A","imacr":"\u012B","image":"\u2111","ImaginaryI":"\u2148","imagline":"\u2110","imagpart":"\u2111","imath":"\u0131","Im":"\u2111","imof":"\u22B7","imped":"\u01B5","Implies":"\u21D2","incare":"\u2105","in":"\u2208","infin":"\u221E","infintie":"\u29DD","inodot":"\u0131","intcal":"\u22BA","int":"\u222B","Int":"\u222C","integers":"\u2124","Integral":"\u222B","intercal":"\u22BA","Intersection":"\u22C2","intlarhk":"\u2A17","intprod":"\u2A3C","InvisibleComma":"\u2063","InvisibleTimes":"\u2062","IOcy":"\u0401","iocy":"\u0451","Iogon":"\u012E","iogon":"\u012F","Iopf":"\uD835\uDD40","iopf":"\uD835\uDD5A","Iota":"\u0399","iota":"\u03B9","iprod":"\u2A3C","iquest":"\u00BF","iscr":"\uD835\uDCBE","Iscr":"\u2110","isin":"\u2208","isindot":"\u22F5","isinE":"\u22F9","isins":"\u22F4","isinsv":"\u22F3","isinv":"\u2208","it":"\u2062","Itilde":"\u0128","itilde":"\u0129","Iukcy":"\u0406","iukcy":"\u0456","Iuml":"\u00CF","iuml":"\u00EF","Jcirc":"\u0134","jcirc":"\u0135","Jcy":"\u0419","jcy":"\u0439","Jfr":"\uD835\uDD0D","jfr":"\uD835\uDD27","jmath":"\u0237","Jopf":"\uD835\uDD41","jopf":"\uD835\uDD5B","Jscr":"\uD835\uDCA5","jscr":"\uD835\uDCBF","Jsercy":"\u0408","jsercy":"\u0458","Jukcy":"\u0404","jukcy":"\u0454","Kappa":"\u039A","kappa":"\u03BA","kappav":"\u03F0","Kcedil":"\u0136","kcedil":"\u0137","Kcy":"\u041A","kcy":"\u043A","Kfr":"\uD835\uDD0E","kfr":"\uD835\uDD28","kgreen":"\u0138","KHcy":"\u0425","khcy":"\u0445","KJcy":"\u040C","kjcy":"\u045C","Kopf":"\uD835\uDD42","kopf":"\uD835\uDD5C","Kscr":"\uD835\uDCA6","kscr":"\uD835\uDCC0","lAarr":"\u21DA","Lacute":"\u0139","lacute":"\u013A","laemptyv":"\u29B4","lagran":"\u2112","Lambda":"\u039B","lambda":"\u03BB","lang":"\u27E8","Lang":"\u27EA","langd":"\u2991","langle":"\u27E8","lap":"\u2A85","Laplacetrf":"\u2112","laquo":"\u00AB","larrb":"\u21E4","larrbfs":"\u291F","larr":"\u2190","Larr":"\u219E","lArr":"\u21D0","larrfs":"\u291D","larrhk":"\u21A9","larrlp":"\u21AB","larrpl":"\u2939","larrsim":"\u2973","larrtl":"\u21A2","latail":"\u2919","lAtail":"\u291B","lat":"\u2AAB","late":"\u2AAD","lates":"\u2AAD\uFE00","lbarr":"\u290C","lBarr":"\u290E","lbbrk":"\u2772","lbrace":"{","lbrack":"[","lbrke":"\u298B","lbrksld":"\u298F","lbrkslu":"\u298D","Lcaron":"\u013D","lcaron":"\u013E","Lcedil":"\u013B","lcedil":"\u013C","lceil":"\u2308","lcub":"{","Lcy":"\u041B","lcy":"\u043B","ldca":"\u2936","ldquo":"\u201C","ldquor":"\u201E","ldrdhar":"\u2967","ldrushar":"\u294B","ldsh":"\u21B2","le":"\u2264","lE":"\u2266","LeftAngleBracket":"\u27E8","LeftArrowBar":"\u21E4","leftarrow":"\u2190","LeftArrow":"\u2190","Leftarrow":"\u21D0","LeftArrowRightArrow":"\u21C6","leftarrowtail":"\u21A2","LeftCeiling":"\u2308","LeftDoubleBracket":"\u27E6","LeftDownTeeVector":"\u2961","LeftDownVectorBar":"\u2959","LeftDownVector":"\u21C3","LeftFloor":"\u230A","leftharpoondown":"\u21BD","leftharpoonup":"\u21BC","leftleftarrows":"\u21C7","leftrightarrow":"\u2194","LeftRightArrow":"\u2194","Leftrightarrow":"\u21D4","leftrightarrows":"\u21C6","leftrightharpoons":"\u21CB","leftrightsquigarrow":"\u21AD","LeftRightVector":"\u294E","LeftTeeArrow":"\u21A4","LeftTee":"\u22A3","LeftTeeVector":"\u295A","leftthreetimes":"\u22CB","LeftTriangleBar":"\u29CF","LeftTriangle":"\u22B2","LeftTriangleEqual":"\u22B4","LeftUpDownVector":"\u2951","LeftUpTeeVector":"\u2960","LeftUpVectorBar":"\u2958","LeftUpVector":"\u21BF","LeftVectorBar":"\u2952","LeftVector":"\u21BC","lEg":"\u2A8B","leg":"\u22DA","leq":"\u2264","leqq":"\u2266","leqslant":"\u2A7D","lescc":"\u2AA8","les":"\u2A7D","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\uDD0F","lfr":"\uD835\uDD29","lg":"\u2276","lgE":"\u2A91","lHar":"\u2962","lhard":"\u21BD","lharu":"\u21BC","lharul":"\u296A","lhblk":"\u2584","LJcy":"\u0409","ljcy":"\u0459","llarr":"\u21C7","ll":"\u226A","Ll":"\u22D8","llcorner":"\u231E","Lleftarrow":"\u21DA","llhard":"\u296B","lltri":"\u25FA","Lmidot":"\u013F","lmidot":"\u0140","lmoustache":"\u23B0","lmoust":"\u23B0","lnap":"\u2A89","lnapprox":"\u2A89","lne":"\u2A87","lnE":"\u2268","lneq":"\u2A87","lneqq":"\u2268","lnsim":"\u22E6","loang":"\u27EC","loarr":"\u21FD","lobrk":"\u27E6","longleftarrow":"\u27F5","LongLeftArrow":"\u27F5","Longleftarrow":"\u27F8","longleftrightarrow":"\u27F7","LongLeftRightArrow":"\u27F7","Longleftrightarrow":"\u27FA","longmapsto":"\u27FC","longrightarrow":"\u27F6","LongRightArrow":"\u27F6","Longrightarrow":"\u27F9","looparrowleft":"\u21AB","looparrowright":"\u21AC","lopar":"\u2985","Lopf":"\uD835\uDD43","lopf":"\uD835\uDD5D","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":"\u0141","lstrok":"\u0142","ltcc":"\u2AA6","ltcir":"\u2A79","lt":"<","LT":"<","Lt":"\u226A","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":"\u00AF","male":"\u2642","malt":"\u2720","maltese":"\u2720","Map":"\u2905","map":"\u21A6","mapsto":"\u21A6","mapstodown":"\u21A7","mapstoleft":"\u21A4","mapstoup":"\u21A5","marker":"\u25AE","mcomma":"\u2A29","Mcy":"\u041C","mcy":"\u043C","mdash":"\u2014","mDDot":"\u223A","measuredangle":"\u2221","MediumSpace":"\u205F","Mellintrf":"\u2133","Mfr":"\uD835\uDD10","mfr":"\uD835\uDD2A","mho":"\u2127","micro":"\u00B5","midast":"*","midcir":"\u2AF0","mid":"\u2223","middot":"\u00B7","minusb":"\u229F","minus":"\u2212","minusd":"\u2238","minusdu":"\u2A2A","MinusPlus":"\u2213","mlcp":"\u2ADB","mldr":"\u2026","mnplus":"\u2213","models":"\u22A7","Mopf":"\uD835\uDD44","mopf":"\uD835\uDD5E","mp":"\u2213","mscr":"\uD835\uDCC2","Mscr":"\u2133","mstpos":"\u223E","Mu":"\u039C","mu":"\u03BC","multimap":"\u22B8","mumap":"\u22B8","nabla":"\u2207","Nacute":"\u0143","nacute":"\u0144","nang":"\u2220\u20D2","nap":"\u2249","napE":"\u2A70\u0338","napid":"\u224B\u0338","napos":"\u0149","napprox":"\u2249","natural":"\u266E","naturals":"\u2115","natur":"\u266E","nbsp":"\u00A0","nbump":"\u224E\u0338","nbumpe":"\u224F\u0338","ncap":"\u2A43","Ncaron":"\u0147","ncaron":"\u0148","Ncedil":"\u0145","ncedil":"\u0146","ncong":"\u2247","ncongdot":"\u2A6D\u0338","ncup":"\u2A42","Ncy":"\u041D","ncy":"\u043D","ndash":"\u2013","nearhk":"\u2924","nearr":"\u2197","neArr":"\u21D7","nearrow":"\u2197","ne":"\u2260","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\uDD11","nfr":"\uD835\uDD2B","ngE":"\u2267\u0338","nge":"\u2271","ngeq":"\u2271","ngeqq":"\u2267\u0338","ngeqslant":"\u2A7E\u0338","nges":"\u2A7E\u0338","nGg":"\u22D9\u0338","ngsim":"\u2275","nGt":"\u226B\u20D2","ngt":"\u226F","ngtr":"\u226F","nGtv":"\u226B\u0338","nharr":"\u21AE","nhArr":"\u21CE","nhpar":"\u2AF2","ni":"\u220B","nis":"\u22FC","nisd":"\u22FA","niv":"\u220B","NJcy":"\u040A","njcy":"\u045A","nlarr":"\u219A","nlArr":"\u21CD","nldr":"\u2025","nlE":"\u2266\u0338","nle":"\u2270","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":"\u226A\u20D2","nlt":"\u226E","nltri":"\u22EA","nltrie":"\u22EC","nLtv":"\u226A\u0338","nmid":"\u2224","NoBreak":"\u2060","NonBreakingSpace":"\u00A0","nopf":"\uD835\uDD5F","Nopf":"\u2115","Not":"\u2AEC","not":"\u00AC","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","NotLeftTriangleBar":"\u29CF\u0338","NotLeftTriangle":"\u22EA","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","NotRightTriangleBar":"\u29D0\u0338","NotRightTriangle":"\u22EB","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","nparallel":"\u2226","npar":"\u2226","nparsl":"\u2AFD\u20E5","npart":"\u2202\u0338","npolint":"\u2A14","npr":"\u2280","nprcue":"\u22E0","nprec":"\u2280","npreceq":"\u2AAF\u0338","npre":"\u2AAF\u0338","nrarrc":"\u2933\u0338","nrarr":"\u219B","nrArr":"\u21CF","nrarrw":"\u219D\u0338","nrightarrow":"\u219B","nRightarrow":"\u21CF","nrtri":"\u22EB","nrtrie":"\u22ED","nsc":"\u2281","nsccue":"\u22E1","nsce":"\u2AB0\u0338","Nscr":"\uD835\uDCA9","nscr":"\uD835\uDCC3","nshortmid":"\u2224","nshortparallel":"\u2226","nsim":"\u2241","nsime":"\u2244","nsimeq":"\u2244","nsmid":"\u2224","nspar":"\u2226","nsqsube":"\u22E2","nsqsupe":"\u22E3","nsub":"\u2284","nsubE":"\u2AC5\u0338","nsube":"\u2288","nsubset":"\u2282\u20D2","nsubseteq":"\u2288","nsubseteqq":"\u2AC5\u0338","nsucc":"\u2281","nsucceq":"\u2AB0\u0338","nsup":"\u2285","nsupE":"\u2AC6\u0338","nsupe":"\u2289","nsupset":"\u2283\u20D2","nsupseteq":"\u2289","nsupseteqq":"\u2AC6\u0338","ntgl":"\u2279","Ntilde":"\u00D1","ntilde":"\u00F1","ntlg":"\u2278","ntriangleleft":"\u22EA","ntrianglelefteq":"\u22EC","ntriangleright":"\u22EB","ntrianglerighteq":"\u22ED","Nu":"\u039D","nu":"\u03BD","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":"\u00D3","oacute":"\u00F3","oast":"\u229B","Ocirc":"\u00D4","ocirc":"\u00F4","ocir":"\u229A","Ocy":"\u041E","ocy":"\u043E","odash":"\u229D","Odblac":"\u0150","odblac":"\u0151","odiv":"\u2A38","odot":"\u2299","odsold":"\u29BC","OElig":"\u0152","oelig":"\u0153","ofcir":"\u29BF","Ofr":"\uD835\uDD12","ofr":"\uD835\uDD2C","ogon":"\u02DB","Ograve":"\u00D2","ograve":"\u00F2","ogt":"\u29C1","ohbar":"\u29B5","ohm":"\u03A9","oint":"\u222E","olarr":"\u21BA","olcir":"\u29BE","olcross":"\u29BB","oline":"\u203E","olt":"\u29C0","Omacr":"\u014C","omacr":"\u014D","Omega":"\u03A9","omega":"\u03C9","Omicron":"\u039F","omicron":"\u03BF","omid":"\u29B6","ominus":"\u2296","Oopf":"\uD835\uDD46","oopf":"\uD835\uDD60","opar":"\u29B7","OpenCurlyDoubleQuote":"\u201C","OpenCurlyQuote":"\u2018","operp":"\u29B9","oplus":"\u2295","orarr":"\u21BB","Or":"\u2A54","or":"\u2228","ord":"\u2A5D","order":"\u2134","orderof":"\u2134","ordf":"\u00AA","ordm":"\u00BA","origof":"\u22B6","oror":"\u2A56","orslope":"\u2A57","orv":"\u2A5B","oS":"\u24C8","Oscr":"\uD835\uDCAA","oscr":"\u2134","Oslash":"\u00D8","oslash":"\u00F8","osol":"\u2298","Otilde":"\u00D5","otilde":"\u00F5","otimesas":"\u2A36","Otimes":"\u2A37","otimes":"\u2297","Ouml":"\u00D6","ouml":"\u00F6","ovbar":"\u233D","OverBar":"\u203E","OverBrace":"\u23DE","OverBracket":"\u23B4","OverParenthesis":"\u23DC","para":"\u00B6","parallel":"\u2225","par":"\u2225","parsim":"\u2AF3","parsl":"\u2AFD","part":"\u2202","PartialD":"\u2202","Pcy":"\u041F","pcy":"\u043F","percnt":"%","period":".","permil":"\u2030","perp":"\u22A5","pertenk":"\u2031","Pfr":"\uD835\uDD13","pfr":"\uD835\uDD2D","Phi":"\u03A6","phi":"\u03C6","phiv":"\u03D5","phmmat":"\u2133","phone":"\u260E","Pi":"\u03A0","pi":"\u03C0","pitchfork":"\u22D4","piv":"\u03D6","planck":"\u210F","planckh":"\u210E","plankv":"\u210F","plusacir":"\u2A23","plusb":"\u229E","pluscir":"\u2A22","plus":"+","plusdo":"\u2214","plusdu":"\u2A25","pluse":"\u2A72","PlusMinus":"\u00B1","plusmn":"\u00B1","plussim":"\u2A26","plustwo":"\u2A27","pm":"\u00B1","Poincareplane":"\u210C","pointint":"\u2A15","popf":"\uD835\uDD61","Popf":"\u2119","pound":"\u00A3","prap":"\u2AB7","Pr":"\u2ABB","pr":"\u227A","prcue":"\u227C","precapprox":"\u2AB7","prec":"\u227A","preccurlyeq":"\u227C","Precedes":"\u227A","PrecedesEqual":"\u2AAF","PrecedesSlantEqual":"\u227C","PrecedesTilde":"\u227E","preceq":"\u2AAF","precnapprox":"\u2AB9","precneqq":"\u2AB5","precnsim":"\u22E8","pre":"\u2AAF","prE":"\u2AB3","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","Proportional":"\u221D","Proportion":"\u2237","propto":"\u221D","prsim":"\u227E","prurel":"\u22B0","Pscr":"\uD835\uDCAB","pscr":"\uD835\uDCC5","Psi":"\u03A8","psi":"\u03C8","puncsp":"\u2008","Qfr":"\uD835\uDD14","qfr":"\uD835\uDD2E","qint":"\u2A0C","qopf":"\uD835\uDD62","Qopf":"\u211A","qprime":"\u2057","Qscr":"\uD835\uDCAC","qscr":"\uD835\uDCC6","quaternions":"\u210D","quatint":"\u2A16","quest":"?","questeq":"\u225F","quot":"\"","QUOT":"\"","rAarr":"\u21DB","race":"\u223D\u0331","Racute":"\u0154","racute":"\u0155","radic":"\u221A","raemptyv":"\u29B3","rang":"\u27E9","Rang":"\u27EB","rangd":"\u2992","range":"\u29A5","rangle":"\u27E9","raquo":"\u00BB","rarrap":"\u2975","rarrb":"\u21E5","rarrbfs":"\u2920","rarrc":"\u2933","rarr":"\u2192","Rarr":"\u21A0","rArr":"\u21D2","rarrfs":"\u291E","rarrhk":"\u21AA","rarrlp":"\u21AC","rarrpl":"\u2945","rarrsim":"\u2974","Rarrtl":"\u2916","rarrtl":"\u21A3","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":"\u0158","rcaron":"\u0159","Rcedil":"\u0156","rcedil":"\u0157","rceil":"\u2309","rcub":"}","Rcy":"\u0420","rcy":"\u0440","rdca":"\u2937","rdldhar":"\u2969","rdquo":"\u201D","rdquor":"\u201D","rdsh":"\u21B3","real":"\u211C","realine":"\u211B","realpart":"\u211C","reals":"\u211D","Re":"\u211C","rect":"\u25AD","reg":"\u00AE","REG":"\u00AE","ReverseElement":"\u220B","ReverseEquilibrium":"\u21CB","ReverseUpEquilibrium":"\u296F","rfisht":"\u297D","rfloor":"\u230B","rfr":"\uD835\uDD2F","Rfr":"\u211C","rHar":"\u2964","rhard":"\u21C1","rharu":"\u21C0","rharul":"\u296C","Rho":"\u03A1","rho":"\u03C1","rhov":"\u03F1","RightAngleBracket":"\u27E9","RightArrowBar":"\u21E5","rightarrow":"\u2192","RightArrow":"\u2192","Rightarrow":"\u21D2","RightArrowLeftArrow":"\u21C4","rightarrowtail":"\u21A3","RightCeiling":"\u2309","RightDoubleBracket":"\u27E7","RightDownTeeVector":"\u295D","RightDownVectorBar":"\u2955","RightDownVector":"\u21C2","RightFloor":"\u230B","rightharpoondown":"\u21C1","rightharpoonup":"\u21C0","rightleftarrows":"\u21C4","rightleftharpoons":"\u21CC","rightrightarrows":"\u21C9","rightsquigarrow":"\u219D","RightTeeArrow":"\u21A6","RightTee":"\u22A2","RightTeeVector":"\u295B","rightthreetimes":"\u22CC","RightTriangleBar":"\u29D0","RightTriangle":"\u22B3","RightTriangleEqual":"\u22B5","RightUpDownVector":"\u294F","RightUpTeeVector":"\u295C","RightUpVectorBar":"\u2954","RightUpVector":"\u21BE","RightVectorBar":"\u2953","RightVector":"\u21C0","ring":"\u02DA","risingdotseq":"\u2253","rlarr":"\u21C4","rlhar":"\u21CC","rlm":"\u200F","rmoustache":"\u23B1","rmoust":"\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":"\u015A","sacute":"\u015B","sbquo":"\u201A","scap":"\u2AB8","Scaron":"\u0160","scaron":"\u0161","Sc":"\u2ABC","sc":"\u227B","sccue":"\u227D","sce":"\u2AB0","scE":"\u2AB4","Scedil":"\u015E","scedil":"\u015F","Scirc":"\u015C","scirc":"\u015D","scnap":"\u2ABA","scnE":"\u2AB6","scnsim":"\u22E9","scpolint":"\u2A13","scsim":"\u227F","Scy":"\u0421","scy":"\u0441","sdotb":"\u22A1","sdot":"\u22C5","sdote":"\u2A66","searhk":"\u2925","searr":"\u2198","seArr":"\u21D8","searrow":"\u2198","sect":"\u00A7","semi":";","seswar":"\u2929","setminus":"\u2216","setmn":"\u2216","sext":"\u2736","Sfr":"\uD835\uDD16","sfr":"\uD835\uDD30","sfrown":"\u2322","sharp":"\u266F","SHCHcy":"\u0429","shchcy":"\u0449","SHcy":"\u0428","shcy":"\u0448","ShortDownArrow":"\u2193","ShortLeftArrow":"\u2190","shortmid":"\u2223","shortparallel":"\u2225","ShortRightArrow":"\u2192","ShortUpArrow":"\u2191","shy":"\u00AD","Sigma":"\u03A3","sigma":"\u03C3","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":"\u042C","softcy":"\u044C","solbar":"\u233F","solb":"\u29C4","sol":"/","Sopf":"\uD835\uDD4A","sopf":"\uD835\uDD64","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","square":"\u25A1","Square":"\u25A1","SquareIntersection":"\u2293","SquareSubset":"\u228F","SquareSubsetEqual":"\u2291","SquareSuperset":"\u2290","SquareSupersetEqual":"\u2292","SquareUnion":"\u2294","squarf":"\u25AA","squ":"\u25A1","squf":"\u25AA","srarr":"\u2192","Sscr":"\uD835\uDCAE","sscr":"\uD835\uDCC8","ssetmn":"\u2216","ssmile":"\u2323","sstarf":"\u22C6","Star":"\u22C6","star":"\u2606","starf":"\u2605","straightepsilon":"\u03F5","straightphi":"\u03D5","strns":"\u00AF","sub":"\u2282","Sub":"\u22D0","subdot":"\u2ABD","subE":"\u2AC5","sube":"\u2286","subedot":"\u2AC3","submult":"\u2AC1","subnE":"\u2ACB","subne":"\u228A","subplus":"\u2ABF","subrarr":"\u2979","subset":"\u2282","Subset":"\u22D0","subseteq":"\u2286","subseteqq":"\u2AC5","SubsetEqual":"\u2286","subsetneq":"\u228A","subsetneqq":"\u2ACB","subsim":"\u2AC7","subsub":"\u2AD5","subsup":"\u2AD3","succapprox":"\u2AB8","succ":"\u227B","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","sup1":"\u00B9","sup2":"\u00B2","sup3":"\u00B3","sup":"\u2283","Sup":"\u22D1","supdot":"\u2ABE","supdsub":"\u2AD8","supE":"\u2AC6","supe":"\u2287","supedot":"\u2AC4","Superset":"\u2283","SupersetEqual":"\u2287","suphsol":"\u27C9","suphsub":"\u2AD7","suplarr":"\u297B","supmult":"\u2AC2","supnE":"\u2ACC","supne":"\u228B","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":"\u00DF","Tab":"\t","target":"\u2316","Tau":"\u03A4","tau":"\u03C4","tbrk":"\u23B4","Tcaron":"\u0164","tcaron":"\u0165","Tcedil":"\u0162","tcedil":"\u0163","Tcy":"\u0422","tcy":"\u0442","tdot":"\u20DB","telrec":"\u2315","Tfr":"\uD835\uDD17","tfr":"\uD835\uDD31","there4":"\u2234","therefore":"\u2234","Therefore":"\u2234","Theta":"\u0398","theta":"\u03B8","thetasym":"\u03D1","thetav":"\u03D1","thickapprox":"\u2248","thicksim":"\u223C","ThickSpace":"\u205F\u200A","ThinSpace":"\u2009","thinsp":"\u2009","thkap":"\u2248","thksim":"\u223C","THORN":"\u00DE","thorn":"\u00FE","tilde":"\u02DC","Tilde":"\u223C","TildeEqual":"\u2243","TildeFullEqual":"\u2245","TildeTilde":"\u2248","timesbar":"\u2A31","timesb":"\u22A0","times":"\u00D7","timesd":"\u2A30","tint":"\u222D","toea":"\u2928","topbot":"\u2336","topcir":"\u2AF1","top":"\u22A4","Topf":"\uD835\uDD4B","topf":"\uD835\uDD65","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\uDCAF","tscr":"\uD835\uDCC9","TScy":"\u0426","tscy":"\u0446","TSHcy":"\u040B","tshcy":"\u045B","Tstrok":"\u0166","tstrok":"\u0167","twixt":"\u226C","twoheadleftarrow":"\u219E","twoheadrightarrow":"\u21A0","Uacute":"\u00DA","uacute":"\u00FA","uarr":"\u2191","Uarr":"\u219F","uArr":"\u21D1","Uarrocir":"\u2949","Ubrcy":"\u040E","ubrcy":"\u045E","Ubreve":"\u016C","ubreve":"\u016D","Ucirc":"\u00DB","ucirc":"\u00FB","Ucy":"\u0423","ucy":"\u0443","udarr":"\u21C5","Udblac":"\u0170","udblac":"\u0171","udhar":"\u296E","ufisht":"\u297E","Ufr":"\uD835\uDD18","ufr":"\uD835\uDD32","Ugrave":"\u00D9","ugrave":"\u00F9","uHar":"\u2963","uharl":"\u21BF","uharr":"\u21BE","uhblk":"\u2580","ulcorn":"\u231C","ulcorner":"\u231C","ulcrop":"\u230F","ultri":"\u25F8","Umacr":"\u016A","umacr":"\u016B","uml":"\u00A8","UnderBar":"_","UnderBrace":"\u23DF","UnderBracket":"\u23B5","UnderParenthesis":"\u23DD","Union":"\u22C3","UnionPlus":"\u228E","Uogon":"\u0172","uogon":"\u0173","Uopf":"\uD835\uDD4C","uopf":"\uD835\uDD66","UpArrowBar":"\u2912","uparrow":"\u2191","UpArrow":"\u2191","Uparrow":"\u21D1","UpArrowDownArrow":"\u21C5","updownarrow":"\u2195","UpDownArrow":"\u2195","Updownarrow":"\u21D5","UpEquilibrium":"\u296E","upharpoonleft":"\u21BF","upharpoonright":"\u21BE","uplus":"\u228E","UpperLeftArrow":"\u2196","UpperRightArrow":"\u2197","upsi":"\u03C5","Upsi":"\u03D2","upsih":"\u03D2","Upsilon":"\u03A5","upsilon":"\u03C5","UpTeeArrow":"\u21A5","UpTee":"\u22A5","upuparrows":"\u21C8","urcorn":"\u231D","urcorner":"\u231D","urcrop":"\u230E","Uring":"\u016E","uring":"\u016F","urtri":"\u25F9","Uscr":"\uD835\uDCB0","uscr":"\uD835\uDCCA","utdot":"\u22F0","Utilde":"\u0168","utilde":"\u0169","utri":"\u25B5","utrif":"\u25B4","uuarr":"\u21C8","Uuml":"\u00DC","uuml":"\u00FC","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":"\u0412","vcy":"\u0432","vdash":"\u22A2","vDash":"\u22A8","Vdash":"\u22A9","VDash":"\u22AB","Vdashl":"\u2AE6","veebar":"\u22BB","vee":"\u2228","Vee":"\u22C1","veeeq":"\u225A","vellip":"\u22EE","verbar":"|","Verbar":"\u2016","vert":"|","Vert":"\u2016","VerticalBar":"\u2223","VerticalLine":"|","VerticalSeparator":"\u2758","VerticalTilde":"\u2240","VeryThinSpace":"\u200A","Vfr":"\uD835\uDD19","vfr":"\uD835\uDD33","vltri":"\u22B2","vnsub":"\u2282\u20D2","vnsup":"\u2283\u20D2","Vopf":"\uD835\uDD4D","vopf":"\uD835\uDD67","vprop":"\u221D","vrtri":"\u22B3","Vscr":"\uD835\uDCB1","vscr":"\uD835\uDCCB","vsubnE":"\u2ACB\uFE00","vsubne":"\u228A\uFE00","vsupnE":"\u2ACC\uFE00","vsupne":"\u228B\uFE00","Vvdash":"\u22AA","vzigzag":"\u299A","Wcirc":"\u0174","wcirc":"\u0175","wedbar":"\u2A5F","wedge":"\u2227","Wedge":"\u22C0","wedgeq":"\u2259","weierp":"\u2118","Wfr":"\uD835\uDD1A","wfr":"\uD835\uDD34","Wopf":"\uD835\uDD4E","wopf":"\uD835\uDD68","wp":"\u2118","wr":"\u2240","wreath":"\u2240","Wscr":"\uD835\uDCB2","wscr":"\uD835\uDCCC","xcap":"\u22C2","xcirc":"\u25EF","xcup":"\u22C3","xdtri":"\u25BD","Xfr":"\uD835\uDD1B","xfr":"\uD835\uDD35","xharr":"\u27F7","xhArr":"\u27FA","Xi":"\u039E","xi":"\u03BE","xlarr":"\u27F5","xlArr":"\u27F8","xmap":"\u27FC","xnis":"\u22FB","xodot":"\u2A00","Xopf":"\uD835\uDD4F","xopf":"\uD835\uDD69","xoplus":"\u2A01","xotime":"\u2A02","xrarr":"\u27F6","xrArr":"\u27F9","Xscr":"\uD835\uDCB3","xscr":"\uD835\uDCCD","xsqcup":"\u2A06","xuplus":"\u2A04","xutri":"\u25B3","xvee":"\u22C1","xwedge":"\u22C0","Yacute":"\u00DD","yacute":"\u00FD","YAcy":"\u042F","yacy":"\u044F","Ycirc":"\u0176","ycirc":"\u0177","Ycy":"\u042B","ycy":"\u044B","yen":"\u00A5","Yfr":"\uD835\uDD1C","yfr":"\uD835\uDD36","YIcy":"\u0407","yicy":"\u0457","Yopf":"\uD835\uDD50","yopf":"\uD835\uDD6A","Yscr":"\uD835\uDCB4","yscr":"\uD835\uDCCE","YUcy":"\u042E","yucy":"\u044E","yuml":"\u00FF","Yuml":"\u0178","Zacute":"\u0179","zacute":"\u017A","Zcaron":"\u017D","zcaron":"\u017E","Zcy":"\u0417","zcy":"\u0437","Zdot":"\u017B","zdot":"\u017C","zeetrf":"\u2128","ZeroWidthSpace":"\u200B","Zeta":"\u0396","zeta":"\u03B6","zfr":"\uD835\uDD37","Zfr":"\u2128","ZHcy":"\u0416","zhcy":"\u0436","zigrarr":"\u21DD","zopf":"\uD835\uDD6B","Zopf":"\u2124","Zscr":"\uD835\uDCB5","zscr":"\uD835\uDCCF","zwj":"\u200D","zwnj":"\u200C"}
 4791    -1 },{}],29:[function(require,module,exports){
 4792    -1 (function (global){
 4793    -1 
 4794    -1 /*
 4795    -1  * Module requirements.
 4796    -1  */
 4797    -1 
 4798    -1 var isArray = require('isarray');
 4799    -1 
 4800    -1 /**
 4801    -1  * Module exports.
 4802    -1  */
 4803    -1 
 4804    -1 module.exports = hasBinary;
 4805    -1 
 4806    -1 /**
 4807    -1  * Checks for binary data.
 4808    -1  *
 4809    -1  * Right now only Buffer and ArrayBuffer are supported..
 4810    -1  *
 4811    -1  * @param {Object} anything
 4812    -1  * @api public
 4813    -1  */
 4814    -1 
 4815    -1 function hasBinary(data) {
 4816    -1 
 4817    -1   function _hasBinary(obj) {
 4818    -1     if (!obj) return false;
 4819    -1 
 4820    -1     if ( (global.Buffer && global.Buffer.isBuffer && global.Buffer.isBuffer(obj)) ||
 4821    -1          (global.ArrayBuffer && obj instanceof ArrayBuffer) ||
 4822    -1          (global.Blob && obj instanceof Blob) ||
 4823    -1          (global.File && obj instanceof File)
 4824    -1         ) {
 4825    -1       return true;
 4826    -1     }
 4827    -1 
 4828    -1     if (isArray(obj)) {
 4829    -1       for (var i = 0; i < obj.length; i++) {
 4830    -1           if (_hasBinary(obj[i])) {
 4831    -1               return true;
 4832    -1           }
 4833    -1       }
 4834    -1     } else if (obj && 'object' == typeof obj) {
 4835    -1       // see: https://github.com/Automattic/has-binary/pull/4
 4836    -1       if (obj.toJSON && 'function' == typeof obj.toJSON) {
 4837    -1         obj = obj.toJSON();
 4838    -1       }
 4839    -1 
 4840    -1       for (var key in obj) {
 4841    -1         if (Object.prototype.hasOwnProperty.call(obj, key) && _hasBinary(obj[key])) {
 4842    -1           return true;
 4843    -1         }
 4844    -1       }
 4845    -1     }
 4846    -1 
 4847    -1     return false;
 4848    -1   }
 4849    -1 
 4850    -1   return _hasBinary(data);
 4851    -1 }
 4852    -1 
 4853    -1 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 4854    -1 },{"isarray":32}],30:[function(require,module,exports){
 4855    -1 
 4856    -1 /**
 4857    -1  * Module exports.
 4858    -1  *
 4859    -1  * Logic borrowed from Modernizr:
 4860    -1  *
 4861    -1  *   - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js
 4862    -1  */
 4863    -1 
 4864    -1 try {
 4865    -1   module.exports = typeof XMLHttpRequest !== 'undefined' &&
 4866    -1     'withCredentials' in new XMLHttpRequest();
 4867    -1 } catch (err) {
 4868    -1   // if XMLHttp support is disabled in IE then it will throw
 4869    -1   // when trying to create
 4870    -1   module.exports = false;
 4871    -1 }
 4872    -1 
 4873    -1 },{}],31:[function(require,module,exports){
 4874    -1 
 4875    -1 var indexOf = [].indexOf;
 4876    -1 
 4877    -1 module.exports = function(arr, obj){
 4878    -1   if (indexOf) return arr.indexOf(obj);
 4879    -1   for (var i = 0; i < arr.length; ++i) {
 4880    -1     if (arr[i] === obj) return i;
 4881    -1   }
 4882    -1   return -1;
 4883    -1 };
 4884    -1 },{}],32:[function(require,module,exports){
 4885    -1 module.exports = Array.isArray || function (arr) {
 4886    -1   return Object.prototype.toString.call(arr) == '[object Array]';
 4887    -1 };
 4888    -1 
 4889    -1 },{}],33:[function(require,module,exports){
 4890    -1 (function (global){
 4891    -1 /*! JSON v3.3.2 | http://bestiejs.github.io/json3 | Copyright 2012-2014, Kit Cambridge | http://kit.mit-license.org */
 4892    -1 ;(function () {
 4893    -1   // Detect the `define` function exposed by asynchronous module loaders. The
 4894    -1   // strict `define` check is necessary for compatibility with `r.js`.
 4895    -1   var isLoader = typeof define === "function" && define.amd;
 4896    -1 
 4897    -1   // A set of types used to distinguish objects from primitives.
 4898    -1   var objectTypes = {
 4899    -1     "function": true,
 4900    -1     "object": true
 4901    -1   };
 4902    -1 
 4903    -1   // Detect the `exports` object exposed by CommonJS implementations.
 4904    -1   var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
 4905    -1 
 4906    -1   // Use the `global` object exposed by Node (including Browserify via
 4907    -1   // `insert-module-globals`), Narwhal, and Ringo as the default context,
 4908    -1   // and the `window` object in browsers. Rhino exports a `global` function
 4909    -1   // instead.
 4910    -1   var root = objectTypes[typeof window] && window || this,
 4911    -1       freeGlobal = freeExports && objectTypes[typeof module] && module && !module.nodeType && typeof global == "object" && global;
 4912    -1 
 4913    -1   if (freeGlobal && (freeGlobal["global"] === freeGlobal || freeGlobal["window"] === freeGlobal || freeGlobal["self"] === freeGlobal)) {
 4914    -1     root = freeGlobal;
 4915    -1   }
 4916    -1 
 4917    -1   // Public: Initializes JSON 3 using the given `context` object, attaching the
 4918    -1   // `stringify` and `parse` functions to the specified `exports` object.
 4919    -1   function runInContext(context, exports) {
 4920    -1     context || (context = root["Object"]());
 4921    -1     exports || (exports = root["Object"]());
 4922    -1 
 4923    -1     // Native constructor aliases.
 4924    -1     var Number = context["Number"] || root["Number"],
 4925    -1         String = context["String"] || root["String"],
 4926    -1         Object = context["Object"] || root["Object"],
 4927    -1         Date = context["Date"] || root["Date"],
 4928    -1         SyntaxError = context["SyntaxError"] || root["SyntaxError"],
 4929    -1         TypeError = context["TypeError"] || root["TypeError"],
 4930    -1         Math = context["Math"] || root["Math"],
 4931    -1         nativeJSON = context["JSON"] || root["JSON"];
 4932    -1 
 4933    -1     // Delegate to the native `stringify` and `parse` implementations.
 4934    -1     if (typeof nativeJSON == "object" && nativeJSON) {
 4935    -1       exports.stringify = nativeJSON.stringify;
 4936    -1       exports.parse = nativeJSON.parse;
 4937    -1     }
 4938    -1 
 4939    -1     // Convenience aliases.
 4940    -1     var objectProto = Object.prototype,
 4941    -1         getClass = objectProto.toString,
 4942    -1         isProperty, forEach, undef;
 4943    -1 
 4944    -1     // Test the `Date#getUTC*` methods. Based on work by @Yaffle.
 4945    -1     var isExtended = new Date(-3509827334573292);
 4946    -1     try {
 4947    -1       // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical
 4948    -1       // results for certain dates in Opera >= 10.53.
 4949    -1       isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 &&
 4950    -1         // Safari < 2.0.2 stores the internal millisecond time value correctly,
 4951    -1         // but clips the values returned by the date methods to the range of
 4952    -1         // signed 32-bit integers ([-2 ** 31, 2 ** 31 - 1]).
 4953    -1         isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708;
 4954    -1     } catch (exception) {}
 4955    -1 
 4956    -1     // Internal: Determines whether the native `JSON.stringify` and `parse`
 4957    -1     // implementations are spec-compliant. Based on work by Ken Snyder.
 4958    -1     function has(name) {
 4959    -1       if (has[name] !== undef) {
 4960    -1         // Return cached feature test result.
 4961    -1         return has[name];
 4962    -1       }
 4963    -1       var isSupported;
 4964    -1       if (name == "bug-string-char-index") {
 4965    -1         // IE <= 7 doesn't support accessing string characters using square
 4966    -1         // bracket notation. IE 8 only supports this for primitives.
 4967    -1         isSupported = "a"[0] != "a";
 4968    -1       } else if (name == "json") {
 4969    -1         // Indicates whether both `JSON.stringify` and `JSON.parse` are
 4970    -1         // supported.
 4971    -1         isSupported = has("json-stringify") && has("json-parse");
 4972    -1       } else {
 4973    -1         var value, serialized = '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';
 4974    -1         // Test `JSON.stringify`.
 4975    -1         if (name == "json-stringify") {
 4976    -1           var stringify = exports.stringify, stringifySupported = typeof stringify == "function" && isExtended;
 4977    -1           if (stringifySupported) {
 4978    -1             // A test function object with a custom `toJSON` method.
 4979    -1             (value = function () {
 4980    -1               return 1;
 4981    -1             }).toJSON = value;
 4982    -1             try {
 4983    -1               stringifySupported =
 4984    -1                 // Firefox 3.1b1 and b2 serialize string, number, and boolean
 4985    -1                 // primitives as object literals.
 4986    -1                 stringify(0) === "0" &&
 4987    -1                 // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object
 4988    -1                 // literals.
 4989    -1                 stringify(new Number()) === "0" &&
 4990    -1                 stringify(new String()) == '""' &&
 4991    -1                 // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or
 4992    -1                 // does not define a canonical JSON representation (this applies to
 4993    -1                 // objects with `toJSON` properties as well, *unless* they are nested
 4994    -1                 // within an object or array).
 4995    -1                 stringify(getClass) === undef &&
 4996    -1                 // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and
 4997    -1                 // FF 3.1b3 pass this test.
 4998    -1                 stringify(undef) === undef &&
 4999    -1                 // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s,
 5000    -1                 // respectively, if the value is omitted entirely.
 5001    -1                 stringify() === undef &&
 5002    -1                 // FF 3.1b1, 2 throw an error if the given value is not a number,
 5003    -1                 // string, array, object, Boolean, or `null` literal. This applies to
 5004    -1                 // objects with custom `toJSON` methods as well, unless they are nested
 5005    -1                 // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON`
 5006    -1                 // methods entirely.
 5007    -1                 stringify(value) === "1" &&
 5008    -1                 stringify([value]) == "[1]" &&
 5009    -1                 // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of
 5010    -1                 // `"[null]"`.
 5011    -1                 stringify([undef]) == "[null]" &&
 5012    -1                 // YUI 3.0.0b1 fails to serialize `null` literals.
 5013    -1                 stringify(null) == "null" &&
 5014    -1                 // FF 3.1b1, 2 halts serialization if an array contains a function:
 5015    -1                 // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3
 5016    -1                 // elides non-JSON values from objects and arrays, unless they
 5017    -1                 // define custom `toJSON` methods.
 5018    -1                 stringify([undef, getClass, null]) == "[null,null,null]" &&
 5019    -1                 // Simple serialization test. FF 3.1b1 uses Unicode escape sequences
 5020    -1                 // where character escape codes are expected (e.g., `\b` => `\u0008`).
 5021    -1                 stringify({ "a": [value, true, false, null, "\x00\b\n\f\r\t"] }) == serialized &&
 5022    -1                 // FF 3.1b1 and b2 ignore the `filter` and `width` arguments.
 5023    -1                 stringify(null, value) === "1" &&
 5024    -1                 stringify([1, 2], null, 1) == "[\n 1,\n 2\n]" &&
 5025    -1                 // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly
 5026    -1                 // serialize extended years.
 5027    -1                 stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' &&
 5028    -1                 // The milliseconds are optional in ES 5, but required in 5.1.
 5029    -1                 stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' &&
 5030    -1                 // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative
 5031    -1                 // four-digit years instead of six-digit years. Credits: @Yaffle.
 5032    -1                 stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' &&
 5033    -1                 // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond
 5034    -1                 // values less than 1000. Credits: @Yaffle.
 5035    -1                 stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"';
 5036    -1             } catch (exception) {
 5037    -1               stringifySupported = false;
 5038    -1             }
 5039    -1           }
 5040    -1           isSupported = stringifySupported;
 5041    -1         }
 5042    -1         // Test `JSON.parse`.
 5043    -1         if (name == "json-parse") {
 5044    -1           var parse = exports.parse;
 5045    -1           if (typeof parse == "function") {
 5046    -1             try {
 5047    -1               // FF 3.1b1, b2 will throw an exception if a bare literal is provided.
 5048    -1               // Conforming implementations should also coerce the initial argument to
 5049    -1               // a string prior to parsing.
 5050    -1               if (parse("0") === 0 && !parse(false)) {
 5051    -1                 // Simple parsing test.
 5052    -1                 value = parse(serialized);
 5053    -1                 var parseSupported = value["a"].length == 5 && value["a"][0] === 1;
 5054    -1                 if (parseSupported) {
 5055    -1                   try {
 5056    -1                     // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings.
 5057    -1                     parseSupported = !parse('"\t"');
 5058    -1                   } catch (exception) {}
 5059    -1                   if (parseSupported) {
 5060    -1                     try {
 5061    -1                       // FF 4.0 and 4.0.1 allow leading `+` signs and leading
 5062    -1                       // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow
 5063    -1                       // certain octal literals.
 5064    -1                       parseSupported = parse("01") !== 1;
 5065    -1                     } catch (exception) {}
 5066    -1                   }
 5067    -1                   if (parseSupported) {
 5068    -1                     try {
 5069    -1                       // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal
 5070    -1                       // points. These environments, along with FF 3.1b1 and 2,
 5071    -1                       // also allow trailing commas in JSON objects and arrays.
 5072    -1                       parseSupported = parse("1.") !== 1;
 5073    -1                     } catch (exception) {}
 5074    -1                   }
 5075    -1                 }
 5076    -1               }
 5077    -1             } catch (exception) {
 5078    -1               parseSupported = false;
 5079    -1             }
 5080    -1           }
 5081    -1           isSupported = parseSupported;
 5082    -1         }
 5083    -1       }
 5084    -1       return has[name] = !!isSupported;
 5085    -1     }
 5086    -1 
 5087    -1     if (!has("json")) {
 5088    -1       // Common `[[Class]]` name aliases.
 5089    -1       var functionClass = "[object Function]",
 5090    -1           dateClass = "[object Date]",
 5091    -1           numberClass = "[object Number]",
 5092    -1           stringClass = "[object String]",
 5093    -1           arrayClass = "[object Array]",
 5094    -1           booleanClass = "[object Boolean]";
 5095    -1 
 5096    -1       // Detect incomplete support for accessing string characters by index.
 5097    -1       var charIndexBuggy = has("bug-string-char-index");
 5098    -1 
 5099    -1       // Define additional utility methods if the `Date` methods are buggy.
 5100    -1       if (!isExtended) {
 5101    -1         var floor = Math.floor;
 5102    -1         // A mapping between the months of the year and the number of days between
 5103    -1         // January 1st and the first of the respective month.
 5104    -1         var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
 5105    -1         // Internal: Calculates the number of days between the Unix epoch and the
 5106    -1         // first day of the given month.
 5107    -1         var getDay = function (year, month) {
 5108    -1           return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400);
 5109    -1         };
 5110    -1       }
 5111    -1 
 5112    -1       // Internal: Determines if a property is a direct property of the given
 5113    -1       // object. Delegates to the native `Object#hasOwnProperty` method.
 5114    -1       if (!(isProperty = objectProto.hasOwnProperty)) {
 5115    -1         isProperty = function (property) {
 5116    -1           var members = {}, constructor;
 5117    -1           if ((members.__proto__ = null, members.__proto__ = {
 5118    -1             // The *proto* property cannot be set multiple times in recent
 5119    -1             // versions of Firefox and SeaMonkey.
 5120    -1             "toString": 1
 5121    -1           }, members).toString != getClass) {
 5122    -1             // Safari <= 2.0.3 doesn't implement `Object#hasOwnProperty`, but
 5123    -1             // supports the mutable *proto* property.
 5124    -1             isProperty = function (property) {
 5125    -1               // Capture and break the object's prototype chain (see section 8.6.2
 5126    -1               // of the ES 5.1 spec). The parenthesized expression prevents an
 5127    -1               // unsafe transformation by the Closure Compiler.
 5128    -1               var original = this.__proto__, result = property in (this.__proto__ = null, this);
 5129    -1               // Restore the original prototype chain.
 5130    -1               this.__proto__ = original;
 5131    -1               return result;
 5132    -1             };
 5133    -1           } else {
 5134    -1             // Capture a reference to the top-level `Object` constructor.
 5135    -1             constructor = members.constructor;
 5136    -1             // Use the `constructor` property to simulate `Object#hasOwnProperty` in
 5137    -1             // other environments.
 5138    -1             isProperty = function (property) {
 5139    -1               var parent = (this.constructor || constructor).prototype;
 5140    -1               return property in this && !(property in parent && this[property] === parent[property]);
 5141    -1             };
 5142    -1           }
 5143    -1           members = null;
 5144    -1           return isProperty.call(this, property);
 5145    -1         };
 5146    -1       }
 5147    -1 
 5148    -1       // Internal: Normalizes the `for...in` iteration algorithm across
 5149    -1       // environments. Each enumerated key is yielded to a `callback` function.
 5150    -1       forEach = function (object, callback) {
 5151    -1         var size = 0, Properties, members, property;
 5152    -1 
 5153    -1         // Tests for bugs in the current environment's `for...in` algorithm. The
 5154    -1         // `valueOf` property inherits the non-enumerable flag from
 5155    -1         // `Object.prototype` in older versions of IE, Netscape, and Mozilla.
 5156    -1         (Properties = function () {
 5157    -1           this.valueOf = 0;
 5158    -1         }).prototype.valueOf = 0;
 5159    -1 
 5160    -1         // Iterate over a new instance of the `Properties` class.
 5161    -1         members = new Properties();
 5162    -1         for (property in members) {
 5163    -1           // Ignore all properties inherited from `Object.prototype`.
 5164    -1           if (isProperty.call(members, property)) {
 5165    -1             size++;
 5166    -1           }
 5167    -1         }
 5168    -1         Properties = members = null;
 5169    -1 
 5170    -1         // Normalize the iteration algorithm.
 5171    -1         if (!size) {
 5172    -1           // A list of non-enumerable properties inherited from `Object.prototype`.
 5173    -1           members = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"];
 5174    -1           // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable
 5175    -1           // properties.
 5176    -1           forEach = function (object, callback) {
 5177    -1             var isFunction = getClass.call(object) == functionClass, property, length;
 5178    -1             var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[typeof object.hasOwnProperty] && object.hasOwnProperty || isProperty;
 5179    -1             for (property in object) {
 5180    -1               // Gecko <= 1.0 enumerates the `prototype` property of functions under
 5181    -1               // certain conditions; IE does not.
 5182    -1               if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) {
 5183    -1                 callback(property);
 5184    -1               }
 5185    -1             }
 5186    -1             // Manually invoke the callback for each non-enumerable property.
 5187    -1             for (length = members.length; property = members[--length]; hasProperty.call(object, property) && callback(property));
 5188    -1           };
 5189    -1         } else if (size == 2) {
 5190    -1           // Safari <= 2.0.4 enumerates shadowed properties twice.
 5191    -1           forEach = function (object, callback) {
 5192    -1             // Create a set of iterated properties.
 5193    -1             var members = {}, isFunction = getClass.call(object) == functionClass, property;
 5194    -1             for (property in object) {
 5195    -1               // Store each property name to prevent double enumeration. The
 5196    -1               // `prototype` property of functions is not enumerated due to cross-
 5197    -1               // environment inconsistencies.
 5198    -1               if (!(isFunction && property == "prototype") && !isProperty.call(members, property) && (members[property] = 1) && isProperty.call(object, property)) {
 5199    -1                 callback(property);
 5200    -1               }
 5201    -1             }
 5202    -1           };
 5203    -1         } else {
 5204    -1           // No bugs detected; use the standard `for...in` algorithm.
 5205    -1           forEach = function (object, callback) {
 5206    -1             var isFunction = getClass.call(object) == functionClass, property, isConstructor;
 5207    -1             for (property in object) {
 5208    -1               if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) {
 5209    -1                 callback(property);
 5210    -1               }
 5211    -1             }
 5212    -1             // Manually invoke the callback for the `constructor` property due to
 5213    -1             // cross-environment inconsistencies.
 5214    -1             if (isConstructor || isProperty.call(object, (property = "constructor"))) {
 5215    -1               callback(property);
 5216    -1             }
 5217    -1           };
 5218    -1         }
 5219    -1         return forEach(object, callback);
 5220    -1       };
 5221    -1 
 5222    -1       // Public: Serializes a JavaScript `value` as a JSON string. The optional
 5223    -1       // `filter` argument may specify either a function that alters how object and
 5224    -1       // array members are serialized, or an array of strings and numbers that
 5225    -1       // indicates which properties should be serialized. The optional `width`
 5226    -1       // argument may be either a string or number that specifies the indentation
 5227    -1       // level of the output.
 5228    -1       if (!has("json-stringify")) {
 5229    -1         // Internal: A map of control characters and their escaped equivalents.
 5230    -1         var Escapes = {
 5231    -1           92: "\\\\",
 5232    -1           34: '\\"',
 5233    -1           8: "\\b",
 5234    -1           12: "\\f",
 5235    -1           10: "\\n",
 5236    -1           13: "\\r",
 5237    -1           9: "\\t"
 5238    -1         };
 5239    -1 
 5240    -1         // Internal: Converts `value` into a zero-padded string such that its
 5241    -1         // length is at least equal to `width`. The `width` must be <= 6.
 5242    -1         var leadingZeroes = "000000";
 5243    -1         var toPaddedString = function (width, value) {
 5244    -1           // The `|| 0` expression is necessary to work around a bug in
 5245    -1           // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`.
 5246    -1           return (leadingZeroes + (value || 0)).slice(-width);
 5247    -1         };
 5248    -1 
 5249    -1         // Internal: Double-quotes a string `value`, replacing all ASCII control
 5250    -1         // characters (characters with code unit values between 0 and 31) with
 5251    -1         // their escaped equivalents. This is an implementation of the
 5252    -1         // `Quote(value)` operation defined in ES 5.1 section 15.12.3.
 5253    -1         var unicodePrefix = "\\u00";
 5254    -1         var quote = function (value) {
 5255    -1           var result = '"', index = 0, length = value.length, useCharIndex = !charIndexBuggy || length > 10;
 5256    -1           var symbols = useCharIndex && (charIndexBuggy ? value.split("") : value);
 5257    -1           for (; index < length; index++) {
 5258    -1             var charCode = value.charCodeAt(index);
 5259    -1             // If the character is a control character, append its Unicode or
 5260    -1             // shorthand escape sequence; otherwise, append the character as-is.
 5261    -1             switch (charCode) {
 5262    -1               case 8: case 9: case 10: case 12: case 13: case 34: case 92:
 5263    -1                 result += Escapes[charCode];
 5264    -1                 break;
 5265    -1               default:
 5266    -1                 if (charCode < 32) {
 5267    -1                   result += unicodePrefix + toPaddedString(2, charCode.toString(16));
 5268    -1                   break;
 5269    -1                 }
 5270    -1                 result += useCharIndex ? symbols[index] : value.charAt(index);
 5271    -1             }
 5272    -1           }
 5273    -1           return result + '"';
 5274    -1         };
 5275    -1 
 5276    -1         // Internal: Recursively serializes an object. Implements the
 5277    -1         // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations.
 5278    -1         var serialize = function (property, object, callback, properties, whitespace, indentation, stack) {
 5279    -1           var value, className, year, month, date, time, hours, minutes, seconds, milliseconds, results, element, index, length, prefix, result;
 5280    -1           try {
 5281    -1             // Necessary for host object support.
 5282    -1             value = object[property];
 5283    -1           } catch (exception) {}
 5284    -1           if (typeof value == "object" && value) {
 5285    -1             className = getClass.call(value);
 5286    -1             if (className == dateClass && !isProperty.call(value, "toJSON")) {
 5287    -1               if (value > -1 / 0 && value < 1 / 0) {
 5288    -1                 // Dates are serialized according to the `Date#toJSON` method
 5289    -1                 // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15
 5290    -1                 // for the ISO 8601 date time string format.
 5291    -1                 if (getDay) {
 5292    -1                   // Manually compute the year, month, date, hours, minutes,
 5293    -1                   // seconds, and milliseconds if the `getUTC*` methods are
 5294    -1                   // buggy. Adapted from @Yaffle's `date-shim` project.
 5295    -1                   date = floor(value / 864e5);
 5296    -1                   for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++);
 5297    -1                   for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++);
 5298    -1                   date = 1 + date - getDay(year, month);
 5299    -1                   // The `time` value specifies the time within the day (see ES
 5300    -1                   // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used
 5301    -1                   // to compute `A modulo B`, as the `%` operator does not
 5302    -1                   // correspond to the `modulo` operation for negative numbers.
 5303    -1                   time = (value % 864e5 + 864e5) % 864e5;
 5304    -1                   // The hours, minutes, seconds, and milliseconds are obtained by
 5305    -1                   // decomposing the time within the day. See section 15.9.1.10.
 5306    -1                   hours = floor(time / 36e5) % 24;
 5307    -1                   minutes = floor(time / 6e4) % 60;
 5308    -1                   seconds = floor(time / 1e3) % 60;
 5309    -1                   milliseconds = time % 1e3;
 5310    -1                 } else {
 5311    -1                   year = value.getUTCFullYear();
 5312    -1                   month = value.getUTCMonth();
 5313    -1                   date = value.getUTCDate();
 5314    -1                   hours = value.getUTCHours();
 5315    -1                   minutes = value.getUTCMinutes();
 5316    -1                   seconds = value.getUTCSeconds();
 5317    -1                   milliseconds = value.getUTCMilliseconds();
 5318    -1                 }
 5319    -1                 // Serialize extended years correctly.
 5320    -1                 value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) +
 5321    -1                   "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) +
 5322    -1                   // Months, dates, hours, minutes, and seconds should have two
 5323    -1                   // digits; milliseconds should have three.
 5324    -1                   "T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) +
 5325    -1                   // Milliseconds are optional in ES 5.0, but required in 5.1.
 5326    -1                   "." + toPaddedString(3, milliseconds) + "Z";
 5327    -1               } else {
 5328    -1                 value = null;
 5329    -1               }
 5330    -1             } else if (typeof value.toJSON == "function" && ((className != numberClass && className != stringClass && className != arrayClass) || isProperty.call(value, "toJSON"))) {
 5331    -1               // Prototype <= 1.6.1 adds non-standard `toJSON` methods to the
 5332    -1               // `Number`, `String`, `Date`, and `Array` prototypes. JSON 3
 5333    -1               // ignores all `toJSON` methods on these objects unless they are
 5334    -1               // defined directly on an instance.
 5335    -1               value = value.toJSON(property);
 5336    -1             }
 5337    -1           }
 5338    -1           if (callback) {
 5339    -1             // If a replacement function was provided, call it to obtain the value
 5340    -1             // for serialization.
 5341    -1             value = callback.call(object, property, value);
 5342    -1           }
 5343    -1           if (value === null) {
 5344    -1             return "null";
 5345    -1           }
 5346    -1           className = getClass.call(value);
 5347    -1           if (className == booleanClass) {
 5348    -1             // Booleans are represented literally.
 5349    -1             return "" + value;
 5350    -1           } else if (className == numberClass) {
 5351    -1             // JSON numbers must be finite. `Infinity` and `NaN` are serialized as
 5352    -1             // `"null"`.
 5353    -1             return value > -1 / 0 && value < 1 / 0 ? "" + value : "null";
 5354    -1           } else if (className == stringClass) {
 5355    -1             // Strings are double-quoted and escaped.
 5356    -1             return quote("" + value);
 5357    -1           }
 5358    -1           // Recursively serialize objects and arrays.
 5359    -1           if (typeof value == "object") {
 5360    -1             // Check for cyclic structures. This is a linear search; performance
 5361    -1             // is inversely proportional to the number of unique nested objects.
 5362    -1             for (length = stack.length; length--;) {
 5363    -1               if (stack[length] === value) {
 5364    -1                 // Cyclic structures cannot be serialized by `JSON.stringify`.
 5365    -1                 throw TypeError();
 5366    -1               }
 5367    -1             }
 5368    -1             // Add the object to the stack of traversed objects.
 5369    -1             stack.push(value);
 5370    -1             results = [];
 5371    -1             // Save the current indentation level and indent one additional level.
 5372    -1             prefix = indentation;
 5373    -1             indentation += whitespace;
 5374    -1             if (className == arrayClass) {
 5375    -1               // Recursively serialize array elements.
 5376    -1               for (index = 0, length = value.length; index < length; index++) {
 5377    -1                 element = serialize(index, value, callback, properties, whitespace, indentation, stack);
 5378    -1                 results.push(element === undef ? "null" : element);
 5379    -1               }
 5380    -1               result = results.length ? (whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : ("[" + results.join(",") + "]")) : "[]";
 5381    -1             } else {
 5382    -1               // Recursively serialize object members. Members are selected from
 5383    -1               // either a user-specified list of property names, or the object
 5384    -1               // itself.
 5385    -1               forEach(properties || value, function (property) {
 5386    -1                 var element = serialize(property, value, callback, properties, whitespace, indentation, stack);
 5387    -1                 if (element !== undef) {
 5388    -1                   // According to ES 5.1 section 15.12.3: "If `gap` {whitespace}
 5389    -1                   // is not the empty string, let `member` {quote(property) + ":"}
 5390    -1                   // be the concatenation of `member` and the `space` character."
 5391    -1                   // The "`space` character" refers to the literal space
 5392    -1                   // character, not the `space` {width} argument provided to
 5393    -1                   // `JSON.stringify`.
 5394    -1                   results.push(quote(property) + ":" + (whitespace ? " " : "") + element);
 5395    -1                 }
 5396    -1               });
 5397    -1               result = results.length ? (whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : ("{" + results.join(",") + "}")) : "{}";
 5398    -1             }
 5399    -1             // Remove the object from the traversed object stack.
 5400    -1             stack.pop();
 5401    -1             return result;
 5402    -1           }
 5403    -1         };
 5404    -1 
 5405    -1         // Public: `JSON.stringify`. See ES 5.1 section 15.12.3.
 5406    -1         exports.stringify = function (source, filter, width) {
 5407    -1           var whitespace, callback, properties, className;
 5408    -1           if (objectTypes[typeof filter] && filter) {
 5409    -1             if ((className = getClass.call(filter)) == functionClass) {
 5410    -1               callback = filter;
 5411    -1             } else if (className == arrayClass) {
 5412    -1               // Convert the property names array into a makeshift set.
 5413    -1               properties = {};
 5414    -1               for (var index = 0, length = filter.length, value; index < length; value = filter[index++], ((className = getClass.call(value)), className == stringClass || className == numberClass) && (properties[value] = 1));
 5415    -1             }
 5416    -1           }
 5417    -1           if (width) {
 5418    -1             if ((className = getClass.call(width)) == numberClass) {
 5419    -1               // Convert the `width` to an integer and create a string containing
 5420    -1               // `width` number of space characters.
 5421    -1               if ((width -= width % 1) > 0) {
 5422    -1                 for (whitespace = "", width > 10 && (width = 10); whitespace.length < width; whitespace += " ");
 5423    -1               }
 5424    -1             } else if (className == stringClass) {
 5425    -1               whitespace = width.length <= 10 ? width : width.slice(0, 10);
 5426    -1             }
 5427    -1           }
 5428    -1           // Opera <= 7.54u2 discards the values associated with empty string keys
 5429    -1           // (`""`) only if they are used directly within an object member list
 5430    -1           // (e.g., `!("" in { "": 1})`).
 5431    -1           return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []);
 5432    -1         };
 5433    -1       }
 5434    -1 
 5435    -1       // Public: Parses a JSON source string.
 5436    -1       if (!has("json-parse")) {
 5437    -1         var fromCharCode = String.fromCharCode;
 5438    -1 
 5439    -1         // Internal: A map of escaped control characters and their unescaped
 5440    -1         // equivalents.
 5441    -1         var Unescapes = {
 5442    -1           92: "\\",
 5443    -1           34: '"',
 5444    -1           47: "/",
 5445    -1           98: "\b",
 5446    -1           116: "\t",
 5447    -1           110: "\n",
 5448    -1           102: "\f",
 5449    -1           114: "\r"
 5450    -1         };
 5451    -1 
 5452    -1         // Internal: Stores the parser state.
 5453    -1         var Index, Source;
 5454    -1 
 5455    -1         // Internal: Resets the parser state and throws a `SyntaxError`.
 5456    -1         var abort = function () {
 5457    -1           Index = Source = null;
 5458    -1           throw SyntaxError();
 5459    -1         };
 5460    -1 
 5461    -1         // Internal: Returns the next token, or `"$"` if the parser has reached
 5462    -1         // the end of the source string. A token may be a string, number, `null`
 5463    -1         // literal, or Boolean literal.
 5464    -1         var lex = function () {
 5465    -1           var source = Source, length = source.length, value, begin, position, isSigned, charCode;
 5466    -1           while (Index < length) {
 5467    -1             charCode = source.charCodeAt(Index);
 5468    -1             switch (charCode) {
 5469    -1               case 9: case 10: case 13: case 32:
 5470    -1                 // Skip whitespace tokens, including tabs, carriage returns, line
 5471    -1                 // feeds, and space characters.
 5472    -1                 Index++;
 5473    -1                 break;
 5474    -1               case 123: case 125: case 91: case 93: case 58: case 44:
 5475    -1                 // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at
 5476    -1                 // the current position.
 5477    -1                 value = charIndexBuggy ? source.charAt(Index) : source[Index];
 5478    -1                 Index++;
 5479    -1                 return value;
 5480    -1               case 34:
 5481    -1                 // `"` delimits a JSON string; advance to the next character and
 5482    -1                 // begin parsing the string. String tokens are prefixed with the
 5483    -1                 // sentinel `@` character to distinguish them from punctuators and
 5484    -1                 // end-of-string tokens.
 5485    -1                 for (value = "@", Index++; Index < length;) {
 5486    -1                   charCode = source.charCodeAt(Index);
 5487    -1                   if (charCode < 32) {
 5488    -1                     // Unescaped ASCII control characters (those with a code unit
 5489    -1                     // less than the space character) are not permitted.
 5490    -1                     abort();
 5491    -1                   } else if (charCode == 92) {
 5492    -1                     // A reverse solidus (`\`) marks the beginning of an escaped
 5493    -1                     // control character (including `"`, `\`, and `/`) or Unicode
 5494    -1                     // escape sequence.
 5495    -1                     charCode = source.charCodeAt(++Index);
 5496    -1                     switch (charCode) {
 5497    -1                       case 92: case 34: case 47: case 98: case 116: case 110: case 102: case 114:
 5498    -1                         // Revive escaped control characters.
 5499    -1                         value += Unescapes[charCode];
 5500    -1                         Index++;
 5501    -1                         break;
 5502    -1                       case 117:
 5503    -1                         // `\u` marks the beginning of a Unicode escape sequence.
 5504    -1                         // Advance to the first character and validate the
 5505    -1                         // four-digit code point.
 5506    -1                         begin = ++Index;
 5507    -1                         for (position = Index + 4; Index < position; Index++) {
 5508    -1                           charCode = source.charCodeAt(Index);
 5509    -1                           // A valid sequence comprises four hexdigits (case-
 5510    -1                           // insensitive) that form a single hexadecimal value.
 5511    -1                           if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) {
 5512    -1                             // Invalid Unicode escape sequence.
 5513    -1                             abort();
 5514    -1                           }
 5515    -1                         }
 5516    -1                         // Revive the escaped character.
 5517    -1                         value += fromCharCode("0x" + source.slice(begin, Index));
 5518    -1                         break;
 5519    -1                       default:
 5520    -1                         // Invalid escape sequence.
 5521    -1                         abort();
 5522    -1                     }
 5523    -1                   } else {
 5524    -1                     if (charCode == 34) {
 5525    -1                       // An unescaped double-quote character marks the end of the
 5526    -1                       // string.
 5527    -1                       break;
 5528    -1                     }
 5529    -1                     charCode = source.charCodeAt(Index);
 5530    -1                     begin = Index;
 5531    -1                     // Optimize for the common case where a string is valid.
 5532    -1                     while (charCode >= 32 && charCode != 92 && charCode != 34) {
 5533    -1                       charCode = source.charCodeAt(++Index);
 5534    -1                     }
 5535    -1                     // Append the string as-is.
 5536    -1                     value += source.slice(begin, Index);
 5537    -1                   }
 5538    -1                 }
 5539    -1                 if (source.charCodeAt(Index) == 34) {
 5540    -1                   // Advance to the next character and return the revived string.
 5541    -1                   Index++;
 5542    -1                   return value;
 5543    -1                 }
 5544    -1                 // Unterminated string.
 5545    -1                 abort();
 5546    -1               default:
 5547    -1                 // Parse numbers and literals.
 5548    -1                 begin = Index;
 5549    -1                 // Advance past the negative sign, if one is specified.
 5550    -1                 if (charCode == 45) {
 5551    -1                   isSigned = true;
 5552    -1                   charCode = source.charCodeAt(++Index);
 5553    -1                 }
 5554    -1                 // Parse an integer or floating-point value.
 5555    -1                 if (charCode >= 48 && charCode <= 57) {
 5556    -1                   // Leading zeroes are interpreted as octal literals.
 5557    -1                   if (charCode == 48 && ((charCode = source.charCodeAt(Index + 1)), charCode >= 48 && charCode <= 57)) {
 5558    -1                     // Illegal octal literal.
 5559    -1                     abort();
 5560    -1                   }
 5561    -1                   isSigned = false;
 5562    -1                   // Parse the integer component.
 5563    -1                   for (; Index < length && ((charCode = source.charCodeAt(Index)), charCode >= 48 && charCode <= 57); Index++);
 5564    -1                   // Floats cannot contain a leading decimal point; however, this
 5565    -1                   // case is already accounted for by the parser.
 5566    -1                   if (source.charCodeAt(Index) == 46) {
 5567    -1                     position = ++Index;
 5568    -1                     // Parse the decimal component.
 5569    -1                     for (; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++);
 5570    -1                     if (position == Index) {
 5571    -1                       // Illegal trailing decimal.
 5572    -1                       abort();
 5573    -1                     }
 5574    -1                     Index = position;
 5575    -1                   }
 5576    -1                   // Parse exponents. The `e` denoting the exponent is
 5577    -1                   // case-insensitive.
 5578    -1                   charCode = source.charCodeAt(Index);
 5579    -1                   if (charCode == 101 || charCode == 69) {
 5580    -1                     charCode = source.charCodeAt(++Index);
 5581    -1                     // Skip past the sign following the exponent, if one is
 5582    -1                     // specified.
 5583    -1                     if (charCode == 43 || charCode == 45) {
 5584    -1                       Index++;
 5585    -1                     }
 5586    -1                     // Parse the exponential component.
 5587    -1                     for (position = Index; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++);
 5588    -1                     if (position == Index) {
 5589    -1                       // Illegal empty exponent.
 5590    -1                       abort();
 5591    -1                     }
 5592    -1                     Index = position;
 5593    -1                   }
 5594    -1                   // Coerce the parsed value to a JavaScript number.
 5595    -1                   return +source.slice(begin, Index);
 5596    -1                 }
 5597    -1                 // A negative sign may only precede numbers.
 5598    -1                 if (isSigned) {
 5599    -1                   abort();
 5600    -1                 }
 5601    -1                 // `true`, `false`, and `null` literals.
 5602    -1                 if (source.slice(Index, Index + 4) == "true") {
 5603    -1                   Index += 4;
 5604    -1                   return true;
 5605    -1                 } else if (source.slice(Index, Index + 5) == "false") {
 5606    -1                   Index += 5;
 5607    -1                   return false;
 5608    -1                 } else if (source.slice(Index, Index + 4) == "null") {
 5609    -1                   Index += 4;
 5610    -1                   return null;
 5611    -1                 }
 5612    -1                 // Unrecognized token.
 5613    -1                 abort();
 5614    -1             }
 5615    -1           }
 5616    -1           // Return the sentinel `$` character if the parser has reached the end
 5617    -1           // of the source string.
 5618    -1           return "$";
 5619    -1         };
 5620    -1 
 5621    -1         // Internal: Parses a JSON `value` token.
 5622    -1         var get = function (value) {
 5623    -1           var results, hasMembers;
 5624    -1           if (value == "$") {
 5625    -1             // Unexpected end of input.
 5626    -1             abort();
 5627    -1           }
 5628    -1           if (typeof value == "string") {
 5629    -1             if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") {
 5630    -1               // Remove the sentinel `@` character.
 5631    -1               return value.slice(1);
 5632    -1             }
 5633    -1             // Parse object and array literals.
 5634    -1             if (value == "[") {
 5635    -1               // Parses a JSON array, returning a new JavaScript array.
 5636    -1               results = [];
 5637    -1               for (;; hasMembers || (hasMembers = true)) {
 5638    -1                 value = lex();
 5639    -1                 // A closing square bracket marks the end of the array literal.
 5640    -1                 if (value == "]") {
 5641    -1                   break;
 5642    -1                 }
 5643    -1                 // If the array literal contains elements, the current token
 5644    -1                 // should be a comma separating the previous element from the
 5645    -1                 // next.
 5646    -1                 if (hasMembers) {
 5647    -1                   if (value == ",") {
 5648    -1                     value = lex();
 5649    -1                     if (value == "]") {
 5650    -1                       // Unexpected trailing `,` in array literal.
 5651    -1                       abort();
 5652    -1                     }
 5653    -1                   } else {
 5654    -1                     // A `,` must separate each array element.
 5655    -1                     abort();
 5656    -1                   }
 5657    -1                 }
 5658    -1                 // Elisions and leading commas are not permitted.
 5659    -1                 if (value == ",") {
 5660    -1                   abort();
 5661    -1                 }
 5662    -1                 results.push(get(value));
 5663    -1               }
 5664    -1               return results;
 5665    -1             } else if (value == "{") {
 5666    -1               // Parses a JSON object, returning a new JavaScript object.
 5667    -1               results = {};
 5668    -1               for (;; hasMembers || (hasMembers = true)) {
 5669    -1                 value = lex();
 5670    -1                 // A closing curly brace marks the end of the object literal.
 5671    -1                 if (value == "}") {
 5672    -1                   break;
 5673    -1                 }
 5674    -1                 // If the object literal contains members, the current token
 5675    -1                 // should be a comma separator.
 5676    -1                 if (hasMembers) {
 5677    -1                   if (value == ",") {
 5678    -1                     value = lex();
 5679    -1                     if (value == "}") {
 5680    -1                       // Unexpected trailing `,` in object literal.
 5681    -1                       abort();
 5682    -1                     }
 5683    -1                   } else {
 5684    -1                     // A `,` must separate each object member.
 5685    -1                     abort();
 5686    -1                   }
 5687    -1                 }
 5688    -1                 // Leading commas are not permitted, object property names must be
 5689    -1                 // double-quoted strings, and a `:` must separate each property
 5690    -1                 // name and value.
 5691    -1                 if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value[0]) != "@" || lex() != ":") {
 5692    -1                   abort();
 5693    -1                 }
 5694    -1                 results[value.slice(1)] = get(lex());
 5695    -1               }
 5696    -1               return results;
 5697    -1             }
 5698    -1             // Unexpected token encountered.
 5699    -1             abort();
 5700    -1           }
 5701    -1           return value;
 5702    -1         };
 5703    -1 
 5704    -1         // Internal: Updates a traversed object member.
 5705    -1         var update = function (source, property, callback) {
 5706    -1           var element = walk(source, property, callback);
 5707    -1           if (element === undef) {
 5708    -1             delete source[property];
 5709    -1           } else {
 5710    -1             source[property] = element;
 5711    -1           }
 5712    -1         };
 5713    -1 
 5714    -1         // Internal: Recursively traverses a parsed JSON object, invoking the
 5715    -1         // `callback` function for each value. This is an implementation of the
 5716    -1         // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2.
 5717    -1         var walk = function (source, property, callback) {
 5718    -1           var value = source[property], length;
 5719    -1           if (typeof value == "object" && value) {
 5720    -1             // `forEach` can't be used to traverse an array in Opera <= 8.54
 5721    -1             // because its `Object#hasOwnProperty` implementation returns `false`
 5722    -1             // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`).
 5723    -1             if (getClass.call(value) == arrayClass) {
 5724    -1               for (length = value.length; length--;) {
 5725    -1                 update(value, length, callback);
 5726    -1               }
 5727    -1             } else {
 5728    -1               forEach(value, function (property) {
 5729    -1                 update(value, property, callback);
 5730    -1               });
 5731    -1             }
 5732    -1           }
 5733    -1           return callback.call(source, property, value);
 5734    -1         };
 5735    -1 
 5736    -1         // Public: `JSON.parse`. See ES 5.1 section 15.12.2.
 5737    -1         exports.parse = function (source, callback) {
 5738    -1           var result, value;
 5739    -1           Index = 0;
 5740    -1           Source = "" + source;
 5741    -1           result = get(lex());
 5742    -1           // If a JSON string contains multiple tokens, it is invalid.
 5743    -1           if (lex() != "$") {
 5744    -1             abort();
 5745    -1           }
 5746    -1           // Reset the parser state.
 5747    -1           Index = Source = null;
 5748    -1           return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result;
 5749    -1         };
 5750    -1       }
 5751    -1     }
 5752    -1 
 5753    -1     exports["runInContext"] = runInContext;
 5754    -1     return exports;
 5755    -1   }
 5756    -1 
 5757    -1   if (freeExports && !isLoader) {
 5758    -1     // Export for CommonJS environments.
 5759    -1     runInContext(root, freeExports);
 5760    -1   } else {
 5761    -1     // Export for web browsers and JavaScript engines.
 5762    -1     var nativeJSON = root.JSON,
 5763    -1         previousJSON = root["JSON3"],
 5764    -1         isRestored = false;
 5765    -1 
 5766    -1     var JSON3 = runInContext(root, (root["JSON3"] = {
 5767    -1       // Public: Restores the original value of the global `JSON` object and
 5768    -1       // returns a reference to the `JSON3` object.
 5769    -1       "noConflict": function () {
 5770    -1         if (!isRestored) {
 5771    -1           isRestored = true;
 5772    -1           root.JSON = nativeJSON;
 5773    -1           root["JSON3"] = previousJSON;
 5774    -1           nativeJSON = previousJSON = null;
 5775    -1         }
 5776    -1         return JSON3;
 5777    -1       }
 5778    -1     }));
 5779    -1 
 5780    -1     root.JSON = {
 5781    -1       "parse": JSON3.parse,
 5782    -1       "stringify": JSON3.stringify
 5783    -1     };
 5784    -1   }
 5785    -1 
 5786    -1   // Export for asynchronous module loaders.
 5787    -1   if (isLoader) {
 5788    -1     define(function () {
 5789    -1       return JSON3;
 5790    -1     });
 5791    -1   }
 5792    -1 }).call(this);
 5793    -1 
 5794    -1 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 5795    -1 },{}],34:[function(require,module,exports){
 5796    -1 'use strict';
 5797    -1 
 5798    -1 
 5799    -1 ////////////////////////////////////////////////////////////////////////////////
 5800    -1 // Helpers
 5801    -1 
 5802    -1 // Merge objects
 5803    -1 //
 5804    -1 function assign(obj /*from1, from2, from3, ...*/) {
 5805    -1   var sources = Array.prototype.slice.call(arguments, 1);
 5806    -1 
 5807    -1   sources.forEach(function (source) {
 5808    -1     if (!source) { return; }
 5809    -1 
 5810    -1     Object.keys(source).forEach(function (key) {
 5811    -1       obj[key] = source[key];
 5812    -1     });
 5813    -1   });
 5814    -1 
 5815    -1   return obj;
 5816    -1 }
 5817    -1 
 5818    -1 function _class(obj) { return Object.prototype.toString.call(obj); }
 5819    -1 function isString(obj) { return _class(obj) === '[object String]'; }
 5820    -1 function isObject(obj) { return _class(obj) === '[object Object]'; }
 5821    -1 function isRegExp(obj) { return _class(obj) === '[object RegExp]'; }
 5822    -1 function isFunction(obj) { return _class(obj) === '[object Function]'; }
 5823    -1 
 5824    -1 
 5825    -1 function escapeRE(str) { return str.replace(/[.?*+^$[\]\\(){}|-]/g, '\\$&'); }
 5826    -1 
 5827    -1 ////////////////////////////////////////////////////////////////////////////////
 5828    -1 
 5829    -1 
 5830    -1 var defaultOptions = {
 5831    -1   fuzzyLink: true,
 5832    -1   fuzzyEmail: true,
 5833    -1   fuzzyIP: false
 5834    -1 };
 5835    -1 
 5836    -1 
 5837    -1 function isOptionsObj(obj) {
 5838    -1   return Object.keys(obj || {}).reduce(function (acc, k) {
 5839    -1     return acc || defaultOptions.hasOwnProperty(k);
 5840    -1   }, false);
 5841    -1 }
 5842    -1 
 5843    -1 
 5844    -1 var defaultSchemas = {
 5845    -1   'http:': {
 5846    -1     validate: function (text, pos, self) {
 5847    -1       var tail = text.slice(pos);
 5848    -1 
 5849    -1       if (!self.re.http) {
 5850    -1         // compile lazily, because "host"-containing variables can change on tlds update.
 5851    -1         self.re.http =  new RegExp(
 5852    -1           '^\\/\\/' + self.re.src_auth + self.re.src_host_port_strict + self.re.src_path, 'i'
 5853    -1         );
 5854    -1       }
 5855    -1       if (self.re.http.test(tail)) {
 5856    -1         return tail.match(self.re.http)[0].length;
 5857    -1       }
 5858    -1       return 0;
 5859    -1     }
 5860    -1   },
 5861    -1   'https:':  'http:',
 5862    -1   'ftp:':    'http:',
 5863    -1   '//':      {
 5864    -1     validate: function (text, pos, self) {
 5865    -1       var tail = text.slice(pos);
 5866    -1 
 5867    -1       if (!self.re.no_http) {
 5868    -1       // compile lazily, because "host"-containing variables can change on tlds update.
 5869    -1         self.re.no_http =  new RegExp(
 5870    -1           '^' +
 5871    -1           self.re.src_auth +
 5872    -1           // Don't allow single-level domains, because of false positives like '//test'
 5873    -1           // with code comments
 5874    -1           '(?:localhost|(?:(?:' + self.re.src_domain + ')\\.)+' + self.re.src_domain_root + ')' +
 5875    -1           self.re.src_port +
 5876    -1           self.re.src_host_terminator +
 5877    -1           self.re.src_path,
 5878    -1 
 5879    -1           'i'
 5880    -1         );
 5881    -1       }
 5882    -1 
 5883    -1       if (self.re.no_http.test(tail)) {
 5884    -1         // should not be `://` & `///`, that protects from errors in protocol name
 5885    -1         if (pos >= 3 && text[pos - 3] === ':') { return 0; }
 5886    -1         if (pos >= 3 && text[pos - 3] === '/') { return 0; }
 5887    -1         return tail.match(self.re.no_http)[0].length;
 5888    -1       }
 5889    -1       return 0;
 5890    -1     }
 5891    -1   },
 5892    -1   'mailto:': {
 5893    -1     validate: function (text, pos, self) {
 5894    -1       var tail = text.slice(pos);
 5895    -1 
 5896    -1       if (!self.re.mailto) {
 5897    -1         self.re.mailto =  new RegExp(
 5898    -1           '^' + self.re.src_email_name + '@' + self.re.src_host_strict, 'i'
 5899    -1         );
 5900    -1       }
 5901    -1       if (self.re.mailto.test(tail)) {
 5902    -1         return tail.match(self.re.mailto)[0].length;
 5903    -1       }
 5904    -1       return 0;
 5905    -1     }
 5906    -1   }
 5907    -1 };
 5908    -1 
 5909    -1 /*eslint-disable max-len*/
 5910    -1 
 5911    -1 // RE pattern for 2-character tlds (autogenerated by ./support/tlds_2char_gen.js)
 5912    -1 var tlds_2ch_src_re = 'a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]';
 5913    -1 
 5914    -1 // DON'T try to make PRs with changes. Extend TLDs with LinkifyIt.tlds() instead
 5915    -1 var tlds_default = 'biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф'.split('|');
 5916    -1 
 5917    -1 /*eslint-enable max-len*/
 5918    -1 
 5919    -1 ////////////////////////////////////////////////////////////////////////////////
 5920    -1 
 5921    -1 function resetScanCache(self) {
 5922    -1   self.__index__ = -1;
 5923    -1   self.__text_cache__   = '';
 5924    -1 }
 5925    -1 
 5926    -1 function createValidator(re) {
 5927    -1   return function (text, pos) {
 5928    -1     var tail = text.slice(pos);
 5929    -1 
 5930    -1     if (re.test(tail)) {
 5931    -1       return tail.match(re)[0].length;
 5932    -1     }
 5933    -1     return 0;
 5934    -1   };
 5935    -1 }
 5936    -1 
 5937    -1 function createNormalizer() {
 5938    -1   return function (match, self) {
 5939    -1     self.normalize(match);
 5940    -1   };
 5941    -1 }
 5942    -1 
 5943    -1 // Schemas compiler. Build regexps.
 5944    -1 //
 5945    -1 function compile(self) {
 5946    -1 
 5947    -1   // Load & clone RE patterns.
 5948    -1   var re = self.re = require('./lib/re')(self.__opts__);
 5949    -1 
 5950    -1   // Define dynamic patterns
 5951    -1   var tlds = self.__tlds__.slice();
 5952    -1 
 5953    -1   self.onCompile();
 5954    -1 
 5955    -1   if (!self.__tlds_replaced__) {
 5956    -1     tlds.push(tlds_2ch_src_re);
 5957    -1   }
 5958    -1   tlds.push(re.src_xn);
 5959    -1 
 5960    -1   re.src_tlds = tlds.join('|');
 5961    -1 
 5962    -1   function untpl(tpl) { return tpl.replace('%TLDS%', re.src_tlds); }
 5963    -1 
 5964    -1   re.email_fuzzy      = RegExp(untpl(re.tpl_email_fuzzy), 'i');
 5965    -1   re.link_fuzzy       = RegExp(untpl(re.tpl_link_fuzzy), 'i');
 5966    -1   re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), 'i');
 5967    -1   re.host_fuzzy_test  = RegExp(untpl(re.tpl_host_fuzzy_test), 'i');
 5968    -1 
 5969    -1   //
 5970    -1   // Compile each schema
 5971    -1   //
 5972    -1 
 5973    -1   var aliases = [];
 5974    -1 
 5975    -1   self.__compiled__ = {}; // Reset compiled data
 5976    -1 
 5977    -1   function schemaError(name, val) {
 5978    -1     throw new Error('(LinkifyIt) Invalid schema "' + name + '": ' + val);
 5979    -1   }
 5980    -1 
 5981    -1   Object.keys(self.__schemas__).forEach(function (name) {
 5982    -1     var val = self.__schemas__[name];
 5983    -1 
 5984    -1     // skip disabled methods
 5985    -1     if (val === null) { return; }
 5986    -1 
 5987    -1     var compiled = { validate: null, link: null };
 5988    -1 
 5989    -1     self.__compiled__[name] = compiled;
 5990    -1 
 5991    -1     if (isObject(val)) {
 5992    -1       if (isRegExp(val.validate)) {
 5993    -1         compiled.validate = createValidator(val.validate);
 5994    -1       } else if (isFunction(val.validate)) {
 5995    -1         compiled.validate = val.validate;
 5996    -1       } else {
 5997    -1         schemaError(name, val);
 5998    -1       }
 5999    -1 
 6000    -1       if (isFunction(val.normalize)) {
 6001    -1         compiled.normalize = val.normalize;
 6002    -1       } else if (!val.normalize) {
 6003    -1         compiled.normalize = createNormalizer();
 6004    -1       } else {
 6005    -1         schemaError(name, val);
 6006    -1       }
 6007    -1 
 6008    -1       return;
 6009    -1     }
 6010    -1 
 6011    -1     if (isString(val)) {
 6012    -1       aliases.push(name);
 6013    -1       return;
 6014    -1     }
 6015    -1 
 6016    -1     schemaError(name, val);
 6017    -1   });
 6018    -1 
 6019    -1   //
 6020    -1   // Compile postponed aliases
 6021    -1   //
 6022    -1 
 6023    -1   aliases.forEach(function (alias) {
 6024    -1     if (!self.__compiled__[self.__schemas__[alias]]) {
 6025    -1       // Silently fail on missed schemas to avoid errons on disable.
 6026    -1       // schemaError(alias, self.__schemas__[alias]);
 6027    -1       return;
 6028    -1     }
 6029    -1 
 6030    -1     self.__compiled__[alias].validate =
 6031    -1       self.__compiled__[self.__schemas__[alias]].validate;
 6032    -1     self.__compiled__[alias].normalize =
 6033    -1       self.__compiled__[self.__schemas__[alias]].normalize;
 6034    -1   });
 6035    -1 
 6036    -1   //
 6037    -1   // Fake record for guessed links
 6038    -1   //
 6039    -1   self.__compiled__[''] = { validate: null, normalize: createNormalizer() };
 6040    -1 
 6041    -1   //
 6042    -1   // Build schema condition
 6043    -1   //
 6044    -1   var slist = Object.keys(self.__compiled__)
 6045    -1                       .filter(function (name) {
 6046    -1                         // Filter disabled & fake schemas
 6047    -1                         return name.length > 0 && self.__compiled__[name];
 6048    -1                       })
 6049    -1                       .map(escapeRE)
 6050    -1                       .join('|');
 6051    -1   // (?!_) cause 1.5x slowdown
 6052    -1   self.re.schema_test   = RegExp('(^|(?!_)(?:[><\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'i');
 6053    -1   self.re.schema_search = RegExp('(^|(?!_)(?:[><\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'ig');
 6054    -1 
 6055    -1   self.re.pretest       = RegExp(
 6056    -1                             '(' + self.re.schema_test.source + ')|' +
 6057    -1                             '(' + self.re.host_fuzzy_test.source + ')|' +
 6058    -1                             '@',
 6059    -1                             'i');
 6060    -1 
 6061    -1   //
 6062    -1   // Cleanup
 6063    -1   //
 6064    -1 
 6065    -1   resetScanCache(self);
 6066    -1 }
 6067    -1 
 6068    -1 /**
 6069    -1  * class Match
 6070    -1  *
 6071    -1  * Match result. Single element of array, returned by [[LinkifyIt#match]]
 6072    -1  **/
 6073    -1 function Match(self, shift) {
 6074    -1   var start = self.__index__,
 6075    -1       end   = self.__last_index__,
 6076    -1       text  = self.__text_cache__.slice(start, end);
 6077    -1 
 6078    -1   /**
 6079    -1    * Match#schema -> String
 6080    -1    *
 6081    -1    * Prefix (protocol) for matched string.
 6082    -1    **/
 6083    -1   this.schema    = self.__schema__.toLowerCase();
 6084    -1   /**
 6085    -1    * Match#index -> Number
 6086    -1    *
 6087    -1    * First position of matched string.
 6088    -1    **/
 6089    -1   this.index     = start + shift;
 6090    -1   /**
 6091    -1    * Match#lastIndex -> Number
 6092    -1    *
 6093    -1    * Next position after matched string.
 6094    -1    **/
 6095    -1   this.lastIndex = end + shift;
 6096    -1   /**
 6097    -1    * Match#raw -> String
 6098    -1    *
 6099    -1    * Matched string.
 6100    -1    **/
 6101    -1   this.raw       = text;
 6102    -1   /**
 6103    -1    * Match#text -> String
 6104    -1    *
 6105    -1    * Notmalized text of matched string.
 6106    -1    **/
 6107    -1   this.text      = text;
 6108    -1   /**
 6109    -1    * Match#url -> String
 6110    -1    *
 6111    -1    * Normalized url of matched string.
 6112    -1    **/
 6113    -1   this.url       = text;
 6114    -1 }
 6115    -1 
 6116    -1 function createMatch(self, shift) {
 6117    -1   var match = new Match(self, shift);
 6118    -1 
 6119    -1   self.__compiled__[match.schema].normalize(match, self);
 6120    -1 
 6121    -1   return match;
 6122    -1 }
 6123    -1 
 6124    -1 
 6125    -1 /**
 6126    -1  * class LinkifyIt
 6127    -1  **/
 6128    -1 
 6129    -1 /**
 6130    -1  * new LinkifyIt(schemas, options)
 6131    -1  * - schemas (Object): Optional. Additional schemas to validate (prefix/validator)
 6132    -1  * - options (Object): { fuzzyLink|fuzzyEmail|fuzzyIP: true|false }
 6133    -1  *
 6134    -1  * Creates new linkifier instance with optional additional schemas.
 6135    -1  * Can be called without `new` keyword for convenience.
 6136    -1  *
 6137    -1  * By default understands:
 6138    -1  *
 6139    -1  * - `http(s)://...` , `ftp://...`, `mailto:...` & `//...` links
 6140    -1  * - "fuzzy" links and emails (example.com, foo@bar.com).
 6141    -1  *
 6142    -1  * `schemas` is an object, where each key/value describes protocol/rule:
 6143    -1  *
 6144    -1  * - __key__ - link prefix (usually, protocol name with `:` at the end, `skype:`
 6145    -1  *   for example). `linkify-it` makes shure that prefix is not preceeded with
 6146    -1  *   alphanumeric char and symbols. Only whitespaces and punctuation allowed.
 6147    -1  * - __value__ - rule to check tail after link prefix
 6148    -1  *   - _String_ - just alias to existing rule
 6149    -1  *   - _Object_
 6150    -1  *     - _validate_ - validator function (should return matched length on success),
 6151    -1  *       or `RegExp`.
 6152    -1  *     - _normalize_ - optional function to normalize text & url of matched result
 6153    -1  *       (for example, for @twitter mentions).
 6154    -1  *
 6155    -1  * `options`:
 6156    -1  *
 6157    -1  * - __fuzzyLink__ - recognige URL-s without `http(s):` prefix. Default `true`.
 6158    -1  * - __fuzzyIP__ - allow IPs in fuzzy links above. Can conflict with some texts
 6159    -1  *   like version numbers. Default `false`.
 6160    -1  * - __fuzzyEmail__ - recognize emails without `mailto:` prefix.
 6161    -1  *
 6162    -1  **/
 6163    -1 function LinkifyIt(schemas, options) {
 6164    -1   if (!(this instanceof LinkifyIt)) {
 6165    -1     return new LinkifyIt(schemas, options);
 6166    -1   }
 6167    -1 
 6168    -1   if (!options) {
 6169    -1     if (isOptionsObj(schemas)) {
 6170    -1       options = schemas;
 6171    -1       schemas = {};
 6172    -1     }
 6173    -1   }
 6174    -1 
 6175    -1   this.__opts__           = assign({}, defaultOptions, options);
 6176    -1 
 6177    -1   // Cache last tested result. Used to skip repeating steps on next `match` call.
 6178    -1   this.__index__          = -1;
 6179    -1   this.__last_index__     = -1; // Next scan position
 6180    -1   this.__schema__         = '';
 6181    -1   this.__text_cache__     = '';
 6182    -1 
 6183    -1   this.__schemas__        = assign({}, defaultSchemas, schemas);
 6184    -1   this.__compiled__       = {};
 6185    -1 
 6186    -1   this.__tlds__           = tlds_default;
 6187    -1   this.__tlds_replaced__  = false;
 6188    -1 
 6189    -1   this.re = {};
 6190    -1 
 6191    -1   compile(this);
 6192    -1 }
 6193    -1 
 6194    -1 
 6195    -1 /** chainable
 6196    -1  * LinkifyIt#add(schema, definition)
 6197    -1  * - schema (String): rule name (fixed pattern prefix)
 6198    -1  * - definition (String|RegExp|Object): schema definition
 6199    -1  *
 6200    -1  * Add new rule definition. See constructor description for details.
 6201    -1  **/
 6202    -1 LinkifyIt.prototype.add = function add(schema, definition) {
 6203    -1   this.__schemas__[schema] = definition;
 6204    -1   compile(this);
 6205    -1   return this;
 6206    -1 };
 6207    -1 
 6208    -1 
 6209    -1 /** chainable
 6210    -1  * LinkifyIt#set(options)
 6211    -1  * - options (Object): { fuzzyLink|fuzzyEmail|fuzzyIP: true|false }
 6212    -1  *
 6213    -1  * Set recognition options for links without schema.
 6214    -1  **/
 6215    -1 LinkifyIt.prototype.set = function set(options) {
 6216    -1   this.__opts__ = assign(this.__opts__, options);
 6217    -1   return this;
 6218    -1 };
 6219    -1 
 6220    -1 
 6221    -1 /**
 6222    -1  * LinkifyIt#test(text) -> Boolean
 6223    -1  *
 6224    -1  * Searches linkifiable pattern and returns `true` on success or `false` on fail.
 6225    -1  **/
 6226    -1 LinkifyIt.prototype.test = function test(text) {
 6227    -1   // Reset scan cache
 6228    -1   this.__text_cache__ = text;
 6229    -1   this.__index__      = -1;
 6230    -1 
 6231    -1   if (!text.length) { return false; }
 6232    -1 
 6233    -1   var m, ml, me, len, shift, next, re, tld_pos, at_pos;
 6234    -1 
 6235    -1   // try to scan for link with schema - that's the most simple rule
 6236    -1   if (this.re.schema_test.test(text)) {
 6237    -1     re = this.re.schema_search;
 6238    -1     re.lastIndex = 0;
 6239    -1     while ((m = re.exec(text)) !== null) {
 6240    -1       len = this.testSchemaAt(text, m[2], re.lastIndex);
 6241    -1       if (len) {
 6242    -1         this.__schema__     = m[2];
 6243    -1         this.__index__      = m.index + m[1].length;
 6244    -1         this.__last_index__ = m.index + m[0].length + len;
 6245    -1         break;
 6246    -1       }
 6247    -1     }
 6248    -1   }
 6249    -1 
 6250    -1   if (this.__opts__.fuzzyLink && this.__compiled__['http:']) {
 6251    -1     // guess schemaless links
 6252    -1     tld_pos = text.search(this.re.host_fuzzy_test);
 6253    -1     if (tld_pos >= 0) {
 6254    -1       // if tld is located after found link - no need to check fuzzy pattern
 6255    -1       if (this.__index__ < 0 || tld_pos < this.__index__) {
 6256    -1         if ((ml = text.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy)) !== null) {
 6257    -1 
 6258    -1           shift = ml.index + ml[1].length;
 6259    -1 
 6260    -1           if (this.__index__ < 0 || shift < this.__index__) {
 6261    -1             this.__schema__     = '';
 6262    -1             this.__index__      = shift;
 6263    -1             this.__last_index__ = ml.index + ml[0].length;
 6264    -1           }
 6265    -1         }
 6266    -1       }
 6267    -1     }
 6268    -1   }
 6269    -1 
 6270    -1   if (this.__opts__.fuzzyEmail && this.__compiled__['mailto:']) {
 6271    -1     // guess schemaless emails
 6272    -1     at_pos = text.indexOf('@');
 6273    -1     if (at_pos >= 0) {
 6274    -1       // We can't skip this check, because this cases are possible:
 6275    -1       // 192.168.1.1@gmail.com, my.in@example.com
 6276    -1       if ((me = text.match(this.re.email_fuzzy)) !== null) {
 6277    -1 
 6278    -1         shift = me.index + me[1].length;
 6279    -1         next  = me.index + me[0].length;
 6280    -1 
 6281    -1         if (this.__index__ < 0 || shift < this.__index__ ||
 6282    -1             (shift === this.__index__ && next > this.__last_index__)) {
 6283    -1           this.__schema__     = 'mailto:';
 6284    -1           this.__index__      = shift;
 6285    -1           this.__last_index__ = next;
 6286    -1         }
 6287    -1       }
 6288    -1     }
 6289    -1   }
 6290    -1 
 6291    -1   return this.__index__ >= 0;
 6292    -1 };
 6293    -1 
 6294    -1 
 6295    -1 /**
 6296    -1  * LinkifyIt#pretest(text) -> Boolean
 6297    -1  *
 6298    -1  * Very quick check, that can give false positives. Returns true if link MAY BE
 6299    -1  * can exists. Can be used for speed optimization, when you need to check that
 6300    -1  * link NOT exists.
 6301    -1  **/
 6302    -1 LinkifyIt.prototype.pretest = function pretest(text) {
 6303    -1   return this.re.pretest.test(text);
 6304    -1 };
 6305    -1 
 6306    -1 
 6307    -1 /**
 6308    -1  * LinkifyIt#testSchemaAt(text, name, position) -> Number
 6309    -1  * - text (String): text to scan
 6310    -1  * - name (String): rule (schema) name
 6311    -1  * - position (Number): text offset to check from
 6312    -1  *
 6313    -1  * Similar to [[LinkifyIt#test]] but checks only specific protocol tail exactly
 6314    -1  * at given position. Returns length of found pattern (0 on fail).
 6315    -1  **/
 6316    -1 LinkifyIt.prototype.testSchemaAt = function testSchemaAt(text, schema, pos) {
 6317    -1   // If not supported schema check requested - terminate
 6318    -1   if (!this.__compiled__[schema.toLowerCase()]) {
 6319    -1     return 0;
 6320    -1   }
 6321    -1   return this.__compiled__[schema.toLowerCase()].validate(text, pos, this);
 6322    -1 };
 6323    -1 
 6324    -1 
 6325    -1 /**
 6326    -1  * LinkifyIt#match(text) -> Array|null
 6327    -1  *
 6328    -1  * Returns array of found link descriptions or `null` on fail. We strongly
 6329    -1  * recommend to use [[LinkifyIt#test]] first, for best speed.
 6330    -1  *
 6331    -1  * ##### Result match description
 6332    -1  *
 6333    -1  * - __schema__ - link schema, can be empty for fuzzy links, or `//` for
 6334    -1  *   protocol-neutral  links.
 6335    -1  * - __index__ - offset of matched text
 6336    -1  * - __lastIndex__ - index of next char after mathch end
 6337    -1  * - __raw__ - matched text
 6338    -1  * - __text__ - normalized text
 6339    -1  * - __url__ - link, generated from matched text
 6340    -1  **/
 6341    -1 LinkifyIt.prototype.match = function match(text) {
 6342    -1   var shift = 0, result = [];
 6343    -1 
 6344    -1   // Try to take previous element from cache, if .test() called before
 6345    -1   if (this.__index__ >= 0 && this.__text_cache__ === text) {
 6346    -1     result.push(createMatch(this, shift));
 6347    -1     shift = this.__last_index__;
 6348    -1   }
 6349    -1 
 6350    -1   // Cut head if cache was used
 6351    -1   var tail = shift ? text.slice(shift) : text;
 6352    -1 
 6353    -1   // Scan string until end reached
 6354    -1   while (this.test(tail)) {
 6355    -1     result.push(createMatch(this, shift));
 6356    -1 
 6357    -1     tail = tail.slice(this.__last_index__);
 6358    -1     shift += this.__last_index__;
 6359    -1   }
 6360    -1 
 6361    -1   if (result.length) {
 6362    -1     return result;
 6363    -1   }
 6364    -1 
 6365    -1   return null;
 6366    -1 };
 6367    -1 
 6368    -1 
 6369    -1 /** chainable
 6370    -1  * LinkifyIt#tlds(list [, keepOld]) -> this
 6371    -1  * - list (Array): list of tlds
 6372    -1  * - keepOld (Boolean): merge with current list if `true` (`false` by default)
 6373    -1  *
 6374    -1  * Load (or merge) new tlds list. Those are user for fuzzy links (without prefix)
 6375    -1  * to avoid false positives. By default this algorythm used:
 6376    -1  *
 6377    -1  * - hostname with any 2-letter root zones are ok.
 6378    -1  * - biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф
 6379    -1  *   are ok.
 6380    -1  * - encoded (`xn--...`) root zones are ok.
 6381    -1  *
 6382    -1  * If list is replaced, then exact match for 2-chars root zones will be checked.
 6383    -1  **/
 6384    -1 LinkifyIt.prototype.tlds = function tlds(list, keepOld) {
 6385    -1   list = Array.isArray(list) ? list : [ list ];
 6386    -1 
 6387    -1   if (!keepOld) {
 6388    -1     this.__tlds__ = list.slice();
 6389    -1     this.__tlds_replaced__ = true;
 6390    -1     compile(this);
 6391    -1     return this;
 6392    -1   }
 6393    -1 
 6394    -1   this.__tlds__ = this.__tlds__.concat(list)
 6395    -1                                   .sort()
 6396    -1                                   .filter(function (el, idx, arr) {
 6397    -1                                     return el !== arr[idx - 1];
 6398    -1                                   })
 6399    -1                                   .reverse();
 6400    -1 
 6401    -1   compile(this);
 6402    -1   return this;
 6403    -1 };
 6404    -1 
 6405    -1 /**
 6406    -1  * LinkifyIt#normalize(match)
 6407    -1  *
 6408    -1  * Default normalizer (if schema does not define it's own).
 6409    -1  **/
 6410    -1 LinkifyIt.prototype.normalize = function normalize(match) {
 6411    -1 
 6412    -1   // Do minimal possible changes by default. Need to collect feedback prior
 6413    -1   // to move forward https://github.com/markdown-it/linkify-it/issues/1
 6414    -1 
 6415    -1   if (!match.schema) { match.url = 'http://' + match.url; }
 6416    -1 
 6417    -1   if (match.schema === 'mailto:' && !/^mailto:/i.test(match.url)) {
 6418    -1     match.url = 'mailto:' + match.url;
 6419    -1   }
 6420    -1 };
 6421    -1 
 6422    -1 
 6423    -1 /**
 6424    -1  * LinkifyIt#onCompile()
 6425    -1  *
 6426    -1  * Override to modify basic RegExp-s.
 6427    -1  **/
 6428    -1 LinkifyIt.prototype.onCompile = function onCompile() {
 6429    -1 };
 6430    -1 
 6431    -1 
 6432    -1 module.exports = LinkifyIt;
 6433    -1 
 6434    -1 },{"./lib/re":35}],35:[function(require,module,exports){
 6435    -1 'use strict';
 6436    -1 
 6437    -1 
 6438    -1 module.exports = function (opts) {
 6439    -1   var re = {};
 6440    -1 
 6441    -1   // Use direct extract instead of `regenerate` to reduse browserified size
 6442    -1   re.src_Any = require('uc.micro/properties/Any/regex').source;
 6443    -1   re.src_Cc  = require('uc.micro/categories/Cc/regex').source;
 6444    -1   re.src_Z   = require('uc.micro/categories/Z/regex').source;
 6445    -1   re.src_P   = require('uc.micro/categories/P/regex').source;
 6446    -1 
 6447    -1   // \p{\Z\P\Cc\CF} (white spaces + control + format + punctuation)
 6448    -1   re.src_ZPCc = [ re.src_Z, re.src_P, re.src_Cc ].join('|');
 6449    -1 
 6450    -1   // \p{\Z\Cc} (white spaces + control)
 6451    -1   re.src_ZCc = [ re.src_Z, re.src_Cc ].join('|');
 6452    -1 
 6453    -1   // Experimental. List of chars, completely prohibited in links
 6454    -1   // because can separate it from other part of text
 6455    -1   var text_separators = '[><\uff5c]';
 6456    -1 
 6457    -1   // All possible word characters (everything without punctuation, spaces & controls)
 6458    -1   // Defined via punctuation & spaces to save space
 6459    -1   // Should be something like \p{\L\N\S\M} (\w but without `_`)
 6460    -1   re.src_pseudo_letter       = '(?:(?!' + text_separators + '|' + re.src_ZPCc + ')' + re.src_Any + ')';
 6461    -1   // The same as abothe but without [0-9]
 6462    -1   // var src_pseudo_letter_non_d = '(?:(?![0-9]|' + src_ZPCc + ')' + src_Any + ')';
 6463    -1 
 6464    -1   ////////////////////////////////////////////////////////////////////////////////
 6465    -1 
 6466    -1   re.src_ip4 =
 6467    -1 
 6468    -1     '(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';
 6469    -1 
 6470    -1   // Prohibit any of "@/[]()" in user/pass to avoid wrong domain fetch.
 6471    -1   re.src_auth    = '(?:(?:(?!' + re.src_ZCc + '|[@/\\[\\]()]).)+@)?';
 6472    -1 
 6473    -1   re.src_port =
 6474    -1 
 6475    -1     '(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?';
 6476    -1 
 6477    -1   re.src_host_terminator =
 6478    -1 
 6479    -1     '(?=$|' + text_separators + '|' + re.src_ZPCc + ')(?!-|_|:\\d|\\.-|\\.(?!$|' + re.src_ZPCc + '))';
 6480    -1 
 6481    -1   re.src_path =
 6482    -1 
 6483    -1     '(?:' +
 6484    -1       '[/?#]' +
 6485    -1         '(?:' +
 6486    -1           '(?!' + re.src_ZCc + '|' + text_separators + '|[()[\\]{}.,"\'?!\\-]).|' +
 6487    -1           '\\[(?:(?!' + re.src_ZCc + '|\\]).)*\\]|' +
 6488    -1           '\\((?:(?!' + re.src_ZCc + '|[)]).)*\\)|' +
 6489    -1           '\\{(?:(?!' + re.src_ZCc + '|[}]).)*\\}|' +
 6490    -1           '\\"(?:(?!' + re.src_ZCc + '|["]).)+\\"|' +
 6491    -1           "\\'(?:(?!" + re.src_ZCc + "|[']).)+\\'|" +
 6492    -1           "\\'(?=" + re.src_pseudo_letter + '|[-]).|' +  // allow `I'm_king` if no pair found
 6493    -1           '\\.{2,3}[a-zA-Z0-9%/]|' + // github has ... in commit range links. Restrict to
 6494    -1                                      // - english
 6495    -1                                      // - percent-encoded
 6496    -1                                      // - parts of file path
 6497    -1                                      // until more examples found.
 6498    -1           '\\.(?!' + re.src_ZCc + '|[.]).|' +
 6499    -1           (opts && opts['---'] ?
 6500    -1             '\\-(?!--(?:[^-]|$))(?:-*)|' // `---` => long dash, terminate
 6501    -1           :
 6502    -1             '\\-+|'
 6503    -1           ) +
 6504    -1           '\\,(?!' + re.src_ZCc + ').|' +      // allow `,,,` in paths
 6505    -1           '\\!(?!' + re.src_ZCc + '|[!]).|' +
 6506    -1           '\\?(?!' + re.src_ZCc + '|[?]).' +
 6507    -1         ')+' +
 6508    -1       '|\\/' +
 6509    -1     ')?';
 6510    -1 
 6511    -1   re.src_email_name =
 6512    -1 
 6513    -1     '[\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]+';
 6514    -1 
 6515    -1   re.src_xn =
 6516    -1 
 6517    -1     'xn--[a-z0-9\\-]{1,59}';
 6518    -1 
 6519    -1   // More to read about domain names
 6520    -1   // http://serverfault.com/questions/638260/
 6521    -1 
 6522    -1   re.src_domain_root =
 6523    -1 
 6524    -1     // Allow letters & digits (http://test1)
 6525    -1     '(?:' +
 6526    -1       re.src_xn +
 6527    -1       '|' +
 6528    -1       re.src_pseudo_letter + '{1,63}' +
 6529    -1     ')';
 6530    -1 
 6531    -1   re.src_domain =
 6532    -1 
 6533    -1     '(?:' +
 6534    -1       re.src_xn +
 6535    -1       '|' +
 6536    -1       '(?:' + re.src_pseudo_letter + ')' +
 6537    -1       '|' +
 6538    -1       // don't allow `--` in domain names, because:
 6539    -1       // - that can conflict with markdown &mdash; / &ndash;
 6540    -1       // - nobody use those anyway
 6541    -1       '(?:' + re.src_pseudo_letter + '(?:-(?!-)|' + re.src_pseudo_letter + '){0,61}' + re.src_pseudo_letter + ')' +
 6542    -1     ')';
 6543    -1 
 6544    -1   re.src_host =
 6545    -1 
 6546    -1     '(?:' +
 6547    -1     // Don't need IP check, because digits are already allowed in normal domain names
 6548    -1     //   src_ip4 +
 6549    -1     // '|' +
 6550    -1       '(?:(?:(?:' + re.src_domain + ')\\.)*' + re.src_domain/*_root*/ + ')' +
 6551    -1     ')';
 6552    -1 
 6553    -1   re.tpl_host_fuzzy =
 6554    -1 
 6555    -1     '(?:' +
 6556    -1       re.src_ip4 +
 6557    -1     '|' +
 6558    -1       '(?:(?:(?:' + re.src_domain + ')\\.)+(?:%TLDS%))' +
 6559    -1     ')';
 6560    -1 
 6561    -1   re.tpl_host_no_ip_fuzzy =
 6562    -1 
 6563    -1     '(?:(?:(?:' + re.src_domain + ')\\.)+(?:%TLDS%))';
 6564    -1 
 6565    -1   re.src_host_strict =
 6566    -1 
 6567    -1     re.src_host + re.src_host_terminator;
 6568    -1 
 6569    -1   re.tpl_host_fuzzy_strict =
 6570    -1 
 6571    -1     re.tpl_host_fuzzy + re.src_host_terminator;
 6572    -1 
 6573    -1   re.src_host_port_strict =
 6574    -1 
 6575    -1     re.src_host + re.src_port + re.src_host_terminator;
 6576    -1 
 6577    -1   re.tpl_host_port_fuzzy_strict =
 6578    -1 
 6579    -1     re.tpl_host_fuzzy + re.src_port + re.src_host_terminator;
 6580    -1 
 6581    -1   re.tpl_host_port_no_ip_fuzzy_strict =
 6582    -1 
 6583    -1     re.tpl_host_no_ip_fuzzy + re.src_port + re.src_host_terminator;
 6584    -1 
 6585    -1 
 6586    -1   ////////////////////////////////////////////////////////////////////////////////
 6587    -1   // Main rules
 6588    -1 
 6589    -1   // Rude test fuzzy links by host, for quick deny
 6590    -1   re.tpl_host_fuzzy_test =
 6591    -1 
 6592    -1     'localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:' + re.src_ZPCc + '|>|$))';
 6593    -1 
 6594    -1   re.tpl_email_fuzzy =
 6595    -1 
 6596    -1       '(^|' + text_separators + '|\\(|' + re.src_ZCc + ')(' + re.src_email_name + '@' + re.tpl_host_fuzzy_strict + ')';
 6597    -1 
 6598    -1   re.tpl_link_fuzzy =
 6599    -1       // Fuzzy link can't be prepended with .:/\- and non punctuation.
 6600    -1       // but can start with > (markdown blockquote)
 6601    -1       '(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|' + re.src_ZPCc + '))' +
 6602    -1       '((?![$+<=>^`|\uff5c])' + re.tpl_host_port_fuzzy_strict + re.src_path + ')';
 6603    -1 
 6604    -1   re.tpl_link_no_ip_fuzzy =
 6605    -1       // Fuzzy link can't be prepended with .:/\- and non punctuation.
 6606    -1       // but can start with > (markdown blockquote)
 6607    -1       '(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|' + re.src_ZPCc + '))' +
 6608    -1       '((?![$+<=>^`|\uff5c])' + re.tpl_host_port_no_ip_fuzzy_strict + re.src_path + ')';
 6609    -1 
 6610    -1   return re;
 6611    -1 };
 6612    -1 
 6613    -1 },{"uc.micro/categories/Cc/regex":113,"uc.micro/categories/P/regex":115,"uc.micro/categories/Z/regex":116,"uc.micro/properties/Any/regex":118}],36:[function(require,module,exports){
 6614    -1 'use strict';
 6615    -1 
 6616    -1 
 6617    -1 module.exports = require('./lib/');
 6618    -1 
 6619    -1 },{"./lib/":45}],37:[function(require,module,exports){
 6620    -1 // HTML5 entities map: { name -> utf16string }
 6621    -1 //
 6622    -1 'use strict';
 6623    -1 
 6624    -1 /*eslint quotes:0*/
 6625    -1 module.exports = require('entities/maps/entities.json');
 6626    -1 
 6627    -1 },{"entities/maps/entities.json":28}],38:[function(require,module,exports){
 6628    -1 // List of valid html blocks names, accorting to commonmark spec
 6629    -1 // http://jgm.github.io/CommonMark/spec.html#html-blocks
 6630    -1 
 6631    -1 'use strict';
 6632    -1 
 6633    -1 
 6634    -1 module.exports = [
 6635    -1   'address',
 6636    -1   'article',
 6637    -1   'aside',
 6638    -1   'base',
 6639    -1   'basefont',
 6640    -1   'blockquote',
 6641    -1   'body',
 6642    -1   'caption',
 6643    -1   'center',
 6644    -1   'col',
 6645    -1   'colgroup',
 6646    -1   'dd',
 6647    -1   'details',
 6648    -1   'dialog',
 6649    -1   'dir',
 6650    -1   'div',
 6651    -1   'dl',
 6652    -1   'dt',
 6653    -1   'fieldset',
 6654    -1   'figcaption',
 6655    -1   'figure',
 6656    -1   'footer',
 6657    -1   'form',
 6658    -1   'frame',
 6659    -1   'frameset',
 6660    -1   'h1',
 6661    -1   'head',
 6662    -1   'header',
 6663    -1   'hr',
 6664    -1   'html',
 6665    -1   'iframe',
 6666    -1   'legend',
 6667    -1   'li',
 6668    -1   'link',
 6669    -1   'main',
 6670    -1   'menu',
 6671    -1   'menuitem',
 6672    -1   'meta',
 6673    -1   'nav',
 6674    -1   'noframes',
 6675    -1   'ol',
 6676    -1   'optgroup',
 6677    -1   'option',
 6678    -1   'p',
 6679    -1   'param',
 6680    -1   'pre',
 6681    -1   'section',
 6682    -1   'source',
 6683    -1   'title',
 6684    -1   'summary',
 6685    -1   'table',
 6686    -1   'tbody',
 6687    -1   'td',
 6688    -1   'tfoot',
 6689    -1   'th',
 6690    -1   'thead',
 6691    -1   'title',
 6692    -1   'tr',
 6693    -1   'track',
 6694    -1   'ul'
 6695    -1 ];
 6696    -1 
 6697    -1 },{}],39:[function(require,module,exports){
 6698    -1 // Regexps to match html elements
 6699    -1 
 6700    -1 'use strict';
 6701    -1 
 6702    -1 var attr_name     = '[a-zA-Z_:][a-zA-Z0-9:._-]*';
 6703    -1 
 6704    -1 var unquoted      = '[^"\'=<>`\\x00-\\x20]+';
 6705    -1 var single_quoted = "'[^']*'";
 6706    -1 var double_quoted = '"[^"]*"';
 6707    -1 
 6708    -1 var attr_value  = '(?:' + unquoted + '|' + single_quoted + '|' + double_quoted + ')';
 6709    -1 
 6710    -1 var attribute   = '(?:\\s+' + attr_name + '(?:\\s*=\\s*' + attr_value + ')?)';
 6711    -1 
 6712    -1 var open_tag    = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>';
 6713    -1 
 6714    -1 var close_tag   = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>';
 6715    -1 var comment     = '<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->';
 6716    -1 var processing  = '<[?].*?[?]>';
 6717    -1 var declaration = '<![A-Z]+\\s+[^>]*>';
 6718    -1 var cdata       = '<!\\[CDATA\\[[\\s\\S]*?\\]\\]>';
 6719    -1 
 6720    -1 var HTML_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + '|' + comment +
 6721    -1                         '|' + processing + '|' + declaration + '|' + cdata + ')');
 6722    -1 var HTML_OPEN_CLOSE_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + ')');
 6723    -1 
 6724    -1 module.exports.HTML_TAG_RE = HTML_TAG_RE;
 6725    -1 module.exports.HTML_OPEN_CLOSE_TAG_RE = HTML_OPEN_CLOSE_TAG_RE;
 6726    -1 
 6727    -1 },{}],40:[function(require,module,exports){
 6728    -1 // Utilities
 6729    -1 //
 6730    -1 'use strict';
 6731    -1 
 6732    -1 
 6733    -1 function _class(obj) { return Object.prototype.toString.call(obj); }
 6734    -1 
 6735    -1 function isString(obj) { return _class(obj) === '[object String]'; }
 6736    -1 
 6737    -1 var _hasOwnProperty = Object.prototype.hasOwnProperty;
 6738    -1 
 6739    -1 function has(object, key) {
 6740    -1   return _hasOwnProperty.call(object, key);
 6741    -1 }
 6742    -1 
 6743    -1 // Merge objects
 6744    -1 //
 6745    -1 function assign(obj /*from1, from2, from3, ...*/) {
 6746    -1   var sources = Array.prototype.slice.call(arguments, 1);
 6747    -1 
 6748    -1   sources.forEach(function (source) {
 6749    -1     if (!source) { return; }
 6750    -1 
 6751    -1     if (typeof source !== 'object') {
 6752    -1       throw new TypeError(source + 'must be object');
 6753    -1     }
 6754    -1 
 6755    -1     Object.keys(source).forEach(function (key) {
 6756    -1       obj[key] = source[key];
 6757    -1     });
 6758    -1   });
 6759    -1 
 6760    -1   return obj;
 6761    -1 }
 6762    -1 
 6763    -1 // Remove element from array and put another array at those position.
 6764    -1 // Useful for some operations with tokens
 6765    -1 function arrayReplaceAt(src, pos, newElements) {
 6766    -1   return [].concat(src.slice(0, pos), newElements, src.slice(pos + 1));
 6767    -1 }
 6768    -1 
 6769    -1 ////////////////////////////////////////////////////////////////////////////////
 6770    -1 
 6771    -1 function isValidEntityCode(c) {
 6772    -1   /*eslint no-bitwise:0*/
 6773    -1   // broken sequence
 6774    -1   if (c >= 0xD800 && c <= 0xDFFF) { return false; }
 6775    -1   // never used
 6776    -1   if (c >= 0xFDD0 && c <= 0xFDEF) { return false; }
 6777    -1   if ((c & 0xFFFF) === 0xFFFF || (c & 0xFFFF) === 0xFFFE) { return false; }
 6778    -1   // control codes
 6779    -1   if (c >= 0x00 && c <= 0x08) { return false; }
 6780    -1   if (c === 0x0B) { return false; }
 6781    -1   if (c >= 0x0E && c <= 0x1F) { return false; }
 6782    -1   if (c >= 0x7F && c <= 0x9F) { return false; }
 6783    -1   // out of range
 6784    -1   if (c > 0x10FFFF) { return false; }
 6785    -1   return true;
 6786    -1 }
 6787    -1 
 6788    -1 function fromCodePoint(c) {
 6789    -1   /*eslint no-bitwise:0*/
 6790    -1   if (c > 0xffff) {
 6791    -1     c -= 0x10000;
 6792    -1     var surrogate1 = 0xd800 + (c >> 10),
 6793    -1         surrogate2 = 0xdc00 + (c & 0x3ff);
 6794    -1 
 6795    -1     return String.fromCharCode(surrogate1, surrogate2);
 6796    -1   }
 6797    -1   return String.fromCharCode(c);
 6798    -1 }
 6799    -1 
 6800    -1 
 6801    -1 var UNESCAPE_MD_RE  = /\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g;
 6802    -1 var ENTITY_RE       = /&([a-z#][a-z0-9]{1,31});/gi;
 6803    -1 var UNESCAPE_ALL_RE = new RegExp(UNESCAPE_MD_RE.source + '|' + ENTITY_RE.source, 'gi');
 6804    -1 
 6805    -1 var DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i;
 6806    -1 
 6807    -1 var entities = require('./entities');
 6808    -1 
 6809    -1 function replaceEntityPattern(match, name) {
 6810    -1   var code = 0;
 6811    -1 
 6812    -1   if (has(entities, name)) {
 6813    -1     return entities[name];
 6814    -1   }
 6815    -1 
 6816    -1   if (name.charCodeAt(0) === 0x23/* # */ && DIGITAL_ENTITY_TEST_RE.test(name)) {
 6817    -1     code = name[1].toLowerCase() === 'x' ?
 6818    -1       parseInt(name.slice(2), 16)
 6819    -1     :
 6820    -1       parseInt(name.slice(1), 10);
 6821    -1     if (isValidEntityCode(code)) {
 6822    -1       return fromCodePoint(code);
 6823    -1     }
 6824    -1   }
 6825    -1 
 6826    -1   return match;
 6827    -1 }
 6828    -1 
 6829    -1 /*function replaceEntities(str) {
 6830    -1   if (str.indexOf('&') < 0) { return str; }
 6831    -1 
 6832    -1   return str.replace(ENTITY_RE, replaceEntityPattern);
 6833    -1 }*/
 6834    -1 
 6835    -1 function unescapeMd(str) {
 6836    -1   if (str.indexOf('\\') < 0) { return str; }
 6837    -1   return str.replace(UNESCAPE_MD_RE, '$1');
 6838    -1 }
 6839    -1 
 6840    -1 function unescapeAll(str) {
 6841    -1   if (str.indexOf('\\') < 0 && str.indexOf('&') < 0) { return str; }
 6842    -1 
 6843    -1   return str.replace(UNESCAPE_ALL_RE, function (match, escaped, entity) {
 6844    -1     if (escaped) { return escaped; }
 6845    -1     return replaceEntityPattern(match, entity);
 6846    -1   });
 6847    -1 }
 6848    -1 
 6849    -1 ////////////////////////////////////////////////////////////////////////////////
 6850    -1 
 6851    -1 var HTML_ESCAPE_TEST_RE = /[&<>"]/;
 6852    -1 var HTML_ESCAPE_REPLACE_RE = /[&<>"]/g;
 6853    -1 var HTML_REPLACEMENTS = {
 6854    -1   '&': '&amp;',
 6855    -1   '<': '&lt;',
 6856    -1   '>': '&gt;',
 6857    -1   '"': '&quot;'
 6858    -1 };
 6859    -1 
 6860    -1 function replaceUnsafeChar(ch) {
 6861    -1   return HTML_REPLACEMENTS[ch];
 6862    -1 }
 6863    -1 
 6864    -1 function escapeHtml(str) {
 6865    -1   if (HTML_ESCAPE_TEST_RE.test(str)) {
 6866    -1     return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar);
 6867    -1   }
 6868    -1   return str;
 6869    -1 }
 6870    -1 
 6871    -1 ////////////////////////////////////////////////////////////////////////////////
 6872    -1 
 6873    -1 var REGEXP_ESCAPE_RE = /[.?*+^$[\]\\(){}|-]/g;
 6874    -1 
 6875    -1 function escapeRE(str) {
 6876    -1   return str.replace(REGEXP_ESCAPE_RE, '\\$&');
 6877    -1 }
 6878    -1 
 6879    -1 ////////////////////////////////////////////////////////////////////////////////
 6880    -1 
 6881    -1 function isSpace(code) {
 6882    -1   switch (code) {
 6883    -1     case 0x09:
 6884    -1     case 0x20:
 6885    -1       return true;
 6886    -1   }
 6887    -1   return false;
 6888    -1 }
 6889    -1 
 6890    -1 // Zs (unicode class) || [\t\f\v\r\n]
 6891    -1 function isWhiteSpace(code) {
 6892    -1   if (code >= 0x2000 && code <= 0x200A) { return true; }
 6893    -1   switch (code) {
 6894    -1     case 0x09: // \t
 6895    -1     case 0x0A: // \n
 6896    -1     case 0x0B: // \v
 6897    -1     case 0x0C: // \f
 6898    -1     case 0x0D: // \r
 6899    -1     case 0x20:
 6900    -1     case 0xA0:
 6901    -1     case 0x1680:
 6902    -1     case 0x202F:
 6903    -1     case 0x205F:
 6904    -1     case 0x3000:
 6905    -1       return true;
 6906    -1   }
 6907    -1   return false;
 6908    -1 }
 6909    -1 
 6910    -1 ////////////////////////////////////////////////////////////////////////////////
 6911    -1 
 6912    -1 /*eslint-disable max-len*/
 6913    -1 var UNICODE_PUNCT_RE = require('uc.micro/categories/P/regex');
 6914    -1 
 6915    -1 // Currently without astral characters support.
 6916    -1 function isPunctChar(ch) {
 6917    -1   return UNICODE_PUNCT_RE.test(ch);
 6918    -1 }
 6919    -1 
 6920    -1 
 6921    -1 // Markdown ASCII punctuation characters.
 6922    -1 //
 6923    -1 // !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~
 6924    -1 // http://spec.commonmark.org/0.15/#ascii-punctuation-character
 6925    -1 //
 6926    -1 // Don't confuse with unicode punctuation !!! It lacks some chars in ascii range.
 6927    -1 //
 6928    -1 function isMdAsciiPunct(ch) {
 6929    -1   switch (ch) {
 6930    -1     case 0x21/* ! */:
 6931    -1     case 0x22/* " */:
 6932    -1     case 0x23/* # */:
 6933    -1     case 0x24/* $ */:
 6934    -1     case 0x25/* % */:
 6935    -1     case 0x26/* & */:
 6936    -1     case 0x27/* ' */:
 6937    -1     case 0x28/* ( */:
 6938    -1     case 0x29/* ) */:
 6939    -1     case 0x2A/* * */:
 6940    -1     case 0x2B/* + */:
 6941    -1     case 0x2C/* , */:
 6942    -1     case 0x2D/* - */:
 6943    -1     case 0x2E/* . */:
 6944    -1     case 0x2F/* / */:
 6945    -1     case 0x3A/* : */:
 6946    -1     case 0x3B/* ; */:
 6947    -1     case 0x3C/* < */:
 6948    -1     case 0x3D/* = */:
 6949    -1     case 0x3E/* > */:
 6950    -1     case 0x3F/* ? */:
 6951    -1     case 0x40/* @ */:
 6952    -1     case 0x5B/* [ */:
 6953    -1     case 0x5C/* \ */:
 6954    -1     case 0x5D/* ] */:
 6955    -1     case 0x5E/* ^ */:
 6956    -1     case 0x5F/* _ */:
 6957    -1     case 0x60/* ` */:
 6958    -1     case 0x7B/* { */:
 6959    -1     case 0x7C/* | */:
 6960    -1     case 0x7D/* } */:
 6961    -1     case 0x7E/* ~ */:
 6962    -1       return true;
 6963    -1     default:
 6964    -1       return false;
 6965    -1   }
 6966    -1 }
 6967    -1 
 6968    -1 // Hepler to unify [reference labels].
 6969    -1 //
 6970    -1 function normalizeReference(str) {
 6971    -1   // use .toUpperCase() instead of .toLowerCase()
 6972    -1   // here to avoid a conflict with Object.prototype
 6973    -1   // members (most notably, `__proto__`)
 6974    -1   return str.trim().replace(/\s+/g, ' ').toUpperCase();
 6975    -1 }
 6976    -1 
 6977    -1 ////////////////////////////////////////////////////////////////////////////////
 6978    -1 
 6979    -1 // Re-export libraries commonly used in both markdown-it and its plugins,
 6980    -1 // so plugins won't have to depend on them explicitly, which reduces their
 6981    -1 // bundled size (e.g. a browser build).
 6982    -1 //
 6983    -1 exports.lib                 = {};
 6984    -1 exports.lib.mdurl           = require('mdurl');
 6985    -1 exports.lib.ucmicro         = require('uc.micro');
 6986    -1 
 6987    -1 exports.assign              = assign;
 6988    -1 exports.isString            = isString;
 6989    -1 exports.has                 = has;
 6990    -1 exports.unescapeMd          = unescapeMd;
 6991    -1 exports.unescapeAll         = unescapeAll;
 6992    -1 exports.isValidEntityCode   = isValidEntityCode;
 6993    -1 exports.fromCodePoint       = fromCodePoint;
 6994    -1 // exports.replaceEntities     = replaceEntities;
 6995    -1 exports.escapeHtml          = escapeHtml;
 6996    -1 exports.arrayReplaceAt      = arrayReplaceAt;
 6997    -1 exports.isSpace             = isSpace;
 6998    -1 exports.isWhiteSpace        = isWhiteSpace;
 6999    -1 exports.isMdAsciiPunct      = isMdAsciiPunct;
 7000    -1 exports.isPunctChar         = isPunctChar;
 7001    -1 exports.escapeRE            = escapeRE;
 7002    -1 exports.normalizeReference  = normalizeReference;
 7003    -1 
 7004    -1 },{"./entities":37,"mdurl":91,"uc.micro":117,"uc.micro/categories/P/regex":115}],41:[function(require,module,exports){
 7005    -1 // Just a shortcut for bulk export
 7006    -1 'use strict';
 7007    -1 
 7008    -1 
 7009    -1 exports.parseLinkLabel       = require('./parse_link_label');
 7010    -1 exports.parseLinkDestination = require('./parse_link_destination');
 7011    -1 exports.parseLinkTitle       = require('./parse_link_title');
 7012    -1 
 7013    -1 },{"./parse_link_destination":42,"./parse_link_label":43,"./parse_link_title":44}],42:[function(require,module,exports){
 7014    -1 // Parse link destination
 7015    -1 //
 7016    -1 'use strict';
 7017    -1 
 7018    -1 
 7019    -1 var isSpace     = require('../common/utils').isSpace;
 7020    -1 var unescapeAll = require('../common/utils').unescapeAll;
 7021    -1 
 7022    -1 
 7023    -1 module.exports = function parseLinkDestination(str, pos, max) {
 7024    -1   var code, level,
 7025    -1       lines = 0,
 7026    -1       start = pos,
 7027    -1       result = {
 7028    -1         ok: false,
 7029    -1         pos: 0,
 7030    -1         lines: 0,
 7031    -1         str: ''
 7032    -1       };
 7033    -1 
 7034    -1   if (str.charCodeAt(pos) === 0x3C /* < */) {
 7035    -1     pos++;
 7036    -1     while (pos < max) {
 7037    -1       code = str.charCodeAt(pos);
 7038    -1       if (code === 0x0A /* \n */ || isSpace(code)) { return result; }
 7039    -1       if (code === 0x3E /* > */) {
 7040    -1         result.pos = pos + 1;
 7041    -1         result.str = unescapeAll(str.slice(start + 1, pos));
 7042    -1         result.ok = true;
 7043    -1         return result;
 7044    -1       }
 7045    -1       if (code === 0x5C /* \ */ && pos + 1 < max) {
 7046    -1         pos += 2;
 7047    -1         continue;
 7048    -1       }
 7049    -1 
 7050    -1       pos++;
 7051    -1     }
 7052    -1 
 7053    -1     // no closing '>'
 7054    -1     return result;
 7055    -1   }
 7056    -1 
 7057    -1   // this should be ... } else { ... branch
 7058    -1 
 7059    -1   level = 0;
 7060    -1   while (pos < max) {
 7061    -1     code = str.charCodeAt(pos);
 7062    -1 
 7063    -1     if (code === 0x20) { break; }
 7064    -1 
 7065    -1     // ascii control characters
 7066    -1     if (code < 0x20 || code === 0x7F) { break; }
 7067    -1 
 7068    -1     if (code === 0x5C /* \ */ && pos + 1 < max) {
 7069    -1       pos += 2;
 7070    -1       continue;
 7071    -1     }
 7072    -1 
 7073    -1     if (code === 0x28 /* ( */) {
 7074    -1       level++;
 7075    -1       if (level > 1) { break; }
 7076    -1     }
 7077    -1 
 7078    -1     if (code === 0x29 /* ) */) {
 7079    -1       level--;
 7080    -1       if (level < 0) { break; }
 7081    -1     }
 7082    -1 
 7083    -1     pos++;
 7084    -1   }
 7085    -1 
 7086    -1   if (start === pos) { return result; }
 7087    -1 
 7088    -1   result.str = unescapeAll(str.slice(start, pos));
 7089    -1   result.lines = lines;
 7090    -1   result.pos = pos;
 7091    -1   result.ok = true;
 7092    -1   return result;
 7093    -1 };
 7094    -1 
 7095    -1 },{"../common/utils":40}],43:[function(require,module,exports){
 7096    -1 // Parse link label
 7097    -1 //
 7098    -1 // this function assumes that first character ("[") already matches;
 7099    -1 // returns the end of the label
 7100    -1 //
 7101    -1 'use strict';
 7102    -1 
 7103    -1 module.exports = function parseLinkLabel(state, start, disableNested) {
 7104    -1   var level, found, marker, prevPos,
 7105    -1       labelEnd = -1,
 7106    -1       max = state.posMax,
 7107    -1       oldPos = state.pos;
 7108    -1 
 7109    -1   state.pos = start + 1;
 7110    -1   level = 1;
 7111    -1 
 7112    -1   while (state.pos < max) {
 7113    -1     marker = state.src.charCodeAt(state.pos);
 7114    -1     if (marker === 0x5D /* ] */) {
 7115    -1       level--;
 7116    -1       if (level === 0) {
 7117    -1         found = true;
 7118    -1         break;
 7119    -1       }
 7120    -1     }
 7121    -1 
 7122    -1     prevPos = state.pos;
 7123    -1     state.md.inline.skipToken(state);
 7124    -1     if (marker === 0x5B /* [ */) {
 7125    -1       if (prevPos === state.pos - 1) {
 7126    -1         // increase level if we find text `[`, which is not a part of any token
 7127    -1         level++;
 7128    -1       } else if (disableNested) {
 7129    -1         state.pos = oldPos;
 7130    -1         return -1;
 7131    -1       }
 7132    -1     }
 7133    -1   }
 7134    -1 
 7135    -1   if (found) {
 7136    -1     labelEnd = state.pos;
 7137    -1   }
 7138    -1 
 7139    -1   // restore old state
 7140    -1   state.pos = oldPos;
 7141    -1 
 7142    -1   return labelEnd;
 7143    -1 };
 7144    -1 
 7145    -1 },{}],44:[function(require,module,exports){
 7146    -1 // Parse link title
 7147    -1 //
 7148    -1 'use strict';
 7149    -1 
 7150    -1 
 7151    -1 var unescapeAll = require('../common/utils').unescapeAll;
 7152    -1 
 7153    -1 
 7154    -1 module.exports = function parseLinkTitle(str, pos, max) {
 7155    -1   var code,
 7156    -1       marker,
 7157    -1       lines = 0,
 7158    -1       start = pos,
 7159    -1       result = {
 7160    -1         ok: false,
 7161    -1         pos: 0,
 7162    -1         lines: 0,
 7163    -1         str: ''
 7164    -1       };
 7165    -1 
 7166    -1   if (pos >= max) { return result; }
 7167    -1 
 7168    -1   marker = str.charCodeAt(pos);
 7169    -1 
 7170    -1   if (marker !== 0x22 /* " */ && marker !== 0x27 /* ' */ && marker !== 0x28 /* ( */) { return result; }
 7171    -1 
 7172    -1   pos++;
 7173    -1 
 7174    -1   // if opening marker is "(", switch it to closing marker ")"
 7175    -1   if (marker === 0x28) { marker = 0x29; }
 7176    -1 
 7177    -1   while (pos < max) {
 7178    -1     code = str.charCodeAt(pos);
 7179    -1     if (code === marker) {
 7180    -1       result.pos = pos + 1;
 7181    -1       result.lines = lines;
 7182    -1       result.str = unescapeAll(str.slice(start + 1, pos));
 7183    -1       result.ok = true;
 7184    -1       return result;
 7185    -1     } else if (code === 0x0A) {
 7186    -1       lines++;
 7187    -1     } else if (code === 0x5C /* \ */ && pos + 1 < max) {
 7188    -1       pos++;
 7189    -1       if (str.charCodeAt(pos) === 0x0A) {
 7190    -1         lines++;
 7191    -1       }
 7192    -1     }
 7193    -1 
 7194    -1     pos++;
 7195    -1   }
 7196    -1 
 7197    -1   return result;
 7198    -1 };
 7199    -1 
 7200    -1 },{"../common/utils":40}],45:[function(require,module,exports){
 7201    -1 // Main parser class
 7202    -1 
 7203    -1 'use strict';
 7204    -1 
 7205    -1 
 7206    -1 var utils        = require('./common/utils');
 7207    -1 var helpers      = require('./helpers');
 7208    -1 var Renderer     = require('./renderer');
 7209    -1 var ParserCore   = require('./parser_core');
 7210    -1 var ParserBlock  = require('./parser_block');
 7211    -1 var ParserInline = require('./parser_inline');
 7212    -1 var LinkifyIt    = require('linkify-it');
 7213    -1 var mdurl        = require('mdurl');
 7214    -1 var punycode     = require('punycode');
 7215    -1 
 7216    -1 
 7217    -1 var config = {
 7218    -1   'default': require('./presets/default'),
 7219    -1   zero: require('./presets/zero'),
 7220    -1   commonmark: require('./presets/commonmark')
 7221    -1 };
 7222    -1 
 7223    -1 ////////////////////////////////////////////////////////////////////////////////
 7224    -1 //
 7225    -1 // This validator can prohibit more than really needed to prevent XSS. It's a
 7226    -1 // tradeoff to keep code simple and to be secure by default.
 7227    -1 //
 7228    -1 // If you need different setup - override validator method as you wish. Or
 7229    -1 // replace it with dummy function and use external sanitizer.
 7230    -1 //
 7231    -1 
 7232    -1 var BAD_PROTO_RE = /^(vbscript|javascript|file|data):/;
 7233    -1 var GOOD_DATA_RE = /^data:image\/(gif|png|jpeg|webp);/;
 7234    -1 
 7235    -1 function validateLink(url) {
 7236    -1   // url should be normalized at this point, and existing entities are decoded
 7237    -1   var str = url.trim().toLowerCase();
 7238    -1 
 7239    -1   return BAD_PROTO_RE.test(str) ? (GOOD_DATA_RE.test(str) ? true : false) : true;
 7240    -1 }
 7241    -1 
 7242    -1 ////////////////////////////////////////////////////////////////////////////////
 7243    -1 
 7244    -1 
 7245    -1 var RECODE_HOSTNAME_FOR = [ 'http:', 'https:', 'mailto:' ];
 7246    -1 
 7247    -1 function normalizeLink(url) {
 7248    -1   var parsed = mdurl.parse(url, true);
 7249    -1 
 7250    -1   if (parsed.hostname) {
 7251    -1     // Encode hostnames in urls like:
 7252    -1     // `http://host/`, `https://host/`, `mailto:user@host`, `//host/`
 7253    -1     //
 7254    -1     // We don't encode unknown schemas, because it's likely that we encode
 7255    -1     // something we shouldn't (e.g. `skype:name` treated as `skype:host`)
 7256    -1     //
 7257    -1     if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {
 7258    -1       try {
 7259    -1         parsed.hostname = punycode.toASCII(parsed.hostname);
 7260    -1       } catch (er) { /**/ }
 7261    -1     }
 7262    -1   }
 7263    -1 
 7264    -1   return mdurl.encode(mdurl.format(parsed));
 7265    -1 }
 7266    -1 
 7267    -1 function normalizeLinkText(url) {
 7268    -1   var parsed = mdurl.parse(url, true);
 7269    -1 
 7270    -1   if (parsed.hostname) {
 7271    -1     // Encode hostnames in urls like:
 7272    -1     // `http://host/`, `https://host/`, `mailto:user@host`, `//host/`
 7273    -1     //
 7274    -1     // We don't encode unknown schemas, because it's likely that we encode
 7275    -1     // something we shouldn't (e.g. `skype:name` treated as `skype:host`)
 7276    -1     //
 7277    -1     if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {
 7278    -1       try {
 7279    -1         parsed.hostname = punycode.toUnicode(parsed.hostname);
 7280    -1       } catch (er) { /**/ }
 7281    -1     }
 7282    -1   }
 7283    -1 
 7284    -1   return mdurl.decode(mdurl.format(parsed));
 7285    -1 }
 7286    -1 
 7287    -1 
 7288    -1 /**
 7289    -1  * class MarkdownIt
 7290    -1  *
 7291    -1  * Main parser/renderer class.
 7292    -1  *
 7293    -1  * ##### Usage
 7294    -1  *
 7295    -1  * ```javascript
 7296    -1  * // node.js, "classic" way:
 7297    -1  * var MarkdownIt = require('markdown-it'),
 7298    -1  *     md = new MarkdownIt();
 7299    -1  * var result = md.render('# markdown-it rulezz!');
 7300    -1  *
 7301    -1  * // node.js, the same, but with sugar:
 7302    -1  * var md = require('markdown-it')();
 7303    -1  * var result = md.render('# markdown-it rulezz!');
 7304    -1  *
 7305    -1  * // browser without AMD, added to "window" on script load
 7306    -1  * // Note, there are no dash.
 7307    -1  * var md = window.markdownit();
 7308    -1  * var result = md.render('# markdown-it rulezz!');
 7309    -1  * ```
 7310    -1  *
 7311    -1  * Single line rendering, without paragraph wrap:
 7312    -1  *
 7313    -1  * ```javascript
 7314    -1  * var md = require('markdown-it')();
 7315    -1  * var result = md.renderInline('__markdown-it__ rulezz!');
 7316    -1  * ```
 7317    -1  **/
 7318    -1 
 7319    -1 /**
 7320    -1  * new MarkdownIt([presetName, options])
 7321    -1  * - presetName (String): optional, `commonmark` / `zero`
 7322    -1  * - options (Object)
 7323    -1  *
 7324    -1  * Creates parser instanse with given config. Can be called without `new`.
 7325    -1  *
 7326    -1  * ##### presetName
 7327    -1  *
 7328    -1  * MarkdownIt provides named presets as a convenience to quickly
 7329    -1  * enable/disable active syntax rules and options for common use cases.
 7330    -1  *
 7331    -1  * - ["commonmark"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/commonmark.js) -
 7332    -1  *   configures parser to strict [CommonMark](http://commonmark.org/) mode.
 7333    -1  * - [default](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/default.js) -
 7334    -1  *   similar to GFM, used when no preset name given. Enables all available rules,
 7335    -1  *   but still without html, typographer & autolinker.
 7336    -1  * - ["zero"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/zero.js) -
 7337    -1  *   all rules disabled. Useful to quickly setup your config via `.enable()`.
 7338    -1  *   For example, when you need only `bold` and `italic` markup and nothing else.
 7339    -1  *
 7340    -1  * ##### options:
 7341    -1  *
 7342    -1  * - __html__ - `false`. Set `true` to enable HTML tags in source. Be careful!
 7343    -1  *   That's not safe! You may need external sanitizer to protect output from XSS.
 7344    -1  *   It's better to extend features via plugins, instead of enabling HTML.
 7345    -1  * - __xhtmlOut__ - `false`. Set `true` to add '/' when closing single tags
 7346    -1  *   (`<br />`). This is needed only for full CommonMark compatibility. In real
 7347    -1  *   world you will need HTML output.
 7348    -1  * - __breaks__ - `false`. Set `true` to convert `\n` in paragraphs into `<br>`.
 7349    -1  * - __langPrefix__ - `language-`. CSS language class prefix for fenced blocks.
 7350    -1  *   Can be useful for external highlighters.
 7351    -1  * - __linkify__ - `false`. Set `true` to autoconvert URL-like text to links.
 7352    -1  * - __typographer__  - `false`. Set `true` to enable [some language-neutral
 7353    -1  *   replacement](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.js) +
 7354    -1  *   quotes beautification (smartquotes).
 7355    -1  * - __quotes__ - `“”‘’`, String or Array. Double + single quotes replacement
 7356    -1  *   pairs, when typographer enabled and smartquotes on. For example, you can
 7357    -1  *   use `'«»„“'` for Russian, `'„“‚‘'` for German, and
 7358    -1  *   `['«\xA0', '\xA0»', '‹\xA0', '\xA0›']` for French (including nbsp).
 7359    -1  * - __highlight__ - `null`. Highlighter function for fenced code blocks.
 7360    -1  *   Highlighter `function (str, lang)` should return escaped HTML. It can also
 7361    -1  *   return empty string if the source was not changed and should be escaped
 7362    -1  *   externaly. If result starts with <pre... internal wrapper is skipped.
 7363    -1  *
 7364    -1  * ##### Example
 7365    -1  *
 7366    -1  * ```javascript
 7367    -1  * // commonmark mode
 7368    -1  * var md = require('markdown-it')('commonmark');
 7369    -1  *
 7370    -1  * // default mode
 7371    -1  * var md = require('markdown-it')();
 7372    -1  *
 7373    -1  * // enable everything
 7374    -1  * var md = require('markdown-it')({
 7375    -1  *   html: true,
 7376    -1  *   linkify: true,
 7377    -1  *   typographer: true
 7378    -1  * });
 7379    -1  * ```
 7380    -1  *
 7381    -1  * ##### Syntax highlighting
 7382    -1  *
 7383    -1  * ```js
 7384    -1  * var hljs = require('highlight.js') // https://highlightjs.org/
 7385    -1  *
 7386    -1  * var md = require('markdown-it')({
 7387    -1  *   highlight: function (str, lang) {
 7388    -1  *     if (lang && hljs.getLanguage(lang)) {
 7389    -1  *       try {
 7390    -1  *         return hljs.highlight(lang, str, true).value;
 7391    -1  *       } catch (__) {}
 7392    -1  *     }
 7393    -1  *
 7394    -1  *     return ''; // use external default escaping
 7395    -1  *   }
 7396    -1  * });
 7397    -1  * ```
 7398    -1  *
 7399    -1  * Or with full wrapper override (if you need assign class to `<pre>`):
 7400    -1  *
 7401    -1  * ```javascript
 7402    -1  * var hljs = require('highlight.js') // https://highlightjs.org/
 7403    -1  *
 7404    -1  * // Actual default values
 7405    -1  * var md = require('markdown-it')({
 7406    -1  *   highlight: function (str, lang) {
 7407    -1  *     if (lang && hljs.getLanguage(lang)) {
 7408    -1  *       try {
 7409    -1  *         return '<pre class="hljs"><code>' +
 7410    -1  *                hljs.highlight(lang, str, true).value +
 7411    -1  *                '</code></pre>';
 7412    -1  *       } catch (__) {}
 7413    -1  *     }
 7414    -1  *
 7415    -1  *     return '<pre class="hljs"><code>' + md.utils.escapeHtml(str) + '</code></pre>';
 7416    -1  *   }
 7417    -1  * });
 7418    -1  * ```
 7419    -1  *
 7420    -1  **/
 7421    -1 function MarkdownIt(presetName, options) {
 7422    -1   if (!(this instanceof MarkdownIt)) {
 7423    -1     return new MarkdownIt(presetName, options);
 7424    -1   }
 7425    -1 
 7426    -1   if (!options) {
 7427    -1     if (!utils.isString(presetName)) {
 7428    -1       options = presetName || {};
 7429    -1       presetName = 'default';
 7430    -1     }
 7431    -1   }
 7432    -1 
 7433    -1   /**
 7434    -1    * MarkdownIt#inline -> ParserInline
 7435    -1    *
 7436    -1    * Instance of [[ParserInline]]. You may need it to add new rules when
 7437    -1    * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
 7438    -1    * [[MarkdownIt.enable]].
 7439    -1    **/
 7440    -1   this.inline = new ParserInline();
 7441    -1 
 7442    -1   /**
 7443    -1    * MarkdownIt#block -> ParserBlock
 7444    -1    *
 7445    -1    * Instance of [[ParserBlock]]. You may need it to add new rules when
 7446    -1    * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
 7447    -1    * [[MarkdownIt.enable]].
 7448    -1    **/
 7449    -1   this.block = new ParserBlock();
 7450    -1 
 7451    -1   /**
 7452    -1    * MarkdownIt#core -> Core
 7453    -1    *
 7454    -1    * Instance of [[Core]] chain executor. You may need it to add new rules when
 7455    -1    * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
 7456    -1    * [[MarkdownIt.enable]].
 7457    -1    **/
 7458    -1   this.core = new ParserCore();
 7459    -1 
 7460    -1   /**
 7461    -1    * MarkdownIt#renderer -> Renderer
 7462    -1    *
 7463    -1    * Instance of [[Renderer]]. Use it to modify output look. Or to add rendering
 7464    -1    * rules for new token types, generated by plugins.
 7465    -1    *
 7466    -1    * ##### Example
 7467    -1    *
 7468    -1    * ```javascript
 7469    -1    * var md = require('markdown-it')();
 7470    -1    *
 7471    -1    * function myToken(tokens, idx, options, env, self) {
 7472    -1    *   //...
 7473    -1    *   return result;
 7474    -1    * };
 7475    -1    *
 7476    -1    * md.renderer.rules['my_token'] = myToken
 7477    -1    * ```
 7478    -1    *
 7479    -1    * See [[Renderer]] docs and [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js).
 7480    -1    **/
 7481    -1   this.renderer = new Renderer();
 7482    -1 
 7483    -1   /**
 7484    -1    * MarkdownIt#linkify -> LinkifyIt
 7485    -1    *
 7486    -1    * [linkify-it](https://github.com/markdown-it/linkify-it) instance.
 7487    -1    * Used by [linkify](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.js)
 7488    -1    * rule.
 7489    -1    **/
 7490    -1   this.linkify = new LinkifyIt();
 7491    -1 
 7492    -1   /**
 7493    -1    * MarkdownIt#validateLink(url) -> Boolean
 7494    -1    *
 7495    -1    * Link validation function. CommonMark allows too much in links. By default
 7496    -1    * we disable `javascript:`, `vbscript:`, `file:` schemas, and almost all `data:...` schemas
 7497    -1    * except some embedded image types.
 7498    -1    *
 7499    -1    * You can change this behaviour:
 7500    -1    *
 7501    -1    * ```javascript
 7502    -1    * var md = require('markdown-it')();
 7503    -1    * // enable everything
 7504    -1    * md.validateLink = function () { return true; }
 7505    -1    * ```
 7506    -1    **/
 7507    -1   this.validateLink = validateLink;
 7508    -1 
 7509    -1   /**
 7510    -1    * MarkdownIt#normalizeLink(url) -> String
 7511    -1    *
 7512    -1    * Function used to encode link url to a machine-readable format,
 7513    -1    * which includes url-encoding, punycode, etc.
 7514    -1    **/
 7515    -1   this.normalizeLink = normalizeLink;
 7516    -1 
 7517    -1   /**
 7518    -1    * MarkdownIt#normalizeLinkText(url) -> String
 7519    -1    *
 7520    -1    * Function used to decode link url to a human-readable format`
 7521    -1    **/
 7522    -1   this.normalizeLinkText = normalizeLinkText;
 7523    -1 
 7524    -1 
 7525    -1   // Expose utils & helpers for easy acces from plugins
 7526    -1 
 7527    -1   /**
 7528    -1    * MarkdownIt#utils -> utils
 7529    -1    *
 7530    -1    * Assorted utility functions, useful to write plugins. See details
 7531    -1    * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/common/utils.js).
 7532    -1    **/
 7533    -1   this.utils = utils;
 7534    -1 
 7535    -1   /**
 7536    -1    * MarkdownIt#helpers -> helpers
 7537    -1    *
 7538    -1    * Link components parser functions, useful to write plugins. See details
 7539    -1    * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/helpers).
 7540    -1    **/
 7541    -1   this.helpers = helpers;
 7542    -1 
 7543    -1 
 7544    -1   this.options = {};
 7545    -1   this.configure(presetName);
 7546    -1 
 7547    -1   if (options) { this.set(options); }
 7548    -1 }
 7549    -1 
 7550    -1 
 7551    -1 /** chainable
 7552    -1  * MarkdownIt.set(options)
 7553    -1  *
 7554    -1  * Set parser options (in the same format as in constructor). Probably, you
 7555    -1  * will never need it, but you can change options after constructor call.
 7556    -1  *
 7557    -1  * ##### Example
 7558    -1  *
 7559    -1  * ```javascript
 7560    -1  * var md = require('markdown-it')()
 7561    -1  *             .set({ html: true, breaks: true })
 7562    -1  *             .set({ typographer, true });
 7563    -1  * ```
 7564    -1  *
 7565    -1  * __Note:__ To achieve the best possible performance, don't modify a
 7566    -1  * `markdown-it` instance options on the fly. If you need multiple configurations
 7567    -1  * it's best to create multiple instances and initialize each with separate
 7568    -1  * config.
 7569    -1  **/
 7570    -1 MarkdownIt.prototype.set = function (options) {
 7571    -1   utils.assign(this.options, options);
 7572    -1   return this;
 7573    -1 };
 7574    -1 
 7575    -1 
 7576    -1 /** chainable, internal
 7577    -1  * MarkdownIt.configure(presets)
 7578    -1  *
 7579    -1  * Batch load of all options and compenent settings. This is internal method,
 7580    -1  * and you probably will not need it. But if you with - see available presets
 7581    -1  * and data structure [here](https://github.com/markdown-it/markdown-it/tree/master/lib/presets)
 7582    -1  *
 7583    -1  * We strongly recommend to use presets instead of direct config loads. That
 7584    -1  * will give better compatibility with next versions.
 7585    -1  **/
 7586    -1 MarkdownIt.prototype.configure = function (presets) {
 7587    -1   var self = this, presetName;
 7588    -1 
 7589    -1   if (utils.isString(presets)) {
 7590    -1     presetName = presets;
 7591    -1     presets = config[presetName];
 7592    -1     if (!presets) { throw new Error('Wrong `markdown-it` preset "' + presetName + '", check name'); }
 7593    -1   }
 7594    -1 
 7595    -1   if (!presets) { throw new Error('Wrong `markdown-it` preset, can\'t be empty'); }
 7596    -1 
 7597    -1   if (presets.options) { self.set(presets.options); }
 7598    -1 
 7599    -1   if (presets.components) {
 7600    -1     Object.keys(presets.components).forEach(function (name) {
 7601    -1       if (presets.components[name].rules) {
 7602    -1         self[name].ruler.enableOnly(presets.components[name].rules);
 7603    -1       }
 7604    -1       if (presets.components[name].rules2) {
 7605    -1         self[name].ruler2.enableOnly(presets.components[name].rules2);
 7606    -1       }
 7607    -1     });
 7608    -1   }
 7609    -1   return this;
 7610    -1 };
 7611    -1 
 7612    -1 
 7613    -1 /** chainable
 7614    -1  * MarkdownIt.enable(list, ignoreInvalid)
 7615    -1  * - list (String|Array): rule name or list of rule names to enable
 7616    -1  * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
 7617    -1  *
 7618    -1  * Enable list or rules. It will automatically find appropriate components,
 7619    -1  * containing rules with given names. If rule not found, and `ignoreInvalid`
 7620    -1  * not set - throws exception.
 7621    -1  *
 7622    -1  * ##### Example
 7623    -1  *
 7624    -1  * ```javascript
 7625    -1  * var md = require('markdown-it')()
 7626    -1  *             .enable(['sub', 'sup'])
 7627    -1  *             .disable('smartquotes');
 7628    -1  * ```
 7629    -1  **/
 7630    -1 MarkdownIt.prototype.enable = function (list, ignoreInvalid) {
 7631    -1   var result = [];
 7632    -1 
 7633    -1   if (!Array.isArray(list)) { list = [ list ]; }
 7634    -1 
 7635    -1   [ 'core', 'block', 'inline' ].forEach(function (chain) {
 7636    -1     result = result.concat(this[chain].ruler.enable(list, true));
 7637    -1   }, this);
 7638    -1 
 7639    -1   result = result.concat(this.inline.ruler2.enable(list, true));
 7640    -1 
 7641    -1   var missed = list.filter(function (name) { return result.indexOf(name) < 0; });
 7642    -1 
 7643    -1   if (missed.length && !ignoreInvalid) {
 7644    -1     throw new Error('MarkdownIt. Failed to enable unknown rule(s): ' + missed);
 7645    -1   }
 7646    -1 
 7647    -1   return this;
 7648    -1 };
 7649    -1 
 7650    -1 
 7651    -1 /** chainable
 7652    -1  * MarkdownIt.disable(list, ignoreInvalid)
 7653    -1  * - list (String|Array): rule name or list of rule names to disable.
 7654    -1  * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
 7655    -1  *
 7656    -1  * The same as [[MarkdownIt.enable]], but turn specified rules off.
 7657    -1  **/
 7658    -1 MarkdownIt.prototype.disable = function (list, ignoreInvalid) {
 7659    -1   var result = [];
 7660    -1 
 7661    -1   if (!Array.isArray(list)) { list = [ list ]; }
 7662    -1 
 7663    -1   [ 'core', 'block', 'inline' ].forEach(function (chain) {
 7664    -1     result = result.concat(this[chain].ruler.disable(list, true));
 7665    -1   }, this);
 7666    -1 
 7667    -1   result = result.concat(this.inline.ruler2.disable(list, true));
 7668    -1 
 7669    -1   var missed = list.filter(function (name) { return result.indexOf(name) < 0; });
 7670    -1 
 7671    -1   if (missed.length && !ignoreInvalid) {
 7672    -1     throw new Error('MarkdownIt. Failed to disable unknown rule(s): ' + missed);
 7673    -1   }
 7674    -1   return this;
 7675    -1 };
 7676    -1 
 7677    -1 
 7678    -1 /** chainable
 7679    -1  * MarkdownIt.use(plugin, params)
 7680    -1  *
 7681    -1  * Load specified plugin with given params into current parser instance.
 7682    -1  * It's just a sugar to call `plugin(md, params)` with curring.
 7683    -1  *
 7684    -1  * ##### Example
 7685    -1  *
 7686    -1  * ```javascript
 7687    -1  * var iterator = require('markdown-it-for-inline');
 7688    -1  * var md = require('markdown-it')()
 7689    -1  *             .use(iterator, 'foo_replace', 'text', function (tokens, idx) {
 7690    -1  *               tokens[idx].content = tokens[idx].content.replace(/foo/g, 'bar');
 7691    -1  *             });
 7692    -1  * ```
 7693    -1  **/
 7694    -1 MarkdownIt.prototype.use = function (plugin /*, params, ... */) {
 7695    -1   var args = [ this ].concat(Array.prototype.slice.call(arguments, 1));
 7696    -1   plugin.apply(plugin, args);
 7697    -1   return this;
 7698    -1 };
 7699    -1 
 7700    -1 
 7701    -1 /** internal
 7702    -1  * MarkdownIt.parse(src, env) -> Array
 7703    -1  * - src (String): source string
 7704    -1  * - env (Object): environment sandbox
 7705    -1  *
 7706    -1  * Parse input string and returns list of block tokens (special token type
 7707    -1  * "inline" will contain list of inline tokens). You should not call this
 7708    -1  * method directly, until you write custom renderer (for example, to produce
 7709    -1  * AST).
 7710    -1  *
 7711    -1  * `env` is used to pass data between "distributed" rules and return additional
 7712    -1  * metadata like reference info, needed for the renderer. It also can be used to
 7713    -1  * inject data in specific cases. Usually, you will be ok to pass `{}`,
 7714    -1  * and then pass updated object to renderer.
 7715    -1  **/
 7716    -1 MarkdownIt.prototype.parse = function (src, env) {
 7717    -1   var state = new this.core.State(src, this, env);
 7718    -1 
 7719    -1   this.core.process(state);
 7720    -1 
 7721    -1   return state.tokens;
 7722    -1 };
 7723    -1 
 7724    -1 
 7725    -1 /**
 7726    -1  * MarkdownIt.render(src [, env]) -> String
 7727    -1  * - src (String): source string
 7728    -1  * - env (Object): environment sandbox
 7729    -1  *
 7730    -1  * Render markdown string into html. It does all magic for you :).
 7731    -1  *
 7732    -1  * `env` can be used to inject additional metadata (`{}` by default).
 7733    -1  * But you will not need it with high probability. See also comment
 7734    -1  * in [[MarkdownIt.parse]].
 7735    -1  **/
 7736    -1 MarkdownIt.prototype.render = function (src, env) {
 7737    -1   env = env || {};
 7738    -1 
 7739    -1   return this.renderer.render(this.parse(src, env), this.options, env);
 7740    -1 };
 7741    -1 
 7742    -1 
 7743    -1 /** internal
 7744    -1  * MarkdownIt.parseInline(src, env) -> Array
 7745    -1  * - src (String): source string
 7746    -1  * - env (Object): environment sandbox
 7747    -1  *
 7748    -1  * The same as [[MarkdownIt.parse]] but skip all block rules. It returns the
 7749    -1  * block tokens list with the single `inline` element, containing parsed inline
 7750    -1  * tokens in `children` property. Also updates `env` object.
 7751    -1  **/
 7752    -1 MarkdownIt.prototype.parseInline = function (src, env) {
 7753    -1   var state = new this.core.State(src, this, env);
 7754    -1 
 7755    -1   state.inlineMode = true;
 7756    -1   this.core.process(state);
 7757    -1 
 7758    -1   return state.tokens;
 7759    -1 };
 7760    -1 
 7761    -1 
 7762    -1 /**
 7763    -1  * MarkdownIt.renderInline(src [, env]) -> String
 7764    -1  * - src (String): source string
 7765    -1  * - env (Object): environment sandbox
 7766    -1  *
 7767    -1  * Similar to [[MarkdownIt.render]] but for single paragraph content. Result
 7768    -1  * will NOT be wrapped into `<p>` tags.
 7769    -1  **/
 7770    -1 MarkdownIt.prototype.renderInline = function (src, env) {
 7771    -1   env = env || {};
 7772    -1 
 7773    -1   return this.renderer.render(this.parseInline(src, env), this.options, env);
 7774    -1 };
 7775    -1 
 7776    -1 
 7777    -1 module.exports = MarkdownIt;
 7778    -1 
 7779    -1 },{"./common/utils":40,"./helpers":41,"./parser_block":46,"./parser_core":47,"./parser_inline":48,"./presets/commonmark":49,"./presets/default":50,"./presets/zero":51,"./renderer":52,"linkify-it":34,"mdurl":91,"punycode":3}],46:[function(require,module,exports){
 7780    -1 /** internal
 7781    -1  * class ParserBlock
 7782    -1  *
 7783    -1  * Block-level tokenizer.
 7784    -1  **/
 7785    -1 'use strict';
 7786    -1 
 7787    -1 
 7788    -1 var Ruler           = require('./ruler');
 7789    -1 
 7790    -1 
 7791    -1 var _rules = [
 7792    -1   // First 2 params - rule name & source. Secondary array - list of rules,
 7793    -1   // which can be terminated by this one.
 7794    -1   [ 'table',      require('./rules_block/table'),      [ 'paragraph', 'reference' ] ],
 7795    -1   [ 'code',       require('./rules_block/code') ],
 7796    -1   [ 'fence',      require('./rules_block/fence'),      [ 'paragraph', 'reference', 'blockquote', 'list' ] ],
 7797    -1   [ 'blockquote', require('./rules_block/blockquote'), [ 'paragraph', 'reference', 'list' ] ],
 7798    -1   [ 'hr',         require('./rules_block/hr'),         [ 'paragraph', 'reference', 'blockquote', 'list' ] ],
 7799    -1   [ 'list',       require('./rules_block/list'),       [ 'paragraph', 'reference', 'blockquote' ] ],
 7800    -1   [ 'reference',  require('./rules_block/reference') ],
 7801    -1   [ 'heading',    require('./rules_block/heading'),    [ 'paragraph', 'reference', 'blockquote' ] ],
 7802    -1   [ 'lheading',   require('./rules_block/lheading') ],
 7803    -1   [ 'html_block', require('./rules_block/html_block'), [ 'paragraph', 'reference', 'blockquote' ] ],
 7804    -1   [ 'paragraph',  require('./rules_block/paragraph') ]
 7805    -1 ];
 7806    -1 
 7807    -1 
 7808    -1 /**
 7809    -1  * new ParserBlock()
 7810    -1  **/
 7811    -1 function ParserBlock() {
 7812    -1   /**
 7813    -1    * ParserBlock#ruler -> Ruler
 7814    -1    *
 7815    -1    * [[Ruler]] instance. Keep configuration of block rules.
 7816    -1    **/
 7817    -1   this.ruler = new Ruler();
 7818    -1 
 7819    -1   for (var i = 0; i < _rules.length; i++) {
 7820    -1     this.ruler.push(_rules[i][0], _rules[i][1], { alt: (_rules[i][2] || []).slice() });
 7821    -1   }
 7822    -1 }
 7823    -1 
 7824    -1 
 7825    -1 // Generate tokens for input range
 7826    -1 //
 7827    -1 ParserBlock.prototype.tokenize = function (state, startLine, endLine) {
 7828    -1   var ok, i,
 7829    -1       rules = this.ruler.getRules(''),
 7830    -1       len = rules.length,
 7831    -1       line = startLine,
 7832    -1       hasEmptyLines = false,
 7833    -1       maxNesting = state.md.options.maxNesting;
 7834    -1 
 7835    -1   while (line < endLine) {
 7836    -1     state.line = line = state.skipEmptyLines(line);
 7837    -1     if (line >= endLine) { break; }
 7838    -1 
 7839    -1     // Termination condition for nested calls.
 7840    -1     // Nested calls currently used for blockquotes & lists
 7841    -1     if (state.sCount[line] < state.blkIndent) { break; }
 7842    -1 
 7843    -1     // If nesting level exceeded - skip tail to the end. That's not ordinary
 7844    -1     // situation and we should not care about content.
 7845    -1     if (state.level >= maxNesting) {
 7846    -1       state.line = endLine;
 7847    -1       break;
 7848    -1     }
 7849    -1 
 7850    -1     // Try all possible rules.
 7851    -1     // On success, rule should:
 7852    -1     //
 7853    -1     // - update `state.line`
 7854    -1     // - update `state.tokens`
 7855    -1     // - return true
 7856    -1 
 7857    -1     for (i = 0; i < len; i++) {
 7858    -1       ok = rules[i](state, line, endLine, false);
 7859    -1       if (ok) { break; }
 7860    -1     }
 7861    -1 
 7862    -1     // set state.tight iff we had an empty line before current tag
 7863    -1     // i.e. latest empty line should not count
 7864    -1     state.tight = !hasEmptyLines;
 7865    -1 
 7866    -1     // paragraph might "eat" one newline after it in nested lists
 7867    -1     if (state.isEmpty(state.line - 1)) {
 7868    -1       hasEmptyLines = true;
 7869    -1     }
 7870    -1 
 7871    -1     line = state.line;
 7872    -1 
 7873    -1     if (line < endLine && state.isEmpty(line)) {
 7874    -1       hasEmptyLines = true;
 7875    -1       line++;
 7876    -1 
 7877    -1       // two empty lines should stop the parser in list mode
 7878    -1       if (line < endLine && state.parentType === 'list' && state.isEmpty(line)) { break; }
 7879    -1       state.line = line;
 7880    -1     }
 7881    -1   }
 7882    -1 };
 7883    -1 
 7884    -1 
 7885    -1 /**
 7886    -1  * ParserBlock.parse(str, md, env, outTokens)
 7887    -1  *
 7888    -1  * Process input string and push block tokens into `outTokens`
 7889    -1  **/
 7890    -1 ParserBlock.prototype.parse = function (src, md, env, outTokens) {
 7891    -1   var state;
 7892    -1 
 7893    -1   if (!src) { return; }
 7894    -1 
 7895    -1   state = new this.State(src, md, env, outTokens);
 7896    -1 
 7897    -1   this.tokenize(state, state.line, state.lineMax);
 7898    -1 };
 7899    -1 
 7900    -1 
 7901    -1 ParserBlock.prototype.State = require('./rules_block/state_block');
 7902    -1 
 7903    -1 
 7904    -1 module.exports = ParserBlock;
 7905    -1 
 7906    -1 },{"./ruler":53,"./rules_block/blockquote":54,"./rules_block/code":55,"./rules_block/fence":56,"./rules_block/heading":57,"./rules_block/hr":58,"./rules_block/html_block":59,"./rules_block/lheading":60,"./rules_block/list":61,"./rules_block/paragraph":62,"./rules_block/reference":63,"./rules_block/state_block":64,"./rules_block/table":65}],47:[function(require,module,exports){
 7907    -1 /** internal
 7908    -1  * class Core
 7909    -1  *
 7910    -1  * Top-level rules executor. Glues block/inline parsers and does intermediate
 7911    -1  * transformations.
 7912    -1  **/
 7913    -1 'use strict';
 7914    -1 
 7915    -1 
 7916    -1 var Ruler  = require('./ruler');
 7917    -1 
 7918    -1 
 7919    -1 var _rules = [
 7920    -1   [ 'normalize',      require('./rules_core/normalize')      ],
 7921    -1   [ 'block',          require('./rules_core/block')          ],
 7922    -1   [ 'inline',         require('./rules_core/inline')         ],
 7923    -1   [ 'linkify',        require('./rules_core/linkify')        ],
 7924    -1   [ 'replacements',   require('./rules_core/replacements')   ],
 7925    -1   [ 'smartquotes',    require('./rules_core/smartquotes')    ]
 7926    -1 ];
 7927    -1 
 7928    -1 
 7929    -1 /**
 7930    -1  * new Core()
 7931    -1  **/
 7932    -1 function Core() {
 7933    -1   /**
 7934    -1    * Core#ruler -> Ruler
 7935    -1    *
 7936    -1    * [[Ruler]] instance. Keep configuration of core rules.
 7937    -1    **/
 7938    -1   this.ruler = new Ruler();
 7939    -1 
 7940    -1   for (var i = 0; i < _rules.length; i++) {
 7941    -1     this.ruler.push(_rules[i][0], _rules[i][1]);
 7942    -1   }
 7943    -1 }
 7944    -1 
 7945    -1 
 7946    -1 /**
 7947    -1  * Core.process(state)
 7948    -1  *
 7949    -1  * Executes core chain rules.
 7950    -1  **/
 7951    -1 Core.prototype.process = function (state) {
 7952    -1   var i, l, rules;
 7953    -1 
 7954    -1   rules = this.ruler.getRules('');
 7955    -1 
 7956    -1   for (i = 0, l = rules.length; i < l; i++) {
 7957    -1     rules[i](state);
 7958    -1   }
 7959    -1 };
 7960    -1 
 7961    -1 Core.prototype.State = require('./rules_core/state_core');
 7962    -1 
 7963    -1 
 7964    -1 module.exports = Core;
 7965    -1 
 7966    -1 },{"./ruler":53,"./rules_core/block":66,"./rules_core/inline":67,"./rules_core/linkify":68,"./rules_core/normalize":69,"./rules_core/replacements":70,"./rules_core/smartquotes":71,"./rules_core/state_core":72}],48:[function(require,module,exports){
 7967    -1 /** internal
 7968    -1  * class ParserInline
 7969    -1  *
 7970    -1  * Tokenizes paragraph content.
 7971    -1  **/
 7972    -1 'use strict';
 7973    -1 
 7974    -1 
 7975    -1 var Ruler           = require('./ruler');
 7976    -1 
 7977    -1 
 7978    -1 ////////////////////////////////////////////////////////////////////////////////
 7979    -1 // Parser rules
 7980    -1 
 7981    -1 var _rules = [
 7982    -1   [ 'text',            require('./rules_inline/text') ],
 7983    -1   [ 'newline',         require('./rules_inline/newline') ],
 7984    -1   [ 'escape',          require('./rules_inline/escape') ],
 7985    -1   [ 'backticks',       require('./rules_inline/backticks') ],
 7986    -1   [ 'strikethrough',   require('./rules_inline/strikethrough').tokenize ],
 7987    -1   [ 'emphasis',        require('./rules_inline/emphasis').tokenize ],
 7988    -1   [ 'link',            require('./rules_inline/link') ],
 7989    -1   [ 'image',           require('./rules_inline/image') ],
 7990    -1   [ 'autolink',        require('./rules_inline/autolink') ],
 7991    -1   [ 'html_inline',     require('./rules_inline/html_inline') ],
 7992    -1   [ 'entity',          require('./rules_inline/entity') ]
 7993    -1 ];
 7994    -1 
 7995    -1 var _rules2 = [
 7996    -1   [ 'balance_pairs',   require('./rules_inline/balance_pairs') ],
 7997    -1   [ 'strikethrough',   require('./rules_inline/strikethrough').postProcess ],
 7998    -1   [ 'emphasis',        require('./rules_inline/emphasis').postProcess ],
 7999    -1   [ 'text_collapse',   require('./rules_inline/text_collapse') ]
 8000    -1 ];
 8001    -1 
 8002    -1 
 8003    -1 /**
 8004    -1  * new ParserInline()
 8005    -1  **/
 8006    -1 function ParserInline() {
 8007    -1   var i;
 8008    -1 
 8009    -1   /**
 8010    -1    * ParserInline#ruler -> Ruler
 8011    -1    *
 8012    -1    * [[Ruler]] instance. Keep configuration of inline rules.
 8013    -1    **/
 8014    -1   this.ruler = new Ruler();
 8015    -1 
 8016    -1   for (i = 0; i < _rules.length; i++) {
 8017    -1     this.ruler.push(_rules[i][0], _rules[i][1]);
 8018    -1   }
 8019    -1 
 8020    -1   /**
 8021    -1    * ParserInline#ruler2 -> Ruler
 8022    -1    *
 8023    -1    * [[Ruler]] instance. Second ruler used for post-processing
 8024    -1    * (e.g. in emphasis-like rules).
 8025    -1    **/
 8026    -1   this.ruler2 = new Ruler();
 8027    -1 
 8028    -1   for (i = 0; i < _rules2.length; i++) {
 8029    -1     this.ruler2.push(_rules2[i][0], _rules2[i][1]);
 8030    -1   }
 8031    -1 }
 8032    -1 
 8033    -1 
 8034    -1 // Skip single token by running all rules in validation mode;
 8035    -1 // returns `true` if any rule reported success
 8036    -1 //
 8037    -1 ParserInline.prototype.skipToken = function (state) {
 8038    -1   var ok, i, pos = state.pos,
 8039    -1       rules = this.ruler.getRules(''),
 8040    -1       len = rules.length,
 8041    -1       maxNesting = state.md.options.maxNesting,
 8042    -1       cache = state.cache;
 8043    -1 
 8044    -1 
 8045    -1   if (typeof cache[pos] !== 'undefined') {
 8046    -1     state.pos = cache[pos];
 8047    -1     return;
 8048    -1   }
 8049    -1 
 8050    -1   if (state.level < maxNesting) {
 8051    -1     for (i = 0; i < len; i++) {
 8052    -1       // Increment state.level and decrement it later to limit recursion.
 8053    -1       // It's harmless to do here, because no tokens are created. But ideally,
 8054    -1       // we'd need a separate private state variable for this purpose.
 8055    -1       //
 8056    -1       state.level++;
 8057    -1       ok = rules[i](state, true);
 8058    -1       state.level--;
 8059    -1 
 8060    -1       if (ok) { break; }
 8061    -1     }
 8062    -1   } else {
 8063    -1     // Too much nesting, just skip until the end of the paragraph.
 8064    -1     //
 8065    -1     // NOTE: this will cause links to behave incorrectly in the following case,
 8066    -1     //       when an amount of `[` is exactly equal to `maxNesting + 1`:
 8067    -1     //
 8068    -1     //       [[[[[[[[[[[[[[[[[[[[[foo]()
 8069    -1     //
 8070    -1     // TODO: remove this workaround when CM standard will allow nested links
 8071    -1     //       (we can replace it by preventing links from being parsed in
 8072    -1     //       validation mode)
 8073    -1     //
 8074    -1     state.pos = state.posMax;
 8075    -1   }
 8076    -1 
 8077    -1   if (!ok) { state.pos++; }
 8078    -1   cache[pos] = state.pos;
 8079    -1 };
 8080    -1 
 8081    -1 
 8082    -1 // Generate tokens for input range
 8083    -1 //
 8084    -1 ParserInline.prototype.tokenize = function (state) {
 8085    -1   var ok, i,
 8086    -1       rules = this.ruler.getRules(''),
 8087    -1       len = rules.length,
 8088    -1       end = state.posMax,
 8089    -1       maxNesting = state.md.options.maxNesting;
 8090    -1 
 8091    -1   while (state.pos < end) {
 8092    -1     // Try all possible rules.
 8093    -1     // On success, rule should:
 8094    -1     //
 8095    -1     // - update `state.pos`
 8096    -1     // - update `state.tokens`
 8097    -1     // - return true
 8098    -1 
 8099    -1     if (state.level < maxNesting) {
 8100    -1       for (i = 0; i < len; i++) {
 8101    -1         ok = rules[i](state, false);
 8102    -1         if (ok) { break; }
 8103    -1       }
 8104    -1     }
 8105    -1 
 8106    -1     if (ok) {
 8107    -1       if (state.pos >= end) { break; }
 8108    -1       continue;
 8109    -1     }
 8110    -1 
 8111    -1     state.pending += state.src[state.pos++];
 8112    -1   }
 8113    -1 
 8114    -1   if (state.pending) {
 8115    -1     state.pushPending();
 8116    -1   }
 8117    -1 };
 8118    -1 
 8119    -1 
 8120    -1 /**
 8121    -1  * ParserInline.parse(str, md, env, outTokens)
 8122    -1  *
 8123    -1  * Process input string and push inline tokens into `outTokens`
 8124    -1  **/
 8125    -1 ParserInline.prototype.parse = function (str, md, env, outTokens) {
 8126    -1   var i, rules, len;
 8127    -1   var state = new this.State(str, md, env, outTokens);
 8128    -1 
 8129    -1   this.tokenize(state);
 8130    -1 
 8131    -1   rules = this.ruler2.getRules('');
 8132    -1   len = rules.length;
 8133    -1 
 8134    -1   for (i = 0; i < len; i++) {
 8135    -1     rules[i](state);
 8136    -1   }
 8137    -1 };
 8138    -1 
 8139    -1 
 8140    -1 ParserInline.prototype.State = require('./rules_inline/state_inline');
 8141    -1 
 8142    -1 
 8143    -1 module.exports = ParserInline;
 8144    -1 
 8145    -1 },{"./ruler":53,"./rules_inline/autolink":73,"./rules_inline/backticks":74,"./rules_inline/balance_pairs":75,"./rules_inline/emphasis":76,"./rules_inline/entity":77,"./rules_inline/escape":78,"./rules_inline/html_inline":79,"./rules_inline/image":80,"./rules_inline/link":81,"./rules_inline/newline":82,"./rules_inline/state_inline":83,"./rules_inline/strikethrough":84,"./rules_inline/text":85,"./rules_inline/text_collapse":86}],49:[function(require,module,exports){
 8146    -1 // Commonmark default options
 8147    -1 
 8148    -1 'use strict';
 8149    -1 
 8150    -1 
 8151    -1 module.exports = {
 8152    -1   options: {
 8153    -1     html:         true,         // Enable HTML tags in source
 8154    -1     xhtmlOut:     true,         // Use '/' to close single tags (<br />)
 8155    -1     breaks:       false,        // Convert '\n' in paragraphs into <br>
 8156    -1     langPrefix:   'language-',  // CSS language prefix for fenced blocks
 8157    -1     linkify:      false,        // autoconvert URL-like texts to links
 8158    -1 
 8159    -1     // Enable some language-neutral replacements + quotes beautification
 8160    -1     typographer:  false,
 8161    -1 
 8162    -1     // Double + single quotes replacement pairs, when typographer enabled,
 8163    -1     // and smartquotes on. Could be either a String or an Array.
 8164    -1     //
 8165    -1     // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
 8166    -1     // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
 8167    -1     quotes: '\u201c\u201d\u2018\u2019', /* “”‘’ */
 8168    -1 
 8169    -1     // Highlighter function. Should return escaped HTML,
 8170    -1     // or '' if the source string is not changed and should be escaped externaly.
 8171    -1     // If result starts with <pre... internal wrapper is skipped.
 8172    -1     //
 8173    -1     // function (/*str, lang*/) { return ''; }
 8174    -1     //
 8175    -1     highlight: null,
 8176    -1 
 8177    -1     maxNesting:   20            // Internal protection, recursion limit
 8178    -1   },
 8179    -1 
 8180    -1   components: {
 8181    -1 
 8182    -1     core: {
 8183    -1       rules: [
 8184    -1         'normalize',
 8185    -1         'block',
 8186    -1         'inline'
 8187    -1       ]
 8188    -1     },
 8189    -1 
 8190    -1     block: {
 8191    -1       rules: [
 8192    -1         'blockquote',
 8193    -1         'code',
 8194    -1         'fence',
 8195    -1         'heading',
 8196    -1         'hr',
 8197    -1         'html_block',
 8198    -1         'lheading',
 8199    -1         'list',
 8200    -1         'reference',
 8201    -1         'paragraph'
 8202    -1       ]
 8203    -1     },
 8204    -1 
 8205    -1     inline: {
 8206    -1       rules: [
 8207    -1         'autolink',
 8208    -1         'backticks',
 8209    -1         'emphasis',
 8210    -1         'entity',
 8211    -1         'escape',
 8212    -1         'html_inline',
 8213    -1         'image',
 8214    -1         'link',
 8215    -1         'newline',
 8216    -1         'text'
 8217    -1       ],
 8218    -1       rules2: [
 8219    -1         'balance_pairs',
 8220    -1         'emphasis',
 8221    -1         'text_collapse'
 8222    -1       ]
 8223    -1     }
 8224    -1   }
 8225    -1 };
 8226    -1 
 8227    -1 },{}],50:[function(require,module,exports){
 8228    -1 // markdown-it default options
 8229    -1 
 8230    -1 'use strict';
 8231    -1 
 8232    -1 
 8233    -1 module.exports = {
 8234    -1   options: {
 8235    -1     html:         false,        // Enable HTML tags in source
 8236    -1     xhtmlOut:     false,        // Use '/' to close single tags (<br />)
 8237    -1     breaks:       false,        // Convert '\n' in paragraphs into <br>
 8238    -1     langPrefix:   'language-',  // CSS language prefix for fenced blocks
 8239    -1     linkify:      false,        // autoconvert URL-like texts to links
 8240    -1 
 8241    -1     // Enable some language-neutral replacements + quotes beautification
 8242    -1     typographer:  false,
 8243    -1 
 8244    -1     // Double + single quotes replacement pairs, when typographer enabled,
 8245    -1     // and smartquotes on. Could be either a String or an Array.
 8246    -1     //
 8247    -1     // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
 8248    -1     // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
 8249    -1     quotes: '\u201c\u201d\u2018\u2019', /* “”‘’ */
 8250    -1 
 8251    -1     // Highlighter function. Should return escaped HTML,
 8252    -1     // or '' if the source string is not changed and should be escaped externaly.
 8253    -1     // If result starts with <pre... internal wrapper is skipped.
 8254    -1     //
 8255    -1     // function (/*str, lang*/) { return ''; }
 8256    -1     //
 8257    -1     highlight: null,
 8258    -1 
 8259    -1     maxNesting:   100            // Internal protection, recursion limit
 8260    -1   },
 8261    -1 
 8262    -1   components: {
 8263    -1 
 8264    -1     core: {},
 8265    -1     block: {},
 8266    -1     inline: {}
 8267    -1   }
 8268    -1 };
 8269    -1 
 8270    -1 },{}],51:[function(require,module,exports){
 8271    -1 // "Zero" preset, with nothing enabled. Useful for manual configuring of simple
 8272    -1 // modes. For example, to parse bold/italic only.
 8273    -1 
 8274    -1 'use strict';
 8275    -1 
 8276    -1 
 8277    -1 module.exports = {
 8278    -1   options: {
 8279    -1     html:         false,        // Enable HTML tags in source
 8280    -1     xhtmlOut:     false,        // Use '/' to close single tags (<br />)
 8281    -1     breaks:       false,        // Convert '\n' in paragraphs into <br>
 8282    -1     langPrefix:   'language-',  // CSS language prefix for fenced blocks
 8283    -1     linkify:      false,        // autoconvert URL-like texts to links
 8284    -1 
 8285    -1     // Enable some language-neutral replacements + quotes beautification
 8286    -1     typographer:  false,
 8287    -1 
 8288    -1     // Double + single quotes replacement pairs, when typographer enabled,
 8289    -1     // and smartquotes on. Could be either a String or an Array.
 8290    -1     //
 8291    -1     // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
 8292    -1     // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
 8293    -1     quotes: '\u201c\u201d\u2018\u2019', /* “”‘’ */
 8294    -1 
 8295    -1     // Highlighter function. Should return escaped HTML,
 8296    -1     // or '' if the source string is not changed and should be escaped externaly.
 8297    -1     // If result starts with <pre... internal wrapper is skipped.
 8298    -1     //
 8299    -1     // function (/*str, lang*/) { return ''; }
 8300    -1     //
 8301    -1     highlight: null,
 8302    -1 
 8303    -1     maxNesting:   20            // Internal protection, recursion limit
 8304    -1   },
 8305    -1 
 8306    -1   components: {
 8307    -1 
 8308    -1     core: {
 8309    -1       rules: [
 8310    -1         'normalize',
 8311    -1         'block',
 8312    -1         'inline'
 8313    -1       ]
 8314    -1     },
 8315    -1 
 8316    -1     block: {
 8317    -1       rules: [
 8318    -1         'paragraph'
 8319    -1       ]
 8320    -1     },
 8321    -1 
 8322    -1     inline: {
 8323    -1       rules: [
 8324    -1         'text'
 8325    -1       ],
 8326    -1       rules2: [
 8327    -1         'balance_pairs',
 8328    -1         'text_collapse'
 8329    -1       ]
 8330    -1     }
 8331    -1   }
 8332    -1 };
 8333    -1 
 8334    -1 },{}],52:[function(require,module,exports){
 8335    -1 /**
 8336    -1  * class Renderer
 8337    -1  *
 8338    -1  * Generates HTML from parsed token stream. Each instance has independent
 8339    -1  * copy of rules. Those can be rewritten with ease. Also, you can add new
 8340    -1  * rules if you create plugin and adds new token types.
 8341    -1  **/
 8342    -1 'use strict';
 8343    -1 
 8344    -1 
 8345    -1 var assign          = require('./common/utils').assign;
 8346    -1 var unescapeAll     = require('./common/utils').unescapeAll;
 8347    -1 var escapeHtml      = require('./common/utils').escapeHtml;
 8348    -1 
 8349    -1 
 8350    -1 ////////////////////////////////////////////////////////////////////////////////
 8351    -1 
 8352    -1 var default_rules = {};
 8353    -1 
 8354    -1 
 8355    -1 default_rules.code_inline = function (tokens, idx, options, env, slf) {
 8356    -1   var token = tokens[idx];
 8357    -1 
 8358    -1   return  '<code' + slf.renderAttrs(token) + '>' +
 8359    -1           escapeHtml(tokens[idx].content) +
 8360    -1           '</code>';
 8361    -1 };
 8362    -1 
 8363    -1 
 8364    -1 default_rules.code_block = function (tokens, idx, options, env, slf) {
 8365    -1   var token = tokens[idx];
 8366    -1 
 8367    -1   return  '<pre' + slf.renderAttrs(token) + '><code>' +
 8368    -1           escapeHtml(tokens[idx].content) +
 8369    -1           '</code></pre>\n';
 8370    -1 };
 8371    -1 
 8372    -1 
 8373    -1 default_rules.fence = function (tokens, idx, options, env, slf) {
 8374    -1   var token = tokens[idx],
 8375    -1       info = token.info ? unescapeAll(token.info).trim() : '',
 8376    -1       langName = '',
 8377    -1       highlighted, i, tmpAttrs, tmpToken;
 8378    -1 
 8379    -1   if (info) {
 8380    -1     langName = info.split(/\s+/g)[0];
 8381    -1   }
 8382    -1 
 8383    -1   if (options.highlight) {
 8384    -1     highlighted = options.highlight(token.content, langName) || escapeHtml(token.content);
 8385    -1   } else {
 8386    -1     highlighted = escapeHtml(token.content);
 8387    -1   }
 8388    -1 
 8389    -1   if (highlighted.indexOf('<pre') === 0) {
 8390    -1     return highlighted + '\n';
 8391    -1   }
 8392    -1 
 8393    -1   // If language exists, inject class gently, without mudofying original token.
 8394    -1   // May be, one day we will add .clone() for token and simplify this part, but
 8395    -1   // now we prefer to keep things local.
 8396    -1   if (info) {
 8397    -1     i        = token.attrIndex('class');
 8398    -1     tmpAttrs = token.attrs ? token.attrs.slice() : [];
 8399    -1 
 8400    -1     if (i < 0) {
 8401    -1       tmpAttrs.push([ 'class', options.langPrefix + langName ]);
 8402    -1     } else {
 8403    -1       tmpAttrs[i][1] += ' ' + options.langPrefix + langName;
 8404    -1     }
 8405    -1 
 8406    -1     // Fake token just to render attributes
 8407    -1     tmpToken = {
 8408    -1       attrs: tmpAttrs
 8409    -1     };
 8410    -1 
 8411    -1     return  '<pre><code' + slf.renderAttrs(tmpToken) + '>'
 8412    -1           + highlighted
 8413    -1           + '</code></pre>\n';
 8414    -1   }
 8415    -1 
 8416    -1 
 8417    -1   return  '<pre><code' + slf.renderAttrs(token) + '>'
 8418    -1         + highlighted
 8419    -1         + '</code></pre>\n';
 8420    -1 };
 8421    -1 
 8422    -1 
 8423    -1 default_rules.image = function (tokens, idx, options, env, slf) {
 8424    -1   var token = tokens[idx];
 8425    -1 
 8426    -1   // "alt" attr MUST be set, even if empty. Because it's mandatory and
 8427    -1   // should be placed on proper position for tests.
 8428    -1   //
 8429    -1   // Replace content with actual value
 8430    -1 
 8431    -1   token.attrs[token.attrIndex('alt')][1] =
 8432    -1     slf.renderInlineAsText(token.children, options, env);
 8433    -1 
 8434    -1   return slf.renderToken(tokens, idx, options);
 8435    -1 };
 8436    -1 
 8437    -1 
 8438    -1 default_rules.hardbreak = function (tokens, idx, options /*, env */) {
 8439    -1   return options.xhtmlOut ? '<br />\n' : '<br>\n';
 8440    -1 };
 8441    -1 default_rules.softbreak = function (tokens, idx, options /*, env */) {
 8442    -1   return options.breaks ? (options.xhtmlOut ? '<br />\n' : '<br>\n') : '\n';
 8443    -1 };
 8444    -1 
 8445    -1 
 8446    -1 default_rules.text = function (tokens, idx /*, options, env */) {
 8447    -1   return escapeHtml(tokens[idx].content);
 8448    -1 };
 8449    -1 
 8450    -1 
 8451    -1 default_rules.html_block = function (tokens, idx /*, options, env */) {
 8452    -1   return tokens[idx].content;
 8453    -1 };
 8454    -1 default_rules.html_inline = function (tokens, idx /*, options, env */) {
 8455    -1   return tokens[idx].content;
 8456    -1 };
 8457    -1 
 8458    -1 
 8459    -1 /**
 8460    -1  * new Renderer()
 8461    -1  *
 8462    -1  * Creates new [[Renderer]] instance and fill [[Renderer#rules]] with defaults.
 8463    -1  **/
 8464    -1 function Renderer() {
 8465    -1 
 8466    -1   /**
 8467    -1    * Renderer#rules -> Object
 8468    -1    *
 8469    -1    * Contains render rules for tokens. Can be updated and extended.
 8470    -1    *
 8471    -1    * ##### Example
 8472    -1    *
 8473    -1    * ```javascript
 8474    -1    * var md = require('markdown-it')();
 8475    -1    *
 8476    -1    * md.renderer.rules.strong_open  = function () { return '<b>'; };
 8477    -1    * md.renderer.rules.strong_close = function () { return '</b>'; };
 8478    -1    *
 8479    -1    * var result = md.renderInline(...);
 8480    -1    * ```
 8481    -1    *
 8482    -1    * Each rule is called as independed static function with fixed signature:
 8483    -1    *
 8484    -1    * ```javascript
 8485    -1    * function my_token_render(tokens, idx, options, env, renderer) {
 8486    -1    *   // ...
 8487    -1    *   return renderedHTML;
 8488    -1    * }
 8489    -1    * ```
 8490    -1    *
 8491    -1    * See [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js)
 8492    -1    * for more details and examples.
 8493    -1    **/
 8494    -1   this.rules = assign({}, default_rules);
 8495    -1 }
 8496    -1 
 8497    -1 
 8498    -1 /**
 8499    -1  * Renderer.renderAttrs(token) -> String
 8500    -1  *
 8501    -1  * Render token attributes to string.
 8502    -1  **/
 8503    -1 Renderer.prototype.renderAttrs = function renderAttrs(token) {
 8504    -1   var i, l, result;
 8505    -1 
 8506    -1   if (!token.attrs) { return ''; }
 8507    -1 
 8508    -1   result = '';
 8509    -1 
 8510    -1   for (i = 0, l = token.attrs.length; i < l; i++) {
 8511    -1     result += ' ' + escapeHtml(token.attrs[i][0]) + '="' + escapeHtml(token.attrs[i][1]) + '"';
 8512    -1   }
 8513    -1 
 8514    -1   return result;
 8515    -1 };
 8516    -1 
 8517    -1 
 8518    -1 /**
 8519    -1  * Renderer.renderToken(tokens, idx, options) -> String
 8520    -1  * - tokens (Array): list of tokens
 8521    -1  * - idx (Numbed): token index to render
 8522    -1  * - options (Object): params of parser instance
 8523    -1  *
 8524    -1  * Default token renderer. Can be overriden by custom function
 8525    -1  * in [[Renderer#rules]].
 8526    -1  **/
 8527    -1 Renderer.prototype.renderToken = function renderToken(tokens, idx, options) {
 8528    -1   var nextToken,
 8529    -1       result = '',
 8530    -1       needLf = false,
 8531    -1       token = tokens[idx];
 8532    -1 
 8533    -1   // Tight list paragraphs
 8534    -1   if (token.hidden) {
 8535    -1     return '';
 8536    -1   }
 8537    -1 
 8538    -1   // Insert a newline between hidden paragraph and subsequent opening
 8539    -1   // block-level tag.
 8540    -1   //
 8541    -1   // For example, here we should insert a newline before blockquote:
 8542    -1   //  - a
 8543    -1   //    >
 8544    -1   //
 8545    -1   if (token.block && token.nesting !== -1 && idx && tokens[idx - 1].hidden) {
 8546    -1     result += '\n';
 8547    -1   }
 8548    -1 
 8549    -1   // Add token name, e.g. `<img`
 8550    -1   result += (token.nesting === -1 ? '</' : '<') + token.tag;
 8551    -1 
 8552    -1   // Encode attributes, e.g. `<img src="foo"`
 8553    -1   result += this.renderAttrs(token);
 8554    -1 
 8555    -1   // Add a slash for self-closing tags, e.g. `<img src="foo" /`
 8556    -1   if (token.nesting === 0 && options.xhtmlOut) {
 8557    -1     result += ' /';
 8558    -1   }
 8559    -1 
 8560    -1   // Check if we need to add a newline after this tag
 8561    -1   if (token.block) {
 8562    -1     needLf = true;
 8563    -1 
 8564    -1     if (token.nesting === 1) {
 8565    -1       if (idx + 1 < tokens.length) {
 8566    -1         nextToken = tokens[idx + 1];
 8567    -1 
 8568    -1         if (nextToken.type === 'inline' || nextToken.hidden) {
 8569    -1           // Block-level tag containing an inline tag.
 8570    -1           //
 8571    -1           needLf = false;
 8572    -1 
 8573    -1         } else if (nextToken.nesting === -1 && nextToken.tag === token.tag) {
 8574    -1           // Opening tag + closing tag of the same type. E.g. `<li></li>`.
 8575    -1           //
 8576    -1           needLf = false;
 8577    -1         }
 8578    -1       }
 8579    -1     }
 8580    -1   }
 8581    -1 
 8582    -1   result += needLf ? '>\n' : '>';
 8583    -1 
 8584    -1   return result;
 8585    -1 };
 8586    -1 
 8587    -1 
 8588    -1 /**
 8589    -1  * Renderer.renderInline(tokens, options, env) -> String
 8590    -1  * - tokens (Array): list on block tokens to renter
 8591    -1  * - options (Object): params of parser instance
 8592    -1  * - env (Object): additional data from parsed input (references, for example)
 8593    -1  *
 8594    -1  * The same as [[Renderer.render]], but for single token of `inline` type.
 8595    -1  **/
 8596    -1 Renderer.prototype.renderInline = function (tokens, options, env) {
 8597    -1   var type,
 8598    -1       result = '',
 8599    -1       rules = this.rules;
 8600    -1 
 8601    -1   for (var i = 0, len = tokens.length; i < len; i++) {
 8602    -1     type = tokens[i].type;
 8603    -1 
 8604    -1     if (typeof rules[type] !== 'undefined') {
 8605    -1       result += rules[type](tokens, i, options, env, this);
 8606    -1     } else {
 8607    -1       result += this.renderToken(tokens, i, options);
 8608    -1     }
 8609    -1   }
 8610    -1 
 8611    -1   return result;
 8612    -1 };
 8613    -1 
 8614    -1 
 8615    -1 /** internal
 8616    -1  * Renderer.renderInlineAsText(tokens, options, env) -> String
 8617    -1  * - tokens (Array): list on block tokens to renter
 8618    -1  * - options (Object): params of parser instance
 8619    -1  * - env (Object): additional data from parsed input (references, for example)
 8620    -1  *
 8621    -1  * Special kludge for image `alt` attributes to conform CommonMark spec.
 8622    -1  * Don't try to use it! Spec requires to show `alt` content with stripped markup,
 8623    -1  * instead of simple escaping.
 8624    -1  **/
 8625    -1 Renderer.prototype.renderInlineAsText = function (tokens, options, env) {
 8626    -1   var result = '';
 8627    -1 
 8628    -1   for (var i = 0, len = tokens.length; i < len; i++) {
 8629    -1     if (tokens[i].type === 'text') {
 8630    -1       result += tokens[i].content;
 8631    -1     } else if (tokens[i].type === 'image') {
 8632    -1       result += this.renderInlineAsText(tokens[i].children, options, env);
 8633    -1     }
 8634    -1   }
 8635    -1 
 8636    -1   return result;
 8637    -1 };
 8638    -1 
 8639    -1 
 8640    -1 /**
 8641    -1  * Renderer.render(tokens, options, env) -> String
 8642    -1  * - tokens (Array): list on block tokens to renter
 8643    -1  * - options (Object): params of parser instance
 8644    -1  * - env (Object): additional data from parsed input (references, for example)
 8645    -1  *
 8646    -1  * Takes token stream and generates HTML. Probably, you will never need to call
 8647    -1  * this method directly.
 8648    -1  **/
 8649    -1 Renderer.prototype.render = function (tokens, options, env) {
 8650    -1   var i, len, type,
 8651    -1       result = '',
 8652    -1       rules = this.rules;
 8653    -1 
 8654    -1   for (i = 0, len = tokens.length; i < len; i++) {
 8655    -1     type = tokens[i].type;
 8656    -1 
 8657    -1     if (type === 'inline') {
 8658    -1       result += this.renderInline(tokens[i].children, options, env);
 8659    -1     } else if (typeof rules[type] !== 'undefined') {
 8660    -1       result += rules[tokens[i].type](tokens, i, options, env, this);
 8661    -1     } else {
 8662    -1       result += this.renderToken(tokens, i, options, env);
 8663    -1     }
 8664    -1   }
 8665    -1 
 8666    -1   return result;
 8667    -1 };
 8668    -1 
 8669    -1 module.exports = Renderer;
 8670    -1 
 8671    -1 },{"./common/utils":40}],53:[function(require,module,exports){
 8672    -1 /**
 8673    -1  * class Ruler
 8674    -1  *
 8675    -1  * Helper class, used by [[MarkdownIt#core]], [[MarkdownIt#block]] and
 8676    -1  * [[MarkdownIt#inline]] to manage sequences of functions (rules):
 8677    -1  *
 8678    -1  * - keep rules in defined order
 8679    -1  * - assign the name to each rule
 8680    -1  * - enable/disable rules
 8681    -1  * - add/replace rules
 8682    -1  * - allow assign rules to additional named chains (in the same)
 8683    -1  * - cacheing lists of active rules
 8684    -1  *
 8685    -1  * You will not need use this class directly until write plugins. For simple
 8686    -1  * rules control use [[MarkdownIt.disable]], [[MarkdownIt.enable]] and
 8687    -1  * [[MarkdownIt.use]].
 8688    -1  **/
 8689    -1 'use strict';
 8690    -1 
 8691    -1 
 8692    -1 /**
 8693    -1  * new Ruler()
 8694    -1  **/
 8695    -1 function Ruler() {
 8696    -1   // List of added rules. Each element is:
 8697    -1   //
 8698    -1   // {
 8699    -1   //   name: XXX,
 8700    -1   //   enabled: Boolean,
 8701    -1   //   fn: Function(),
 8702    -1   //   alt: [ name2, name3 ]
 8703    -1   // }
 8704    -1   //
 8705    -1   this.__rules__ = [];
 8706    -1 
 8707    -1   // Cached rule chains.
 8708    -1   //
 8709    -1   // First level - chain name, '' for default.
 8710    -1   // Second level - diginal anchor for fast filtering by charcodes.
 8711    -1   //
 8712    -1   this.__cache__ = null;
 8713    -1 }
 8714    -1 
 8715    -1 ////////////////////////////////////////////////////////////////////////////////
 8716    -1 // Helper methods, should not be used directly
 8717    -1 
 8718    -1 
 8719    -1 // Find rule index by name
 8720    -1 //
 8721    -1 Ruler.prototype.__find__ = function (name) {
 8722    -1   for (var i = 0; i < this.__rules__.length; i++) {
 8723    -1     if (this.__rules__[i].name === name) {
 8724    -1       return i;
 8725    -1     }
 8726    -1   }
 8727    -1   return -1;
 8728    -1 };
 8729    -1 
 8730    -1 
 8731    -1 // Build rules lookup cache
 8732    -1 //
 8733    -1 Ruler.prototype.__compile__ = function () {
 8734    -1   var self = this;
 8735    -1   var chains = [ '' ];
 8736    -1 
 8737    -1   // collect unique names
 8738    -1   self.__rules__.forEach(function (rule) {
 8739    -1     if (!rule.enabled) { return; }
 8740    -1 
 8741    -1     rule.alt.forEach(function (altName) {
 8742    -1       if (chains.indexOf(altName) < 0) {
 8743    -1         chains.push(altName);
 8744    -1       }
 8745    -1     });
 8746    -1   });
 8747    -1 
 8748    -1   self.__cache__ = {};
 8749    -1 
 8750    -1   chains.forEach(function (chain) {
 8751    -1     self.__cache__[chain] = [];
 8752    -1     self.__rules__.forEach(function (rule) {
 8753    -1       if (!rule.enabled) { return; }
 8754    -1 
 8755    -1       if (chain && rule.alt.indexOf(chain) < 0) { return; }
 8756    -1 
 8757    -1       self.__cache__[chain].push(rule.fn);
 8758    -1     });
 8759    -1   });
 8760    -1 };
 8761    -1 
 8762    -1 
 8763    -1 /**
 8764    -1  * Ruler.at(name, fn [, options])
 8765    -1  * - name (String): rule name to replace.
 8766    -1  * - fn (Function): new rule function.
 8767    -1  * - options (Object): new rule options (not mandatory).
 8768    -1  *
 8769    -1  * Replace rule by name with new function & options. Throws error if name not
 8770    -1  * found.
 8771    -1  *
 8772    -1  * ##### Options:
 8773    -1  *
 8774    -1  * - __alt__ - array with names of "alternate" chains.
 8775    -1  *
 8776    -1  * ##### Example
 8777    -1  *
 8778    -1  * Replace existing typorgapher replacement rule with new one:
 8779    -1  *
 8780    -1  * ```javascript
 8781    -1  * var md = require('markdown-it')();
 8782    -1  *
 8783    -1  * md.core.ruler.at('replacements', function replace(state) {
 8784    -1  *   //...
 8785    -1  * });
 8786    -1  * ```
 8787    -1  **/
 8788    -1 Ruler.prototype.at = function (name, fn, options) {
 8789    -1   var index = this.__find__(name);
 8790    -1   var opt = options || {};
 8791    -1 
 8792    -1   if (index === -1) { throw new Error('Parser rule not found: ' + name); }
 8793    -1 
 8794    -1   this.__rules__[index].fn = fn;
 8795    -1   this.__rules__[index].alt = opt.alt || [];
 8796    -1   this.__cache__ = null;
 8797    -1 };
 8798    -1 
 8799    -1 
 8800    -1 /**
 8801    -1  * Ruler.before(beforeName, ruleName, fn [, options])
 8802    -1  * - beforeName (String): new rule will be added before this one.
 8803    -1  * - ruleName (String): name of added rule.
 8804    -1  * - fn (Function): rule function.
 8805    -1  * - options (Object): rule options (not mandatory).
 8806    -1  *
 8807    -1  * Add new rule to chain before one with given name. See also
 8808    -1  * [[Ruler.after]], [[Ruler.push]].
 8809    -1  *
 8810    -1  * ##### Options:
 8811    -1  *
 8812    -1  * - __alt__ - array with names of "alternate" chains.
 8813    -1  *
 8814    -1  * ##### Example
 8815    -1  *
 8816    -1  * ```javascript
 8817    -1  * var md = require('markdown-it')();
 8818    -1  *
 8819    -1  * md.block.ruler.before('paragraph', 'my_rule', function replace(state) {
 8820    -1  *   //...
 8821    -1  * });
 8822    -1  * ```
 8823    -1  **/
 8824    -1 Ruler.prototype.before = function (beforeName, ruleName, fn, options) {
 8825    -1   var index = this.__find__(beforeName);
 8826    -1   var opt = options || {};
 8827    -1 
 8828    -1   if (index === -1) { throw new Error('Parser rule not found: ' + beforeName); }
 8829    -1 
 8830    -1   this.__rules__.splice(index, 0, {
 8831    -1     name: ruleName,
 8832    -1     enabled: true,
 8833    -1     fn: fn,
 8834    -1     alt: opt.alt || []
 8835    -1   });
 8836    -1 
 8837    -1   this.__cache__ = null;
 8838    -1 };
 8839    -1 
 8840    -1 
 8841    -1 /**
 8842    -1  * Ruler.after(afterName, ruleName, fn [, options])
 8843    -1  * - afterName (String): new rule will be added after this one.
 8844    -1  * - ruleName (String): name of added rule.
 8845    -1  * - fn (Function): rule function.
 8846    -1  * - options (Object): rule options (not mandatory).
 8847    -1  *
 8848    -1  * Add new rule to chain after one with given name. See also
 8849    -1  * [[Ruler.before]], [[Ruler.push]].
 8850    -1  *
 8851    -1  * ##### Options:
 8852    -1  *
 8853    -1  * - __alt__ - array with names of "alternate" chains.
 8854    -1  *
 8855    -1  * ##### Example
 8856    -1  *
 8857    -1  * ```javascript
 8858    -1  * var md = require('markdown-it')();
 8859    -1  *
 8860    -1  * md.inline.ruler.after('text', 'my_rule', function replace(state) {
 8861    -1  *   //...
 8862    -1  * });
 8863    -1  * ```
 8864    -1  **/
 8865    -1 Ruler.prototype.after = function (afterName, ruleName, fn, options) {
 8866    -1   var index = this.__find__(afterName);
 8867    -1   var opt = options || {};
 8868    -1 
 8869    -1   if (index === -1) { throw new Error('Parser rule not found: ' + afterName); }
 8870    -1 
 8871    -1   this.__rules__.splice(index + 1, 0, {
 8872    -1     name: ruleName,
 8873    -1     enabled: true,
 8874    -1     fn: fn,
 8875    -1     alt: opt.alt || []
 8876    -1   });
 8877    -1 
 8878    -1   this.__cache__ = null;
 8879    -1 };
 8880    -1 
 8881    -1 /**
 8882    -1  * Ruler.push(ruleName, fn [, options])
 8883    -1  * - ruleName (String): name of added rule.
 8884    -1  * - fn (Function): rule function.
 8885    -1  * - options (Object): rule options (not mandatory).
 8886    -1  *
 8887    -1  * Push new rule to the end of chain. See also
 8888    -1  * [[Ruler.before]], [[Ruler.after]].
 8889    -1  *
 8890    -1  * ##### Options:
 8891    -1  *
 8892    -1  * - __alt__ - array with names of "alternate" chains.
 8893    -1  *
 8894    -1  * ##### Example
 8895    -1  *
 8896    -1  * ```javascript
 8897    -1  * var md = require('markdown-it')();
 8898    -1  *
 8899    -1  * md.core.ruler.push('my_rule', function replace(state) {
 8900    -1  *   //...
 8901    -1  * });
 8902    -1  * ```
 8903    -1  **/
 8904    -1 Ruler.prototype.push = function (ruleName, fn, options) {
 8905    -1   var opt = options || {};
 8906    -1 
 8907    -1   this.__rules__.push({
 8908    -1     name: ruleName,
 8909    -1     enabled: true,
 8910    -1     fn: fn,
 8911    -1     alt: opt.alt || []
 8912    -1   });
 8913    -1 
 8914    -1   this.__cache__ = null;
 8915    -1 };
 8916    -1 
 8917    -1 
 8918    -1 /**
 8919    -1  * Ruler.enable(list [, ignoreInvalid]) -> Array
 8920    -1  * - list (String|Array): list of rule names to enable.
 8921    -1  * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
 8922    -1  *
 8923    -1  * Enable rules with given names. If any rule name not found - throw Error.
 8924    -1  * Errors can be disabled by second param.
 8925    -1  *
 8926    -1  * Returns list of found rule names (if no exception happened).
 8927    -1  *
 8928    -1  * See also [[Ruler.disable]], [[Ruler.enableOnly]].
 8929    -1  **/
 8930    -1 Ruler.prototype.enable = function (list, ignoreInvalid) {
 8931    -1   if (!Array.isArray(list)) { list = [ list ]; }
 8932    -1 
 8933    -1   var result = [];
 8934    -1 
 8935    -1   // Search by name and enable
 8936    -1   list.forEach(function (name) {
 8937    -1     var idx = this.__find__(name);
 8938    -1 
 8939    -1     if (idx < 0) {
 8940    -1       if (ignoreInvalid) { return; }
 8941    -1       throw new Error('Rules manager: invalid rule name ' + name);
 8942    -1     }
 8943    -1     this.__rules__[idx].enabled = true;
 8944    -1     result.push(name);
 8945    -1   }, this);
 8946    -1 
 8947    -1   this.__cache__ = null;
 8948    -1   return result;
 8949    -1 };
 8950    -1 
 8951    -1 
 8952    -1 /**
 8953    -1  * Ruler.enableOnly(list [, ignoreInvalid])
 8954    -1  * - list (String|Array): list of rule names to enable (whitelist).
 8955    -1  * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
 8956    -1  *
 8957    -1  * Enable rules with given names, and disable everything else. If any rule name
 8958    -1  * not found - throw Error. Errors can be disabled by second param.
 8959    -1  *
 8960    -1  * See also [[Ruler.disable]], [[Ruler.enable]].
 8961    -1  **/
 8962    -1 Ruler.prototype.enableOnly = function (list, ignoreInvalid) {
 8963    -1   if (!Array.isArray(list)) { list = [ list ]; }
 8964    -1 
 8965    -1   this.__rules__.forEach(function (rule) { rule.enabled = false; });
 8966    -1 
 8967    -1   this.enable(list, ignoreInvalid);
 8968    -1 };
 8969    -1 
 8970    -1 
 8971    -1 /**
 8972    -1  * Ruler.disable(list [, ignoreInvalid]) -> Array
 8973    -1  * - list (String|Array): list of rule names to disable.
 8974    -1  * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
 8975    -1  *
 8976    -1  * Disable rules with given names. If any rule name not found - throw Error.
 8977    -1  * Errors can be disabled by second param.
 8978    -1  *
 8979    -1  * Returns list of found rule names (if no exception happened).
 8980    -1  *
 8981    -1  * See also [[Ruler.enable]], [[Ruler.enableOnly]].
 8982    -1  **/
 8983    -1 Ruler.prototype.disable = function (list, ignoreInvalid) {
 8984    -1   if (!Array.isArray(list)) { list = [ list ]; }
 8985    -1 
 8986    -1   var result = [];
 8987    -1 
 8988    -1   // Search by name and disable
 8989    -1   list.forEach(function (name) {
 8990    -1     var idx = this.__find__(name);
 8991    -1 
 8992    -1     if (idx < 0) {
 8993    -1       if (ignoreInvalid) { return; }
 8994    -1       throw new Error('Rules manager: invalid rule name ' + name);
 8995    -1     }
 8996    -1     this.__rules__[idx].enabled = false;
 8997    -1     result.push(name);
 8998    -1   }, this);
 8999    -1 
 9000    -1   this.__cache__ = null;
 9001    -1   return result;
 9002    -1 };
 9003    -1 
 9004    -1 
 9005    -1 /**
 9006    -1  * Ruler.getRules(chainName) -> Array
 9007    -1  *
 9008    -1  * Return array of active functions (rules) for given chain name. It analyzes
 9009    -1  * rules configuration, compiles caches if not exists and returns result.
 9010    -1  *
 9011    -1  * Default chain name is `''` (empty string). It can't be skipped. That's
 9012    -1  * done intentionally, to keep signature monomorphic for high speed.
 9013    -1  **/
 9014    -1 Ruler.prototype.getRules = function (chainName) {
 9015    -1   if (this.__cache__ === null) {
 9016    -1     this.__compile__();
 9017    -1   }
 9018    -1 
 9019    -1   // Chain can be empty, if rules disabled. But we still have to return Array.
 9020    -1   return this.__cache__[chainName] || [];
 9021    -1 };
 9022    -1 
 9023    -1 module.exports = Ruler;
 9024    -1 
 9025    -1 },{}],54:[function(require,module,exports){
 9026    -1 // Block quotes
 9027    -1 
 9028    -1 'use strict';
 9029    -1 
 9030    -1 var isSpace = require('../common/utils').isSpace;
 9031    -1 
 9032    -1 
 9033    -1 module.exports = function blockquote(state, startLine, endLine, silent) {
 9034    -1   var nextLine, lastLineEmpty, oldTShift, oldSCount, oldBMarks, oldIndent, oldParentType, lines, initial, offset, ch,
 9035    -1       terminatorRules, token,
 9036    -1       i, l, terminate,
 9037    -1       pos = state.bMarks[startLine] + state.tShift[startLine],
 9038    -1       max = state.eMarks[startLine];
 9039    -1 
 9040    -1   // check the block quote marker
 9041    -1   if (state.src.charCodeAt(pos++) !== 0x3E/* > */) { return false; }
 9042    -1 
 9043    -1   // we know that it's going to be a valid blockquote,
 9044    -1   // so no point trying to find the end of it in silent mode
 9045    -1   if (silent) { return true; }
 9046    -1 
 9047    -1   // skip one optional space (but not tab, check cmark impl) after '>'
 9048    -1   if (state.src.charCodeAt(pos) === 0x20) { pos++; }
 9049    -1 
 9050    -1   oldIndent = state.blkIndent;
 9051    -1   state.blkIndent = 0;
 9052    -1 
 9053    -1   // skip spaces after ">" and re-calculate offset
 9054    -1   initial = offset = state.sCount[startLine] + pos - (state.bMarks[startLine] + state.tShift[startLine]);
 9055    -1 
 9056    -1   oldBMarks = [ state.bMarks[startLine] ];
 9057    -1   state.bMarks[startLine] = pos;
 9058    -1 
 9059    -1   while (pos < max) {
 9060    -1     ch = state.src.charCodeAt(pos);
 9061    -1 
 9062    -1     if (isSpace(ch)) {
 9063    -1       if (ch === 0x09) {
 9064    -1         offset += 4 - offset % 4;
 9065    -1       } else {
 9066    -1         offset++;
 9067    -1       }
 9068    -1     } else {
 9069    -1       break;
 9070    -1     }
 9071    -1 
 9072    -1     pos++;
 9073    -1   }
 9074    -1 
 9075    -1   lastLineEmpty = pos >= max;
 9076    -1 
 9077    -1   oldSCount = [ state.sCount[startLine] ];
 9078    -1   state.sCount[startLine] = offset - initial;
 9079    -1 
 9080    -1   oldTShift = [ state.tShift[startLine] ];
 9081    -1   state.tShift[startLine] = pos - state.bMarks[startLine];
 9082    -1 
 9083    -1   terminatorRules = state.md.block.ruler.getRules('blockquote');
 9084    -1 
 9085    -1   // Search the end of the block
 9086    -1   //
 9087    -1   // Block ends with either:
 9088    -1   //  1. an empty line outside:
 9089    -1   //     ```
 9090    -1   //     > test
 9091    -1   //
 9092    -1   //     ```
 9093    -1   //  2. an empty line inside:
 9094    -1   //     ```
 9095    -1   //     >
 9096    -1   //     test
 9097    -1   //     ```
 9098    -1   //  3. another tag
 9099    -1   //     ```
 9100    -1   //     > test
 9101    -1   //      - - -
 9102    -1   //     ```
 9103    -1   for (nextLine = startLine + 1; nextLine < endLine; nextLine++) {
 9104    -1     if (state.sCount[nextLine] < oldIndent) { break; }
 9105    -1 
 9106    -1     pos = state.bMarks[nextLine] + state.tShift[nextLine];
 9107    -1     max = state.eMarks[nextLine];
 9108    -1 
 9109    -1     if (pos >= max) {
 9110    -1       // Case 1: line is not inside the blockquote, and this line is empty.
 9111    -1       break;
 9112    -1     }
 9113    -1 
 9114    -1     if (state.src.charCodeAt(pos++) === 0x3E/* > */) {
 9115    -1       // This line is inside the blockquote.
 9116    -1 
 9117    -1       // skip one optional space (but not tab, check cmark impl) after '>'
 9118    -1       if (state.src.charCodeAt(pos) === 0x20) { pos++; }
 9119    -1 
 9120    -1       // skip spaces after ">" and re-calculate offset
 9121    -1       initial = offset = state.sCount[nextLine] + pos - (state.bMarks[nextLine] + state.tShift[nextLine]);
 9122    -1 
 9123    -1       oldBMarks.push(state.bMarks[nextLine]);
 9124    -1       state.bMarks[nextLine] = pos;
 9125    -1 
 9126    -1       while (pos < max) {
 9127    -1         ch = state.src.charCodeAt(pos);
 9128    -1 
 9129    -1         if (isSpace(ch)) {
 9130    -1           if (ch === 0x09) {
 9131    -1             offset += 4 - offset % 4;
 9132    -1           } else {
 9133    -1             offset++;
 9134    -1           }
 9135    -1         } else {
 9136    -1           break;
 9137    -1         }
 9138    -1 
 9139    -1         pos++;
 9140    -1       }
 9141    -1 
 9142    -1       lastLineEmpty = pos >= max;
 9143    -1 
 9144    -1       oldSCount.push(state.sCount[nextLine]);
 9145    -1       state.sCount[nextLine] = offset - initial;
 9146    -1 
 9147    -1       oldTShift.push(state.tShift[nextLine]);
 9148    -1       state.tShift[nextLine] = pos - state.bMarks[nextLine];
 9149    -1       continue;
 9150    -1     }
 9151    -1 
 9152    -1     // Case 2: line is not inside the blockquote, and the last line was empty.
 9153    -1     if (lastLineEmpty) { break; }
 9154    -1 
 9155    -1     // Case 3: another tag found.
 9156    -1     terminate = false;
 9157    -1     for (i = 0, l = terminatorRules.length; i < l; i++) {
 9158    -1       if (terminatorRules[i](state, nextLine, endLine, true)) {
 9159    -1         terminate = true;
 9160    -1         break;
 9161    -1       }
 9162    -1     }
 9163    -1     if (terminate) { break; }
 9164    -1 
 9165    -1     oldBMarks.push(state.bMarks[nextLine]);
 9166    -1     oldTShift.push(state.tShift[nextLine]);
 9167    -1     oldSCount.push(state.sCount[nextLine]);
 9168    -1 
 9169    -1     // A negative indentation means that this is a paragraph continuation
 9170    -1     //
 9171    -1     state.sCount[nextLine] = -1;
 9172    -1   }
 9173    -1 
 9174    -1   oldParentType = state.parentType;
 9175    -1   state.parentType = 'blockquote';
 9176    -1 
 9177    -1   token        = state.push('blockquote_open', 'blockquote', 1);
 9178    -1   token.markup = '>';
 9179    -1   token.map    = lines = [ startLine, 0 ];
 9180    -1 
 9181    -1   state.md.block.tokenize(state, startLine, nextLine);
 9182    -1 
 9183    -1   token        = state.push('blockquote_close', 'blockquote', -1);
 9184    -1   token.markup = '>';
 9185    -1 
 9186    -1   state.parentType = oldParentType;
 9187    -1   lines[1] = state.line;
 9188    -1 
 9189    -1   // Restore original tShift; this might not be necessary since the parser
 9190    -1   // has already been here, but just to make sure we can do that.
 9191    -1   for (i = 0; i < oldTShift.length; i++) {
 9192    -1     state.bMarks[i + startLine] = oldBMarks[i];
 9193    -1     state.tShift[i + startLine] = oldTShift[i];
 9194    -1     state.sCount[i + startLine] = oldSCount[i];
 9195    -1   }
 9196    -1   state.blkIndent = oldIndent;
 9197    -1 
 9198    -1   return true;
 9199    -1 };
 9200    -1 
 9201    -1 },{"../common/utils":40}],55:[function(require,module,exports){
 9202    -1 // Code block (4 spaces padded)
 9203    -1 
 9204    -1 'use strict';
 9205    -1 
 9206    -1 
 9207    -1 module.exports = function code(state, startLine, endLine/*, silent*/) {
 9208    -1   var nextLine, last, token, emptyLines = 0;
 9209    -1 
 9210    -1   if (state.sCount[startLine] - state.blkIndent < 4) { return false; }
 9211    -1 
 9212    -1   last = nextLine = startLine + 1;
 9213    -1 
 9214    -1   while (nextLine < endLine) {
 9215    -1     if (state.isEmpty(nextLine)) {
 9216    -1       emptyLines++;
 9217    -1 
 9218    -1       // workaround for lists: 2 blank lines should terminate indented
 9219    -1       // code block, but not fenced code block
 9220    -1       if (emptyLines >= 2 && state.parentType === 'list') {
 9221    -1         break;
 9222    -1       }
 9223    -1 
 9224    -1       nextLine++;
 9225    -1       continue;
 9226    -1     }
 9227    -1 
 9228    -1     emptyLines = 0;
 9229    -1 
 9230    -1     if (state.sCount[nextLine] - state.blkIndent >= 4) {
 9231    -1       nextLine++;
 9232    -1       last = nextLine;
 9233    -1       continue;
 9234    -1     }
 9235    -1     break;
 9236    -1   }
 9237    -1 
 9238    -1   state.line = last;
 9239    -1 
 9240    -1   token         = state.push('code_block', 'code', 0);
 9241    -1   token.content = state.getLines(startLine, last, 4 + state.blkIndent, true);
 9242    -1   token.map     = [ startLine, state.line ];
 9243    -1 
 9244    -1   return true;
 9245    -1 };
 9246    -1 
 9247    -1 },{}],56:[function(require,module,exports){
 9248    -1 // fences (``` lang, ~~~ lang)
 9249    -1 
 9250    -1 'use strict';
 9251    -1 
 9252    -1 
 9253    -1 module.exports = function fence(state, startLine, endLine, silent) {
 9254    -1   var marker, len, params, nextLine, mem, token, markup,
 9255    -1       haveEndMarker = false,
 9256    -1       pos = state.bMarks[startLine] + state.tShift[startLine],
 9257    -1       max = state.eMarks[startLine];
 9258    -1 
 9259    -1   if (pos + 3 > max) { return false; }
 9260    -1 
 9261    -1   marker = state.src.charCodeAt(pos);
 9262    -1 
 9263    -1   if (marker !== 0x7E/* ~ */ && marker !== 0x60 /* ` */) {
 9264    -1     return false;
 9265    -1   }
 9266    -1 
 9267    -1   // scan marker length
 9268    -1   mem = pos;
 9269    -1   pos = state.skipChars(pos, marker);
 9270    -1 
 9271    -1   len = pos - mem;
 9272    -1 
 9273    -1   if (len < 3) { return false; }
 9274    -1 
 9275    -1   markup = state.src.slice(mem, pos);
 9276    -1   params = state.src.slice(pos, max);
 9277    -1 
 9278    -1   if (params.indexOf('`') >= 0) { return false; }
 9279    -1 
 9280    -1   // Since start is found, we can report success here in validation mode
 9281    -1   if (silent) { return true; }
 9282    -1 
 9283    -1   // search end of block
 9284    -1   nextLine = startLine;
 9285    -1 
 9286    -1   for (;;) {
 9287    -1     nextLine++;
 9288    -1     if (nextLine >= endLine) {
 9289    -1       // unclosed block should be autoclosed by end of document.
 9290    -1       // also block seems to be autoclosed by end of parent
 9291    -1       break;
 9292    -1     }
 9293    -1 
 9294    -1     pos = mem = state.bMarks[nextLine] + state.tShift[nextLine];
 9295    -1     max = state.eMarks[nextLine];
 9296    -1 
 9297    -1     if (pos < max && state.sCount[nextLine] < state.blkIndent) {
 9298    -1       // non-empty line with negative indent should stop the list:
 9299    -1       // - ```
 9300    -1       //  test
 9301    -1       break;
 9302    -1     }
 9303    -1 
 9304    -1     if (state.src.charCodeAt(pos) !== marker) { continue; }
 9305    -1 
 9306    -1     if (state.sCount[nextLine] - state.blkIndent >= 4) {
 9307    -1       // closing fence should be indented less than 4 spaces
 9308    -1       continue;
 9309    -1     }
 9310    -1 
 9311    -1     pos = state.skipChars(pos, marker);
 9312    -1 
 9313    -1     // closing code fence must be at least as long as the opening one
 9314    -1     if (pos - mem < len) { continue; }
 9315    -1 
 9316    -1     // make sure tail has spaces only
 9317    -1     pos = state.skipSpaces(pos);
 9318    -1 
 9319    -1     if (pos < max) { continue; }
 9320    -1 
 9321    -1     haveEndMarker = true;
 9322    -1     // found!
 9323    -1     break;
 9324    -1   }
 9325    -1 
 9326    -1   // If a fence has heading spaces, they should be removed from its inner block
 9327    -1   len = state.sCount[startLine];
 9328    -1 
 9329    -1   state.line = nextLine + (haveEndMarker ? 1 : 0);
 9330    -1 
 9331    -1   token         = state.push('fence', 'code', 0);
 9332    -1   token.info    = params;
 9333    -1   token.content = state.getLines(startLine + 1, nextLine, len, true);
 9334    -1   token.markup  = markup;
 9335    -1   token.map     = [ startLine, state.line ];
 9336    -1 
 9337    -1   return true;
 9338    -1 };
 9339    -1 
 9340    -1 },{}],57:[function(require,module,exports){
 9341    -1 // heading (#, ##, ...)
 9342    -1 
 9343    -1 'use strict';
 9344    -1 
 9345    -1 var isSpace = require('../common/utils').isSpace;
 9346    -1 
 9347    -1 
 9348    -1 module.exports = function heading(state, startLine, endLine, silent) {
 9349    -1   var ch, level, tmp, token,
 9350    -1       pos = state.bMarks[startLine] + state.tShift[startLine],
 9351    -1       max = state.eMarks[startLine];
 9352    -1 
 9353    -1   ch  = state.src.charCodeAt(pos);
 9354    -1 
 9355    -1   if (ch !== 0x23/* # */ || pos >= max) { return false; }
 9356    -1 
 9357    -1   // count heading level
 9358    -1   level = 1;
 9359    -1   ch = state.src.charCodeAt(++pos);
 9360    -1   while (ch === 0x23/* # */ && pos < max && level <= 6) {
 9361    -1     level++;
 9362    -1     ch = state.src.charCodeAt(++pos);
 9363    -1   }
 9364    -1 
 9365    -1   if (level > 6 || (pos < max && ch !== 0x20/* space */)) { return false; }
 9366    -1 
 9367    -1   if (silent) { return true; }
 9368    -1 
 9369    -1   // Let's cut tails like '    ###  ' from the end of string
 9370    -1 
 9371    -1   max = state.skipSpacesBack(max, pos);
 9372    -1   tmp = state.skipCharsBack(max, 0x23, pos); // #
 9373    -1   if (tmp > pos && isSpace(state.src.charCodeAt(tmp - 1))) {
 9374    -1     max = tmp;
 9375    -1   }
 9376    -1 
 9377    -1   state.line = startLine + 1;
 9378    -1 
 9379    -1   token        = state.push('heading_open', 'h' + String(level), 1);
 9380    -1   token.markup = '########'.slice(0, level);
 9381    -1   token.map    = [ startLine, state.line ];
 9382    -1 
 9383    -1   token          = state.push('inline', '', 0);
 9384    -1   token.content  = state.src.slice(pos, max).trim();
 9385    -1   token.map      = [ startLine, state.line ];
 9386    -1   token.children = [];
 9387    -1 
 9388    -1   token        = state.push('heading_close', 'h' + String(level), -1);
 9389    -1   token.markup = '########'.slice(0, level);
 9390    -1 
 9391    -1   return true;
 9392    -1 };
 9393    -1 
 9394    -1 },{"../common/utils":40}],58:[function(require,module,exports){
 9395    -1 // Horizontal rule
 9396    -1 
 9397    -1 'use strict';
 9398    -1 
 9399    -1 var isSpace = require('../common/utils').isSpace;
 9400    -1 
 9401    -1 
 9402    -1 module.exports = function hr(state, startLine, endLine, silent) {
 9403    -1   var marker, cnt, ch, token,
 9404    -1       pos = state.bMarks[startLine] + state.tShift[startLine],
 9405    -1       max = state.eMarks[startLine];
 9406    -1 
 9407    -1   marker = state.src.charCodeAt(pos++);
 9408    -1 
 9409    -1   // Check hr marker
 9410    -1   if (marker !== 0x2A/* * */ &&
 9411    -1       marker !== 0x2D/* - */ &&
 9412    -1       marker !== 0x5F/* _ */) {
 9413    -1     return false;
 9414    -1   }
 9415    -1 
 9416    -1   // markers can be mixed with spaces, but there should be at least 3 of them
 9417    -1 
 9418    -1   cnt = 1;
 9419    -1   while (pos < max) {
 9420    -1     ch = state.src.charCodeAt(pos++);
 9421    -1     if (ch !== marker && !isSpace(ch)) { return false; }
 9422    -1     if (ch === marker) { cnt++; }
 9423    -1   }
 9424    -1 
 9425    -1   if (cnt < 3) { return false; }
 9426    -1 
 9427    -1   if (silent) { return true; }
 9428    -1 
 9429    -1   state.line = startLine + 1;
 9430    -1 
 9431    -1   token        = state.push('hr', 'hr', 0);
 9432    -1   token.map    = [ startLine, state.line ];
 9433    -1   token.markup = Array(cnt + 1).join(String.fromCharCode(marker));
 9434    -1 
 9435    -1   return true;
 9436    -1 };
 9437    -1 
 9438    -1 },{"../common/utils":40}],59:[function(require,module,exports){
 9439    -1 // HTML block
 9440    -1 
 9441    -1 'use strict';
 9442    -1 
 9443    -1 
 9444    -1 var block_names = require('../common/html_blocks');
 9445    -1 var HTML_OPEN_CLOSE_TAG_RE = require('../common/html_re').HTML_OPEN_CLOSE_TAG_RE;
 9446    -1 
 9447    -1 // An array of opening and corresponding closing sequences for html tags,
 9448    -1 // last argument defines whether it can terminate a paragraph or not
 9449    -1 //
 9450    -1 var HTML_SEQUENCES = [
 9451    -1   [ /^<(script|pre|style)(?=(\s|>|$))/i, /<\/(script|pre|style)>/i, true ],
 9452    -1   [ /^<!--/,        /-->/,   true ],
 9453    -1   [ /^<\?/,         /\?>/,   true ],
 9454    -1   [ /^<![A-Z]/,     />/,     true ],
 9455    -1   [ /^<!\[CDATA\[/, /\]\]>/, true ],
 9456    -1   [ new RegExp('^</?(' + block_names.join('|') + ')(?=(\\s|/?>|$))', 'i'), /^$/, true ],
 9457    -1   [ new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + '\\s*$'),  /^$/, false ]
 9458    -1 ];
 9459    -1 
 9460    -1 
 9461    -1 module.exports = function html_block(state, startLine, endLine, silent) {
 9462    -1   var i, nextLine, token, lineText,
 9463    -1       pos = state.bMarks[startLine] + state.tShift[startLine],
 9464    -1       max = state.eMarks[startLine];
 9465    -1 
 9466    -1   if (!state.md.options.html) { return false; }
 9467    -1 
 9468    -1   if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }
 9469    -1 
 9470    -1   lineText = state.src.slice(pos, max);
 9471    -1 
 9472    -1   for (i = 0; i < HTML_SEQUENCES.length; i++) {
 9473    -1     if (HTML_SEQUENCES[i][0].test(lineText)) { break; }
 9474    -1   }
 9475    -1 
 9476    -1   if (i === HTML_SEQUENCES.length) { return false; }
 9477    -1 
 9478    -1   if (silent) {
 9479    -1     // true if this sequence can be a terminator, false otherwise
 9480    -1     return HTML_SEQUENCES[i][2];
 9481    -1   }
 9482    -1 
 9483    -1   nextLine = startLine + 1;
 9484    -1 
 9485    -1   // If we are here - we detected HTML block.
 9486    -1   // Let's roll down till block end.
 9487    -1   if (!HTML_SEQUENCES[i][1].test(lineText)) {
 9488    -1     for (; nextLine < endLine; nextLine++) {
 9489    -1       if (state.sCount[nextLine] < state.blkIndent) { break; }
 9490    -1 
 9491    -1       pos = state.bMarks[nextLine] + state.tShift[nextLine];
 9492    -1       max = state.eMarks[nextLine];
 9493    -1       lineText = state.src.slice(pos, max);
 9494    -1 
 9495    -1       if (HTML_SEQUENCES[i][1].test(lineText)) {
 9496    -1         if (lineText.length !== 0) { nextLine++; }
 9497    -1         break;
 9498    -1       }
 9499    -1     }
 9500    -1   }
 9501    -1 
 9502    -1   state.line = nextLine;
 9503    -1 
 9504    -1   token         = state.push('html_block', '', 0);
 9505    -1   token.map     = [ startLine, nextLine ];
 9506    -1   token.content = state.getLines(startLine, nextLine, state.blkIndent, true);
 9507    -1 
 9508    -1   return true;
 9509    -1 };
 9510    -1 
 9511    -1 },{"../common/html_blocks":38,"../common/html_re":39}],60:[function(require,module,exports){
 9512    -1 // lheading (---, ===)
 9513    -1 
 9514    -1 'use strict';
 9515    -1 
 9516    -1 
 9517    -1 module.exports = function lheading(state, startLine, endLine/*, silent*/) {
 9518    -1   var content, terminate, i, l, token, pos, max, level, marker,
 9519    -1       nextLine = startLine + 1,
 9520    -1       terminatorRules = state.md.block.ruler.getRules('paragraph');
 9521    -1 
 9522    -1   // jump line-by-line until empty one or EOF
 9523    -1   for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
 9524    -1     // this would be a code block normally, but after paragraph
 9525    -1     // it's considered a lazy continuation regardless of what's there
 9526    -1     if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }
 9527    -1 
 9528    -1     //
 9529    -1     // Check for underline in setext header
 9530    -1     //
 9531    -1     if (state.sCount[nextLine] >= state.blkIndent) {
 9532    -1       pos = state.bMarks[nextLine] + state.tShift[nextLine];
 9533    -1       max = state.eMarks[nextLine];
 9534    -1 
 9535    -1       if (pos < max) {
 9536    -1         marker = state.src.charCodeAt(pos);
 9537    -1 
 9538    -1         if (marker === 0x2D/* - */ || marker === 0x3D/* = */) {
 9539    -1           pos = state.skipChars(pos, marker);
 9540    -1           pos = state.skipSpaces(pos);
 9541    -1 
 9542    -1           if (pos >= max) {
 9543    -1             level = (marker === 0x3D/* = */ ? 1 : 2);
 9544    -1             break;
 9545    -1           }
 9546    -1         }
 9547    -1       }
 9548    -1     }
 9549    -1 
 9550    -1     // quirk for blockquotes, this line should already be checked by that rule
 9551    -1     if (state.sCount[nextLine] < 0) { continue; }
 9552    -1 
 9553    -1     // Some tags can terminate paragraph without empty line.
 9554    -1     terminate = false;
 9555    -1     for (i = 0, l = terminatorRules.length; i < l; i++) {
 9556    -1       if (terminatorRules[i](state, nextLine, endLine, true)) {
 9557    -1         terminate = true;
 9558    -1         break;
 9559    -1       }
 9560    -1     }
 9561    -1     if (terminate) { break; }
 9562    -1   }
 9563    -1 
 9564    -1   if (!level) {
 9565    -1     // Didn't find valid underline
 9566    -1     return false;
 9567    -1   }
 9568    -1 
 9569    -1   content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
 9570    -1 
 9571    -1   state.line = nextLine + 1;
 9572    -1 
 9573    -1   token          = state.push('heading_open', 'h' + String(level), 1);
 9574    -1   token.markup   = String.fromCharCode(marker);
 9575    -1   token.map      = [ startLine, state.line ];
 9576    -1 
 9577    -1   token          = state.push('inline', '', 0);
 9578    -1   token.content  = content;
 9579    -1   token.map      = [ startLine, state.line - 1 ];
 9580    -1   token.children = [];
 9581    -1 
 9582    -1   token          = state.push('heading_close', 'h' + String(level), -1);
 9583    -1   token.markup   = String.fromCharCode(marker);
 9584    -1 
 9585    -1   return true;
 9586    -1 };
 9587    -1 
 9588    -1 },{}],61:[function(require,module,exports){
 9589    -1 // Lists
 9590    -1 
 9591    -1 'use strict';
 9592    -1 
 9593    -1 var isSpace = require('../common/utils').isSpace;
 9594    -1 
 9595    -1 
 9596    -1 // Search `[-+*][\n ]`, returns next pos arter marker on success
 9597    -1 // or -1 on fail.
 9598    -1 function skipBulletListMarker(state, startLine) {
 9599    -1   var marker, pos, max, ch;
 9600    -1 
 9601    -1   pos = state.bMarks[startLine] + state.tShift[startLine];
 9602    -1   max = state.eMarks[startLine];
 9603    -1 
 9604    -1   marker = state.src.charCodeAt(pos++);
 9605    -1   // Check bullet
 9606    -1   if (marker !== 0x2A/* * */ &&
 9607    -1       marker !== 0x2D/* - */ &&
 9608    -1       marker !== 0x2B/* + */) {
 9609    -1     return -1;
 9610    -1   }
 9611    -1 
 9612    -1   if (pos < max) {
 9613    -1     ch = state.src.charCodeAt(pos);
 9614    -1 
 9615    -1     if (!isSpace(ch)) {
 9616    -1       // " -test " - is not a list item
 9617    -1       return -1;
 9618    -1     }
 9619    -1   }
 9620    -1 
 9621    -1   return pos;
 9622    -1 }
 9623    -1 
 9624    -1 // Search `\d+[.)][\n ]`, returns next pos arter marker on success
 9625    -1 // or -1 on fail.
 9626    -1 function skipOrderedListMarker(state, startLine) {
 9627    -1   var ch,
 9628    -1       start = state.bMarks[startLine] + state.tShift[startLine],
 9629    -1       pos = start,
 9630    -1       max = state.eMarks[startLine];
 9631    -1 
 9632    -1   // List marker should have at least 2 chars (digit + dot)
 9633    -1   if (pos + 1 >= max) { return -1; }
 9634    -1 
 9635    -1   ch = state.src.charCodeAt(pos++);
 9636    -1 
 9637    -1   if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }
 9638    -1 
 9639    -1   for (;;) {
 9640    -1     // EOL -> fail
 9641    -1     if (pos >= max) { return -1; }
 9642    -1 
 9643    -1     ch = state.src.charCodeAt(pos++);
 9644    -1 
 9645    -1     if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {
 9646    -1 
 9647    -1       // List marker should have no more than 9 digits
 9648    -1       // (prevents integer overflow in browsers)
 9649    -1       if (pos - start >= 10) { return -1; }
 9650    -1 
 9651    -1       continue;
 9652    -1     }
 9653    -1 
 9654    -1     // found valid marker
 9655    -1     if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {
 9656    -1       break;
 9657    -1     }
 9658    -1 
 9659    -1     return -1;
 9660    -1   }
 9661    -1 
 9662    -1 
 9663    -1   if (pos < max) {
 9664    -1     ch = state.src.charCodeAt(pos);
 9665    -1 
 9666    -1     if (!isSpace(ch)) {
 9667    -1       // " 1.test " - is not a list item
 9668    -1       return -1;
 9669    -1     }
 9670    -1   }
 9671    -1   return pos;
 9672    -1 }
 9673    -1 
 9674    -1 function markTightParagraphs(state, idx) {
 9675    -1   var i, l,
 9676    -1       level = state.level + 2;
 9677    -1 
 9678    -1   for (i = idx + 2, l = state.tokens.length - 2; i < l; i++) {
 9679    -1     if (state.tokens[i].level === level && state.tokens[i].type === 'paragraph_open') {
 9680    -1       state.tokens[i + 2].hidden = true;
 9681    -1       state.tokens[i].hidden = true;
 9682    -1       i += 2;
 9683    -1     }
 9684    -1   }
 9685    -1 }
 9686    -1 
 9687    -1 
 9688    -1 module.exports = function list(state, startLine, endLine, silent) {
 9689    -1   var nextLine,
 9690    -1       initial,
 9691    -1       offset,
 9692    -1       indent,
 9693    -1       oldTShift,
 9694    -1       oldIndent,
 9695    -1       oldLIndent,
 9696    -1       oldTight,
 9697    -1       oldParentType,
 9698    -1       start,
 9699    -1       posAfterMarker,
 9700    -1       ch,
 9701    -1       pos,
 9702    -1       max,
 9703    -1       indentAfterMarker,
 9704    -1       markerValue,
 9705    -1       markerCharCode,
 9706    -1       isOrdered,
 9707    -1       contentStart,
 9708    -1       listTokIdx,
 9709    -1       prevEmptyEnd,
 9710    -1       listLines,
 9711    -1       itemLines,
 9712    -1       tight = true,
 9713    -1       terminatorRules,
 9714    -1       token,
 9715    -1       i, l, terminate;
 9716    -1 
 9717    -1   // Detect list type and position after marker
 9718    -1   if ((posAfterMarker = skipOrderedListMarker(state, startLine)) >= 0) {
 9719    -1     isOrdered = true;
 9720    -1   } else if ((posAfterMarker = skipBulletListMarker(state, startLine)) >= 0) {
 9721    -1     isOrdered = false;
 9722    -1   } else {
 9723    -1     return false;
 9724    -1   }
 9725    -1 
 9726    -1   // We should terminate list on style change. Remember first one to compare.
 9727    -1   markerCharCode = state.src.charCodeAt(posAfterMarker - 1);
 9728    -1 
 9729    -1   // For validation mode we can terminate immediately
 9730    -1   if (silent) { return true; }
 9731    -1 
 9732    -1   // Start list
 9733    -1   listTokIdx = state.tokens.length;
 9734    -1 
 9735    -1   if (isOrdered) {
 9736    -1     start = state.bMarks[startLine] + state.tShift[startLine];
 9737    -1     markerValue = Number(state.src.substr(start, posAfterMarker - start - 1));
 9738    -1 
 9739    -1     token       = state.push('ordered_list_open', 'ol', 1);
 9740    -1     if (markerValue !== 1) {
 9741    -1       token.attrs = [ [ 'start', markerValue ] ];
 9742    -1     }
 9743    -1 
 9744    -1   } else {
 9745    -1     token       = state.push('bullet_list_open', 'ul', 1);
 9746    -1   }
 9747    -1 
 9748    -1   token.map    = listLines = [ startLine, 0 ];
 9749    -1   token.markup = String.fromCharCode(markerCharCode);
 9750    -1 
 9751    -1   //
 9752    -1   // Iterate list items
 9753    -1   //
 9754    -1 
 9755    -1   nextLine = startLine;
 9756    -1   prevEmptyEnd = false;
 9757    -1   terminatorRules = state.md.block.ruler.getRules('list');
 9758    -1 
 9759    -1   while (nextLine < endLine) {
 9760    -1     pos = posAfterMarker;
 9761    -1     max = state.eMarks[nextLine];
 9762    -1 
 9763    -1     initial = offset = state.sCount[nextLine] + posAfterMarker - (state.bMarks[startLine] + state.tShift[startLine]);
 9764    -1 
 9765    -1     while (pos < max) {
 9766    -1       ch = state.src.charCodeAt(pos);
 9767    -1 
 9768    -1       if (isSpace(ch)) {
 9769    -1         if (ch === 0x09) {
 9770    -1           offset += 4 - offset % 4;
 9771    -1         } else {
 9772    -1           offset++;
 9773    -1         }
 9774    -1       } else {
 9775    -1         break;
 9776    -1       }
 9777    -1 
 9778    -1       pos++;
 9779    -1     }
 9780    -1 
 9781    -1     contentStart = pos;
 9782    -1 
 9783    -1     if (contentStart >= max) {
 9784    -1       // trimming space in "-    \n  3" case, indent is 1 here
 9785    -1       indentAfterMarker = 1;
 9786    -1     } else {
 9787    -1       indentAfterMarker = offset - initial;
 9788    -1     }
 9789    -1 
 9790    -1     // If we have more than 4 spaces, the indent is 1
 9791    -1     // (the rest is just indented code block)
 9792    -1     if (indentAfterMarker > 4) { indentAfterMarker = 1; }
 9793    -1 
 9794    -1     // "  -  test"
 9795    -1     //  ^^^^^ - calculating total length of this thing
 9796    -1     indent = initial + indentAfterMarker;
 9797    -1 
 9798    -1     // Run subparser & write tokens
 9799    -1     token        = state.push('list_item_open', 'li', 1);
 9800    -1     token.markup = String.fromCharCode(markerCharCode);
 9801    -1     token.map    = itemLines = [ startLine, 0 ];
 9802    -1 
 9803    -1     oldIndent = state.blkIndent;
 9804    -1     oldTight = state.tight;
 9805    -1     oldTShift = state.tShift[startLine];
 9806    -1     oldLIndent = state.sCount[startLine];
 9807    -1     oldParentType = state.parentType;
 9808    -1     state.blkIndent = indent;
 9809    -1     state.tight = true;
 9810    -1     state.parentType = 'list';
 9811    -1     state.tShift[startLine] = contentStart - state.bMarks[startLine];
 9812    -1     state.sCount[startLine] = offset;
 9813    -1 
 9814    -1     if (contentStart >= max && state.isEmpty(startLine + 1)) {
 9815    -1       // workaround for this case
 9816    -1       // (list item is empty, list terminates before "foo"):
 9817    -1       // ~~~~~~~~
 9818    -1       //   -
 9819    -1       //
 9820    -1       //     foo
 9821    -1       // ~~~~~~~~
 9822    -1       state.line = Math.min(state.line + 2, endLine);
 9823    -1     } else {
 9824    -1       state.md.block.tokenize(state, startLine, endLine, true);
 9825    -1     }
 9826    -1 
 9827    -1     // If any of list item is tight, mark list as tight
 9828    -1     if (!state.tight || prevEmptyEnd) {
 9829    -1       tight = false;
 9830    -1     }
 9831    -1     // Item become loose if finish with empty line,
 9832    -1     // but we should filter last element, because it means list finish
 9833    -1     prevEmptyEnd = (state.line - startLine) > 1 && state.isEmpty(state.line - 1);
 9834    -1 
 9835    -1     state.blkIndent = oldIndent;
 9836    -1     state.tShift[startLine] = oldTShift;
 9837    -1     state.sCount[startLine] = oldLIndent;
 9838    -1     state.tight = oldTight;
 9839    -1     state.parentType = oldParentType;
 9840    -1 
 9841    -1     token        = state.push('list_item_close', 'li', -1);
 9842    -1     token.markup = String.fromCharCode(markerCharCode);
 9843    -1 
 9844    -1     nextLine = startLine = state.line;
 9845    -1     itemLines[1] = nextLine;
 9846    -1     contentStart = state.bMarks[startLine];
 9847    -1 
 9848    -1     if (nextLine >= endLine) { break; }
 9849    -1 
 9850    -1     if (state.isEmpty(nextLine)) {
 9851    -1       break;
 9852    -1     }
 9853    -1 
 9854    -1     //
 9855    -1     // Try to check if list is terminated or continued.
 9856    -1     //
 9857    -1     if (state.sCount[nextLine] < state.blkIndent) { break; }
 9858    -1 
 9859    -1     // fail if terminating block found
 9860    -1     terminate = false;
 9861    -1     for (i = 0, l = terminatorRules.length; i < l; i++) {
 9862    -1       if (terminatorRules[i](state, nextLine, endLine, true)) {
 9863    -1         terminate = true;
 9864    -1         break;
 9865    -1       }
 9866    -1     }
 9867    -1     if (terminate) { break; }
 9868    -1 
 9869    -1     // fail if list has another type
 9870    -1     if (isOrdered) {
 9871    -1       posAfterMarker = skipOrderedListMarker(state, nextLine);
 9872    -1       if (posAfterMarker < 0) { break; }
 9873    -1     } else {
 9874    -1       posAfterMarker = skipBulletListMarker(state, nextLine);
 9875    -1       if (posAfterMarker < 0) { break; }
 9876    -1     }
 9877    -1 
 9878    -1     if (markerCharCode !== state.src.charCodeAt(posAfterMarker - 1)) { break; }
 9879    -1   }
 9880    -1 
 9881    -1   // Finilize list
 9882    -1   if (isOrdered) {
 9883    -1     token = state.push('ordered_list_close', 'ol', -1);
 9884    -1   } else {
 9885    -1     token = state.push('bullet_list_close', 'ul', -1);
 9886    -1   }
 9887    -1   token.markup = String.fromCharCode(markerCharCode);
 9888    -1 
 9889    -1   listLines[1] = nextLine;
 9890    -1   state.line = nextLine;
 9891    -1 
 9892    -1   // mark paragraphs tight if needed
 9893    -1   if (tight) {
 9894    -1     markTightParagraphs(state, listTokIdx);
 9895    -1   }
 9896    -1 
 9897    -1   return true;
 9898    -1 };
 9899    -1 
 9900    -1 },{"../common/utils":40}],62:[function(require,module,exports){
 9901    -1 // Paragraph
 9902    -1 
 9903    -1 'use strict';
 9904    -1 
 9905    -1 
 9906    -1 module.exports = function paragraph(state, startLine/*, endLine*/) {
 9907    -1   var content, terminate, i, l, token,
 9908    -1       nextLine = startLine + 1,
 9909    -1       terminatorRules = state.md.block.ruler.getRules('paragraph'),
 9910    -1       endLine = state.lineMax;
 9911    -1 
 9912    -1   // jump line-by-line until empty one or EOF
 9913    -1   for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
 9914    -1     // this would be a code block normally, but after paragraph
 9915    -1     // it's considered a lazy continuation regardless of what's there
 9916    -1     if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }
 9917    -1 
 9918    -1     // quirk for blockquotes, this line should already be checked by that rule
 9919    -1     if (state.sCount[nextLine] < 0) { continue; }
 9920    -1 
 9921    -1     // Some tags can terminate paragraph without empty line.
 9922    -1     terminate = false;
 9923    -1     for (i = 0, l = terminatorRules.length; i < l; i++) {
 9924    -1       if (terminatorRules[i](state, nextLine, endLine, true)) {
 9925    -1         terminate = true;
 9926    -1         break;
 9927    -1       }
 9928    -1     }
 9929    -1     if (terminate) { break; }
 9930    -1   }
 9931    -1 
 9932    -1   content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
 9933    -1 
 9934    -1   state.line = nextLine;
 9935    -1 
 9936    -1   token          = state.push('paragraph_open', 'p', 1);
 9937    -1   token.map      = [ startLine, state.line ];
 9938    -1 
 9939    -1   token          = state.push('inline', '', 0);
 9940    -1   token.content  = content;
 9941    -1   token.map      = [ startLine, state.line ];
 9942    -1   token.children = [];
 9943    -1 
 9944    -1   token          = state.push('paragraph_close', 'p', -1);
 9945    -1 
 9946    -1   return true;
 9947    -1 };
 9948    -1 
 9949    -1 },{}],63:[function(require,module,exports){
 9950    -1 'use strict';
 9951    -1 
 9952    -1 
 9953    -1 var parseLinkDestination = require('../helpers/parse_link_destination');
 9954    -1 var parseLinkTitle       = require('../helpers/parse_link_title');
 9955    -1 var normalizeReference   = require('../common/utils').normalizeReference;
 9956    -1 var isSpace              = require('../common/utils').isSpace;
 9957    -1 
 9958    -1 
 9959    -1 module.exports = function reference(state, startLine, _endLine, silent) {
 9960    -1   var ch,
 9961    -1       destEndPos,
 9962    -1       destEndLineNo,
 9963    -1       endLine,
 9964    -1       href,
 9965    -1       i,
 9966    -1       l,
 9967    -1       label,
 9968    -1       labelEnd,
 9969    -1       res,
 9970    -1       start,
 9971    -1       str,
 9972    -1       terminate,
 9973    -1       terminatorRules,
 9974    -1       title,
 9975    -1       lines = 0,
 9976    -1       pos = state.bMarks[startLine] + state.tShift[startLine],
 9977    -1       max = state.eMarks[startLine],
 9978    -1       nextLine = startLine + 1;
 9979    -1 
 9980    -1   if (state.src.charCodeAt(pos) !== 0x5B/* [ */) { return false; }
 9981    -1 
 9982    -1   // Simple check to quickly interrupt scan on [link](url) at the start of line.
 9983    -1   // Can be useful on practice: https://github.com/markdown-it/markdown-it/issues/54
 9984    -1   while (++pos < max) {
 9985    -1     if (state.src.charCodeAt(pos) === 0x5D /* ] */ &&
 9986    -1         state.src.charCodeAt(pos - 1) !== 0x5C/* \ */) {
 9987    -1       if (pos + 1 === max) { return false; }
 9988    -1       if (state.src.charCodeAt(pos + 1) !== 0x3A/* : */) { return false; }
 9989    -1       break;
 9990    -1     }
 9991    -1   }
 9992    -1 
 9993    -1   endLine = state.lineMax;
 9994    -1 
 9995    -1   // jump line-by-line until empty one or EOF
 9996    -1   terminatorRules = state.md.block.ruler.getRules('reference');
 9997    -1 
 9998    -1   for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
 9999    -1     // this would be a code block normally, but after paragraph
10000    -1     // it's considered a lazy continuation regardless of what's there
10001    -1     if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }
10002    -1 
10003    -1     // quirk for blockquotes, this line should already be checked by that rule
10004    -1     if (state.sCount[nextLine] < 0) { continue; }
10005    -1 
10006    -1     // Some tags can terminate paragraph without empty line.
10007    -1     terminate = false;
10008    -1     for (i = 0, l = terminatorRules.length; i < l; i++) {
10009    -1       if (terminatorRules[i](state, nextLine, endLine, true)) {
10010    -1         terminate = true;
10011    -1         break;
10012    -1       }
10013    -1     }
10014    -1     if (terminate) { break; }
10015    -1   }
10016    -1 
10017    -1   str = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
10018    -1   max = str.length;
10019    -1 
10020    -1   for (pos = 1; pos < max; pos++) {
10021    -1     ch = str.charCodeAt(pos);
10022    -1     if (ch === 0x5B /* [ */) {
10023    -1       return false;
10024    -1     } else if (ch === 0x5D /* ] */) {
10025    -1       labelEnd = pos;
10026    -1       break;
10027    -1     } else if (ch === 0x0A /* \n */) {
10028    -1       lines++;
10029    -1     } else if (ch === 0x5C /* \ */) {
10030    -1       pos++;
10031    -1       if (pos < max && str.charCodeAt(pos) === 0x0A) {
10032    -1         lines++;
10033    -1       }
10034    -1     }
10035    -1   }
10036    -1 
10037    -1   if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 0x3A/* : */) { return false; }
10038    -1 
10039    -1   // [label]:   destination   'title'
10040    -1   //         ^^^ skip optional whitespace here
10041    -1   for (pos = labelEnd + 2; pos < max; pos++) {
10042    -1     ch = str.charCodeAt(pos);
10043    -1     if (ch === 0x0A) {
10044    -1       lines++;
10045    -1     } else if (isSpace(ch)) {
10046    -1       /*eslint no-empty:0*/
10047    -1     } else {
10048    -1       break;
10049    -1     }
10050    -1   }
10051    -1 
10052    -1   // [label]:   destination   'title'
10053    -1   //            ^^^^^^^^^^^ parse this
10054    -1   res = parseLinkDestination(str, pos, max);
10055    -1   if (!res.ok) { return false; }
10056    -1 
10057    -1   href = state.md.normalizeLink(res.str);
10058    -1   if (!state.md.validateLink(href)) { return false; }
10059    -1 
10060    -1   pos = res.pos;
10061    -1   lines += res.lines;
10062    -1 
10063    -1   // save cursor state, we could require to rollback later
10064    -1   destEndPos = pos;
10065    -1   destEndLineNo = lines;
10066    -1 
10067    -1   // [label]:   destination   'title'
10068    -1   //                       ^^^ skipping those spaces
10069    -1   start = pos;
10070    -1   for (; pos < max; pos++) {
10071    -1     ch = str.charCodeAt(pos);
10072    -1     if (ch === 0x0A) {
10073    -1       lines++;
10074    -1     } else if (isSpace(ch)) {
10075    -1       /*eslint no-empty:0*/
10076    -1     } else {
10077    -1       break;
10078    -1     }
10079    -1   }
10080    -1 
10081    -1   // [label]:   destination   'title'
10082    -1   //                          ^^^^^^^ parse this
10083    -1   res = parseLinkTitle(str, pos, max);
10084    -1   if (pos < max && start !== pos && res.ok) {
10085    -1     title = res.str;
10086    -1     pos = res.pos;
10087    -1     lines += res.lines;
10088    -1   } else {
10089    -1     title = '';
10090    -1     pos = destEndPos;
10091    -1     lines = destEndLineNo;
10092    -1   }
10093    -1 
10094    -1   // skip trailing spaces until the rest of the line
10095    -1   while (pos < max) {
10096    -1     ch = str.charCodeAt(pos);
10097    -1     if (!isSpace(ch)) { break; }
10098    -1     pos++;
10099    -1   }
10100    -1 
10101    -1   if (pos < max && str.charCodeAt(pos) !== 0x0A) {
10102    -1     if (title) {
10103    -1       // garbage at the end of the line after title,
10104    -1       // but it could still be a valid reference if we roll back
10105    -1       title = '';
10106    -1       pos = destEndPos;
10107    -1       lines = destEndLineNo;
10108    -1       while (pos < max) {
10109    -1         ch = str.charCodeAt(pos);
10110    -1         if (!isSpace(ch)) { break; }
10111    -1         pos++;
10112    -1       }
10113    -1     }
10114    -1   }
10115    -1 
10116    -1   if (pos < max && str.charCodeAt(pos) !== 0x0A) {
10117    -1     // garbage at the end of the line
10118    -1     return false;
10119    -1   }
10120    -1 
10121    -1   label = normalizeReference(str.slice(1, labelEnd));
10122    -1   if (!label) {
10123    -1     // CommonMark 0.20 disallows empty labels
10124    -1     return false;
10125    -1   }
10126    -1 
10127    -1   // Reference can not terminate anything. This check is for safety only.
10128    -1   /*istanbul ignore if*/
10129    -1   if (silent) { return true; }
10130    -1 
10131    -1   if (typeof state.env.references === 'undefined') {
10132    -1     state.env.references = {};
10133    -1   }
10134    -1   if (typeof state.env.references[label] === 'undefined') {
10135    -1     state.env.references[label] = { title: title, href: href };
10136    -1   }
10137    -1 
10138    -1   state.line = startLine + lines + 1;
10139    -1   return true;
10140    -1 };
10141    -1 
10142    -1 },{"../common/utils":40,"../helpers/parse_link_destination":42,"../helpers/parse_link_title":44}],64:[function(require,module,exports){
10143    -1 // Parser state class
10144    -1 
10145    -1 'use strict';
10146    -1 
10147    -1 var Token = require('../token');
10148    -1 var isSpace = require('../common/utils').isSpace;
10149    -1 
10150    -1 
10151    -1 function StateBlock(src, md, env, tokens) {
10152    -1   var ch, s, start, pos, len, indent, offset, indent_found;
10153    -1 
10154    -1   this.src = src;
10155    -1 
10156    -1   // link to parser instance
10157    -1   this.md     = md;
10158    -1 
10159    -1   this.env = env;
10160    -1 
10161    -1   //
10162    -1   // Internal state vartiables
10163    -1   //
10164    -1 
10165    -1   this.tokens = tokens;
10166    -1 
10167    -1   this.bMarks = [];  // line begin offsets for fast jumps
10168    -1   this.eMarks = [];  // line end offsets for fast jumps
10169    -1   this.tShift = [];  // offsets of the first non-space characters (tabs not expanded)
10170    -1   this.sCount = [];  // indents for each line (tabs expanded)
10171    -1 
10172    -1   // block parser variables
10173    -1   this.blkIndent  = 0; // required block content indent
10174    -1                        // (for example, if we are in list)
10175    -1   this.line       = 0; // line index in src
10176    -1   this.lineMax    = 0; // lines count
10177    -1   this.tight      = false;  // loose/tight mode for lists
10178    -1   this.parentType = 'root'; // if `list`, block parser stops on two newlines
10179    -1   this.ddIndent   = -1; // indent of the current dd block (-1 if there isn't any)
10180    -1 
10181    -1   this.level = 0;
10182    -1 
10183    -1   // renderer
10184    -1   this.result = '';
10185    -1 
10186    -1   // Create caches
10187    -1   // Generate markers.
10188    -1   s = this.src;
10189    -1   indent_found = false;
10190    -1 
10191    -1   for (start = pos = indent = offset = 0, len = s.length; pos < len; pos++) {
10192    -1     ch = s.charCodeAt(pos);
10193    -1 
10194    -1     if (!indent_found) {
10195    -1       if (isSpace(ch)) {
10196    -1         indent++;
10197    -1 
10198    -1         if (ch === 0x09) {
10199    -1           offset += 4 - offset % 4;
10200    -1         } else {
10201    -1           offset++;
10202    -1         }
10203    -1         continue;
10204    -1       } else {
10205    -1         indent_found = true;
10206    -1       }
10207    -1     }
10208    -1 
10209    -1     if (ch === 0x0A || pos === len - 1) {
10210    -1       if (ch !== 0x0A) { pos++; }
10211    -1       this.bMarks.push(start);
10212    -1       this.eMarks.push(pos);
10213    -1       this.tShift.push(indent);
10214    -1       this.sCount.push(offset);
10215    -1 
10216    -1       indent_found = false;
10217    -1       indent = 0;
10218    -1       offset = 0;
10219    -1       start = pos + 1;
10220    -1     }
10221    -1   }
10222    -1 
10223    -1   // Push fake entry to simplify cache bounds checks
10224    -1   this.bMarks.push(s.length);
10225    -1   this.eMarks.push(s.length);
10226    -1   this.tShift.push(0);
10227    -1   this.sCount.push(0);
10228    -1 
10229    -1   this.lineMax = this.bMarks.length - 1; // don't count last fake line
10230    -1 }
10231    -1 
10232    -1 // Push new token to "stream".
10233    -1 //
10234    -1 StateBlock.prototype.push = function (type, tag, nesting) {
10235    -1   var token = new Token(type, tag, nesting);
10236    -1   token.block = true;
10237    -1 
10238    -1   if (nesting < 0) { this.level--; }
10239    -1   token.level = this.level;
10240    -1   if (nesting > 0) { this.level++; }
10241    -1 
10242    -1   this.tokens.push(token);
10243    -1   return token;
10244    -1 };
10245    -1 
10246    -1 StateBlock.prototype.isEmpty = function isEmpty(line) {
10247    -1   return this.bMarks[line] + this.tShift[line] >= this.eMarks[line];
10248    -1 };
10249    -1 
10250    -1 StateBlock.prototype.skipEmptyLines = function skipEmptyLines(from) {
10251    -1   for (var max = this.lineMax; from < max; from++) {
10252    -1     if (this.bMarks[from] + this.tShift[from] < this.eMarks[from]) {
10253    -1       break;
10254    -1     }
10255    -1   }
10256    -1   return from;
10257    -1 };
10258    -1 
10259    -1 // Skip spaces from given position.
10260    -1 StateBlock.prototype.skipSpaces = function skipSpaces(pos) {
10261    -1   var ch;
10262    -1 
10263    -1   for (var max = this.src.length; pos < max; pos++) {
10264    -1     ch = this.src.charCodeAt(pos);
10265    -1     if (!isSpace(ch)) { break; }
10266    -1   }
10267    -1   return pos;
10268    -1 };
10269    -1 
10270    -1 // Skip spaces from given position in reverse.
10271    -1 StateBlock.prototype.skipSpacesBack = function skipSpacesBack(pos, min) {
10272    -1   if (pos <= min) { return pos; }
10273    -1 
10274    -1   while (pos > min) {
10275    -1     if (!isSpace(this.src.charCodeAt(--pos))) { return pos + 1; }
10276    -1   }
10277    -1   return pos;
10278    -1 };
10279    -1 
10280    -1 // Skip char codes from given position
10281    -1 StateBlock.prototype.skipChars = function skipChars(pos, code) {
10282    -1   for (var max = this.src.length; pos < max; pos++) {
10283    -1     if (this.src.charCodeAt(pos) !== code) { break; }
10284    -1   }
10285    -1   return pos;
10286    -1 };
10287    -1 
10288    -1 // Skip char codes reverse from given position - 1
10289    -1 StateBlock.prototype.skipCharsBack = function skipCharsBack(pos, code, min) {
10290    -1   if (pos <= min) { return pos; }
10291    -1 
10292    -1   while (pos > min) {
10293    -1     if (code !== this.src.charCodeAt(--pos)) { return pos + 1; }
10294    -1   }
10295    -1   return pos;
10296    -1 };
10297    -1 
10298    -1 // cut lines range from source.
10299    -1 StateBlock.prototype.getLines = function getLines(begin, end, indent, keepLastLF) {
10300    -1   var i, lineIndent, ch, first, last, queue, lineStart,
10301    -1       line = begin;
10302    -1 
10303    -1   if (begin >= end) {
10304    -1     return '';
10305    -1   }
10306    -1 
10307    -1   queue = new Array(end - begin);
10308    -1 
10309    -1   for (i = 0; line < end; line++, i++) {
10310    -1     lineIndent = 0;
10311    -1     lineStart = first = this.bMarks[line];
10312    -1 
10313    -1     if (line + 1 < end || keepLastLF) {
10314    -1       // No need for bounds check because we have fake entry on tail.
10315    -1       last = this.eMarks[line] + 1;
10316    -1     } else {
10317    -1       last = this.eMarks[line];
10318    -1     }
10319    -1 
10320    -1     while (first < last && lineIndent < indent) {
10321    -1       ch = this.src.charCodeAt(first);
10322    -1 
10323    -1       if (isSpace(ch)) {
10324    -1         if (ch === 0x09) {
10325    -1           lineIndent += 4 - lineIndent % 4;
10326    -1         } else {
10327    -1           lineIndent++;
10328    -1         }
10329    -1       } else if (first - lineStart < this.tShift[line]) {
10330    -1         // patched tShift masked characters to look like spaces (blockquotes, list markers)
10331    -1         lineIndent++;
10332    -1       } else {
10333    -1         break;
10334    -1       }
10335    -1 
10336    -1       first++;
10337    -1     }
10338    -1 
10339    -1     queue[i] = this.src.slice(first, last);
10340    -1   }
10341    -1 
10342    -1   return queue.join('');
10343    -1 };
10344    -1 
10345    -1 // re-export Token class to use in block rules
10346    -1 StateBlock.prototype.Token = Token;
10347    -1 
10348    -1 
10349    -1 module.exports = StateBlock;
10350    -1 
10351    -1 },{"../common/utils":40,"../token":87}],65:[function(require,module,exports){
10352    -1 // GFM table, non-standard
10353    -1 
10354    -1 'use strict';
10355    -1 
10356    -1 
10357    -1 function getLine(state, line) {
10358    -1   var pos = state.bMarks[line] + state.blkIndent,
10359    -1       max = state.eMarks[line];
10360    -1 
10361    -1   return state.src.substr(pos, max - pos);
10362    -1 }
10363    -1 
10364    -1 function escapedSplit(str) {
10365    -1   var result = [],
10366    -1       pos = 0,
10367    -1       max = str.length,
10368    -1       ch,
10369    -1       escapes = 0,
10370    -1       lastPos = 0,
10371    -1       backTicked = false,
10372    -1       lastBackTick = 0;
10373    -1 
10374    -1   ch  = str.charCodeAt(pos);
10375    -1 
10376    -1   while (pos < max) {
10377    -1     if (ch === 0x60/* ` */ && (escapes % 2 === 0)) {
10378    -1       backTicked = !backTicked;
10379    -1       lastBackTick = pos;
10380    -1     } else if (ch === 0x7c/* | */ && (escapes % 2 === 0) && !backTicked) {
10381    -1       result.push(str.substring(lastPos, pos));
10382    -1       lastPos = pos + 1;
10383    -1     } else if (ch === 0x5c/* \ */) {
10384    -1       escapes++;
10385    -1     } else {
10386    -1       escapes = 0;
10387    -1     }
10388    -1 
10389    -1     pos++;
10390    -1 
10391    -1     // If there was an un-closed backtick, go back to just after
10392    -1     // the last backtick, but as if it was a normal character
10393    -1     if (pos === max && backTicked) {
10394    -1       backTicked = false;
10395    -1       pos = lastBackTick + 1;
10396    -1     }
10397    -1 
10398    -1     ch = str.charCodeAt(pos);
10399    -1   }
10400    -1 
10401    -1   result.push(str.substring(lastPos));
10402    -1 
10403    -1   return result;
10404    -1 }
10405    -1 
10406    -1 
10407    -1 module.exports = function table(state, startLine, endLine, silent) {
10408    -1   var ch, lineText, pos, i, nextLine, columns, columnCount, token,
10409    -1       aligns, t, tableLines, tbodyLines;
10410    -1 
10411    -1   // should have at least three lines
10412    -1   if (startLine + 2 > endLine) { return false; }
10413    -1 
10414    -1   nextLine = startLine + 1;
10415    -1 
10416    -1   if (state.sCount[nextLine] < state.blkIndent) { return false; }
10417    -1 
10418    -1   // first character of the second line should be '|' or '-'
10419    -1 
10420    -1   pos = state.bMarks[nextLine] + state.tShift[nextLine];
10421    -1   if (pos >= state.eMarks[nextLine]) { return false; }
10422    -1 
10423    -1   ch = state.src.charCodeAt(pos);
10424    -1   if (ch !== 0x7C/* | */ && ch !== 0x2D/* - */ && ch !== 0x3A/* : */) { return false; }
10425    -1 
10426    -1   lineText = getLine(state, startLine + 1);
10427    -1   if (!/^[-:| ]+$/.test(lineText)) { return false; }
10428    -1 
10429    -1   columns = lineText.split('|');
10430    -1   aligns = [];
10431    -1   for (i = 0; i < columns.length; i++) {
10432    -1     t = columns[i].trim();
10433    -1     if (!t) {
10434    -1       // allow empty columns before and after table, but not in between columns;
10435    -1       // e.g. allow ` |---| `, disallow ` ---||--- `
10436    -1       if (i === 0 || i === columns.length - 1) {
10437    -1         continue;
10438    -1       } else {
10439    -1         return false;
10440    -1       }
10441    -1     }
10442    -1 
10443    -1     if (!/^:?-+:?$/.test(t)) { return false; }
10444    -1     if (t.charCodeAt(t.length - 1) === 0x3A/* : */) {
10445    -1       aligns.push(t.charCodeAt(0) === 0x3A/* : */ ? 'center' : 'right');
10446    -1     } else if (t.charCodeAt(0) === 0x3A/* : */) {
10447    -1       aligns.push('left');
10448    -1     } else {
10449    -1       aligns.push('');
10450    -1     }
10451    -1   }
10452    -1 
10453    -1   lineText = getLine(state, startLine).trim();
10454    -1   if (lineText.indexOf('|') === -1) { return false; }
10455    -1   columns = escapedSplit(lineText.replace(/^\||\|$/g, ''));
10456    -1 
10457    -1   // header row will define an amount of columns in the entire table,
10458    -1   // and align row shouldn't be smaller than that (the rest of the rows can)
10459    -1   columnCount = columns.length;
10460    -1   if (columnCount > aligns.length) { return false; }
10461    -1 
10462    -1   if (silent) { return true; }
10463    -1 
10464    -1   token     = state.push('table_open', 'table', 1);
10465    -1   token.map = tableLines = [ startLine, 0 ];
10466    -1 
10467    -1   token     = state.push('thead_open', 'thead', 1);
10468    -1   token.map = [ startLine, startLine + 1 ];
10469    -1 
10470    -1   token     = state.push('tr_open', 'tr', 1);
10471    -1   token.map = [ startLine, startLine + 1 ];
10472    -1 
10473    -1   for (i = 0; i < columns.length; i++) {
10474    -1     token          = state.push('th_open', 'th', 1);
10475    -1     token.map      = [ startLine, startLine + 1 ];
10476    -1     if (aligns[i]) {
10477    -1       token.attrs  = [ [ 'style', 'text-align:' + aligns[i] ] ];
10478    -1     }
10479    -1 
10480    -1     token          = state.push('inline', '', 0);
10481    -1     token.content  = columns[i].trim();
10482    -1     token.map      = [ startLine, startLine + 1 ];
10483    -1     token.children = [];
10484    -1 
10485    -1     token          = state.push('th_close', 'th', -1);
10486    -1   }
10487    -1 
10488    -1   token     = state.push('tr_close', 'tr', -1);
10489    -1   token     = state.push('thead_close', 'thead', -1);
10490    -1 
10491    -1   token     = state.push('tbody_open', 'tbody', 1);
10492    -1   token.map = tbodyLines = [ startLine + 2, 0 ];
10493    -1 
10494    -1   for (nextLine = startLine + 2; nextLine < endLine; nextLine++) {
10495    -1     if (state.sCount[nextLine] < state.blkIndent) { break; }
10496    -1 
10497    -1     lineText = getLine(state, nextLine);
10498    -1     if (lineText.indexOf('|') === -1) { break; }
10499    -1 
10500    -1     // keep spaces at beginning of line to indicate an empty first cell, but
10501    -1     // strip trailing whitespace
10502    -1     columns = escapedSplit(lineText.replace(/^\||\|\s*$/g, ''));
10503    -1 
10504    -1     token = state.push('tr_open', 'tr', 1);
10505    -1     for (i = 0; i < columnCount; i++) {
10506    -1       token          = state.push('td_open', 'td', 1);
10507    -1       if (aligns[i]) {
10508    -1         token.attrs  = [ [ 'style', 'text-align:' + aligns[i] ] ];
10509    -1       }
10510    -1 
10511    -1       token          = state.push('inline', '', 0);
10512    -1       token.content  = columns[i] ? columns[i].trim() : '';
10513    -1       token.children = [];
10514    -1 
10515    -1       token          = state.push('td_close', 'td', -1);
10516    -1     }
10517    -1     token = state.push('tr_close', 'tr', -1);
10518    -1   }
10519    -1   token = state.push('tbody_close', 'tbody', -1);
10520    -1   token = state.push('table_close', 'table', -1);
10521    -1 
10522    -1   tableLines[1] = tbodyLines[1] = nextLine;
10523    -1   state.line = nextLine;
10524    -1   return true;
10525    -1 };
10526    -1 
10527    -1 },{}],66:[function(require,module,exports){
10528    -1 'use strict';
10529    -1 
10530    -1 
10531    -1 module.exports = function block(state) {
10532    -1   var token;
10533    -1 
10534    -1   if (state.inlineMode) {
10535    -1     token          = new state.Token('inline', '', 0);
10536    -1     token.content  = state.src;
10537    -1     token.map      = [ 0, 1 ];
10538    -1     token.children = [];
10539    -1     state.tokens.push(token);
10540    -1   } else {
10541    -1     state.md.block.parse(state.src, state.md, state.env, state.tokens);
10542    -1   }
10543    -1 };
10544    -1 
10545    -1 },{}],67:[function(require,module,exports){
10546    -1 'use strict';
10547    -1 
10548    -1 module.exports = function inline(state) {
10549    -1   var tokens = state.tokens, tok, i, l;
10550    -1 
10551    -1   // Parse inlines
10552    -1   for (i = 0, l = tokens.length; i < l; i++) {
10553    -1     tok = tokens[i];
10554    -1     if (tok.type === 'inline') {
10555    -1       state.md.inline.parse(tok.content, state.md, state.env, tok.children);
10556    -1     }
10557    -1   }
10558    -1 };
10559    -1 
10560    -1 },{}],68:[function(require,module,exports){
10561    -1 // Replace link-like texts with link nodes.
10562    -1 //
10563    -1 // Currently restricted by `md.validateLink()` to http/https/ftp
10564    -1 //
10565    -1 'use strict';
10566    -1 
10567    -1 
10568    -1 var arrayReplaceAt = require('../common/utils').arrayReplaceAt;
10569    -1 
10570    -1 
10571    -1 function isLinkOpen(str) {
10572    -1   return /^<a[>\s]/i.test(str);
10573    -1 }
10574    -1 function isLinkClose(str) {
10575    -1   return /^<\/a\s*>/i.test(str);
10576    -1 }
10577    -1 
10578    -1 
10579    -1 module.exports = function linkify(state) {
10580    -1   var i, j, l, tokens, token, currentToken, nodes, ln, text, pos, lastPos,
10581    -1       level, htmlLinkLevel, url, fullUrl, urlText,
10582    -1       blockTokens = state.tokens,
10583    -1       links;
10584    -1 
10585    -1   if (!state.md.options.linkify) { return; }
10586    -1 
10587    -1   for (j = 0, l = blockTokens.length; j < l; j++) {
10588    -1     if (blockTokens[j].type !== 'inline' ||
10589    -1         !state.md.linkify.pretest(blockTokens[j].content)) {
10590    -1       continue;
10591    -1     }
10592    -1 
10593    -1     tokens = blockTokens[j].children;
10594    -1 
10595    -1     htmlLinkLevel = 0;
10596    -1 
10597    -1     // We scan from the end, to keep position when new tags added.
10598    -1     // Use reversed logic in links start/end match
10599    -1     for (i = tokens.length - 1; i >= 0; i--) {
10600    -1       currentToken = tokens[i];
10601    -1 
10602    -1       // Skip content of markdown links
10603    -1       if (currentToken.type === 'link_close') {
10604    -1         i--;
10605    -1         while (tokens[i].level !== currentToken.level && tokens[i].type !== 'link_open') {
10606    -1           i--;
10607    -1         }
10608    -1         continue;
10609    -1       }
10610    -1 
10611    -1       // Skip content of html tag links
10612    -1       if (currentToken.type === 'html_inline') {
10613    -1         if (isLinkOpen(currentToken.content) && htmlLinkLevel > 0) {
10614    -1           htmlLinkLevel--;
10615    -1         }
10616    -1         if (isLinkClose(currentToken.content)) {
10617    -1           htmlLinkLevel++;
10618    -1         }
10619    -1       }
10620    -1       if (htmlLinkLevel > 0) { continue; }
10621    -1 
10622    -1       if (currentToken.type === 'text' && state.md.linkify.test(currentToken.content)) {
10623    -1 
10624    -1         text = currentToken.content;
10625    -1         links = state.md.linkify.match(text);
10626    -1 
10627    -1         // Now split string to nodes
10628    -1         nodes = [];
10629    -1         level = currentToken.level;
10630    -1         lastPos = 0;
10631    -1 
10632    -1         for (ln = 0; ln < links.length; ln++) {
10633    -1 
10634    -1           url = links[ln].url;
10635    -1           fullUrl = state.md.normalizeLink(url);
10636    -1           if (!state.md.validateLink(fullUrl)) { continue; }
10637    -1 
10638    -1           urlText = links[ln].text;
10639    -1 
10640    -1           // Linkifier might send raw hostnames like "example.com", where url
10641    -1           // starts with domain name. So we prepend http:// in those cases,
10642    -1           // and remove it afterwards.
10643    -1           //
10644    -1           if (!links[ln].schema) {
10645    -1             urlText = state.md.normalizeLinkText('http://' + urlText).replace(/^http:\/\//, '');
10646    -1           } else if (links[ln].schema === 'mailto:' && !/^mailto:/i.test(urlText)) {
10647    -1             urlText = state.md.normalizeLinkText('mailto:' + urlText).replace(/^mailto:/, '');
10648    -1           } else {
10649    -1             urlText = state.md.normalizeLinkText(urlText);
10650    -1           }
10651    -1 
10652    -1           pos = links[ln].index;
10653    -1 
10654    -1           if (pos > lastPos) {
10655    -1             token         = new state.Token('text', '', 0);
10656    -1             token.content = text.slice(lastPos, pos);
10657    -1             token.level   = level;
10658    -1             nodes.push(token);
10659    -1           }
10660    -1 
10661    -1           token         = new state.Token('link_open', 'a', 1);
10662    -1           token.attrs   = [ [ 'href', fullUrl ] ];
10663    -1           token.level   = level++;
10664    -1           token.markup  = 'linkify';
10665    -1           token.info    = 'auto';
10666    -1           nodes.push(token);
10667    -1 
10668    -1           token         = new state.Token('text', '', 0);
10669    -1           token.content = urlText;
10670    -1           token.level   = level;
10671    -1           nodes.push(token);
10672    -1 
10673    -1           token         = new state.Token('link_close', 'a', -1);
10674    -1           token.level   = --level;
10675    -1           token.markup  = 'linkify';
10676    -1           token.info    = 'auto';
10677    -1           nodes.push(token);
10678    -1 
10679    -1           lastPos = links[ln].lastIndex;
10680    -1         }
10681    -1         if (lastPos < text.length) {
10682    -1           token         = new state.Token('text', '', 0);
10683    -1           token.content = text.slice(lastPos);
10684    -1           token.level   = level;
10685    -1           nodes.push(token);
10686    -1         }
10687    -1 
10688    -1         // replace current node
10689    -1         blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);
10690    -1       }
10691    -1     }
10692    -1   }
10693    -1 };
10694    -1 
10695    -1 },{"../common/utils":40}],69:[function(require,module,exports){
10696    -1 // Normalize input string
10697    -1 
10698    -1 'use strict';
10699    -1 
10700    -1 
10701    -1 var NEWLINES_RE  = /\r[\n\u0085]?|[\u2424\u2028\u0085]/g;
10702    -1 var NULL_RE      = /\u0000/g;
10703    -1 
10704    -1 
10705    -1 module.exports = function inline(state) {
10706    -1   var str;
10707    -1 
10708    -1   // Normalize newlines
10709    -1   str = state.src.replace(NEWLINES_RE, '\n');
10710    -1 
10711    -1   // Replace NULL characters
10712    -1   str = str.replace(NULL_RE, '\uFFFD');
10713    -1 
10714    -1   state.src = str;
10715    -1 };
10716    -1 
10717    -1 },{}],70:[function(require,module,exports){
10718    -1 // Simple typographyc replacements
10719    -1 //
10720    -1 // (c) (C) → ©
10721    -1 // (tm) (TM) → ™
10722    -1 // (r) (R) → ®
10723    -1 // +- → ±
10724    -1 // (p) (P) -> §
10725    -1 // ... → … (also ?.... → ?.., !.... → !..)
10726    -1 // ???????? → ???, !!!!! → !!!, `,,` → `,`
10727    -1 // -- → &ndash;, --- → &mdash;
10728    -1 //
10729    -1 'use strict';
10730    -1 
10731    -1 // TODO:
10732    -1 // - fractionals 1/2, 1/4, 3/4 -> ½, ¼, ¾
10733    -1 // - miltiplication 2 x 4 -> 2 × 4
10734    -1 
10735    -1 var RARE_RE = /\+-|\.\.|\?\?\?\?|!!!!|,,|--/;
10736    -1 
10737    -1 // Workaround for phantomjs - need regex without /g flag,
10738    -1 // or root check will fail every second time
10739    -1 var SCOPED_ABBR_TEST_RE = /\((c|tm|r|p)\)/i;
10740    -1 
10741    -1 var SCOPED_ABBR_RE = /\((c|tm|r|p)\)/ig;
10742    -1 var SCOPED_ABBR = {
10743    -1   c: '©',
10744    -1   r: '®',
10745    -1   p: '§',
10746    -1   tm: '™'
10747    -1 };
10748    -1 
10749    -1 function replaceFn(match, name) {
10750    -1   return SCOPED_ABBR[name.toLowerCase()];
10751    -1 }
10752    -1 
10753    -1 function replace_scoped(inlineTokens) {
10754    -1   var i, token, inside_autolink = 0;
10755    -1 
10756    -1   for (i = inlineTokens.length - 1; i >= 0; i--) {
10757    -1     token = inlineTokens[i];
10758    -1 
10759    -1     if (token.type === 'text' && !inside_autolink) {
10760    -1       token.content = token.content.replace(SCOPED_ABBR_RE, replaceFn);
10761    -1     }
10762    -1 
10763    -1     if (token.type === 'link_open' && token.info === 'auto') {
10764    -1       inside_autolink--;
10765    -1     }
10766    -1 
10767    -1     if (token.type === 'link_close' && token.info === 'auto') {
10768    -1       inside_autolink++;
10769    -1     }
10770    -1   }
10771    -1 }
10772    -1 
10773    -1 function replace_rare(inlineTokens) {
10774    -1   var i, token, inside_autolink = 0;
10775    -1 
10776    -1   for (i = inlineTokens.length - 1; i >= 0; i--) {
10777    -1     token = inlineTokens[i];
10778    -1 
10779    -1     if (token.type === 'text' && !inside_autolink) {
10780    -1       if (RARE_RE.test(token.content)) {
10781    -1         token.content = token.content
10782    -1                     .replace(/\+-/g, '±')
10783    -1                     // .., ..., ....... -> …
10784    -1                     // but ?..... & !..... -> ?.. & !..
10785    -1                     .replace(/\.{2,}/g, '…').replace(/([?!])…/g, '$1..')
10786    -1                     .replace(/([?!]){4,}/g, '$1$1$1').replace(/,{2,}/g, ',')
10787    -1                     // em-dash
10788    -1                     .replace(/(^|[^-])---([^-]|$)/mg, '$1\u2014$2')
10789    -1                     // en-dash
10790    -1                     .replace(/(^|\s)--(\s|$)/mg, '$1\u2013$2')
10791    -1                     .replace(/(^|[^-\s])--([^-\s]|$)/mg, '$1\u2013$2');
10792    -1       }
10793    -1     }
10794    -1 
10795    -1     if (token.type === 'link_open' && token.info === 'auto') {
10796    -1       inside_autolink--;
10797    -1     }
10798    -1 
10799    -1     if (token.type === 'link_close' && token.info === 'auto') {
10800    -1       inside_autolink++;
10801    -1     }
10802    -1   }
10803    -1 }
10804    -1 
10805    -1 
10806    -1 module.exports = function replace(state) {
10807    -1   var blkIdx;
10808    -1 
10809    -1   if (!state.md.options.typographer) { return; }
10810    -1 
10811    -1   for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {
10812    -1 
10813    -1     if (state.tokens[blkIdx].type !== 'inline') { continue; }
10814    -1 
10815    -1     if (SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)) {
10816    -1       replace_scoped(state.tokens[blkIdx].children);
10817    -1     }
10818    -1 
10819    -1     if (RARE_RE.test(state.tokens[blkIdx].content)) {
10820    -1       replace_rare(state.tokens[blkIdx].children);
10821    -1     }
10822    -1 
10823    -1   }
10824    -1 };
10825    -1 
10826    -1 },{}],71:[function(require,module,exports){
10827    -1 // Convert straight quotation marks to typographic ones
10828    -1 //
10829    -1 'use strict';
10830    -1 
10831    -1 
10832    -1 var isWhiteSpace   = require('../common/utils').isWhiteSpace;
10833    -1 var isPunctChar    = require('../common/utils').isPunctChar;
10834    -1 var isMdAsciiPunct = require('../common/utils').isMdAsciiPunct;
10835    -1 
10836    -1 var QUOTE_TEST_RE = /['"]/;
10837    -1 var QUOTE_RE = /['"]/g;
10838    -1 var APOSTROPHE = '\u2019'; /* ’ */
10839    -1 
10840    -1 
10841    -1 function replaceAt(str, index, ch) {
10842    -1   return str.substr(0, index) + ch + str.substr(index + 1);
10843    -1 }
10844    -1 
10845    -1 function process_inlines(tokens, state) {
10846    -1   var i, token, text, t, pos, max, thisLevel, item, lastChar, nextChar,
10847    -1       isLastPunctChar, isNextPunctChar, isLastWhiteSpace, isNextWhiteSpace,
10848    -1       canOpen, canClose, j, isSingle, stack, openQuote, closeQuote;
10849    -1 
10850    -1   stack = [];
10851    -1 
10852    -1   for (i = 0; i < tokens.length; i++) {
10853    -1     token = tokens[i];
10854    -1 
10855    -1     thisLevel = tokens[i].level;
10856    -1 
10857    -1     for (j = stack.length - 1; j >= 0; j--) {
10858    -1       if (stack[j].level <= thisLevel) { break; }
10859    -1     }
10860    -1     stack.length = j + 1;
10861    -1 
10862    -1     if (token.type !== 'text') { continue; }
10863    -1 
10864    -1     text = token.content;
10865    -1     pos = 0;
10866    -1     max = text.length;
10867    -1 
10868    -1     /*eslint no-labels:0,block-scoped-var:0*/
10869    -1     OUTER:
10870    -1     while (pos < max) {
10871    -1       QUOTE_RE.lastIndex = pos;
10872    -1       t = QUOTE_RE.exec(text);
10873    -1       if (!t) { break; }
10874    -1 
10875    -1       canOpen = canClose = true;
10876    -1       pos = t.index + 1;
10877    -1       isSingle = (t[0] === "'");
10878    -1 
10879    -1       // Find previous character,
10880    -1       // default to space if it's the beginning of the line
10881    -1       //
10882    -1       lastChar = 0x20;
10883    -1 
10884    -1       if (t.index - 1 >= 0) {
10885    -1         lastChar = text.charCodeAt(t.index - 1);
10886    -1       } else {
10887    -1         for (j = i - 1; j >= 0; j--) {
10888    -1           if (tokens[j].type !== 'text') { continue; }
10889    -1 
10890    -1           lastChar = tokens[j].content.charCodeAt(tokens[j].content.length - 1);
10891    -1           break;
10892    -1         }
10893    -1       }
10894    -1 
10895    -1       // Find next character,
10896    -1       // default to space if it's the end of the line
10897    -1       //
10898    -1       nextChar = 0x20;
10899    -1 
10900    -1       if (pos < max) {
10901    -1         nextChar = text.charCodeAt(pos);
10902    -1       } else {
10903    -1         for (j = i + 1; j < tokens.length; j++) {
10904    -1           if (tokens[j].type !== 'text') { continue; }
10905    -1 
10906    -1           nextChar = tokens[j].content.charCodeAt(0);
10907    -1           break;
10908    -1         }
10909    -1       }
10910    -1 
10911    -1       isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));
10912    -1       isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));
10913    -1 
10914    -1       isLastWhiteSpace = isWhiteSpace(lastChar);
10915    -1       isNextWhiteSpace = isWhiteSpace(nextChar);
10916    -1 
10917    -1       if (isNextWhiteSpace) {
10918    -1         canOpen = false;
10919    -1       } else if (isNextPunctChar) {
10920    -1         if (!(isLastWhiteSpace || isLastPunctChar)) {
10921    -1           canOpen = false;
10922    -1         }
10923    -1       }
10924    -1 
10925    -1       if (isLastWhiteSpace) {
10926    -1         canClose = false;
10927    -1       } else if (isLastPunctChar) {
10928    -1         if (!(isNextWhiteSpace || isNextPunctChar)) {
10929    -1           canClose = false;
10930    -1         }
10931    -1       }
10932    -1 
10933    -1       if (nextChar === 0x22 /* " */ && t[0] === '"') {
10934    -1         if (lastChar >= 0x30 /* 0 */ && lastChar <= 0x39 /* 9 */) {
10935    -1           // special case: 1"" - count first quote as an inch
10936    -1           canClose = canOpen = false;
10937    -1         }
10938    -1       }
10939    -1 
10940    -1       if (canOpen && canClose) {
10941    -1         // treat this as the middle of the word
10942    -1         canOpen = false;
10943    -1         canClose = isNextPunctChar;
10944    -1       }
10945    -1 
10946    -1       if (!canOpen && !canClose) {
10947    -1         // middle of word
10948    -1         if (isSingle) {
10949    -1           token.content = replaceAt(token.content, t.index, APOSTROPHE);
10950    -1         }
10951    -1         continue;
10952    -1       }
10953    -1 
10954    -1       if (canClose) {
10955    -1         // this could be a closing quote, rewind the stack to get a match
10956    -1         for (j = stack.length - 1; j >= 0; j--) {
10957    -1           item = stack[j];
10958    -1           if (stack[j].level < thisLevel) { break; }
10959    -1           if (item.single === isSingle && stack[j].level === thisLevel) {
10960    -1             item = stack[j];
10961    -1 
10962    -1             if (isSingle) {
10963    -1               openQuote = state.md.options.quotes[2];
10964    -1               closeQuote = state.md.options.quotes[3];
10965    -1             } else {
10966    -1               openQuote = state.md.options.quotes[0];
10967    -1               closeQuote = state.md.options.quotes[1];
10968    -1             }
10969    -1 
10970    -1             // replace token.content *before* tokens[item.token].content,
10971    -1             // because, if they are pointing at the same token, replaceAt
10972    -1             // could mess up indices when quote length != 1
10973    -1             token.content = replaceAt(token.content, t.index, closeQuote);
10974    -1             tokens[item.token].content = replaceAt(
10975    -1               tokens[item.token].content, item.pos, openQuote);
10976    -1 
10977    -1             pos += closeQuote.length - 1;
10978    -1             if (item.token === i) { pos += openQuote.length - 1; }
10979    -1 
10980    -1             text = token.content;
10981    -1             max = text.length;
10982    -1 
10983    -1             stack.length = j;
10984    -1             continue OUTER;
10985    -1           }
10986    -1         }
10987    -1       }
10988    -1 
10989    -1       if (canOpen) {
10990    -1         stack.push({
10991    -1           token: i,
10992    -1           pos: t.index,
10993    -1           single: isSingle,
10994    -1           level: thisLevel
10995    -1         });
10996    -1       } else if (canClose && isSingle) {
10997    -1         token.content = replaceAt(token.content, t.index, APOSTROPHE);
10998    -1       }
10999    -1     }
11000    -1   }
11001    -1 }
11002    -1 
11003    -1 
11004    -1 module.exports = function smartquotes(state) {
11005    -1   /*eslint max-depth:0*/
11006    -1   var blkIdx;
11007    -1 
11008    -1   if (!state.md.options.typographer) { return; }
11009    -1 
11010    -1   for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {
11011    -1 
11012    -1     if (state.tokens[blkIdx].type !== 'inline' ||
11013    -1         !QUOTE_TEST_RE.test(state.tokens[blkIdx].content)) {
11014    -1       continue;
11015    -1     }
11016    -1 
11017    -1     process_inlines(state.tokens[blkIdx].children, state);
11018    -1   }
11019    -1 };
11020    -1 
11021    -1 },{"../common/utils":40}],72:[function(require,module,exports){
11022    -1 // Core state object
11023    -1 //
11024    -1 'use strict';
11025    -1 
11026    -1 var Token = require('../token');
11027    -1 
11028    -1 
11029    -1 function StateCore(src, md, env) {
11030    -1   this.src = src;
11031    -1   this.env = env;
11032    -1   this.tokens = [];
11033    -1   this.inlineMode = false;
11034    -1   this.md = md; // link to parser instance
11035    -1 }
11036    -1 
11037    -1 // re-export Token class to use in core rules
11038    -1 StateCore.prototype.Token = Token;
11039    -1 
11040    -1 
11041    -1 module.exports = StateCore;
11042    -1 
11043    -1 },{"../token":87}],73:[function(require,module,exports){
11044    -1 // Process autolinks '<protocol:...>'
11045    -1 
11046    -1 'use strict';
11047    -1 
11048    -1 
11049    -1 /*eslint max-len:0*/
11050    -1 var EMAIL_RE    = /^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/;
11051    -1 var AUTOLINK_RE = /^<([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)>/;
11052    -1 
11053    -1 
11054    -1 module.exports = function autolink(state, silent) {
11055    -1   var tail, linkMatch, emailMatch, url, fullUrl, token,
11056    -1       pos = state.pos;
11057    -1 
11058    -1   if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }
11059    -1 
11060    -1   tail = state.src.slice(pos);
11061    -1 
11062    -1   if (tail.indexOf('>') < 0) { return false; }
11063    -1 
11064    -1   if (AUTOLINK_RE.test(tail)) {
11065    -1     linkMatch = tail.match(AUTOLINK_RE);
11066    -1 
11067    -1     url = linkMatch[0].slice(1, -1);
11068    -1     fullUrl = state.md.normalizeLink(url);
11069    -1     if (!state.md.validateLink(fullUrl)) { return false; }
11070    -1 
11071    -1     if (!silent) {
11072    -1       token         = state.push('link_open', 'a', 1);
11073    -1       token.attrs   = [ [ 'href', fullUrl ] ];
11074    -1       token.markup  = 'autolink';
11075    -1       token.info    = 'auto';
11076    -1 
11077    -1       token         = state.push('text', '', 0);
11078    -1       token.content = state.md.normalizeLinkText(url);
11079    -1 
11080    -1       token         = state.push('link_close', 'a', -1);
11081    -1       token.markup  = 'autolink';
11082    -1       token.info    = 'auto';
11083    -1     }
11084    -1 
11085    -1     state.pos += linkMatch[0].length;
11086    -1     return true;
11087    -1   }
11088    -1 
11089    -1   if (EMAIL_RE.test(tail)) {
11090    -1     emailMatch = tail.match(EMAIL_RE);
11091    -1 
11092    -1     url = emailMatch[0].slice(1, -1);
11093    -1     fullUrl = state.md.normalizeLink('mailto:' + url);
11094    -1     if (!state.md.validateLink(fullUrl)) { return false; }
11095    -1 
11096    -1     if (!silent) {
11097    -1       token         = state.push('link_open', 'a', 1);
11098    -1       token.attrs   = [ [ 'href', fullUrl ] ];
11099    -1       token.markup  = 'autolink';
11100    -1       token.info    = 'auto';
11101    -1 
11102    -1       token         = state.push('text', '', 0);
11103    -1       token.content = state.md.normalizeLinkText(url);
11104    -1 
11105    -1       token         = state.push('link_close', 'a', -1);
11106    -1       token.markup  = 'autolink';
11107    -1       token.info    = 'auto';
11108    -1     }
11109    -1 
11110    -1     state.pos += emailMatch[0].length;
11111    -1     return true;
11112    -1   }
11113    -1 
11114    -1   return false;
11115    -1 };
11116    -1 
11117    -1 },{}],74:[function(require,module,exports){
11118    -1 // Parse backticks
11119    -1 
11120    -1 'use strict';
11121    -1 
11122    -1 module.exports = function backtick(state, silent) {
11123    -1   var start, max, marker, matchStart, matchEnd, token,
11124    -1       pos = state.pos,
11125    -1       ch = state.src.charCodeAt(pos);
11126    -1 
11127    -1   if (ch !== 0x60/* ` */) { return false; }
11128    -1 
11129    -1   start = pos;
11130    -1   pos++;
11131    -1   max = state.posMax;
11132    -1 
11133    -1   while (pos < max && state.src.charCodeAt(pos) === 0x60/* ` */) { pos++; }
11134    -1 
11135    -1   marker = state.src.slice(start, pos);
11136    -1 
11137    -1   matchStart = matchEnd = pos;
11138    -1 
11139    -1   while ((matchStart = state.src.indexOf('`', matchEnd)) !== -1) {
11140    -1     matchEnd = matchStart + 1;
11141    -1 
11142    -1     while (matchEnd < max && state.src.charCodeAt(matchEnd) === 0x60/* ` */) { matchEnd++; }
11143    -1 
11144    -1     if (matchEnd - matchStart === marker.length) {
11145    -1       if (!silent) {
11146    -1         token         = state.push('code_inline', 'code', 0);
11147    -1         token.markup  = marker;
11148    -1         token.content = state.src.slice(pos, matchStart)
11149    -1                                  .replace(/[ \n]+/g, ' ')
11150    -1                                  .trim();
11151    -1       }
11152    -1       state.pos = matchEnd;
11153    -1       return true;
11154    -1     }
11155    -1   }
11156    -1 
11157    -1   if (!silent) { state.pending += marker; }
11158    -1   state.pos += marker.length;
11159    -1   return true;
11160    -1 };
11161    -1 
11162    -1 },{}],75:[function(require,module,exports){
11163    -1 // For each opening emphasis-like marker find a matching closing one
11164    -1 //
11165    -1 'use strict';
11166    -1 
11167    -1 
11168    -1 module.exports = function link_pairs(state) {
11169    -1   var i, j, lastDelim, currDelim,
11170    -1       delimiters = state.delimiters,
11171    -1       max = state.delimiters.length;
11172    -1 
11173    -1   for (i = 0; i < max; i++) {
11174    -1     lastDelim = delimiters[i];
11175    -1 
11176    -1     if (!lastDelim.close) { continue; }
11177    -1 
11178    -1     j = i - lastDelim.jump - 1;
11179    -1 
11180    -1     while (j >= 0) {
11181    -1       currDelim = delimiters[j];
11182    -1 
11183    -1       if (currDelim.open &&
11184    -1           currDelim.marker === lastDelim.marker &&
11185    -1           currDelim.end < 0 &&
11186    -1           currDelim.level === lastDelim.level) {
11187    -1 
11188    -1         lastDelim.jump = i - j;
11189    -1         lastDelim.open = false;
11190    -1         currDelim.end  = i;
11191    -1         currDelim.jump = 0;
11192    -1         break;
11193    -1       }
11194    -1 
11195    -1       j -= currDelim.jump + 1;
11196    -1     }
11197    -1   }
11198    -1 };
11199    -1 
11200    -1 },{}],76:[function(require,module,exports){
11201    -1 // Process *this* and _that_
11202    -1 //
11203    -1 'use strict';
11204    -1 
11205    -1 
11206    -1 // Insert each marker as a separate text token, and add it to delimiter list
11207    -1 //
11208    -1 module.exports.tokenize = function emphasis(state, silent) {
11209    -1   var i, scanned, token,
11210    -1       start = state.pos,
11211    -1       marker = state.src.charCodeAt(start);
11212    -1 
11213    -1   if (silent) { return false; }
11214    -1 
11215    -1   if (marker !== 0x5F /* _ */ && marker !== 0x2A /* * */) { return false; }
11216    -1 
11217    -1   scanned = state.scanDelims(state.pos, marker === 0x2A);
11218    -1 
11219    -1   for (i = 0; i < scanned.length; i++) {
11220    -1     token         = state.push('text', '', 0);
11221    -1     token.content = String.fromCharCode(marker);
11222    -1 
11223    -1     state.delimiters.push({
11224    -1       // Char code of the starting marker (number).
11225    -1       //
11226    -1       marker: marker,
11227    -1 
11228    -1       // An amount of characters before this one that's equivalent to
11229    -1       // current one. In plain English: if this delimiter does not open
11230    -1       // an emphasis, neither do previous `jump` characters.
11231    -1       //
11232    -1       // Used to skip sequences like "*****" in one step, for 1st asterisk
11233    -1       // value will be 0, for 2nd it's 1 and so on.
11234    -1       //
11235    -1       jump:   i,
11236    -1 
11237    -1       // A position of the token this delimiter corresponds to.
11238    -1       //
11239    -1       token:  state.tokens.length - 1,
11240    -1 
11241    -1       // Token level.
11242    -1       //
11243    -1       level:  state.level,
11244    -1 
11245    -1       // If this delimiter is matched as a valid opener, `end` will be
11246    -1       // equal to its position, otherwise it's `-1`.
11247    -1       //
11248    -1       end:    -1,
11249    -1 
11250    -1       // Boolean flags that determine if this delimiter could open or close
11251    -1       // an emphasis.
11252    -1       //
11253    -1       open:   scanned.can_open,
11254    -1       close:  scanned.can_close
11255    -1     });
11256    -1   }
11257    -1 
11258    -1   state.pos += scanned.length;
11259    -1 
11260    -1   return true;
11261    -1 };
11262    -1 
11263    -1 
11264    -1 // Walk through delimiter list and replace text tokens with tags
11265    -1 //
11266    -1 module.exports.postProcess = function emphasis(state) {
11267    -1   var i,
11268    -1       startDelim,
11269    -1       endDelim,
11270    -1       token,
11271    -1       ch,
11272    -1       isStrong,
11273    -1       delimiters = state.delimiters,
11274    -1       max = state.delimiters.length;
11275    -1 
11276    -1   for (i = 0; i < max; i++) {
11277    -1     startDelim = delimiters[i];
11278    -1 
11279    -1     if (startDelim.marker !== 0x5F/* _ */ && startDelim.marker !== 0x2A/* * */) {
11280    -1       continue;
11281    -1     }
11282    -1 
11283    -1     // Process only opening markers
11284    -1     if (startDelim.end === -1) {
11285    -1       continue;
11286    -1     }
11287    -1 
11288    -1     endDelim = delimiters[startDelim.end];
11289    -1 
11290    -1     // If the next delimiter has the same marker and is adjacent to this one,
11291    -1     // merge those into one strong delimiter.
11292    -1     //
11293    -1     // `<em><em>whatever</em></em>` -> `<strong>whatever</strong>`
11294    -1     //
11295    -1     isStrong = i + 1 < max &&
11296    -1                delimiters[i + 1].end === startDelim.end - 1 &&
11297    -1                delimiters[i + 1].token === startDelim.token + 1 &&
11298    -1                delimiters[startDelim.end - 1].token === endDelim.token - 1 &&
11299    -1                delimiters[i + 1].marker === startDelim.marker;
11300    -1 
11301    -1     ch = String.fromCharCode(startDelim.marker);
11302    -1 
11303    -1     token         = state.tokens[startDelim.token];
11304    -1     token.type    = isStrong ? 'strong_open' : 'em_open';
11305    -1     token.tag     = isStrong ? 'strong' : 'em';
11306    -1     token.nesting = 1;
11307    -1     token.markup  = isStrong ? ch + ch : ch;
11308    -1     token.content = '';
11309    -1 
11310    -1     token         = state.tokens[endDelim.token];
11311    -1     token.type    = isStrong ? 'strong_close' : 'em_close';
11312    -1     token.tag     = isStrong ? 'strong' : 'em';
11313    -1     token.nesting = -1;
11314    -1     token.markup  = isStrong ? ch + ch : ch;
11315    -1     token.content = '';
11316    -1 
11317    -1     if (isStrong) {
11318    -1       state.tokens[delimiters[i + 1].token].content = '';
11319    -1       state.tokens[delimiters[startDelim.end - 1].token].content = '';
11320    -1       i++;
11321    -1     }
11322    -1   }
11323    -1 };
11324    -1 
11325    -1 },{}],77:[function(require,module,exports){
11326    -1 // Process html entity - &#123;, &#xAF;, &quot;, ...
11327    -1 
11328    -1 'use strict';
11329    -1 
11330    -1 var entities          = require('../common/entities');
11331    -1 var has               = require('../common/utils').has;
11332    -1 var isValidEntityCode = require('../common/utils').isValidEntityCode;
11333    -1 var fromCodePoint     = require('../common/utils').fromCodePoint;
11334    -1 
11335    -1 
11336    -1 var DIGITAL_RE = /^&#((?:x[a-f0-9]{1,8}|[0-9]{1,8}));/i;
11337    -1 var NAMED_RE   = /^&([a-z][a-z0-9]{1,31});/i;
11338    -1 
11339    -1 
11340    -1 module.exports = function entity(state, silent) {
11341    -1   var ch, code, match, pos = state.pos, max = state.posMax;
11342    -1 
11343    -1   if (state.src.charCodeAt(pos) !== 0x26/* & */) { return false; }
11344    -1 
11345    -1   if (pos + 1 < max) {
11346    -1     ch = state.src.charCodeAt(pos + 1);
11347    -1 
11348    -1     if (ch === 0x23 /* # */) {
11349    -1       match = state.src.slice(pos).match(DIGITAL_RE);
11350    -1       if (match) {
11351    -1         if (!silent) {
11352    -1           code = match[1][0].toLowerCase() === 'x' ? parseInt(match[1].slice(1), 16) : parseInt(match[1], 10);
11353    -1           state.pending += isValidEntityCode(code) ? fromCodePoint(code) : fromCodePoint(0xFFFD);
11354    -1         }
11355    -1         state.pos += match[0].length;
11356    -1         return true;
11357    -1       }
11358    -1     } else {
11359    -1       match = state.src.slice(pos).match(NAMED_RE);
11360    -1       if (match) {
11361    -1         if (has(entities, match[1])) {
11362    -1           if (!silent) { state.pending += entities[match[1]]; }
11363    -1           state.pos += match[0].length;
11364    -1           return true;
11365    -1         }
11366    -1       }
11367    -1     }
11368    -1   }
11369    -1 
11370    -1   if (!silent) { state.pending += '&'; }
11371    -1   state.pos++;
11372    -1   return true;
11373    -1 };
11374    -1 
11375    -1 },{"../common/entities":37,"../common/utils":40}],78:[function(require,module,exports){
11376    -1 // Proceess escaped chars and hardbreaks
11377    -1 
11378    -1 'use strict';
11379    -1 
11380    -1 var isSpace = require('../common/utils').isSpace;
11381    -1 
11382    -1 var ESCAPED = [];
11383    -1 
11384    -1 for (var i = 0; i < 256; i++) { ESCAPED.push(0); }
11385    -1 
11386    -1 '\\!"#$%&\'()*+,./:;<=>?@[]^_`{|}~-'
11387    -1   .split('').forEach(function (ch) { ESCAPED[ch.charCodeAt(0)] = 1; });
11388    -1 
11389    -1 
11390    -1 module.exports = function escape(state, silent) {
11391    -1   var ch, pos = state.pos, max = state.posMax;
11392    -1 
11393    -1   if (state.src.charCodeAt(pos) !== 0x5C/* \ */) { return false; }
11394    -1 
11395    -1   pos++;
11396    -1 
11397    -1   if (pos < max) {
11398    -1     ch = state.src.charCodeAt(pos);
11399    -1 
11400    -1     if (ch < 256 && ESCAPED[ch] !== 0) {
11401    -1       if (!silent) { state.pending += state.src[pos]; }
11402    -1       state.pos += 2;
11403    -1       return true;
11404    -1     }
11405    -1 
11406    -1     if (ch === 0x0A) {
11407    -1       if (!silent) {
11408    -1         state.push('hardbreak', 'br', 0);
11409    -1       }
11410    -1 
11411    -1       pos++;
11412    -1       // skip leading whitespaces from next line
11413    -1       while (pos < max) {
11414    -1         ch = state.src.charCodeAt(pos);
11415    -1         if (!isSpace(ch)) { break; }
11416    -1         pos++;
11417    -1       }
11418    -1 
11419    -1       state.pos = pos;
11420    -1       return true;
11421    -1     }
11422    -1   }
11423    -1 
11424    -1   if (!silent) { state.pending += '\\'; }
11425    -1   state.pos++;
11426    -1   return true;
11427    -1 };
11428    -1 
11429    -1 },{"../common/utils":40}],79:[function(require,module,exports){
11430    -1 // Process html tags
11431    -1 
11432    -1 'use strict';
11433    -1 
11434    -1 
11435    -1 var HTML_TAG_RE = require('../common/html_re').HTML_TAG_RE;
11436    -1 
11437    -1 
11438    -1 function isLetter(ch) {
11439    -1   /*eslint no-bitwise:0*/
11440    -1   var lc = ch | 0x20; // to lower case
11441    -1   return (lc >= 0x61/* a */) && (lc <= 0x7a/* z */);
11442    -1 }
11443    -1 
11444    -1 
11445    -1 module.exports = function html_inline(state, silent) {
11446    -1   var ch, match, max, token,
11447    -1       pos = state.pos;
11448    -1 
11449    -1   if (!state.md.options.html) { return false; }
11450    -1 
11451    -1   // Check start
11452    -1   max = state.posMax;
11453    -1   if (state.src.charCodeAt(pos) !== 0x3C/* < */ ||
11454    -1       pos + 2 >= max) {
11455    -1     return false;
11456    -1   }
11457    -1 
11458    -1   // Quick fail on second char
11459    -1   ch = state.src.charCodeAt(pos + 1);
11460    -1   if (ch !== 0x21/* ! */ &&
11461    -1       ch !== 0x3F/* ? */ &&
11462    -1       ch !== 0x2F/* / */ &&
11463    -1       !isLetter(ch)) {
11464    -1     return false;
11465    -1   }
11466    -1 
11467    -1   match = state.src.slice(pos).match(HTML_TAG_RE);
11468    -1   if (!match) { return false; }
11469    -1 
11470    -1   if (!silent) {
11471    -1     token         = state.push('html_inline', '', 0);
11472    -1     token.content = state.src.slice(pos, pos + match[0].length);
11473    -1   }
11474    -1   state.pos += match[0].length;
11475    -1   return true;
11476    -1 };
11477    -1 
11478    -1 },{"../common/html_re":39}],80:[function(require,module,exports){
11479    -1 // Process ![image](<src> "title")
11480    -1 
11481    -1 'use strict';
11482    -1 
11483    -1 var parseLinkLabel       = require('../helpers/parse_link_label');
11484    -1 var parseLinkDestination = require('../helpers/parse_link_destination');
11485    -1 var parseLinkTitle       = require('../helpers/parse_link_title');
11486    -1 var normalizeReference   = require('../common/utils').normalizeReference;
11487    -1 var isSpace              = require('../common/utils').isSpace;
11488    -1 
11489    -1 
11490    -1 module.exports = function image(state, silent) {
11491    -1   var attrs,
11492    -1       code,
11493    -1       content,
11494    -1       label,
11495    -1       labelEnd,
11496    -1       labelStart,
11497    -1       pos,
11498    -1       ref,
11499    -1       res,
11500    -1       title,
11501    -1       token,
11502    -1       tokens,
11503    -1       start,
11504    -1       href = '',
11505    -1       oldPos = state.pos,
11506    -1       max = state.posMax;
11507    -1 
11508    -1   if (state.src.charCodeAt(state.pos) !== 0x21/* ! */) { return false; }
11509    -1   if (state.src.charCodeAt(state.pos + 1) !== 0x5B/* [ */) { return false; }
11510    -1 
11511    -1   labelStart = state.pos + 2;
11512    -1   labelEnd = parseLinkLabel(state, state.pos + 1, false);
11513    -1 
11514    -1   // parser failed to find ']', so it's not a valid link
11515    -1   if (labelEnd < 0) { return false; }
11516    -1 
11517    -1   pos = labelEnd + 1;
11518    -1   if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {
11519    -1     //
11520    -1     // Inline link
11521    -1     //
11522    -1 
11523    -1     // [link](  <href>  "title"  )
11524    -1     //        ^^ skipping these spaces
11525    -1     pos++;
11526    -1     for (; pos < max; pos++) {
11527    -1       code = state.src.charCodeAt(pos);
11528    -1       if (!isSpace(code) && code !== 0x0A) { break; }
11529    -1     }
11530    -1     if (pos >= max) { return false; }
11531    -1 
11532    -1     // [link](  <href>  "title"  )
11533    -1     //          ^^^^^^ parsing link destination
11534    -1     start = pos;
11535    -1     res = parseLinkDestination(state.src, pos, state.posMax);
11536    -1     if (res.ok) {
11537    -1       href = state.md.normalizeLink(res.str);
11538    -1       if (state.md.validateLink(href)) {
11539    -1         pos = res.pos;
11540    -1       } else {
11541    -1         href = '';
11542    -1       }
11543    -1     }
11544    -1 
11545    -1     // [link](  <href>  "title"  )
11546    -1     //                ^^ skipping these spaces
11547    -1     start = pos;
11548    -1     for (; pos < max; pos++) {
11549    -1       code = state.src.charCodeAt(pos);
11550    -1       if (!isSpace(code) && code !== 0x0A) { break; }
11551    -1     }
11552    -1 
11553    -1     // [link](  <href>  "title"  )
11554    -1     //                  ^^^^^^^ parsing link title
11555    -1     res = parseLinkTitle(state.src, pos, state.posMax);
11556    -1     if (pos < max && start !== pos && res.ok) {
11557    -1       title = res.str;
11558    -1       pos = res.pos;
11559    -1 
11560    -1       // [link](  <href>  "title"  )
11561    -1       //                         ^^ skipping these spaces
11562    -1       for (; pos < max; pos++) {
11563    -1         code = state.src.charCodeAt(pos);
11564    -1         if (!isSpace(code) && code !== 0x0A) { break; }
11565    -1       }
11566    -1     } else {
11567    -1       title = '';
11568    -1     }
11569    -1 
11570    -1     if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {
11571    -1       state.pos = oldPos;
11572    -1       return false;
11573    -1     }
11574    -1     pos++;
11575    -1   } else {
11576    -1     //
11577    -1     // Link reference
11578    -1     //
11579    -1     if (typeof state.env.references === 'undefined') { return false; }
11580    -1 
11581    -1     if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {
11582    -1       start = pos + 1;
11583    -1       pos = parseLinkLabel(state, pos);
11584    -1       if (pos >= 0) {
11585    -1         label = state.src.slice(start, pos++);
11586    -1       } else {
11587    -1         pos = labelEnd + 1;
11588    -1       }
11589    -1     } else {
11590    -1       pos = labelEnd + 1;
11591    -1     }
11592    -1 
11593    -1     // covers label === '' and label === undefined
11594    -1     // (collapsed reference link and shortcut reference link respectively)
11595    -1     if (!label) { label = state.src.slice(labelStart, labelEnd); }
11596    -1 
11597    -1     ref = state.env.references[normalizeReference(label)];
11598    -1     if (!ref) {
11599    -1       state.pos = oldPos;
11600    -1       return false;
11601    -1     }
11602    -1     href = ref.href;
11603    -1     title = ref.title;
11604    -1   }
11605    -1 
11606    -1   //
11607    -1   // We found the end of the link, and know for a fact it's a valid link;
11608    -1   // so all that's left to do is to call tokenizer.
11609    -1   //
11610    -1   if (!silent) {
11611    -1     content = state.src.slice(labelStart, labelEnd);
11612    -1 
11613    -1     state.md.inline.parse(
11614    -1       content,
11615    -1       state.md,
11616    -1       state.env,
11617    -1       tokens = []
11618    -1     );
11619    -1 
11620    -1     token          = state.push('image', 'img', 0);
11621    -1     token.attrs    = attrs = [ [ 'src', href ], [ 'alt', '' ] ];
11622    -1     token.children = tokens;
11623    -1     token.content  = content;
11624    -1 
11625    -1     if (title) {
11626    -1       attrs.push([ 'title', title ]);
11627    -1     }
11628    -1   }
11629    -1 
11630    -1   state.pos = pos;
11631    -1   state.posMax = max;
11632    -1   return true;
11633    -1 };
11634    -1 
11635    -1 },{"../common/utils":40,"../helpers/parse_link_destination":42,"../helpers/parse_link_label":43,"../helpers/parse_link_title":44}],81:[function(require,module,exports){
11636    -1 // Process [link](<to> "stuff")
11637    -1 
11638    -1 'use strict';
11639    -1 
11640    -1 var parseLinkLabel       = require('../helpers/parse_link_label');
11641    -1 var parseLinkDestination = require('../helpers/parse_link_destination');
11642    -1 var parseLinkTitle       = require('../helpers/parse_link_title');
11643    -1 var normalizeReference   = require('../common/utils').normalizeReference;
11644    -1 var isSpace              = require('../common/utils').isSpace;
11645    -1 
11646    -1 
11647    -1 module.exports = function link(state, silent) {
11648    -1   var attrs,
11649    -1       code,
11650    -1       label,
11651    -1       labelEnd,
11652    -1       labelStart,
11653    -1       pos,
11654    -1       res,
11655    -1       ref,
11656    -1       title,
11657    -1       token,
11658    -1       href = '',
11659    -1       oldPos = state.pos,
11660    -1       max = state.posMax,
11661    -1       start = state.pos;
11662    -1 
11663    -1   if (state.src.charCodeAt(state.pos) !== 0x5B/* [ */) { return false; }
11664    -1 
11665    -1   labelStart = state.pos + 1;
11666    -1   labelEnd = parseLinkLabel(state, state.pos, true);
11667    -1 
11668    -1   // parser failed to find ']', so it's not a valid link
11669    -1   if (labelEnd < 0) { return false; }
11670    -1 
11671    -1   pos = labelEnd + 1;
11672    -1   if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {
11673    -1     //
11674    -1     // Inline link
11675    -1     //
11676    -1 
11677    -1     // [link](  <href>  "title"  )
11678    -1     //        ^^ skipping these spaces
11679    -1     pos++;
11680    -1     for (; pos < max; pos++) {
11681    -1       code = state.src.charCodeAt(pos);
11682    -1       if (!isSpace(code) && code !== 0x0A) { break; }
11683    -1     }
11684    -1     if (pos >= max) { return false; }
11685    -1 
11686    -1     // [link](  <href>  "title"  )
11687    -1     //          ^^^^^^ parsing link destination
11688    -1     start = pos;
11689    -1     res = parseLinkDestination(state.src, pos, state.posMax);
11690    -1     if (res.ok) {
11691    -1       href = state.md.normalizeLink(res.str);
11692    -1       if (state.md.validateLink(href)) {
11693    -1         pos = res.pos;
11694    -1       } else {
11695    -1         href = '';
11696    -1       }
11697    -1     }
11698    -1 
11699    -1     // [link](  <href>  "title"  )
11700    -1     //                ^^ skipping these spaces
11701    -1     start = pos;
11702    -1     for (; pos < max; pos++) {
11703    -1       code = state.src.charCodeAt(pos);
11704    -1       if (!isSpace(code) && code !== 0x0A) { break; }
11705    -1     }
11706    -1 
11707    -1     // [link](  <href>  "title"  )
11708    -1     //                  ^^^^^^^ parsing link title
11709    -1     res = parseLinkTitle(state.src, pos, state.posMax);
11710    -1     if (pos < max && start !== pos && res.ok) {
11711    -1       title = res.str;
11712    -1       pos = res.pos;
11713    -1 
11714    -1       // [link](  <href>  "title"  )
11715    -1       //                         ^^ skipping these spaces
11716    -1       for (; pos < max; pos++) {
11717    -1         code = state.src.charCodeAt(pos);
11718    -1         if (!isSpace(code) && code !== 0x0A) { break; }
11719    -1       }
11720    -1     } else {
11721    -1       title = '';
11722    -1     }
11723    -1 
11724    -1     if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {
11725    -1       state.pos = oldPos;
11726    -1       return false;
11727    -1     }
11728    -1     pos++;
11729    -1   } else {
11730    -1     //
11731    -1     // Link reference
11732    -1     //
11733    -1     if (typeof state.env.references === 'undefined') { return false; }
11734    -1 
11735    -1     if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {
11736    -1       start = pos + 1;
11737    -1       pos = parseLinkLabel(state, pos);
11738    -1       if (pos >= 0) {
11739    -1         label = state.src.slice(start, pos++);
11740    -1       } else {
11741    -1         pos = labelEnd + 1;
11742    -1       }
11743    -1     } else {
11744    -1       pos = labelEnd + 1;
11745    -1     }
11746    -1 
11747    -1     // covers label === '' and label === undefined
11748    -1     // (collapsed reference link and shortcut reference link respectively)
11749    -1     if (!label) { label = state.src.slice(labelStart, labelEnd); }
11750    -1 
11751    -1     ref = state.env.references[normalizeReference(label)];
11752    -1     if (!ref) {
11753    -1       state.pos = oldPos;
11754    -1       return false;
11755    -1     }
11756    -1     href = ref.href;
11757    -1     title = ref.title;
11758    -1   }
11759    -1 
11760    -1   //
11761    -1   // We found the end of the link, and know for a fact it's a valid link;
11762    -1   // so all that's left to do is to call tokenizer.
11763    -1   //
11764    -1   if (!silent) {
11765    -1     state.pos = labelStart;
11766    -1     state.posMax = labelEnd;
11767    -1 
11768    -1     token        = state.push('link_open', 'a', 1);
11769    -1     token.attrs  = attrs = [ [ 'href', href ] ];
11770    -1     if (title) {
11771    -1       attrs.push([ 'title', title ]);
11772    -1     }
11773    -1 
11774    -1     state.md.inline.tokenize(state);
11775    -1 
11776    -1     token        = state.push('link_close', 'a', -1);
11777    -1   }
11778    -1 
11779    -1   state.pos = pos;
11780    -1   state.posMax = max;
11781    -1   return true;
11782    -1 };
11783    -1 
11784    -1 },{"../common/utils":40,"../helpers/parse_link_destination":42,"../helpers/parse_link_label":43,"../helpers/parse_link_title":44}],82:[function(require,module,exports){
11785    -1 // Proceess '\n'
11786    -1 
11787    -1 'use strict';
11788    -1 
11789    -1 module.exports = function newline(state, silent) {
11790    -1   var pmax, max, pos = state.pos;
11791    -1 
11792    -1   if (state.src.charCodeAt(pos) !== 0x0A/* \n */) { return false; }
11793    -1 
11794    -1   pmax = state.pending.length - 1;
11795    -1   max = state.posMax;
11796    -1 
11797    -1   // '  \n' -> hardbreak
11798    -1   // Lookup in pending chars is bad practice! Don't copy to other rules!
11799    -1   // Pending string is stored in concat mode, indexed lookups will cause
11800    -1   // convertion to flat mode.
11801    -1   if (!silent) {
11802    -1     if (pmax >= 0 && state.pending.charCodeAt(pmax) === 0x20) {
11803    -1       if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 0x20) {
11804    -1         state.pending = state.pending.replace(/ +$/, '');
11805    -1         state.push('hardbreak', 'br', 0);
11806    -1       } else {
11807    -1         state.pending = state.pending.slice(0, -1);
11808    -1         state.push('softbreak', 'br', 0);
11809    -1       }
11810    -1 
11811    -1     } else {
11812    -1       state.push('softbreak', 'br', 0);
11813    -1     }
11814    -1   }
11815    -1 
11816    -1   pos++;
11817    -1 
11818    -1   // skip heading spaces for next line
11819    -1   while (pos < max && state.src.charCodeAt(pos) === 0x20) { pos++; }
11820    -1 
11821    -1   state.pos = pos;
11822    -1   return true;
11823    -1 };
11824    -1 
11825    -1 },{}],83:[function(require,module,exports){
11826    -1 // Inline parser state
11827    -1 
11828    -1 'use strict';
11829    -1 
11830    -1 
11831    -1 var Token          = require('../token');
11832    -1 var isWhiteSpace   = require('../common/utils').isWhiteSpace;
11833    -1 var isPunctChar    = require('../common/utils').isPunctChar;
11834    -1 var isMdAsciiPunct = require('../common/utils').isMdAsciiPunct;
11835    -1 
11836    -1 
11837    -1 function StateInline(src, md, env, outTokens) {
11838    -1   this.src = src;
11839    -1   this.env = env;
11840    -1   this.md = md;
11841    -1   this.tokens = outTokens;
11842    -1 
11843    -1   this.pos = 0;
11844    -1   this.posMax = this.src.length;
11845    -1   this.level = 0;
11846    -1   this.pending = '';
11847    -1   this.pendingLevel = 0;
11848    -1 
11849    -1   this.cache = {};        // Stores { start: end } pairs. Useful for backtrack
11850    -1                           // optimization of pairs parse (emphasis, strikes).
11851    -1 
11852    -1   this.delimiters = [];   // Emphasis-like delimiters
11853    -1 }
11854    -1 
11855    -1 
11856    -1 // Flush pending text
11857    -1 //
11858    -1 StateInline.prototype.pushPending = function () {
11859    -1   var token = new Token('text', '', 0);
11860    -1   token.content = this.pending;
11861    -1   token.level = this.pendingLevel;
11862    -1   this.tokens.push(token);
11863    -1   this.pending = '';
11864    -1   return token;
11865    -1 };
11866    -1 
11867    -1 
11868    -1 // Push new token to "stream".
11869    -1 // If pending text exists - flush it as text token
11870    -1 //
11871    -1 StateInline.prototype.push = function (type, tag, nesting) {
11872    -1   if (this.pending) {
11873    -1     this.pushPending();
11874    -1   }
11875    -1 
11876    -1   var token = new Token(type, tag, nesting);
11877    -1 
11878    -1   if (nesting < 0) { this.level--; }
11879    -1   token.level = this.level;
11880    -1   if (nesting > 0) { this.level++; }
11881    -1 
11882    -1   this.pendingLevel = this.level;
11883    -1   this.tokens.push(token);
11884    -1   return token;
11885    -1 };
11886    -1 
11887    -1 
11888    -1 // Scan a sequence of emphasis-like markers, and determine whether
11889    -1 // it can start an emphasis sequence or end an emphasis sequence.
11890    -1 //
11891    -1 //  - start - position to scan from (it should point at a valid marker);
11892    -1 //  - canSplitWord - determine if these markers can be found inside a word
11893    -1 //
11894    -1 StateInline.prototype.scanDelims = function (start, canSplitWord) {
11895    -1   var pos = start, lastChar, nextChar, count, can_open, can_close,
11896    -1       isLastWhiteSpace, isLastPunctChar,
11897    -1       isNextWhiteSpace, isNextPunctChar,
11898    -1       left_flanking = true,
11899    -1       right_flanking = true,
11900    -1       max = this.posMax,
11901    -1       marker = this.src.charCodeAt(start);
11902    -1 
11903    -1   // treat beginning of the line as a whitespace
11904    -1   lastChar = start > 0 ? this.src.charCodeAt(start - 1) : 0x20;
11905    -1 
11906    -1   while (pos < max && this.src.charCodeAt(pos) === marker) { pos++; }
11907    -1 
11908    -1   count = pos - start;
11909    -1 
11910    -1   // treat end of the line as a whitespace
11911    -1   nextChar = pos < max ? this.src.charCodeAt(pos) : 0x20;
11912    -1 
11913    -1   isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));
11914    -1   isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));
11915    -1 
11916    -1   isLastWhiteSpace = isWhiteSpace(lastChar);
11917    -1   isNextWhiteSpace = isWhiteSpace(nextChar);
11918    -1 
11919    -1   if (isNextWhiteSpace) {
11920    -1     left_flanking = false;
11921    -1   } else if (isNextPunctChar) {
11922    -1     if (!(isLastWhiteSpace || isLastPunctChar)) {
11923    -1       left_flanking = false;
11924    -1     }
11925    -1   }
11926    -1 
11927    -1   if (isLastWhiteSpace) {
11928    -1     right_flanking = false;
11929    -1   } else if (isLastPunctChar) {
11930    -1     if (!(isNextWhiteSpace || isNextPunctChar)) {
11931    -1       right_flanking = false;
11932    -1     }
11933    -1   }
11934    -1 
11935    -1   if (!canSplitWord) {
11936    -1     can_open  = left_flanking  && (!right_flanking || isLastPunctChar);
11937    -1     can_close = right_flanking && (!left_flanking  || isNextPunctChar);
11938    -1   } else {
11939    -1     can_open  = left_flanking;
11940    -1     can_close = right_flanking;
11941    -1   }
11942    -1 
11943    -1   return {
11944    -1     can_open:  can_open,
11945    -1     can_close: can_close,
11946    -1     length:    count
11947    -1   };
11948    -1 };
11949    -1 
11950    -1 
11951    -1 // re-export Token class to use in block rules
11952    -1 StateInline.prototype.Token = Token;
11953    -1 
11954    -1 
11955    -1 module.exports = StateInline;
11956    -1 
11957    -1 },{"../common/utils":40,"../token":87}],84:[function(require,module,exports){
11958    -1 // ~~strike through~~
11959    -1 //
11960    -1 'use strict';
11961    -1 
11962    -1 
11963    -1 // Insert each marker as a separate text token, and add it to delimiter list
11964    -1 //
11965    -1 module.exports.tokenize = function strikethrough(state, silent) {
11966    -1   var i, scanned, token, len, ch,
11967    -1       start = state.pos,
11968    -1       marker = state.src.charCodeAt(start);
11969    -1 
11970    -1   if (silent) { return false; }
11971    -1 
11972    -1   if (marker !== 0x7E/* ~ */) { return false; }
11973    -1 
11974    -1   scanned = state.scanDelims(state.pos, true);
11975    -1   len = scanned.length;
11976    -1   ch = String.fromCharCode(marker);
11977    -1 
11978    -1   if (len < 2) { return false; }
11979    -1 
11980    -1   if (len % 2) {
11981    -1     token         = state.push('text', '', 0);
11982    -1     token.content = ch;
11983    -1     len--;
11984    -1   }
11985    -1 
11986    -1   for (i = 0; i < len; i += 2) {
11987    -1     token         = state.push('text', '', 0);
11988    -1     token.content = ch + ch;
11989    -1 
11990    -1     state.delimiters.push({
11991    -1       marker: marker,
11992    -1       jump:   i,
11993    -1       token:  state.tokens.length - 1,
11994    -1       level:  state.level,
11995    -1       end:    -1,
11996    -1       open:   scanned.can_open,
11997    -1       close:  scanned.can_close
11998    -1     });
11999    -1   }
12000    -1 
12001    -1   state.pos += scanned.length;
12002    -1 
12003    -1   return true;
12004    -1 };
12005    -1 
12006    -1 
12007    -1 // Walk through delimiter list and replace text tokens with tags
12008    -1 //
12009    -1 module.exports.postProcess = function strikethrough(state) {
12010    -1   var i, j,
12011    -1       startDelim,
12012    -1       endDelim,
12013    -1       token,
12014    -1       loneMarkers = [],
12015    -1       delimiters = state.delimiters,
12016    -1       max = state.delimiters.length;
12017    -1 
12018    -1   for (i = 0; i < max; i++) {
12019    -1     startDelim = delimiters[i];
12020    -1 
12021    -1     if (startDelim.marker !== 0x7E/* ~ */) {
12022    -1       continue;
12023    -1     }
12024    -1 
12025    -1     if (startDelim.end === -1) {
12026    -1       continue;
12027    -1     }
12028    -1 
12029    -1     endDelim = delimiters[startDelim.end];
12030    -1 
12031    -1     token         = state.tokens[startDelim.token];
12032    -1     token.type    = 's_open';
12033    -1     token.tag     = 's';
12034    -1     token.nesting = 1;
12035    -1     token.markup  = '~~';
12036    -1     token.content = '';
12037    -1 
12038    -1     token         = state.tokens[endDelim.token];
12039    -1     token.type    = 's_close';
12040    -1     token.tag     = 's';
12041    -1     token.nesting = -1;
12042    -1     token.markup  = '~~';
12043    -1     token.content = '';
12044    -1 
12045    -1     if (state.tokens[endDelim.token - 1].type === 'text' &&
12046    -1         state.tokens[endDelim.token - 1].content === '~') {
12047    -1 
12048    -1       loneMarkers.push(endDelim.token - 1);
12049    -1     }
12050    -1   }
12051    -1 
12052    -1   // If a marker sequence has an odd number of characters, it's splitted
12053    -1   // like this: `~~~~~` -> `~` + `~~` + `~~`, leaving one marker at the
12054    -1   // start of the sequence.
12055    -1   //
12056    -1   // So, we have to move all those markers after subsequent s_close tags.
12057    -1   //
12058    -1   while (loneMarkers.length) {
12059    -1     i = loneMarkers.pop();
12060    -1     j = i + 1;
12061    -1 
12062    -1     while (j < state.tokens.length && state.tokens[j].type === 's_close') {
12063    -1       j++;
12064    -1     }
12065    -1 
12066    -1     j--;
12067    -1 
12068    -1     if (i !== j) {
12069    -1       token = state.tokens[j];
12070    -1       state.tokens[j] = state.tokens[i];
12071    -1       state.tokens[i] = token;
12072    -1     }
12073    -1   }
12074    -1 };
12075    -1 
12076    -1 },{}],85:[function(require,module,exports){
12077    -1 // Skip text characters for text token, place those to pending buffer
12078    -1 // and increment current pos
12079    -1 
12080    -1 'use strict';
12081    -1 
12082    -1 
12083    -1 // Rule to skip pure text
12084    -1 // '{}$%@~+=:' reserved for extentions
12085    -1 
12086    -1 // !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~
12087    -1 
12088    -1 // !!!! Don't confuse with "Markdown ASCII Punctuation" chars
12089    -1 // http://spec.commonmark.org/0.15/#ascii-punctuation-character
12090    -1 function isTerminatorChar(ch) {
12091    -1   switch (ch) {
12092    -1     case 0x0A/* \n */:
12093    -1     case 0x21/* ! */:
12094    -1     case 0x23/* # */:
12095    -1     case 0x24/* $ */:
12096    -1     case 0x25/* % */:
12097    -1     case 0x26/* & */:
12098    -1     case 0x2A/* * */:
12099    -1     case 0x2B/* + */:
12100    -1     case 0x2D/* - */:
12101    -1     case 0x3A/* : */:
12102    -1     case 0x3C/* < */:
12103    -1     case 0x3D/* = */:
12104    -1     case 0x3E/* > */:
12105    -1     case 0x40/* @ */:
12106    -1     case 0x5B/* [ */:
12107    -1     case 0x5C/* \ */:
12108    -1     case 0x5D/* ] */:
12109    -1     case 0x5E/* ^ */:
12110    -1     case 0x5F/* _ */:
12111    -1     case 0x60/* ` */:
12112    -1     case 0x7B/* { */:
12113    -1     case 0x7D/* } */:
12114    -1     case 0x7E/* ~ */:
12115    -1       return true;
12116    -1     default:
12117    -1       return false;
12118    -1   }
12119    -1 }
12120    -1 
12121    -1 module.exports = function text(state, silent) {
12122    -1   var pos = state.pos;
12123    -1 
12124    -1   while (pos < state.posMax && !isTerminatorChar(state.src.charCodeAt(pos))) {
12125    -1     pos++;
12126    -1   }
12127    -1 
12128    -1   if (pos === state.pos) { return false; }
12129    -1 
12130    -1   if (!silent) { state.pending += state.src.slice(state.pos, pos); }
12131    -1 
12132    -1   state.pos = pos;
12133    -1 
12134    -1   return true;
12135    -1 };
12136    -1 
12137    -1 // Alternative implementation, for memory.
12138    -1 //
12139    -1 // It costs 10% of performance, but allows extend terminators list, if place it
12140    -1 // to `ParcerInline` property. Probably, will switch to it sometime, such
12141    -1 // flexibility required.
12142    -1 
12143    -1 /*
12144    -1 var TERMINATOR_RE = /[\n!#$%&*+\-:<=>@[\\\]^_`{}~]/;
12145    -1 
12146    -1 module.exports = function text(state, silent) {
12147    -1   var pos = state.pos,
12148    -1       idx = state.src.slice(pos).search(TERMINATOR_RE);
12149    -1 
12150    -1   // first char is terminator -> empty text
12151    -1   if (idx === 0) { return false; }
12152    -1 
12153    -1   // no terminator -> text till end of string
12154    -1   if (idx < 0) {
12155    -1     if (!silent) { state.pending += state.src.slice(pos); }
12156    -1     state.pos = state.src.length;
12157    -1     return true;
12158    -1   }
12159    -1 
12160    -1   if (!silent) { state.pending += state.src.slice(pos, pos + idx); }
12161    -1 
12162    -1   state.pos += idx;
12163    -1 
12164    -1   return true;
12165    -1 };*/
12166    -1 
12167    -1 },{}],86:[function(require,module,exports){
12168    -1 // Merge adjacent text nodes into one, and re-calculate all token levels
12169    -1 //
12170    -1 'use strict';
12171    -1 
12172    -1 
12173    -1 module.exports = function text_collapse(state) {
12174    -1   var curr, last,
12175    -1       level = 0,
12176    -1       tokens = state.tokens,
12177    -1       max = state.tokens.length;
12178    -1 
12179    -1   for (curr = last = 0; curr < max; curr++) {
12180    -1     // re-calculate levels
12181    -1     level += tokens[curr].nesting;
12182    -1     tokens[curr].level = level;
12183    -1 
12184    -1     if (tokens[curr].type === 'text' &&
12185    -1         curr + 1 < max &&
12186    -1         tokens[curr + 1].type === 'text') {
12187    -1 
12188    -1       // collapse two adjacent text nodes
12189    -1       tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;
12190    -1     } else {
12191    -1       if (curr !== last) { tokens[last] = tokens[curr]; }
12192    -1 
12193    -1       last++;
12194    -1     }
12195    -1   }
12196    -1 
12197    -1   if (curr !== last) {
12198    -1     tokens.length = last;
12199    -1   }
12200    -1 };
12201    -1 
12202    -1 },{}],87:[function(require,module,exports){
12203    -1 // Token class
12204    -1 
12205    -1 'use strict';
12206    -1 
12207    -1 
12208    -1 /**
12209    -1  * class Token
12210    -1  **/
12211    -1 
12212    -1 /**
12213    -1  * new Token(type, tag, nesting)
12214    -1  *
12215    -1  * Create new token and fill passed properties.
12216    -1  **/
12217    -1 function Token(type, tag, nesting) {
12218    -1   /**
12219    -1    * Token#type -> String
12220    -1    *
12221    -1    * Type of the token (string, e.g. "paragraph_open")
12222    -1    **/
12223    -1   this.type     = type;
12224    -1 
12225    -1   /**
12226    -1    * Token#tag -> String
12227    -1    *
12228    -1    * html tag name, e.g. "p"
12229    -1    **/
12230    -1   this.tag      = tag;
12231    -1 
12232    -1   /**
12233    -1    * Token#attrs -> Array
12234    -1    *
12235    -1    * Html attributes. Format: `[ [ name1, value1 ], [ name2, value2 ] ]`
12236    -1    **/
12237    -1   this.attrs    = null;
12238    -1 
12239    -1   /**
12240    -1    * Token#map -> Array
12241    -1    *
12242    -1    * Source map info. Format: `[ line_begin, line_end ]`
12243    -1    **/
12244    -1   this.map      = null;
12245    -1 
12246    -1   /**
12247    -1    * Token#nesting -> Number
12248    -1    *
12249    -1    * Level change (number in {-1, 0, 1} set), where:
12250    -1    *
12251    -1    * -  `1` means the tag is opening
12252    -1    * -  `0` means the tag is self-closing
12253    -1    * - `-1` means the tag is closing
12254    -1    **/
12255    -1   this.nesting  = nesting;
12256    -1 
12257    -1   /**
12258    -1    * Token#level -> Number
12259    -1    *
12260    -1    * nesting level, the same as `state.level`
12261    -1    **/
12262    -1   this.level    = 0;
12263    -1 
12264    -1   /**
12265    -1    * Token#children -> Array
12266    -1    *
12267    -1    * An array of child nodes (inline and img tokens)
12268    -1    **/
12269    -1   this.children = null;
12270    -1 
12271    -1   /**
12272    -1    * Token#content -> String
12273    -1    *
12274    -1    * In a case of self-closing tag (code, html, fence, etc.),
12275    -1    * it has contents of this tag.
12276    -1    **/
12277    -1   this.content  = '';
12278    -1 
12279    -1   /**
12280    -1    * Token#markup -> String
12281    -1    *
12282    -1    * '*' or '_' for emphasis, fence string for fence, etc.
12283    -1    **/
12284    -1   this.markup   = '';
12285    -1 
12286    -1   /**
12287    -1    * Token#info -> String
12288    -1    *
12289    -1    * fence infostring
12290    -1    **/
12291    -1   this.info     = '';
12292    -1 
12293    -1   /**
12294    -1    * Token#meta -> Object
12295    -1    *
12296    -1    * A place for plugins to store an arbitrary data
12297    -1    **/
12298    -1   this.meta     = null;
12299    -1 
12300    -1   /**
12301    -1    * Token#block -> Boolean
12302    -1    *
12303    -1    * True for block-level tokens, false for inline tokens.
12304    -1    * Used in renderer to calculate line breaks
12305    -1    **/
12306    -1   this.block    = false;
12307    -1 
12308    -1   /**
12309    -1    * Token#hidden -> Boolean
12310    -1    *
12311    -1    * If it's true, ignore this element when rendering. Used for tight lists
12312    -1    * to hide paragraphs.
12313    -1    **/
12314    -1   this.hidden   = false;
12315    -1 }
12316    -1 
12317    -1 
12318    -1 /**
12319    -1  * Token.attrIndex(name) -> Number
12320    -1  *
12321    -1  * Search attribute index by name.
12322    -1  **/
12323    -1 Token.prototype.attrIndex = function attrIndex(name) {
12324    -1   var attrs, i, len;
12325    -1 
12326    -1   if (!this.attrs) { return -1; }
12327    -1 
12328    -1   attrs = this.attrs;
12329    -1 
12330    -1   for (i = 0, len = attrs.length; i < len; i++) {
12331    -1     if (attrs[i][0] === name) { return i; }
12332    -1   }
12333    -1   return -1;
12334    -1 };
12335    -1 
12336    -1 
12337    -1 /**
12338    -1  * Token.attrPush(attrData)
12339    -1  *
12340    -1  * Add `[ name, value ]` attribute to list. Init attrs if necessary
12341    -1  **/
12342    -1 Token.prototype.attrPush = function attrPush(attrData) {
12343    -1   if (this.attrs) {
12344    -1     this.attrs.push(attrData);
12345    -1   } else {
12346    -1     this.attrs = [ attrData ];
12347    -1   }
12348    -1 };
12349    -1 
12350    -1 
12351    -1 /**
12352    -1  * Token.attrSet(name, value)
12353    -1  *
12354    -1  * Set `name` attribute to `value`. Override old value if exists.
12355    -1  **/
12356    -1 Token.prototype.attrSet = function attrSet(name, value) {
12357    -1   var idx = this.attrIndex(name),
12358    -1       attrData = [ name, value ];
12359    -1 
12360    -1   if (idx < 0) {
12361    -1     this.attrPush(attrData);
12362    -1   } else {
12363    -1     this.attrs[idx] = attrData;
12364    -1   }
12365    -1 };
12366    -1 
12367    -1 
12368    -1 /**
12369    -1  * Token.attrGet(name)
12370    -1  *
12371    -1  * Get the value of attribute `name`, or null if it does not exist.
12372    -1  **/
12373    -1 Token.prototype.attrGet = function attrGet(name) {
12374    -1   var idx = this.attrIndex(name), value = null;
12375    -1   if (idx >= 0) {
12376    -1     value = this.attrs[idx][1];
12377    -1   }
12378    -1   return value;
12379    -1 };
12380    -1 
12381    -1 
12382    -1 /**
12383    -1  * Token.attrJoin(name, value)
12384    -1  *
12385    -1  * Join value to existing attribute via space. Or create new attribute if not
12386    -1  * exists. Useful to operate with token classes.
12387    -1  **/
12388    -1 Token.prototype.attrJoin = function attrJoin(name, value) {
12389    -1   var idx = this.attrIndex(name);
12390    -1 
12391    -1   if (idx < 0) {
12392    -1     this.attrPush([ name, value ]);
12393    -1   } else {
12394    -1     this.attrs[idx][1] = this.attrs[idx][1] + ' ' + value;
12395    -1   }
12396    -1 };
12397    -1 
12398    -1 
12399    -1 module.exports = Token;
12400    -1 
12401    -1 },{}],88:[function(require,module,exports){
12402    -1 
12403    -1 'use strict';
12404    -1 
12405    -1 
12406    -1 /* eslint-disable no-bitwise */
12407    -1 
12408    -1 var decodeCache = {};
12409    -1 
12410    -1 function getDecodeCache(exclude) {
12411    -1   var i, ch, cache = decodeCache[exclude];
12412    -1   if (cache) { return cache; }
12413    -1 
12414    -1   cache = decodeCache[exclude] = [];
12415    -1 
12416    -1   for (i = 0; i < 128; i++) {
12417    -1     ch = String.fromCharCode(i);
12418    -1     cache.push(ch);
12419    -1   }
12420    -1 
12421    -1   for (i = 0; i < exclude.length; i++) {
12422    -1     ch = exclude.charCodeAt(i);
12423    -1     cache[ch] = '%' + ('0' + ch.toString(16).toUpperCase()).slice(-2);
12424    -1   }
12425    -1 
12426    -1   return cache;
12427    -1 }
12428    -1 
12429    -1 
12430    -1 // Decode percent-encoded string.
12431    -1 //
12432    -1 function decode(string, exclude) {
12433    -1   var cache;
12434    -1 
12435    -1   if (typeof exclude !== 'string') {
12436    -1     exclude = decode.defaultChars;
12437    -1   }
12438    -1 
12439    -1   cache = getDecodeCache(exclude);
12440    -1 
12441    -1   return string.replace(/(%[a-f0-9]{2})+/gi, function(seq) {
12442    -1     var i, l, b1, b2, b3, b4, chr,
12443    -1         result = '';
12444    -1 
12445    -1     for (i = 0, l = seq.length; i < l; i += 3) {
12446    -1       b1 = parseInt(seq.slice(i + 1, i + 3), 16);
12447    -1 
12448    -1       if (b1 < 0x80) {
12449    -1         result += cache[b1];
12450    -1         continue;
12451    -1       }
12452    -1 
12453    -1       if ((b1 & 0xE0) === 0xC0 && (i + 3 < l)) {
12454    -1         // 110xxxxx 10xxxxxx
12455    -1         b2 = parseInt(seq.slice(i + 4, i + 6), 16);
12456    -1 
12457    -1         if ((b2 & 0xC0) === 0x80) {
12458    -1           chr = ((b1 << 6) & 0x7C0) | (b2 & 0x3F);
12459    -1 
12460    -1           if (chr < 0x80) {
12461    -1             result += '\ufffd\ufffd';
12462    -1           } else {
12463    -1             result += String.fromCharCode(chr);
12464    -1           }
12465    -1 
12466    -1           i += 3;
12467    -1           continue;
12468    -1         }
12469    -1       }
12470    -1 
12471    -1       if ((b1 & 0xF0) === 0xE0 && (i + 6 < l)) {
12472    -1         // 1110xxxx 10xxxxxx 10xxxxxx
12473    -1         b2 = parseInt(seq.slice(i + 4, i + 6), 16);
12474    -1         b3 = parseInt(seq.slice(i + 7, i + 9), 16);
12475    -1 
12476    -1         if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {
12477    -1           chr = ((b1 << 12) & 0xF000) | ((b2 << 6) & 0xFC0) | (b3 & 0x3F);
12478    -1 
12479    -1           if (chr < 0x800 || (chr >= 0xD800 && chr <= 0xDFFF)) {
12480    -1             result += '\ufffd\ufffd\ufffd';
12481    -1           } else {
12482    -1             result += String.fromCharCode(chr);
12483    -1           }
12484    -1 
12485    -1           i += 6;
12486    -1           continue;
12487    -1         }
12488    -1       }
12489    -1 
12490    -1       if ((b1 & 0xF8) === 0xF0 && (i + 9 < l)) {
12491    -1         // 111110xx 10xxxxxx 10xxxxxx 10xxxxxx
12492    -1         b2 = parseInt(seq.slice(i + 4, i + 6), 16);
12493    -1         b3 = parseInt(seq.slice(i + 7, i + 9), 16);
12494    -1         b4 = parseInt(seq.slice(i + 10, i + 12), 16);
12495    -1 
12496    -1         if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80 && (b4 & 0xC0) === 0x80) {
12497    -1           chr = ((b1 << 18) & 0x1C0000) | ((b2 << 12) & 0x3F000) | ((b3 << 6) & 0xFC0) | (b4 & 0x3F);
12498    -1 
12499    -1           if (chr < 0x10000 || chr > 0x10FFFF) {
12500    -1             result += '\ufffd\ufffd\ufffd\ufffd';
12501    -1           } else {
12502    -1             chr -= 0x10000;
12503    -1             result += String.fromCharCode(0xD800 + (chr >> 10), 0xDC00 + (chr & 0x3FF));
12504    -1           }
12505    -1 
12506    -1           i += 9;
12507    -1           continue;
12508    -1         }
12509    -1       }
12510    -1 
12511    -1       result += '\ufffd';
12512    -1     }
12513    -1 
12514    -1     return result;
12515    -1   });
12516    -1 }
12517    -1 
12518    -1 
12519    -1 decode.defaultChars   = ';/?:@&=+$,#';
12520    -1 decode.componentChars = '';
12521    -1 
12522    -1 
12523    -1 module.exports = decode;
12524    -1 
12525    -1 },{}],89:[function(require,module,exports){
12526    -1 
12527    -1 'use strict';
12528    -1 
12529    -1 
12530    -1 var encodeCache = {};
12531    -1 
12532    -1 
12533    -1 // Create a lookup array where anything but characters in `chars` string
12534    -1 // and alphanumeric chars is percent-encoded.
12535    -1 //
12536    -1 function getEncodeCache(exclude) {
12537    -1   var i, ch, cache = encodeCache[exclude];
12538    -1   if (cache) { return cache; }
12539    -1 
12540    -1   cache = encodeCache[exclude] = [];
12541    -1 
12542    -1   for (i = 0; i < 128; i++) {
12543    -1     ch = String.fromCharCode(i);
12544    -1 
12545    -1     if (/^[0-9a-z]$/i.test(ch)) {
12546    -1       // always allow unencoded alphanumeric characters
12547    -1       cache.push(ch);
12548    -1     } else {
12549    -1       cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2));
12550    -1     }
12551    -1   }
12552    -1 
12553    -1   for (i = 0; i < exclude.length; i++) {
12554    -1     cache[exclude.charCodeAt(i)] = exclude[i];
12555    -1   }
12556    -1 
12557    -1   return cache;
12558    -1 }
12559    -1 
12560    -1 
12561    -1 // Encode unsafe characters with percent-encoding, skipping already
12562    -1 // encoded sequences.
12563    -1 //
12564    -1 //  - string       - string to encode
12565    -1 //  - exclude      - list of characters to ignore (in addition to a-zA-Z0-9)
12566    -1 //  - keepEscaped  - don't encode '%' in a correct escape sequence (default: true)
12567    -1 //
12568    -1 function encode(string, exclude, keepEscaped) {
12569    -1   var i, l, code, nextCode, cache,
12570    -1       result = '';
12571    -1 
12572    -1   if (typeof exclude !== 'string') {
12573    -1     // encode(string, keepEscaped)
12574    -1     keepEscaped  = exclude;
12575    -1     exclude = encode.defaultChars;
12576    -1   }
12577    -1 
12578    -1   if (typeof keepEscaped === 'undefined') {
12579    -1     keepEscaped = true;
12580    -1   }
12581    -1 
12582    -1   cache = getEncodeCache(exclude);
12583    -1 
12584    -1   for (i = 0, l = string.length; i < l; i++) {
12585    -1     code = string.charCodeAt(i);
12586    -1 
12587    -1     if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) {
12588    -1       if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {
12589    -1         result += string.slice(i, i + 3);
12590    -1         i += 2;
12591    -1         continue;
12592    -1       }
12593    -1     }
12594    -1 
12595    -1     if (code < 128) {
12596    -1       result += cache[code];
12597    -1       continue;
12598    -1     }
12599    -1 
12600    -1     if (code >= 0xD800 && code <= 0xDFFF) {
12601    -1       if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) {
12602    -1         nextCode = string.charCodeAt(i + 1);
12603    -1         if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) {
12604    -1           result += encodeURIComponent(string[i] + string[i + 1]);
12605    -1           i++;
12606    -1           continue;
12607    -1         }
12608    -1       }
12609    -1       result += '%EF%BF%BD';
12610    -1       continue;
12611    -1     }
12612    -1 
12613    -1     result += encodeURIComponent(string[i]);
12614    -1   }
12615    -1 
12616    -1   return result;
12617    -1 }
12618    -1 
12619    -1 encode.defaultChars   = ";/?:@&=+$,-_.!~*'()#";
12620    -1 encode.componentChars = "-_.!~*'()";
12621    -1 
12622    -1 
12623    -1 module.exports = encode;
12624    -1 
12625    -1 },{}],90:[function(require,module,exports){
12626    -1 
12627    -1 'use strict';
12628    -1 
12629    -1 
12630    -1 module.exports = function format(url) {
12631    -1   var result = '';
12632    -1 
12633    -1   result += url.protocol || '';
12634    -1   result += url.slashes ? '//' : '';
12635    -1   result += url.auth ? url.auth + '@' : '';
12636    -1 
12637    -1   if (url.hostname && url.hostname.indexOf(':') !== -1) {
12638    -1     // ipv6 address
12639    -1     result += '[' + url.hostname + ']';
12640    -1   } else {
12641    -1     result += url.hostname || '';
12642    -1   }
12643    -1 
12644    -1   result += url.port ? ':' + url.port : '';
12645    -1   result += url.pathname || '';
12646    -1   result += url.search || '';
12647    -1   result += url.hash || '';
12648    -1 
12649    -1   return result;
12650    -1 };
12651    -1 
12652    -1 },{}],91:[function(require,module,exports){
12653    -1 'use strict';
12654    -1 
12655    -1 
12656    -1 module.exports.encode = require('./encode');
12657    -1 module.exports.decode = require('./decode');
12658    -1 module.exports.format = require('./format');
12659    -1 module.exports.parse  = require('./parse');
12660    -1 
12661    -1 },{"./decode":88,"./encode":89,"./format":90,"./parse":92}],92:[function(require,module,exports){
12662    -1 // Copyright Joyent, Inc. and other Node contributors.
12663    -1 //
12664    -1 // Permission is hereby granted, free of charge, to any person obtaining a
12665    -1 // copy of this software and associated documentation files (the
12666    -1 // "Software"), to deal in the Software without restriction, including
12667    -1 // without limitation the rights to use, copy, modify, merge, publish,
12668    -1 // distribute, sublicense, and/or sell copies of the Software, and to permit
12669    -1 // persons to whom the Software is furnished to do so, subject to the
12670    -1 // following conditions:
12671    -1 //
12672    -1 // The above copyright notice and this permission notice shall be included
12673    -1 // in all copies or substantial portions of the Software.
12674    -1 //
12675    -1 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
12676    -1 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
12677    -1 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
12678    -1 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
12679    -1 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
12680    -1 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
12681    -1 // USE OR OTHER DEALINGS IN THE SOFTWARE.
12682    -1 
12683    -1 'use strict';
12684    -1 
12685    -1 //
12686    -1 // Changes from joyent/node:
12687    -1 //
12688    -1 // 1. No leading slash in paths,
12689    -1 //    e.g. in `url.parse('http://foo?bar')` pathname is ``, not `/`
12690    -1 //
12691    -1 // 2. Backslashes are not replaced with slashes,
12692    -1 //    so `http:\\example.org\` is treated like a relative path
12693    -1 //
12694    -1 // 3. Trailing colon is treated like a part of the path,
12695    -1 //    i.e. in `http://example.org:foo` pathname is `:foo`
12696    -1 //
12697    -1 // 4. Nothing is URL-encoded in the resulting object,
12698    -1 //    (in joyent/node some chars in auth and paths are encoded)
12699    -1 //
12700    -1 // 5. `url.parse()` does not have `parseQueryString` argument
12701    -1 //
12702    -1 // 6. Removed extraneous result properties: `host`, `path`, `query`, etc.,
12703    -1 //    which can be constructed using other parts of the url.
12704    -1 //
12705    -1 
12706    -1 
12707    -1 function Url() {
12708    -1   this.protocol = null;
12709    -1   this.slashes = null;
12710    -1   this.auth = null;
12711    -1   this.port = null;
12712    -1   this.hostname = null;
12713    -1   this.hash = null;
12714    -1   this.search = null;
12715    -1   this.pathname = null;
12716    -1 }
12717    -1 
12718    -1 // Reference: RFC 3986, RFC 1808, RFC 2396
12719    -1 
12720    -1 // define these here so at least they only have to be
12721    -1 // compiled once on the first module load.
12722    -1 var protocolPattern = /^([a-z0-9.+-]+:)/i,
12723    -1     portPattern = /:[0-9]*$/,
12724    -1 
12725    -1     // Special case for a simple path URL
12726    -1     simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
12727    -1 
12728    -1     // RFC 2396: characters reserved for delimiting URLs.
12729    -1     // We actually just auto-escape these.
12730    -1     delims = [ '<', '>', '"', '`', ' ', '\r', '\n', '\t' ],
12731    -1 
12732    -1     // RFC 2396: characters not allowed for various reasons.
12733    -1     unwise = [ '{', '}', '|', '\\', '^', '`' ].concat(delims),
12734    -1 
12735    -1     // Allowed by RFCs, but cause of XSS attacks.  Always escape these.
12736    -1     autoEscape = [ '\'' ].concat(unwise),
12737    -1     // Characters that are never ever allowed in a hostname.
12738    -1     // Note that any invalid chars are also handled, but these
12739    -1     // are the ones that are *expected* to be seen, so we fast-path
12740    -1     // them.
12741    -1     nonHostChars = [ '%', '/', '?', ';', '#' ].concat(autoEscape),
12742    -1     hostEndingChars = [ '/', '?', '#' ],
12743    -1     hostnameMaxLen = 255,
12744    -1     hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
12745    -1     hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
12746    -1     // protocols that can allow "unsafe" and "unwise" chars.
12747    -1     /* eslint-disable no-script-url */
12748    -1     // protocols that never have a hostname.
12749    -1     hostlessProtocol = {
12750    -1       'javascript': true,
12751    -1       'javascript:': true
12752    -1     },
12753    -1     // protocols that always contain a // bit.
12754    -1     slashedProtocol = {
12755    -1       'http': true,
12756    -1       'https': true,
12757    -1       'ftp': true,
12758    -1       'gopher': true,
12759    -1       'file': true,
12760    -1       'http:': true,
12761    -1       'https:': true,
12762    -1       'ftp:': true,
12763    -1       'gopher:': true,
12764    -1       'file:': true
12765    -1     };
12766    -1     /* eslint-enable no-script-url */
12767    -1 
12768    -1 function urlParse(url, slashesDenoteHost) {
12769    -1   if (url && url instanceof Url) { return url; }
12770    -1 
12771    -1   var u = new Url();
12772    -1   u.parse(url, slashesDenoteHost);
12773    -1   return u;
12774    -1 }
12775    -1 
12776    -1 Url.prototype.parse = function(url, slashesDenoteHost) {
12777    -1   var i, l, lowerProto, hec, slashes,
12778    -1       rest = url;
12779    -1 
12780    -1   // trim before proceeding.
12781    -1   // This is to support parse stuff like "  http://foo.com  \n"
12782    -1   rest = rest.trim();
12783    -1 
12784    -1   if (!slashesDenoteHost && url.split('#').length === 1) {
12785    -1     // Try fast path regexp
12786    -1     var simplePath = simplePathPattern.exec(rest);
12787    -1     if (simplePath) {
12788    -1       this.pathname = simplePath[1];
12789    -1       if (simplePath[2]) {
12790    -1         this.search = simplePath[2];
12791    -1       }
12792    -1       return this;
12793    -1     }
12794    -1   }
12795    -1 
12796    -1   var proto = protocolPattern.exec(rest);
12797    -1   if (proto) {
12798    -1     proto = proto[0];
12799    -1     lowerProto = proto.toLowerCase();
12800    -1     this.protocol = proto;
12801    -1     rest = rest.substr(proto.length);
12802    -1   }
12803    -1 
12804    -1   // figure out if it's got a host
12805    -1   // user@server is *always* interpreted as a hostname, and url
12806    -1   // resolution will treat //foo/bar as host=foo,path=bar because that's
12807    -1   // how the browser resolves relative URLs.
12808    -1   if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
12809    -1     slashes = rest.substr(0, 2) === '//';
12810    -1     if (slashes && !(proto && hostlessProtocol[proto])) {
12811    -1       rest = rest.substr(2);
12812    -1       this.slashes = true;
12813    -1     }
12814    -1   }
12815    -1 
12816    -1   if (!hostlessProtocol[proto] &&
12817    -1       (slashes || (proto && !slashedProtocol[proto]))) {
12818    -1 
12819    -1     // there's a hostname.
12820    -1     // the first instance of /, ?, ;, or # ends the host.
12821    -1     //
12822    -1     // If there is an @ in the hostname, then non-host chars *are* allowed
12823    -1     // to the left of the last @ sign, unless some host-ending character
12824    -1     // comes *before* the @-sign.
12825    -1     // URLs are obnoxious.
12826    -1     //
12827    -1     // ex:
12828    -1     // http://a@b@c/ => user:a@b host:c
12829    -1     // http://a@b?@c => user:a host:c path:/?@c
12830    -1 
12831    -1     // v0.12 TODO(isaacs): This is not quite how Chrome does things.
12832    -1     // Review our test case against browsers more comprehensively.
12833    -1 
12834    -1     // find the first instance of any hostEndingChars
12835    -1     var hostEnd = -1;
12836    -1     for (i = 0; i < hostEndingChars.length; i++) {
12837    -1       hec = rest.indexOf(hostEndingChars[i]);
12838    -1       if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
12839    -1         hostEnd = hec;
12840    -1       }
12841    -1     }
12842    -1 
12843    -1     // at this point, either we have an explicit point where the
12844    -1     // auth portion cannot go past, or the last @ char is the decider.
12845    -1     var auth, atSign;
12846    -1     if (hostEnd === -1) {
12847    -1       // atSign can be anywhere.
12848    -1       atSign = rest.lastIndexOf('@');
12849    -1     } else {
12850    -1       // atSign must be in auth portion.
12851    -1       // http://a@b/c@d => host:b auth:a path:/c@d
12852    -1       atSign = rest.lastIndexOf('@', hostEnd);
12853    -1     }
12854    -1 
12855    -1     // Now we have a portion which is definitely the auth.
12856    -1     // Pull that off.
12857    -1     if (atSign !== -1) {
12858    -1       auth = rest.slice(0, atSign);
12859    -1       rest = rest.slice(atSign + 1);
12860    -1       this.auth = auth;
12861    -1     }
12862    -1 
12863    -1     // the host is the remaining to the left of the first non-host char
12864    -1     hostEnd = -1;
12865    -1     for (i = 0; i < nonHostChars.length; i++) {
12866    -1       hec = rest.indexOf(nonHostChars[i]);
12867    -1       if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
12868    -1         hostEnd = hec;
12869    -1       }
12870    -1     }
12871    -1     // if we still have not hit it, then the entire thing is a host.
12872    -1     if (hostEnd === -1) {
12873    -1       hostEnd = rest.length;
12874    -1     }
12875    -1 
12876    -1     if (rest[hostEnd - 1] === ':') { hostEnd--; }
12877    -1     var host = rest.slice(0, hostEnd);
12878    -1     rest = rest.slice(hostEnd);
12879    -1 
12880    -1     // pull out port.
12881    -1     this.parseHost(host);
12882    -1 
12883    -1     // we've indicated that there is a hostname,
12884    -1     // so even if it's empty, it has to be present.
12885    -1     this.hostname = this.hostname || '';
12886    -1 
12887    -1     // if hostname begins with [ and ends with ]
12888    -1     // assume that it's an IPv6 address.
12889    -1     var ipv6Hostname = this.hostname[0] === '[' &&
12890    -1         this.hostname[this.hostname.length - 1] === ']';
12891    -1 
12892    -1     // validate a little.
12893    -1     if (!ipv6Hostname) {
12894    -1       var hostparts = this.hostname.split(/\./);
12895    -1       for (i = 0, l = hostparts.length; i < l; i++) {
12896    -1         var part = hostparts[i];
12897    -1         if (!part) { continue; }
12898    -1         if (!part.match(hostnamePartPattern)) {
12899    -1           var newpart = '';
12900    -1           for (var j = 0, k = part.length; j < k; j++) {
12901    -1             if (part.charCodeAt(j) > 127) {
12902    -1               // we replace non-ASCII char with a temporary placeholder
12903    -1               // we need this to make sure size of hostname is not
12904    -1               // broken by replacing non-ASCII by nothing
12905    -1               newpart += 'x';
12906    -1             } else {
12907    -1               newpart += part[j];
12908    -1             }
12909    -1           }
12910    -1           // we test again with ASCII char only
12911    -1           if (!newpart.match(hostnamePartPattern)) {
12912    -1             var validParts = hostparts.slice(0, i);
12913    -1             var notHost = hostparts.slice(i + 1);
12914    -1             var bit = part.match(hostnamePartStart);
12915    -1             if (bit) {
12916    -1               validParts.push(bit[1]);
12917    -1               notHost.unshift(bit[2]);
12918    -1             }
12919    -1             if (notHost.length) {
12920    -1               rest = notHost.join('.') + rest;
12921    -1             }
12922    -1             this.hostname = validParts.join('.');
12923    -1             break;
12924    -1           }
12925    -1         }
12926    -1       }
12927    -1     }
12928    -1 
12929    -1     if (this.hostname.length > hostnameMaxLen) {
12930    -1       this.hostname = '';
12931    -1     }
12932    -1 
12933    -1     // strip [ and ] from the hostname
12934    -1     // the host field still retains them, though
12935    -1     if (ipv6Hostname) {
12936    -1       this.hostname = this.hostname.substr(1, this.hostname.length - 2);
12937    -1     }
12938    -1   }
12939    -1 
12940    -1   // chop off from the tail first.
12941    -1   var hash = rest.indexOf('#');
12942    -1   if (hash !== -1) {
12943    -1     // got a fragment string.
12944    -1     this.hash = rest.substr(hash);
12945    -1     rest = rest.slice(0, hash);
12946    -1   }
12947    -1   var qm = rest.indexOf('?');
12948    -1   if (qm !== -1) {
12949    -1     this.search = rest.substr(qm);
12950    -1     rest = rest.slice(0, qm);
12951    -1   }
12952    -1   if (rest) { this.pathname = rest; }
12953    -1   if (slashedProtocol[lowerProto] &&
12954    -1       this.hostname && !this.pathname) {
12955    -1     this.pathname = '';
12956    -1   }
12957    -1 
12958    -1   return this;
12959    -1 };
12960    -1 
12961    -1 Url.prototype.parseHost = function(host) {
12962    -1   var port = portPattern.exec(host);
12963    -1   if (port) {
12964    -1     port = port[0];
12965    -1     if (port !== ':') {
12966    -1       this.port = port.substr(1);
12967    -1     }
12968    -1     host = host.substr(0, host.length - port.length);
12969    -1   }
12970    -1   if (host) { this.hostname = host; }
12971    -1 };
12972    -1 
12973    -1 module.exports = urlParse;
12974    -1 
12975    -1 },{}],93:[function(require,module,exports){
12976    -1 (function (global){
12977    -1 /**

12978    -1  * JSON parse.

12979    -1  *

12980    -1  * @see Based on jQuery#parseJSON (MIT) and JSON2

12981    -1  * @api private

12982    -1  */

12983    -1 

12984    -1 var rvalidchars = /^[\],:{}\s]*$/;

12985    -1 var rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g;

12986    -1 var rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;

12987    -1 var rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g;

12988    -1 var rtrimLeft = /^\s+/;

12989    -1 var rtrimRight = /\s+$/;

12990    -1 

12991    -1 module.exports = function parsejson(data) {

12992    -1   if ('string' != typeof data || !data) {

12993    -1     return null;

12994    -1   }

12995    -1 

12996    -1   data = data.replace(rtrimLeft, '').replace(rtrimRight, '');

12997    -1 

12998    -1   // Attempt to parse using the native JSON parser first

12999    -1   if (global.JSON && JSON.parse) {

13000    -1     return JSON.parse(data);

13001    -1   }

13002    -1 

13003    -1   if (rvalidchars.test(data.replace(rvalidescape, '@')

13004    -1       .replace(rvalidtokens, ']')

13005    -1       .replace(rvalidbraces, ''))) {

13006    -1     return (new Function('return ' + data))();

13007    -1   }

13008    -1 };
13009    -1 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
13010    -1 },{}],94:[function(require,module,exports){
13011    -1 /**

13012    -1  * Compiles a querystring

13013    -1  * Returns string representation of the object

13014    -1  *

13015    -1  * @param {Object}

13016    -1  * @api private

13017    -1  */

13018    -1 

13019    -1 exports.encode = function (obj) {

13020    -1   var str = '';

13021    -1 

13022    -1   for (var i in obj) {

13023    -1     if (obj.hasOwnProperty(i)) {

13024    -1       if (str.length) str += '&';

13025    -1       str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]);

13026    -1     }

13027    -1   }

13028    -1 

13029    -1   return str;

13030    -1 };

13031    -1 

13032    -1 /**

13033    -1  * Parses a simple querystring into an object

13034    -1  *

13035    -1  * @param {String} qs

13036    -1  * @api private

13037    -1  */

13038    -1 

13039    -1 exports.decode = function(qs){

13040    -1   var qry = {};

13041    -1   var pairs = qs.split('&');

13042    -1   for (var i = 0, l = pairs.length; i < l; i++) {

13043    -1     var pair = pairs[i].split('=');

13044    -1     qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);

13045    -1   }

13046    -1   return qry;

13047    -1 };

13048    -1 
13049    -1 },{}],95:[function(require,module,exports){
13050    -1 /**

13051    -1  * Parses an URI

13052    -1  *

13053    -1  * @author Steven Levithan <stevenlevithan.com> (MIT license)

13054    -1  * @api private

13055    -1  */

13056    -1 

13057    -1 var re = /^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;

13058    -1 

13059    -1 var parts = [

13060    -1     'source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'

13061    -1 ];

13062    -1 

13063    -1 module.exports = function parseuri(str) {

13064    -1     var src = str,

13065    -1         b = str.indexOf('['),

13066    -1         e = str.indexOf(']');

13067    -1 

13068    -1     if (b != -1 && e != -1) {

13069    -1         str = str.substring(0, b) + str.substring(b, e).replace(/:/g, ';') + str.substring(e, str.length);

13070    -1     }

13071    -1 

13072    -1     var m = re.exec(str || ''),

13073    -1         uri = {},

13074    -1         i = 14;

13075    -1 

13076    -1     while (i--) {

13077    -1         uri[parts[i]] = m[i] || '';

13078    -1     }

13079    -1 

13080    -1     if (b != -1 && e != -1) {

13081    -1         uri.source = src;

13082    -1         uri.host = uri.host.substring(1, uri.host.length - 1).replace(/;/g, ':');

13083    -1         uri.authority = uri.authority.replace('[', '').replace(']', '').replace(/;/g, ':');

13084    -1         uri.ipv6uri = true;

13085    -1     }

13086    -1 

13087    -1     return uri;

13088    -1 };

13089    -1 
13090    -1 },{}],96:[function(require,module,exports){
13091    -1 !function() {
13092    -1     'use strict';
13093    -1     function VNode() {}
13094    -1     function h(nodeName, attributes) {
13095    -1         var lastSimple, child, simple, i, children = EMPTY_CHILDREN;
13096    -1         for (i = arguments.length; i-- > 2; ) stack.push(arguments[i]);
13097    -1         if (attributes && null != attributes.children) {
13098    -1             if (!stack.length) stack.push(attributes.children);
13099    -1             delete attributes.children;
13100    -1         }
13101    -1         while (stack.length) if ((child = stack.pop()) && void 0 !== child.pop) for (i = child.length; i--; ) stack.push(child[i]); else {
13102    -1             if ('boolean' == typeof child) child = null;
13103    -1             if (simple = 'function' != typeof nodeName) if (null == child) child = ''; else if ('number' == typeof child) child = String(child); else if ('string' != typeof child) simple = !1;
13104    -1             if (simple && lastSimple) children[children.length - 1] += child; else if (children === EMPTY_CHILDREN) children = [ child ]; else children.push(child);
13105    -1             lastSimple = simple;
13106    -1         }
13107    -1         var p = new VNode();
13108    -1         p.nodeName = nodeName;
13109    -1         p.children = children;
13110    -1         p.attributes = null == attributes ? void 0 : attributes;
13111    -1         p.key = null == attributes ? void 0 : attributes.key;
13112    -1         if (void 0 !== options.vnode) options.vnode(p);
13113    -1         return p;
13114    -1     }
13115    -1     function extend(obj, props) {
13116    -1         for (var i in props) obj[i] = props[i];
13117    -1         return obj;
13118    -1     }
13119    -1     function cloneElement(vnode, props) {
13120    -1         return h(vnode.nodeName, extend(extend({}, vnode.attributes), props), arguments.length > 2 ? [].slice.call(arguments, 2) : vnode.children);
13121    -1     }
13122    -1     function enqueueRender(component) {
13123    -1         if (!component.__d && (component.__d = !0) && 1 == items.push(component)) (options.debounceRendering || defer)(rerender);
13124    -1     }
13125    -1     function rerender() {
13126    -1         var p, list = items;
13127    -1         items = [];
13128    -1         while (p = list.pop()) if (p.__d) renderComponent(p);
13129    -1     }
13130    -1     function isSameNodeType(node, vnode, hydrating) {
13131    -1         if ('string' == typeof vnode || 'number' == typeof vnode) return void 0 !== node.splitText;
13132    -1         if ('string' == typeof vnode.nodeName) return !node._componentConstructor && isNamedNode(node, vnode.nodeName); else return hydrating || node._componentConstructor === vnode.nodeName;
13133    -1     }
13134    -1     function isNamedNode(node, nodeName) {
13135    -1         return node.__n === nodeName || node.nodeName.toLowerCase() === nodeName.toLowerCase();
13136    -1     }
13137    -1     function getNodeProps(vnode) {
13138    -1         var props = extend({}, vnode.attributes);
13139    -1         props.children = vnode.children;
13140    -1         var defaultProps = vnode.nodeName.defaultProps;
13141    -1         if (void 0 !== defaultProps) for (var i in defaultProps) if (void 0 === props[i]) props[i] = defaultProps[i];
13142    -1         return props;
13143    -1     }
13144    -1     function createNode(nodeName, isSvg) {
13145    -1         var node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName);
13146    -1         node.__n = nodeName;
13147    -1         return node;
13148    -1     }
13149    -1     function removeNode(node) {
13150    -1         var parentNode = node.parentNode;
13151    -1         if (parentNode) parentNode.removeChild(node);
13152    -1     }
13153    -1     function setAccessor(node, name, old, value, isSvg) {
13154    -1         if ('className' === name) name = 'class';
13155    -1         if ('key' === name) ; else if ('ref' === name) {
13156    -1             if (old) old(null);
13157    -1             if (value) value(node);
13158    -1         } else if ('class' === name && !isSvg) node.className = value || ''; else if ('style' === name) {
13159    -1             if (!value || 'string' == typeof value || 'string' == typeof old) node.style.cssText = value || '';
13160    -1             if (value && 'object' == typeof value) {
13161    -1                 if ('string' != typeof old) for (var i in old) if (!(i in value)) node.style[i] = '';
13162    -1                 for (var i in value) node.style[i] = 'number' == typeof value[i] && !1 === IS_NON_DIMENSIONAL.test(i) ? value[i] + 'px' : value[i];
13163    -1             }
13164    -1         } else if ('dangerouslySetInnerHTML' === name) {
13165    -1             if (value) node.innerHTML = value.__html || '';
13166    -1         } else if ('o' == name[0] && 'n' == name[1]) {
13167    -1             var useCapture = name !== (name = name.replace(/Capture$/, ''));
13168    -1             name = name.toLowerCase().substring(2);
13169    -1             if (value) {
13170    -1                 if (!old) node.addEventListener(name, eventProxy, useCapture);
13171    -1             } else node.removeEventListener(name, eventProxy, useCapture);
13172    -1             (node.__l || (node.__l = {}))[name] = value;
13173    -1         } else if ('list' !== name && 'type' !== name && !isSvg && name in node) {
13174    -1             setProperty(node, name, null == value ? '' : value);
13175    -1             if (null == value || !1 === value) node.removeAttribute(name);
13176    -1         } else {
13177    -1             var ns = isSvg && name !== (name = name.replace(/^xlink\:?/, ''));
13178    -1             if (null == value || !1 === value) if (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase()); else node.removeAttribute(name); else if ('function' != typeof value) if (ns) node.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value); else node.setAttribute(name, value);
13179    -1         }
13180    -1     }
13181    -1     function setProperty(node, name, value) {
13182    -1         try {
13183    -1             node[name] = value;
13184    -1         } catch (e) {}
13185    -1     }
13186    -1     function eventProxy(e) {
13187    -1         return this.__l[e.type](options.event && options.event(e) || e);
13188    -1     }
13189    -1     function flushMounts() {
13190    -1         var c;
13191    -1         while (c = mounts.pop()) {
13192    -1             if (options.afterMount) options.afterMount(c);
13193    -1             if (c.componentDidMount) c.componentDidMount();
13194    -1         }
13195    -1     }
13196    -1     function diff(dom, vnode, context, mountAll, parent, componentRoot) {
13197    -1         if (!diffLevel++) {
13198    -1             isSvgMode = null != parent && void 0 !== parent.ownerSVGElement;
13199    -1             hydrating = null != dom && !('__preactattr_' in dom);
13200    -1         }
13201    -1         var ret = idiff(dom, vnode, context, mountAll, componentRoot);
13202    -1         if (parent && ret.parentNode !== parent) parent.appendChild(ret);
13203    -1         if (!--diffLevel) {
13204    -1             hydrating = !1;
13205    -1             if (!componentRoot) flushMounts();
13206    -1         }
13207    -1         return ret;
13208    -1     }
13209    -1     function idiff(dom, vnode, context, mountAll, componentRoot) {
13210    -1         var out = dom, prevSvgMode = isSvgMode;
13211    -1         if (null == vnode || 'boolean' == typeof vnode) vnode = '';
13212    -1         if ('string' == typeof vnode || 'number' == typeof vnode) {
13213    -1             if (dom && void 0 !== dom.splitText && dom.parentNode && (!dom._component || componentRoot)) {
13214    -1                 if (dom.nodeValue != vnode) dom.nodeValue = vnode;
13215    -1             } else {
13216    -1                 out = document.createTextNode(vnode);
13217    -1                 if (dom) {
13218    -1                     if (dom.parentNode) dom.parentNode.replaceChild(out, dom);
13219    -1                     recollectNodeTree(dom, !0);
13220    -1                 }
13221    -1             }
13222    -1             out.__preactattr_ = !0;
13223    -1             return out;
13224    -1         }
13225    -1         var vnodeName = vnode.nodeName;
13226    -1         if ('function' == typeof vnodeName) return buildComponentFromVNode(dom, vnode, context, mountAll);
13227    -1         isSvgMode = 'svg' === vnodeName ? !0 : 'foreignObject' === vnodeName ? !1 : isSvgMode;
13228    -1         vnodeName = String(vnodeName);
13229    -1         if (!dom || !isNamedNode(dom, vnodeName)) {
13230    -1             out = createNode(vnodeName, isSvgMode);
13231    -1             if (dom) {
13232    -1                 while (dom.firstChild) out.appendChild(dom.firstChild);
13233    -1                 if (dom.parentNode) dom.parentNode.replaceChild(out, dom);
13234    -1                 recollectNodeTree(dom, !0);
13235    -1             }
13236    -1         }
13237    -1         var fc = out.firstChild, props = out.__preactattr_, vchildren = vnode.children;
13238    -1         if (null == props) {
13239    -1             props = out.__preactattr_ = {};
13240    -1             for (var a = out.attributes, i = a.length; i--; ) props[a[i].name] = a[i].value;
13241    -1         }
13242    -1         if (!hydrating && vchildren && 1 === vchildren.length && 'string' == typeof vchildren[0] && null != fc && void 0 !== fc.splitText && null == fc.nextSibling) {
13243    -1             if (fc.nodeValue != vchildren[0]) fc.nodeValue = vchildren[0];
13244    -1         } else if (vchildren && vchildren.length || null != fc) innerDiffNode(out, vchildren, context, mountAll, hydrating || null != props.dangerouslySetInnerHTML);
13245    -1         diffAttributes(out, vnode.attributes, props);
13246    -1         isSvgMode = prevSvgMode;
13247    -1         return out;
13248    -1     }
13249    -1     function innerDiffNode(dom, vchildren, context, mountAll, isHydrating) {
13250    -1         var j, c, f, vchild, child, originalChildren = dom.childNodes, children = [], keyed = {}, keyedLen = 0, min = 0, len = originalChildren.length, childrenLen = 0, vlen = vchildren ? vchildren.length : 0;
13251    -1         if (0 !== len) for (var i = 0; i < len; i++) {
13252    -1             var _child = originalChildren[i], props = _child.__preactattr_, key = vlen && props ? _child._component ? _child._component.__k : props.key : null;
13253    -1             if (null != key) {
13254    -1                 keyedLen++;
13255    -1                 keyed[key] = _child;
13256    -1             } else if (props || (void 0 !== _child.splitText ? isHydrating ? _child.nodeValue.trim() : !0 : isHydrating)) children[childrenLen++] = _child;
13257    -1         }
13258    -1         if (0 !== vlen) for (var i = 0; i < vlen; i++) {
13259    -1             vchild = vchildren[i];
13260    -1             child = null;
13261    -1             var key = vchild.key;
13262    -1             if (null != key) {
13263    -1                 if (keyedLen && void 0 !== keyed[key]) {
13264    -1                     child = keyed[key];
13265    -1                     keyed[key] = void 0;
13266    -1                     keyedLen--;
13267    -1                 }
13268    -1             } else if (!child && min < childrenLen) for (j = min; j < childrenLen; j++) if (void 0 !== children[j] && isSameNodeType(c = children[j], vchild, isHydrating)) {
13269    -1                 child = c;
13270    -1                 children[j] = void 0;
13271    -1                 if (j === childrenLen - 1) childrenLen--;
13272    -1                 if (j === min) min++;
13273    -1                 break;
13274    -1             }
13275    -1             child = idiff(child, vchild, context, mountAll);
13276    -1             f = originalChildren[i];
13277    -1             if (child && child !== dom && child !== f) if (null == f) dom.appendChild(child); else if (child === f.nextSibling) removeNode(f); else dom.insertBefore(child, f);
13278    -1         }
13279    -1         if (keyedLen) for (var i in keyed) if (void 0 !== keyed[i]) recollectNodeTree(keyed[i], !1);
13280    -1         while (min <= childrenLen) if (void 0 !== (child = children[childrenLen--])) recollectNodeTree(child, !1);
13281    -1     }
13282    -1     function recollectNodeTree(node, unmountOnly) {
13283    -1         var component = node._component;
13284    -1         if (component) unmountComponent(component); else {
13285    -1             if (null != node.__preactattr_ && node.__preactattr_.ref) node.__preactattr_.ref(null);
13286    -1             if (!1 === unmountOnly || null == node.__preactattr_) removeNode(node);
13287    -1             removeChildren(node);
13288    -1         }
13289    -1     }
13290    -1     function removeChildren(node) {
13291    -1         node = node.lastChild;
13292    -1         while (node) {
13293    -1             var next = node.previousSibling;
13294    -1             recollectNodeTree(node, !0);
13295    -1             node = next;
13296    -1         }
13297    -1     }
13298    -1     function diffAttributes(dom, attrs, old) {
13299    -1         var name;
13300    -1         for (name in old) if ((!attrs || null == attrs[name]) && null != old[name]) setAccessor(dom, name, old[name], old[name] = void 0, isSvgMode);
13301    -1         for (name in attrs) if (!('children' === name || 'innerHTML' === name || name in old && attrs[name] === ('value' === name || 'checked' === name ? dom[name] : old[name]))) setAccessor(dom, name, old[name], old[name] = attrs[name], isSvgMode);
13302    -1     }
13303    -1     function collectComponent(component) {
13304    -1         var name = component.constructor.name;
13305    -1         (components[name] || (components[name] = [])).push(component);
13306    -1     }
13307    -1     function createComponent(Ctor, props, context) {
13308    -1         var inst, list = components[Ctor.name];
13309    -1         if (Ctor.prototype && Ctor.prototype.render) {
13310    -1             inst = new Ctor(props, context);
13311    -1             Component.call(inst, props, context);
13312    -1         } else {
13313    -1             inst = new Component(props, context);
13314    -1             inst.constructor = Ctor;
13315    -1             inst.render = doRender;
13316    -1         }
13317    -1         if (list) for (var i = list.length; i--; ) if (list[i].constructor === Ctor) {
13318    -1             inst.__b = list[i].__b;
13319    -1             list.splice(i, 1);
13320    -1             break;
13321    -1         }
13322    -1         return inst;
13323    -1     }
13324    -1     function doRender(props, state, context) {
13325    -1         return this.constructor(props, context);
13326    -1     }
13327    -1     function setComponentProps(component, props, opts, context, mountAll) {
13328    -1         if (!component.__x) {
13329    -1             component.__x = !0;
13330    -1             if (component.__r = props.ref) delete props.ref;
13331    -1             if (component.__k = props.key) delete props.key;
13332    -1             if (!component.base || mountAll) {
13333    -1                 if (component.componentWillMount) component.componentWillMount();
13334    -1             } else if (component.componentWillReceiveProps) component.componentWillReceiveProps(props, context);
13335    -1             if (context && context !== component.context) {
13336    -1                 if (!component.__c) component.__c = component.context;
13337    -1                 component.context = context;
13338    -1             }
13339    -1             if (!component.__p) component.__p = component.props;
13340    -1             component.props = props;
13341    -1             component.__x = !1;
13342    -1             if (0 !== opts) if (1 === opts || !1 !== options.syncComponentUpdates || !component.base) renderComponent(component, 1, mountAll); else enqueueRender(component);
13343    -1             if (component.__r) component.__r(component);
13344    -1         }
13345    -1     }
13346    -1     function renderComponent(component, opts, mountAll, isChild) {
13347    -1         if (!component.__x) {
13348    -1             var rendered, inst, cbase, props = component.props, state = component.state, context = component.context, previousProps = component.__p || props, previousState = component.__s || state, previousContext = component.__c || context, isUpdate = component.base, nextBase = component.__b, initialBase = isUpdate || nextBase, initialChildComponent = component._component, skip = !1;
13349    -1             if (isUpdate) {
13350    -1                 component.props = previousProps;
13351    -1                 component.state = previousState;
13352    -1                 component.context = previousContext;
13353    -1                 if (2 !== opts && component.shouldComponentUpdate && !1 === component.shouldComponentUpdate(props, state, context)) skip = !0; else if (component.componentWillUpdate) component.componentWillUpdate(props, state, context);
13354    -1                 component.props = props;
13355    -1                 component.state = state;
13356    -1                 component.context = context;
13357    -1             }
13358    -1             component.__p = component.__s = component.__c = component.__b = null;
13359    -1             component.__d = !1;
13360    -1             if (!skip) {
13361    -1                 rendered = component.render(props, state, context);
13362    -1                 if (component.getChildContext) context = extend(extend({}, context), component.getChildContext());
13363    -1                 var toUnmount, base, childComponent = rendered && rendered.nodeName;
13364    -1                 if ('function' == typeof childComponent) {
13365    -1                     var childProps = getNodeProps(rendered);
13366    -1                     inst = initialChildComponent;
13367    -1                     if (inst && inst.constructor === childComponent && childProps.key == inst.__k) setComponentProps(inst, childProps, 1, context, !1); else {
13368    -1                         toUnmount = inst;
13369    -1                         component._component = inst = createComponent(childComponent, childProps, context);
13370    -1                         inst.__b = inst.__b || nextBase;
13371    -1                         inst.__u = component;
13372    -1                         setComponentProps(inst, childProps, 0, context, !1);
13373    -1                         renderComponent(inst, 1, mountAll, !0);
13374    -1                     }
13375    -1                     base = inst.base;
13376    -1                 } else {
13377    -1                     cbase = initialBase;
13378    -1                     toUnmount = initialChildComponent;
13379    -1                     if (toUnmount) cbase = component._component = null;
13380    -1                     if (initialBase || 1 === opts) {
13381    -1                         if (cbase) cbase._component = null;
13382    -1                         base = diff(cbase, rendered, context, mountAll || !isUpdate, initialBase && initialBase.parentNode, !0);
13383    -1                     }
13384    -1                 }
13385    -1                 if (initialBase && base !== initialBase && inst !== initialChildComponent) {
13386    -1                     var baseParent = initialBase.parentNode;
13387    -1                     if (baseParent && base !== baseParent) {
13388    -1                         baseParent.replaceChild(base, initialBase);
13389    -1                         if (!toUnmount) {
13390    -1                             initialBase._component = null;
13391    -1                             recollectNodeTree(initialBase, !1);
13392    -1                         }
13393    -1                     }
13394    -1                 }
13395    -1                 if (toUnmount) unmountComponent(toUnmount);
13396    -1                 component.base = base;
13397    -1                 if (base && !isChild) {
13398    -1                     var componentRef = component, t = component;
13399    -1                     while (t = t.__u) (componentRef = t).base = base;
13400    -1                     base._component = componentRef;
13401    -1                     base._componentConstructor = componentRef.constructor;
13402    -1                 }
13403    -1             }
13404    -1             if (!isUpdate || mountAll) mounts.unshift(component); else if (!skip) {
13405    -1                 if (component.componentDidUpdate) component.componentDidUpdate(previousProps, previousState, previousContext);
13406    -1                 if (options.afterUpdate) options.afterUpdate(component);
13407    -1             }
13408    -1             if (null != component.__h) while (component.__h.length) component.__h.pop().call(component);
13409    -1             if (!diffLevel && !isChild) flushMounts();
13410    -1         }
13411    -1     }
13412    -1     function buildComponentFromVNode(dom, vnode, context, mountAll) {
13413    -1         var c = dom && dom._component, originalComponent = c, oldDom = dom, isDirectOwner = c && dom._componentConstructor === vnode.nodeName, isOwner = isDirectOwner, props = getNodeProps(vnode);
13414    -1         while (c && !isOwner && (c = c.__u)) isOwner = c.constructor === vnode.nodeName;
13415    -1         if (c && isOwner && (!mountAll || c._component)) {
13416    -1             setComponentProps(c, props, 3, context, mountAll);
13417    -1             dom = c.base;
13418    -1         } else {
13419    -1             if (originalComponent && !isDirectOwner) {
13420    -1                 unmountComponent(originalComponent);
13421    -1                 dom = oldDom = null;
13422    -1             }
13423    -1             c = createComponent(vnode.nodeName, props, context);
13424    -1             if (dom && !c.__b) {
13425    -1                 c.__b = dom;
13426    -1                 oldDom = null;
13427    -1             }
13428    -1             setComponentProps(c, props, 1, context, mountAll);
13429    -1             dom = c.base;
13430    -1             if (oldDom && dom !== oldDom) {
13431    -1                 oldDom._component = null;
13432    -1                 recollectNodeTree(oldDom, !1);
13433    -1             }
13434    -1         }
13435    -1         return dom;
13436    -1     }
13437    -1     function unmountComponent(component) {
13438    -1         if (options.beforeUnmount) options.beforeUnmount(component);
13439    -1         var base = component.base;
13440    -1         component.__x = !0;
13441    -1         if (component.componentWillUnmount) component.componentWillUnmount();
13442    -1         component.base = null;
13443    -1         var inner = component._component;
13444    -1         if (inner) unmountComponent(inner); else if (base) {
13445    -1             if (base.__preactattr_ && base.__preactattr_.ref) base.__preactattr_.ref(null);
13446    -1             component.__b = base;
13447    -1             removeNode(base);
13448    -1             collectComponent(component);
13449    -1             removeChildren(base);
13450    -1         }
13451    -1         if (component.__r) component.__r(null);
13452    -1     }
13453    -1     function Component(props, context) {
13454    -1         this.__d = !0;
13455    -1         this.context = context;
13456    -1         this.props = props;
13457    -1         this.state = this.state || {};
13458    -1     }
13459    -1     function render(vnode, parent, merge) {
13460    -1         return diff(merge, vnode, {}, !1, parent, !1);
13461    -1     }
13462    -1     var options = {};
13463    -1     var stack = [];
13464    -1     var EMPTY_CHILDREN = [];
13465    -1     var defer = 'function' == typeof Promise ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout;
13466    -1     var IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;
13467    -1     var items = [];
13468    -1     var mounts = [];
13469    -1     var diffLevel = 0;
13470    -1     var isSvgMode = !1;
13471    -1     var hydrating = !1;
13472    -1     var components = {};
13473    -1     extend(Component.prototype, {
13474    -1         setState: function(state, callback) {
13475    -1             var s = this.state;
13476    -1             if (!this.__s) this.__s = extend({}, s);
13477    -1             extend(s, 'function' == typeof state ? state(s, this.props) : state);
13478    -1             if (callback) (this.__h = this.__h || []).push(callback);
13479    -1             enqueueRender(this);
13480    -1         },
13481    -1         forceUpdate: function(callback) {
13482    -1             if (callback) (this.__h = this.__h || []).push(callback);
13483    -1             renderComponent(this, 2);
13484    -1         },
13485    -1         render: function() {}
13486    -1     });
13487    -1     var preact = {
13488    -1         h: h,
13489    -1         createElement: h,
13490    -1         cloneElement: cloneElement,
13491    -1         Component: Component,
13492    -1         render: render,
13493    -1         rerender: rerender,
13494    -1         options: options
13495    -1     };
13496    -1     if ('undefined' != typeof module) module.exports = preact; else self.preact = preact;
13497    -1 }();
13498    -1 
13499    -1 },{}],97:[function(require,module,exports){
13500    -1 
13501    -1 /**
13502    -1  * Module dependencies.
13503    -1  */
13504    -1 
13505    -1 var url = require('./url');
13506    -1 var parser = require('socket.io-parser');
13507    -1 var Manager = require('./manager');
13508    -1 var debug = require('debug')('socket.io-client');
13509    -1 
13510    -1 /**
13511    -1  * Module exports.
13512    -1  */
13513    -1 
13514    -1 module.exports = exports = lookup;
13515    -1 
13516    -1 /**
13517    -1  * Managers cache.
13518    -1  */
13519    -1 
13520    -1 var cache = exports.managers = {};
13521    -1 
13522    -1 /**
13523    -1  * Looks up an existing `Manager` for multiplexing.
13524    -1  * If the user summons:
13525    -1  *
13526    -1  *   `io('http://localhost/a');`
13527    -1  *   `io('http://localhost/b');`
13528    -1  *
13529    -1  * We reuse the existing instance based on same scheme/port/host,
13530    -1  * and we initialize sockets for each namespace.
13531    -1  *
13532    -1  * @api public
13533    -1  */
13534    -1 
13535    -1 function lookup (uri, opts) {
13536    -1   if (typeof uri === 'object') {
13537    -1     opts = uri;
13538    -1     uri = undefined;
13539    -1   }
13540    -1 
13541    -1   opts = opts || {};
13542    -1 
13543    -1   var parsed = url(uri);
13544    -1   var source = parsed.source;
13545    -1   var id = parsed.id;
13546    -1   var path = parsed.path;
13547    -1   var sameNamespace = cache[id] && path in cache[id].nsps;
13548    -1   var newConnection = opts.forceNew || opts['force new connection'] ||
13549    -1                       false === opts.multiplex || sameNamespace;
13550    -1 
13551    -1   var io;
13552    -1 
13553    -1   if (newConnection) {
13554    -1     debug('ignoring socket cache for %s', source);
13555    -1     io = Manager(source, opts);
13556    -1   } else {
13557    -1     if (!cache[id]) {
13558    -1       debug('new io instance for %s', source);
13559    -1       cache[id] = Manager(source, opts);
13560    -1     }
13561    -1     io = cache[id];
13562    -1   }
13563    -1   if (parsed.query && !opts.query) {
13564    -1     opts.query = parsed.query;
13565    -1   } else if (opts && 'object' === typeof opts.query) {
13566    -1     opts.query = encodeQueryString(opts.query);
13567    -1   }
13568    -1   return io.socket(parsed.path, opts);
13569    -1 }
13570    -1 /**
13571    -1  *  Helper method to parse query objects to string.
13572    -1  * @param {object} query
13573    -1  * @returns {string}
13574    -1  */
13575    -1 function encodeQueryString (obj) {
13576    -1   var str = [];
13577    -1   for (var p in obj) {
13578    -1     if (obj.hasOwnProperty(p)) {
13579    -1       str.push(encodeURIComponent(p) + '=' + encodeURIComponent(obj[p]));
13580    -1     }
13581    -1   }
13582    -1   return str.join('&');
13583    -1 }
13584    -1 /**
13585    -1  * Protocol version.
13586    -1  *
13587    -1  * @api public
13588    -1  */
13589    -1 
13590    -1 exports.protocol = parser.protocol;
13591    -1 
13592    -1 /**
13593    -1  * `connect`.
13594    -1  *
13595    -1  * @param {String} uri
13596    -1  * @api public
13597    -1  */
13598    -1 
13599    -1 exports.connect = lookup;
13600    -1 
13601    -1 /**
13602    -1  * Expose constructors for standalone build.
13603    -1  *
13604    -1  * @api public
13605    -1  */
13606    -1 
13607    -1 exports.Manager = require('./manager');
13608    -1 exports.Socket = require('./socket');
13609    -1 
13610    -1 },{"./manager":98,"./socket":100,"./url":101,"debug":103,"socket.io-parser":107}],98:[function(require,module,exports){
13611    -1 
13612    -1 /**
13613    -1  * Module dependencies.
13614    -1  */
13615    -1 
13616    -1 var eio = require('engine.io-client');
13617    -1 var Socket = require('./socket');
13618    -1 var Emitter = require('component-emitter');
13619    -1 var parser = require('socket.io-parser');
13620    -1 var on = require('./on');
13621    -1 var bind = require('component-bind');
13622    -1 var debug = require('debug')('socket.io-client:manager');
13623    -1 var indexOf = require('indexof');
13624    -1 var Backoff = require('backo2');
13625    -1 
13626    -1 /**
13627    -1  * IE6+ hasOwnProperty
13628    -1  */
13629    -1 
13630    -1 var has = Object.prototype.hasOwnProperty;
13631    -1 
13632    -1 /**
13633    -1  * Module exports
13634    -1  */
13635    -1 
13636    -1 module.exports = Manager;
13637    -1 
13638    -1 /**
13639    -1  * `Manager` constructor.
13640    -1  *
13641    -1  * @param {String} engine instance or engine uri/opts
13642    -1  * @param {Object} options
13643    -1  * @api public
13644    -1  */
13645    -1 
13646    -1 function Manager (uri, opts) {
13647    -1   if (!(this instanceof Manager)) return new Manager(uri, opts);
13648    -1   if (uri && ('object' === typeof uri)) {
13649    -1     opts = uri;
13650    -1     uri = undefined;
13651    -1   }
13652    -1   opts = opts || {};
13653    -1 
13654    -1   opts.path = opts.path || '/socket.io';
13655    -1   this.nsps = {};
13656    -1   this.subs = [];
13657    -1   this.opts = opts;
13658    -1   this.reconnection(opts.reconnection !== false);
13659    -1   this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);
13660    -1   this.reconnectionDelay(opts.reconnectionDelay || 1000);
13661    -1   this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000);
13662    -1   this.randomizationFactor(opts.randomizationFactor || 0.5);
13663    -1   this.backoff = new Backoff({
13664    -1     min: this.reconnectionDelay(),
13665    -1     max: this.reconnectionDelayMax(),
13666    -1     jitter: this.randomizationFactor()
13667    -1   });
13668    -1   this.timeout(null == opts.timeout ? 20000 : opts.timeout);
13669    -1   this.readyState = 'closed';
13670    -1   this.uri = uri;
13671    -1   this.connecting = [];
13672    -1   this.lastPing = null;
13673    -1   this.encoding = false;
13674    -1   this.packetBuffer = [];
13675    -1   this.encoder = new parser.Encoder();
13676    -1   this.decoder = new parser.Decoder();
13677    -1   this.autoConnect = opts.autoConnect !== false;
13678    -1   if (this.autoConnect) this.open();
13679    -1 }
13680    -1 
13681    -1 /**
13682    -1  * Propagate given event to sockets and emit on `this`
13683    -1  *
13684    -1  * @api private
13685    -1  */
13686    -1 
13687    -1 Manager.prototype.emitAll = function () {
13688    -1   this.emit.apply(this, arguments);
13689    -1   for (var nsp in this.nsps) {
13690    -1     if (has.call(this.nsps, nsp)) {
13691    -1       this.nsps[nsp].emit.apply(this.nsps[nsp], arguments);
13692    -1     }
13693    -1   }
13694    -1 };
13695    -1 
13696    -1 /**
13697    -1  * Update `socket.id` of all sockets
13698    -1  *
13699    -1  * @api private
13700    -1  */
13701    -1 
13702    -1 Manager.prototype.updateSocketIds = function () {
13703    -1   for (var nsp in this.nsps) {
13704    -1     if (has.call(this.nsps, nsp)) {
13705    -1       this.nsps[nsp].id = this.engine.id;
13706    -1     }
13707    -1   }
13708    -1 };
13709    -1 
13710    -1 /**
13711    -1  * Mix in `Emitter`.
13712    -1  */
13713    -1 
13714    -1 Emitter(Manager.prototype);
13715    -1 
13716    -1 /**
13717    -1  * Sets the `reconnection` config.
13718    -1  *
13719    -1  * @param {Boolean} true/false if it should automatically reconnect
13720    -1  * @return {Manager} self or value
13721    -1  * @api public
13722    -1  */
13723    -1 
13724    -1 Manager.prototype.reconnection = function (v) {
13725    -1   if (!arguments.length) return this._reconnection;
13726    -1   this._reconnection = !!v;
13727    -1   return this;
13728    -1 };
13729    -1 
13730    -1 /**
13731    -1  * Sets the reconnection attempts config.
13732    -1  *
13733    -1  * @param {Number} max reconnection attempts before giving up
13734    -1  * @return {Manager} self or value
13735    -1  * @api public
13736    -1  */
13737    -1 
13738    -1 Manager.prototype.reconnectionAttempts = function (v) {
13739    -1   if (!arguments.length) return this._reconnectionAttempts;
13740    -1   this._reconnectionAttempts = v;
13741    -1   return this;
13742    -1 };
13743    -1 
13744    -1 /**
13745    -1  * Sets the delay between reconnections.
13746    -1  *
13747    -1  * @param {Number} delay
13748    -1  * @return {Manager} self or value
13749    -1  * @api public
13750    -1  */
13751    -1 
13752    -1 Manager.prototype.reconnectionDelay = function (v) {
13753    -1   if (!arguments.length) return this._reconnectionDelay;
13754    -1   this._reconnectionDelay = v;
13755    -1   this.backoff && this.backoff.setMin(v);
13756    -1   return this;
13757    -1 };
13758    -1 
13759    -1 Manager.prototype.randomizationFactor = function (v) {
13760    -1   if (!arguments.length) return this._randomizationFactor;
13761    -1   this._randomizationFactor = v;
13762    -1   this.backoff && this.backoff.setJitter(v);
13763    -1   return this;
13764    -1 };
13765    -1 
13766    -1 /**
13767    -1  * Sets the maximum delay between reconnections.
13768    -1  *
13769    -1  * @param {Number} delay
13770    -1  * @return {Manager} self or value
13771    -1  * @api public
13772    -1  */
13773    -1 
13774    -1 Manager.prototype.reconnectionDelayMax = function (v) {
13775    -1   if (!arguments.length) return this._reconnectionDelayMax;
13776    -1   this._reconnectionDelayMax = v;
13777    -1   this.backoff && this.backoff.setMax(v);
13778    -1   return this;
13779    -1 };
13780    -1 
13781    -1 /**
13782    -1  * Sets the connection timeout. `false` to disable
13783    -1  *
13784    -1  * @return {Manager} self or value
13785    -1  * @api public
13786    -1  */
13787    -1 
13788    -1 Manager.prototype.timeout = function (v) {
13789    -1   if (!arguments.length) return this._timeout;
13790    -1   this._timeout = v;
13791    -1   return this;
13792    -1 };
13793    -1 
13794    -1 /**
13795    -1  * Starts trying to reconnect if reconnection is enabled and we have not
13796    -1  * started reconnecting yet
13797    -1  *
13798    -1  * @api private
13799    -1  */
13800    -1 
13801    -1 Manager.prototype.maybeReconnectOnOpen = function () {
13802    -1   // Only try to reconnect if it's the first time we're connecting
13803    -1   if (!this.reconnecting && this._reconnection && this.backoff.attempts === 0) {
13804    -1     // keeps reconnection from firing twice for the same reconnection loop
13805    -1     this.reconnect();
13806    -1   }
13807    -1 };
13808    -1 
13809    -1 /**
13810    -1  * Sets the current transport `socket`.
13811    -1  *
13812    -1  * @param {Function} optional, callback
13813    -1  * @return {Manager} self
13814    -1  * @api public
13815    -1  */
13816    -1 
13817    -1 Manager.prototype.open =
13818    -1 Manager.prototype.connect = function (fn, opts) {
13819    -1   debug('readyState %s', this.readyState);
13820    -1   if (~this.readyState.indexOf('open')) return this;
13821    -1 
13822    -1   debug('opening %s', this.uri);
13823    -1   this.engine = eio(this.uri, this.opts);
13824    -1   var socket = this.engine;
13825    -1   var self = this;
13826    -1   this.readyState = 'opening';
13827    -1   this.skipReconnect = false;
13828    -1 
13829    -1   // emit `open`
13830    -1   var openSub = on(socket, 'open', function () {
13831    -1     self.onopen();
13832    -1     fn && fn();
13833    -1   });
13834    -1 
13835    -1   // emit `connect_error`
13836    -1   var errorSub = on(socket, 'error', function (data) {
13837    -1     debug('connect_error');
13838    -1     self.cleanup();
13839    -1     self.readyState = 'closed';
13840    -1     self.emitAll('connect_error', data);
13841    -1     if (fn) {
13842    -1       var err = new Error('Connection error');
13843    -1       err.data = data;
13844    -1       fn(err);
13845    -1     } else {
13846    -1       // Only do this if there is no fn to handle the error
13847    -1       self.maybeReconnectOnOpen();
13848    -1     }
13849    -1   });
13850    -1 
13851    -1   // emit `connect_timeout`
13852    -1   if (false !== this._timeout) {
13853    -1     var timeout = this._timeout;
13854    -1     debug('connect attempt will timeout after %d', timeout);
13855    -1 
13856    -1     // set timer
13857    -1     var timer = setTimeout(function () {
13858    -1       debug('connect attempt timed out after %d', timeout);
13859    -1       openSub.destroy();
13860    -1       socket.close();
13861    -1       socket.emit('error', 'timeout');
13862    -1       self.emitAll('connect_timeout', timeout);
13863    -1     }, timeout);
13864    -1 
13865    -1     this.subs.push({
13866    -1       destroy: function () {
13867    -1         clearTimeout(timer);
13868    -1       }
13869    -1     });
13870    -1   }
13871    -1 
13872    -1   this.subs.push(openSub);
13873    -1   this.subs.push(errorSub);
13874    -1 
13875    -1   return this;
13876    -1 };
13877    -1 
13878    -1 /**
13879    -1  * Called upon transport open.
13880    -1  *
13881    -1  * @api private
13882    -1  */
13883    -1 
13884    -1 Manager.prototype.onopen = function () {
13885    -1   debug('open');
13886    -1 
13887    -1   // clear old subs
13888    -1   this.cleanup();
13889    -1 
13890    -1   // mark as open
13891    -1   this.readyState = 'open';
13892    -1   this.emit('open');
13893    -1 
13894    -1   // add new subs
13895    -1   var socket = this.engine;
13896    -1   this.subs.push(on(socket, 'data', bind(this, 'ondata')));
13897    -1   this.subs.push(on(socket, 'ping', bind(this, 'onping')));
13898    -1   this.subs.push(on(socket, 'pong', bind(this, 'onpong')));
13899    -1   this.subs.push(on(socket, 'error', bind(this, 'onerror')));
13900    -1   this.subs.push(on(socket, 'close', bind(this, 'onclose')));
13901    -1   this.subs.push(on(this.decoder, 'decoded', bind(this, 'ondecoded')));
13902    -1 };
13903    -1 
13904    -1 /**
13905    -1  * Called upon a ping.
13906    -1  *
13907    -1  * @api private
13908    -1  */
13909    -1 
13910    -1 Manager.prototype.onping = function () {
13911    -1   this.lastPing = new Date();
13912    -1   this.emitAll('ping');
13913    -1 };
13914    -1 
13915    -1 /**
13916    -1  * Called upon a packet.
13917    -1  *
13918    -1  * @api private
13919    -1  */
13920    -1 
13921    -1 Manager.prototype.onpong = function () {
13922    -1   this.emitAll('pong', new Date() - this.lastPing);
13923    -1 };
13924    -1 
13925    -1 /**
13926    -1  * Called with data.
13927    -1  *
13928    -1  * @api private
13929    -1  */
13930    -1 
13931    -1 Manager.prototype.ondata = function (data) {
13932    -1   this.decoder.add(data);
13933    -1 };
13934    -1 
13935    -1 /**
13936    -1  * Called when parser fully decodes a packet.
13937    -1  *
13938    -1  * @api private
13939    -1  */
13940    -1 
13941    -1 Manager.prototype.ondecoded = function (packet) {
13942    -1   this.emit('packet', packet);
13943    -1 };
13944    -1 
13945    -1 /**
13946    -1  * Called upon socket error.
13947    -1  *
13948    -1  * @api private
13949    -1  */
13950    -1 
13951    -1 Manager.prototype.onerror = function (err) {
13952    -1   debug('error', err);
13953    -1   this.emitAll('error', err);
13954    -1 };
13955    -1 
13956    -1 /**
13957    -1  * Creates a new socket for the given `nsp`.
13958    -1  *
13959    -1  * @return {Socket}
13960    -1  * @api public
13961    -1  */
13962    -1 
13963    -1 Manager.prototype.socket = function (nsp, opts) {
13964    -1   var socket = this.nsps[nsp];
13965    -1   if (!socket) {
13966    -1     socket = new Socket(this, nsp, opts);
13967    -1     this.nsps[nsp] = socket;
13968    -1     var self = this;
13969    -1     socket.on('connecting', onConnecting);
13970    -1     socket.on('connect', function () {
13971    -1       socket.id = self.engine.id;
13972    -1     });
13973    -1 
13974    -1     if (this.autoConnect) {
13975    -1       // manually call here since connecting evnet is fired before listening
13976    -1       onConnecting();
13977    -1     }
13978    -1   }
13979    -1 
13980    -1   function onConnecting () {
13981    -1     if (!~indexOf(self.connecting, socket)) {
13982    -1       self.connecting.push(socket);
13983    -1     }
13984    -1   }
13985    -1 
13986    -1   return socket;
13987    -1 };
13988    -1 
13989    -1 /**
13990    -1  * Called upon a socket close.
13991    -1  *
13992    -1  * @param {Socket} socket
13993    -1  */
13994    -1 
13995    -1 Manager.prototype.destroy = function (socket) {
13996    -1   var index = indexOf(this.connecting, socket);
13997    -1   if (~index) this.connecting.splice(index, 1);
13998    -1   if (this.connecting.length) return;
13999    -1 
14000    -1   this.close();
14001    -1 };
14002    -1 
14003    -1 /**
14004    -1  * Writes a packet.
14005    -1  *
14006    -1  * @param {Object} packet
14007    -1  * @api private
14008    -1  */
14009    -1 
14010    -1 Manager.prototype.packet = function (packet) {
14011    -1   debug('writing packet %j', packet);
14012    -1   var self = this;
14013    -1   if (packet.query && packet.type === 0) packet.nsp += '?' + packet.query;
14014    -1 
14015    -1   if (!self.encoding) {
14016    -1     // encode, then write to engine with result
14017    -1     self.encoding = true;
14018    -1     this.encoder.encode(packet, function (encodedPackets) {
14019    -1       for (var i = 0; i < encodedPackets.length; i++) {
14020    -1         self.engine.write(encodedPackets[i], packet.options);
14021    -1       }
14022    -1       self.encoding = false;
14023    -1       self.processPacketQueue();
14024    -1     });
14025    -1   } else { // add packet to the queue
14026    -1     self.packetBuffer.push(packet);
14027    -1   }
14028    -1 };
14029    -1 
14030    -1 /**
14031    -1  * If packet buffer is non-empty, begins encoding the
14032    -1  * next packet in line.
14033    -1  *
14034    -1  * @api private
14035    -1  */
14036    -1 
14037    -1 Manager.prototype.processPacketQueue = function () {
14038    -1   if (this.packetBuffer.length > 0 && !this.encoding) {
14039    -1     var pack = this.packetBuffer.shift();
14040    -1     this.packet(pack);
14041    -1   }
14042    -1 };
14043    -1 
14044    -1 /**
14045    -1  * Clean up transport subscriptions and packet buffer.
14046    -1  *
14047    -1  * @api private
14048    -1  */
14049    -1 
14050    -1 Manager.prototype.cleanup = function () {
14051    -1   debug('cleanup');
14052    -1 
14053    -1   var subsLength = this.subs.length;
14054    -1   for (var i = 0; i < subsLength; i++) {
14055    -1     var sub = this.subs.shift();
14056    -1     sub.destroy();
14057    -1   }
14058    -1 
14059    -1   this.packetBuffer = [];
14060    -1   this.encoding = false;
14061    -1   this.lastPing = null;
14062    -1 
14063    -1   this.decoder.destroy();
14064    -1 };
14065    -1 
14066    -1 /**
14067    -1  * Close the current socket.
14068    -1  *
14069    -1  * @api private
14070    -1  */
14071    -1 
14072    -1 Manager.prototype.close =
14073    -1 Manager.prototype.disconnect = function () {
14074    -1   debug('disconnect');
14075    -1   this.skipReconnect = true;
14076    -1   this.reconnecting = false;
14077    -1   if ('opening' === this.readyState) {
14078    -1     // `onclose` will not fire because
14079    -1     // an open event never happened
14080    -1     this.cleanup();
14081    -1   }
14082    -1   this.backoff.reset();
14083    -1   this.readyState = 'closed';
14084    -1   if (this.engine) this.engine.close();
14085    -1 };
14086    -1 
14087    -1 /**
14088    -1  * Called upon engine close.
14089    -1  *
14090    -1  * @api private
14091    -1  */
14092    -1 
14093    -1 Manager.prototype.onclose = function (reason) {
14094    -1   debug('onclose');
14095    -1 
14096    -1   this.cleanup();
14097    -1   this.backoff.reset();
14098    -1   this.readyState = 'closed';
14099    -1   this.emit('close', reason);
14100    -1 
14101    -1   if (this._reconnection && !this.skipReconnect) {
14102    -1     this.reconnect();
14103    -1   }
14104    -1 };
14105    -1 
14106    -1 /**
14107    -1  * Attempt a reconnection.
14108    -1  *
14109    -1  * @api private
14110    -1  */
14111    -1 
14112    -1 Manager.prototype.reconnect = function () {
14113    -1   if (this.reconnecting || this.skipReconnect) return this;
14114    -1 
14115    -1   var self = this;
14116    -1 
14117    -1   if (this.backoff.attempts >= this._reconnectionAttempts) {
14118    -1     debug('reconnect failed');
14119    -1     this.backoff.reset();
14120    -1     this.emitAll('reconnect_failed');
14121    -1     this.reconnecting = false;
14122    -1   } else {
14123    -1     var delay = this.backoff.duration();
14124    -1     debug('will wait %dms before reconnect attempt', delay);
14125    -1 
14126    -1     this.reconnecting = true;
14127    -1     var timer = setTimeout(function () {
14128    -1       if (self.skipReconnect) return;
14129    -1 
14130    -1       debug('attempting reconnect');
14131    -1       self.emitAll('reconnect_attempt', self.backoff.attempts);
14132    -1       self.emitAll('reconnecting', self.backoff.attempts);
14133    -1 
14134    -1       // check again for the case socket closed in above events
14135    -1       if (self.skipReconnect) return;
14136    -1 
14137    -1       self.open(function (err) {
14138    -1         if (err) {
14139    -1           debug('reconnect attempt error');
14140    -1           self.reconnecting = false;
14141    -1           self.reconnect();
14142    -1           self.emitAll('reconnect_error', err.data);
14143    -1         } else {
14144    -1           debug('reconnect success');
14145    -1           self.onreconnect();
14146    -1         }
14147    -1       });
14148    -1     }, delay);
14149    -1 
14150    -1     this.subs.push({
14151    -1       destroy: function () {
14152    -1         clearTimeout(timer);
14153    -1       }
14154    -1     });
14155    -1   }
14156    -1 };
14157    -1 
14158    -1 /**
14159    -1  * Called upon successful reconnect.
14160    -1  *
14161    -1  * @api private
14162    -1  */
14163    -1 
14164    -1 Manager.prototype.onreconnect = function () {
14165    -1   var attempt = this.backoff.attempts;
14166    -1   this.reconnecting = false;
14167    -1   this.backoff.reset();
14168    -1   this.updateSocketIds();
14169    -1   this.emitAll('reconnect', attempt);
14170    -1 };
14171    -1 
14172    -1 },{"./on":99,"./socket":100,"backo2":6,"component-bind":9,"component-emitter":102,"debug":103,"engine.io-client":12,"indexof":31,"socket.io-parser":107}],99:[function(require,module,exports){
14173    -1 
14174    -1 /**
14175    -1  * Module exports.
14176    -1  */
14177    -1 
14178    -1 module.exports = on;
14179    -1 
14180    -1 /**
14181    -1  * Helper for subscriptions.
14182    -1  *
14183    -1  * @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter`
14184    -1  * @param {String} event name
14185    -1  * @param {Function} callback
14186    -1  * @api public
14187    -1  */
14188    -1 
14189    -1 function on (obj, ev, fn) {
14190    -1   obj.on(ev, fn);
14191    -1   return {
14192    -1     destroy: function () {
14193    -1       obj.removeListener(ev, fn);
14194    -1     }
14195    -1   };
14196    -1 }
14197    -1 
14198    -1 },{}],100:[function(require,module,exports){
14199    -1 
14200    -1 /**
14201    -1  * Module dependencies.
14202    -1  */
14203    -1 
14204    -1 var parser = require('socket.io-parser');
14205    -1 var Emitter = require('component-emitter');
14206    -1 var toArray = require('to-array');
14207    -1 var on = require('./on');
14208    -1 var bind = require('component-bind');
14209    -1 var debug = require('debug')('socket.io-client:socket');
14210    -1 var hasBin = require('has-binary');
14211    -1 
14212    -1 /**
14213    -1  * Module exports.
14214    -1  */
14215    -1 
14216    -1 module.exports = exports = Socket;
14217    -1 
14218    -1 /**
14219    -1  * Internal events (blacklisted).
14220    -1  * These events can't be emitted by the user.
14221    -1  *
14222    -1  * @api private
14223    -1  */
14224    -1 
14225    -1 var events = {
14226    -1   connect: 1,
14227    -1   connect_error: 1,
14228    -1   connect_timeout: 1,
14229    -1   connecting: 1,
14230    -1   disconnect: 1,
14231    -1   error: 1,
14232    -1   reconnect: 1,
14233    -1   reconnect_attempt: 1,
14234    -1   reconnect_failed: 1,
14235    -1   reconnect_error: 1,
14236    -1   reconnecting: 1,
14237    -1   ping: 1,
14238    -1   pong: 1
14239    -1 };
14240    -1 
14241    -1 /**
14242    -1  * Shortcut to `Emitter#emit`.
14243    -1  */
14244    -1 
14245    -1 var emit = Emitter.prototype.emit;
14246    -1 
14247    -1 /**
14248    -1  * `Socket` constructor.
14249    -1  *
14250    -1  * @api public
14251    -1  */
14252    -1 
14253    -1 function Socket (io, nsp, opts) {
14254    -1   this.io = io;
14255    -1   this.nsp = nsp;
14256    -1   this.json = this; // compat
14257    -1   this.ids = 0;
14258    -1   this.acks = {};
14259    -1   this.receiveBuffer = [];
14260    -1   this.sendBuffer = [];
14261    -1   this.connected = false;
14262    -1   this.disconnected = true;
14263    -1   if (opts && opts.query) {
14264    -1     this.query = opts.query;
14265    -1   }
14266    -1   if (this.io.autoConnect) this.open();
14267    -1 }
14268    -1 
14269    -1 /**
14270    -1  * Mix in `Emitter`.
14271    -1  */
14272    -1 
14273    -1 Emitter(Socket.prototype);
14274    -1 
14275    -1 /**
14276    -1  * Subscribe to open, close and packet events
14277    -1  *
14278    -1  * @api private
14279    -1  */
14280    -1 
14281    -1 Socket.prototype.subEvents = function () {
14282    -1   if (this.subs) return;
14283    -1 
14284    -1   var io = this.io;
14285    -1   this.subs = [
14286    -1     on(io, 'open', bind(this, 'onopen')),
14287    -1     on(io, 'packet', bind(this, 'onpacket')),
14288    -1     on(io, 'close', bind(this, 'onclose'))
14289    -1   ];
14290    -1 };
14291    -1 
14292    -1 /**
14293    -1  * "Opens" the socket.
14294    -1  *
14295    -1  * @api public
14296    -1  */
14297    -1 
14298    -1 Socket.prototype.open =
14299    -1 Socket.prototype.connect = function () {
14300    -1   if (this.connected) return this;
14301    -1 
14302    -1   this.subEvents();
14303    -1   this.io.open(); // ensure open
14304    -1   if ('open' === this.io.readyState) this.onopen();
14305    -1   this.emit('connecting');
14306    -1   return this;
14307    -1 };
14308    -1 
14309    -1 /**
14310    -1  * Sends a `message` event.
14311    -1  *
14312    -1  * @return {Socket} self
14313    -1  * @api public
14314    -1  */
14315    -1 
14316    -1 Socket.prototype.send = function () {
14317    -1   var args = toArray(arguments);
14318    -1   args.unshift('message');
14319    -1   this.emit.apply(this, args);
14320    -1   return this;
14321    -1 };
14322    -1 
14323    -1 /**
14324    -1  * Override `emit`.
14325    -1  * If the event is in `events`, it's emitted normally.
14326    -1  *
14327    -1  * @param {String} event name
14328    -1  * @return {Socket} self
14329    -1  * @api public
14330    -1  */
14331    -1 
14332    -1 Socket.prototype.emit = function (ev) {
14333    -1   if (events.hasOwnProperty(ev)) {
14334    -1     emit.apply(this, arguments);
14335    -1     return this;
14336    -1   }
14337    -1 
14338    -1   var args = toArray(arguments);
14339    -1   var parserType = parser.EVENT; // default
14340    -1   if (hasBin(args)) { parserType = parser.BINARY_EVENT; } // binary
14341    -1   var packet = { type: parserType, data: args };
14342    -1 
14343    -1   packet.options = {};
14344    -1   packet.options.compress = !this.flags || false !== this.flags.compress;
14345    -1 
14346    -1   // event ack callback
14347    -1   if ('function' === typeof args[args.length - 1]) {
14348    -1     debug('emitting packet with ack id %d', this.ids);
14349    -1     this.acks[this.ids] = args.pop();
14350    -1     packet.id = this.ids++;
14351    -1   }
14352    -1 
14353    -1   if (this.connected) {
14354    -1     this.packet(packet);
14355    -1   } else {
14356    -1     this.sendBuffer.push(packet);
14357    -1   }
14358    -1 
14359    -1   delete this.flags;
14360    -1 
14361    -1   return this;
14362    -1 };
14363    -1 
14364    -1 /**
14365    -1  * Sends a packet.
14366    -1  *
14367    -1  * @param {Object} packet
14368    -1  * @api private
14369    -1  */
14370    -1 
14371    -1 Socket.prototype.packet = function (packet) {
14372    -1   packet.nsp = this.nsp;
14373    -1   this.io.packet(packet);
14374    -1 };
14375    -1 
14376    -1 /**
14377    -1  * Called upon engine `open`.
14378    -1  *
14379    -1  * @api private
14380    -1  */
14381    -1 
14382    -1 Socket.prototype.onopen = function () {
14383    -1   debug('transport is open - connecting');
14384    -1 
14385    -1   // write connect packet if necessary
14386    -1   if ('/' !== this.nsp) {
14387    -1     if (this.query) {
14388    -1       this.packet({type: parser.CONNECT, query: this.query});
14389    -1     } else {
14390    -1       this.packet({type: parser.CONNECT});
14391    -1     }
14392    -1   }
14393    -1 };
14394    -1 
14395    -1 /**
14396    -1  * Called upon engine `close`.
14397    -1  *
14398    -1  * @param {String} reason
14399    -1  * @api private
14400    -1  */
14401    -1 
14402    -1 Socket.prototype.onclose = function (reason) {
14403    -1   debug('close (%s)', reason);
14404    -1   this.connected = false;
14405    -1   this.disconnected = true;
14406    -1   delete this.id;
14407    -1   this.emit('disconnect', reason);
14408    -1 };
14409    -1 
14410    -1 /**
14411    -1  * Called with socket packet.
14412    -1  *
14413    -1  * @param {Object} packet
14414    -1  * @api private
14415    -1  */
14416    -1 
14417    -1 Socket.prototype.onpacket = function (packet) {
14418    -1   if (packet.nsp !== this.nsp) return;
14419    -1 
14420    -1   switch (packet.type) {
14421    -1     case parser.CONNECT:
14422    -1       this.onconnect();
14423    -1       break;
14424    -1 
14425    -1     case parser.EVENT:
14426    -1       this.onevent(packet);
14427    -1       break;
14428    -1 
14429    -1     case parser.BINARY_EVENT:
14430    -1       this.onevent(packet);
14431    -1       break;
14432    -1 
14433    -1     case parser.ACK:
14434    -1       this.onack(packet);
14435    -1       break;
14436    -1 
14437    -1     case parser.BINARY_ACK:
14438    -1       this.onack(packet);
14439    -1       break;
14440    -1 
14441    -1     case parser.DISCONNECT:
14442    -1       this.ondisconnect();
14443    -1       break;
14444    -1 
14445    -1     case parser.ERROR:
14446    -1       this.emit('error', packet.data);
14447    -1       break;
14448    -1   }
14449    -1 };
14450    -1 
14451    -1 /**
14452    -1  * Called upon a server event.
14453    -1  *
14454    -1  * @param {Object} packet
14455    -1  * @api private
14456    -1  */
14457    -1 
14458    -1 Socket.prototype.onevent = function (packet) {
14459    -1   var args = packet.data || [];
14460    -1   debug('emitting event %j', args);
14461    -1 
14462    -1   if (null != packet.id) {
14463    -1     debug('attaching ack callback to event');
14464    -1     args.push(this.ack(packet.id));
14465    -1   }
14466    -1 
14467    -1   if (this.connected) {
14468    -1     emit.apply(this, args);
14469    -1   } else {
14470    -1     this.receiveBuffer.push(args);
14471    -1   }
14472    -1 };
14473    -1 
14474    -1 /**
14475    -1  * Produces an ack callback to emit with an event.
14476    -1  *
14477    -1  * @api private
14478    -1  */
14479    -1 
14480    -1 Socket.prototype.ack = function (id) {
14481    -1   var self = this;
14482    -1   var sent = false;
14483    -1   return function () {
14484    -1     // prevent double callbacks
14485    -1     if (sent) return;
14486    -1     sent = true;
14487    -1     var args = toArray(arguments);
14488    -1     debug('sending ack %j', args);
14489    -1 
14490    -1     var type = hasBin(args) ? parser.BINARY_ACK : parser.ACK;
14491    -1     self.packet({
14492    -1       type: type,
14493    -1       id: id,
14494    -1       data: args
14495    -1     });
14496    -1   };
14497    -1 };
14498    -1 
14499    -1 /**
14500    -1  * Called upon a server acknowlegement.
14501    -1  *
14502    -1  * @param {Object} packet
14503    -1  * @api private
14504    -1  */
14505    -1 
14506    -1 Socket.prototype.onack = function (packet) {
14507    -1   var ack = this.acks[packet.id];
14508    -1   if ('function' === typeof ack) {
14509    -1     debug('calling ack %s with %j', packet.id, packet.data);
14510    -1     ack.apply(this, packet.data);
14511    -1     delete this.acks[packet.id];
14512    -1   } else {
14513    -1     debug('bad ack %s', packet.id);
14514    -1   }
14515    -1 };
14516    -1 
14517    -1 /**
14518    -1  * Called upon server connect.
14519    -1  *
14520    -1  * @api private
14521    -1  */
14522    -1 
14523    -1 Socket.prototype.onconnect = function () {
14524    -1   this.connected = true;
14525    -1   this.disconnected = false;
14526    -1   this.emit('connect');
14527    -1   this.emitBuffered();
14528    -1 };
14529    -1 
14530    -1 /**
14531    -1  * Emit buffered events (received and emitted).
14532    -1  *
14533    -1  * @api private
14534    -1  */
14535    -1 
14536    -1 Socket.prototype.emitBuffered = function () {
14537    -1   var i;
14538    -1   for (i = 0; i < this.receiveBuffer.length; i++) {
14539    -1     emit.apply(this, this.receiveBuffer[i]);
14540    -1   }
14541    -1   this.receiveBuffer = [];
14542    -1 
14543    -1   for (i = 0; i < this.sendBuffer.length; i++) {
14544    -1     this.packet(this.sendBuffer[i]);
14545    -1   }
14546    -1   this.sendBuffer = [];
14547    -1 };
14548    -1 
14549    -1 /**
14550    -1  * Called upon server disconnect.
14551    -1  *
14552    -1  * @api private
14553    -1  */
14554    -1 
14555    -1 Socket.prototype.ondisconnect = function () {
14556    -1   debug('server disconnect (%s)', this.nsp);
14557    -1   this.destroy();
14558    -1   this.onclose('io server disconnect');
14559    -1 };
14560    -1 
14561    -1 /**
14562    -1  * Called upon forced client/server side disconnections,
14563    -1  * this method ensures the manager stops tracking us and
14564    -1  * that reconnections don't get triggered for this.
14565    -1  *
14566    -1  * @api private.
14567    -1  */
14568    -1 
14569    -1 Socket.prototype.destroy = function () {
14570    -1   if (this.subs) {
14571    -1     // clean subscriptions to avoid reconnections
14572    -1     for (var i = 0; i < this.subs.length; i++) {
14573    -1       this.subs[i].destroy();
14574    -1     }
14575    -1     this.subs = null;
14576    -1   }
14577    -1 
14578    -1   this.io.destroy(this);
14579    -1 };
14580    -1 
14581    -1 /**
14582    -1  * Disconnects the socket manually.
14583    -1  *
14584    -1  * @return {Socket} self
14585    -1  * @api public
14586    -1  */
14587    -1 
14588    -1 Socket.prototype.close =
14589    -1 Socket.prototype.disconnect = function () {
14590    -1   if (this.connected) {
14591    -1     debug('performing disconnect (%s)', this.nsp);
14592    -1     this.packet({ type: parser.DISCONNECT });
14593    -1   }
14594    -1 
14595    -1   // remove socket from pool
14596    -1   this.destroy();
14597    -1 
14598    -1   if (this.connected) {
14599    -1     // fire events
14600    -1     this.onclose('io client disconnect');
14601    -1   }
14602    -1   return this;
14603    -1 };
14604    -1 
14605    -1 /**
14606    -1  * Sets the compress flag.
14607    -1  *
14608    -1  * @param {Boolean} if `true`, compresses the sending data
14609    -1  * @return {Socket} self
14610    -1  * @api public
14611    -1  */
14612    -1 
14613    -1 Socket.prototype.compress = function (compress) {
14614    -1   this.flags = this.flags || {};
14615    -1   this.flags.compress = compress;
14616    -1   return this;
14617    -1 };
14618    -1 
14619    -1 },{"./on":99,"component-bind":9,"component-emitter":102,"debug":103,"has-binary":29,"socket.io-parser":107,"to-array":112}],101:[function(require,module,exports){
14620    -1 (function (global){
14621    -1 
14622    -1 /**
14623    -1  * Module dependencies.
14624    -1  */
14625    -1 
14626    -1 var parseuri = require('parseuri');
14627    -1 var debug = require('debug')('socket.io-client:url');
14628    -1 
14629    -1 /**
14630    -1  * Module exports.
14631    -1  */
14632    -1 
14633    -1 module.exports = url;
14634    -1 
14635    -1 /**
14636    -1  * URL parser.
14637    -1  *
14638    -1  * @param {String} url
14639    -1  * @param {Object} An object meant to mimic window.location.
14640    -1  *                 Defaults to window.location.
14641    -1  * @api public
14642    -1  */
14643    -1 
14644    -1 function url (uri, loc) {
14645    -1   var obj = uri;
14646    -1 
14647    -1   // default to window.location
14648    -1   loc = loc || global.location;
14649    -1   if (null == uri) uri = loc.protocol + '//' + loc.host;
14650    -1 
14651    -1   // relative path support
14652    -1   if ('string' === typeof uri) {
14653    -1     if ('/' === uri.charAt(0)) {
14654    -1       if ('/' === uri.charAt(1)) {
14655    -1         uri = loc.protocol + uri;
14656    -1       } else {
14657    -1         uri = loc.host + uri;
14658    -1       }
14659    -1     }
14660    -1 
14661    -1     if (!/^(https?|wss?):\/\//.test(uri)) {
14662    -1       debug('protocol-less url %s', uri);
14663    -1       if ('undefined' !== typeof loc) {
14664    -1         uri = loc.protocol + '//' + uri;
14665    -1       } else {
14666    -1         uri = 'https://' + uri;
14667    -1       }
14668    -1     }
14669    -1 
14670    -1     // parse
14671    -1     debug('parse %s', uri);
14672    -1     obj = parseuri(uri);
14673    -1   }
14674    -1 
14675    -1   // make sure we treat `localhost:80` and `localhost` equally
14676    -1   if (!obj.port) {
14677    -1     if (/^(http|ws)$/.test(obj.protocol)) {
14678    -1       obj.port = '80';
14679    -1     } else if (/^(http|ws)s$/.test(obj.protocol)) {
14680    -1       obj.port = '443';
14681    -1     }
14682    -1   }
14683    -1 
14684    -1   obj.path = obj.path || '/';
14685    -1 
14686    -1   var ipv6 = obj.host.indexOf(':') !== -1;
14687    -1   var host = ipv6 ? '[' + obj.host + ']' : obj.host;
14688    -1 
14689    -1   // define unique id
14690    -1   obj.id = obj.protocol + '://' + host + ':' + obj.port;
14691    -1   // define href
14692    -1   obj.href = obj.protocol + '://' + host + (loc && loc.port === obj.port ? '' : (':' + obj.port));
14693    -1 
14694    -1   return obj;
14695    -1 }
14696    -1 
14697    -1 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
14698    -1 },{"debug":103,"parseuri":95}],102:[function(require,module,exports){
14699    -1 arguments[4][22][0].apply(exports,arguments)
14700    -1 },{"dup":22}],103:[function(require,module,exports){
14701    -1 arguments[4][23][0].apply(exports,arguments)
14702    -1 },{"./debug":104,"_process":2,"dup":23}],104:[function(require,module,exports){
14703    -1 arguments[4][24][0].apply(exports,arguments)
14704    -1 },{"dup":24,"ms":105}],105:[function(require,module,exports){
14705    -1 arguments[4][25][0].apply(exports,arguments)
14706    -1 },{"dup":25}],106:[function(require,module,exports){
14707    -1 (function (global){
14708    -1 /*global Blob,File*/
14709    -1 
14710    -1 /**
14711    -1  * Module requirements
14712    -1  */
14713    -1 
14714    -1 var isArray = require('isarray');
14715    -1 var isBuf = require('./is-buffer');
14716    -1 
14717    -1 /**
14718    -1  * Replaces every Buffer | ArrayBuffer in packet with a numbered placeholder.
14719    -1  * Anything with blobs or files should be fed through removeBlobs before coming
14720    -1  * here.
14721    -1  *
14722    -1  * @param {Object} packet - socket.io event packet
14723    -1  * @return {Object} with deconstructed packet and list of buffers
14724    -1  * @api public
14725    -1  */
14726    -1 
14727    -1 exports.deconstructPacket = function(packet){
14728    -1   var buffers = [];
14729    -1   var packetData = packet.data;
14730    -1 
14731    -1   function _deconstructPacket(data) {
14732    -1     if (!data) return data;
14733    -1 
14734    -1     if (isBuf(data)) {
14735    -1       var placeholder = { _placeholder: true, num: buffers.length };
14736    -1       buffers.push(data);
14737    -1       return placeholder;
14738    -1     } else if (isArray(data)) {
14739    -1       var newData = new Array(data.length);
14740    -1       for (var i = 0; i < data.length; i++) {
14741    -1         newData[i] = _deconstructPacket(data[i]);
14742    -1       }
14743    -1       return newData;
14744    -1     } else if ('object' == typeof data && !(data instanceof Date)) {
14745    -1       var newData = {};
14746    -1       for (var key in data) {
14747    -1         newData[key] = _deconstructPacket(data[key]);
14748    -1       }
14749    -1       return newData;
14750    -1     }
14751    -1     return data;
14752    -1   }
14753    -1 
14754    -1   var pack = packet;
14755    -1   pack.data = _deconstructPacket(packetData);
14756    -1   pack.attachments = buffers.length; // number of binary 'attachments'
14757    -1   return {packet: pack, buffers: buffers};
14758    -1 };
14759    -1 
14760    -1 /**
14761    -1  * Reconstructs a binary packet from its placeholder packet and buffers
14762    -1  *
14763    -1  * @param {Object} packet - event packet with placeholders
14764    -1  * @param {Array} buffers - binary buffers to put in placeholder positions
14765    -1  * @return {Object} reconstructed packet
14766    -1  * @api public
14767    -1  */
14768    -1 
14769    -1 exports.reconstructPacket = function(packet, buffers) {
14770    -1   var curPlaceHolder = 0;
14771    -1 
14772    -1   function _reconstructPacket(data) {
14773    -1     if (data && data._placeholder) {
14774    -1       var buf = buffers[data.num]; // appropriate buffer (should be natural order anyway)
14775    -1       return buf;
14776    -1     } else if (isArray(data)) {
14777    -1       for (var i = 0; i < data.length; i++) {
14778    -1         data[i] = _reconstructPacket(data[i]);
14779    -1       }
14780    -1       return data;
14781    -1     } else if (data && 'object' == typeof data) {
14782    -1       for (var key in data) {
14783    -1         data[key] = _reconstructPacket(data[key]);
14784    -1       }
14785    -1       return data;
14786    -1     }
14787    -1     return data;
14788    -1   }
14789    -1 
14790    -1   packet.data = _reconstructPacket(packet.data);
14791    -1   packet.attachments = undefined; // no longer useful
14792    -1   return packet;
14793    -1 };
14794    -1 
14795    -1 /**
14796    -1  * Asynchronously removes Blobs or Files from data via
14797    -1  * FileReader's readAsArrayBuffer method. Used before encoding
14798    -1  * data as msgpack. Calls callback with the blobless data.
14799    -1  *
14800    -1  * @param {Object} data
14801    -1  * @param {Function} callback
14802    -1  * @api private
14803    -1  */
14804    -1 
14805    -1 exports.removeBlobs = function(data, callback) {
14806    -1   function _removeBlobs(obj, curKey, containingObject) {
14807    -1     if (!obj) return obj;
14808    -1 
14809    -1     // convert any blob
14810    -1     if ((global.Blob && obj instanceof Blob) ||
14811    -1         (global.File && obj instanceof File)) {
14812    -1       pendingBlobs++;
14813    -1 
14814    -1       // async filereader
14815    -1       var fileReader = new FileReader();
14816    -1       fileReader.onload = function() { // this.result == arraybuffer
14817    -1         if (containingObject) {
14818    -1           containingObject[curKey] = this.result;
14819    -1         }
14820    -1         else {
14821    -1           bloblessData = this.result;
14822    -1         }
14823    -1 
14824    -1         // if nothing pending its callback time
14825    -1         if(! --pendingBlobs) {
14826    -1           callback(bloblessData);
14827    -1         }
14828    -1       };
14829    -1 
14830    -1       fileReader.readAsArrayBuffer(obj); // blob -> arraybuffer
14831    -1     } else if (isArray(obj)) { // handle array
14832    -1       for (var i = 0; i < obj.length; i++) {
14833    -1         _removeBlobs(obj[i], i, obj);
14834    -1       }
14835    -1     } else if (obj && 'object' == typeof obj && !isBuf(obj)) { // and object
14836    -1       for (var key in obj) {
14837    -1         _removeBlobs(obj[key], key, obj);
14838    -1       }
14839    -1     }
14840    -1   }
14841    -1 
14842    -1   var pendingBlobs = 0;
14843    -1   var bloblessData = data;
14844    -1   _removeBlobs(bloblessData);
14845    -1   if (!pendingBlobs) {
14846    -1     callback(bloblessData);
14847    -1   }
14848    -1 };
14849    -1 
14850    -1 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
14851    -1 },{"./is-buffer":108,"isarray":32}],107:[function(require,module,exports){
14852    -1 
14853    -1 /**
14854    -1  * Module dependencies.
14855    -1  */
14856    -1 
14857    -1 var debug = require('debug')('socket.io-parser');
14858    -1 var json = require('json3');
14859    -1 var Emitter = require('component-emitter');
14860    -1 var binary = require('./binary');
14861    -1 var isBuf = require('./is-buffer');
14862    -1 
14863    -1 /**
14864    -1  * Protocol version.
14865    -1  *
14866    -1  * @api public
14867    -1  */
14868    -1 
14869    -1 exports.protocol = 4;
14870    -1 
14871    -1 /**
14872    -1  * Packet types.
14873    -1  *
14874    -1  * @api public
14875    -1  */
14876    -1 
14877    -1 exports.types = [
14878    -1   'CONNECT',
14879    -1   'DISCONNECT',
14880    -1   'EVENT',
14881    -1   'ACK',
14882    -1   'ERROR',
14883    -1   'BINARY_EVENT',
14884    -1   'BINARY_ACK'
14885    -1 ];
14886    -1 
14887    -1 /**
14888    -1  * Packet type `connect`.
14889    -1  *
14890    -1  * @api public
14891    -1  */
14892    -1 
14893    -1 exports.CONNECT = 0;
14894    -1 
14895    -1 /**
14896    -1  * Packet type `disconnect`.
14897    -1  *
14898    -1  * @api public
14899    -1  */
14900    -1 
14901    -1 exports.DISCONNECT = 1;
14902    -1 
14903    -1 /**
14904    -1  * Packet type `event`.
14905    -1  *
14906    -1  * @api public
14907    -1  */
14908    -1 
14909    -1 exports.EVENT = 2;
14910    -1 
14911    -1 /**
14912    -1  * Packet type `ack`.
14913    -1  *
14914    -1  * @api public
14915    -1  */
14916    -1 
14917    -1 exports.ACK = 3;
14918    -1 
14919    -1 /**
14920    -1  * Packet type `error`.
14921    -1  *
14922    -1  * @api public
14923    -1  */
14924    -1 
14925    -1 exports.ERROR = 4;
14926    -1 
14927    -1 /**
14928    -1  * Packet type 'binary event'
14929    -1  *
14930    -1  * @api public
14931    -1  */
14932    -1 
14933    -1 exports.BINARY_EVENT = 5;
14934    -1 
14935    -1 /**
14936    -1  * Packet type `binary ack`. For acks with binary arguments.
14937    -1  *
14938    -1  * @api public
14939    -1  */
14940    -1 
14941    -1 exports.BINARY_ACK = 6;
14942    -1 
14943    -1 /**
14944    -1  * Encoder constructor.
14945    -1  *
14946    -1  * @api public
14947    -1  */
14948    -1 
14949    -1 exports.Encoder = Encoder;
14950    -1 
14951    -1 /**
14952    -1  * Decoder constructor.
14953    -1  *
14954    -1  * @api public
14955    -1  */
14956    -1 
14957    -1 exports.Decoder = Decoder;
14958    -1 
14959    -1 /**
14960    -1  * A socket.io Encoder instance
14961    -1  *
14962    -1  * @api public
14963    -1  */
14964    -1 
14965    -1 function Encoder() {}
14966    -1 
14967    -1 /**
14968    -1  * Encode a packet as a single string if non-binary, or as a
14969    -1  * buffer sequence, depending on packet type.
14970    -1  *
14971    -1  * @param {Object} obj - packet object
14972    -1  * @param {Function} callback - function to handle encodings (likely engine.write)
14973    -1  * @return Calls callback with Array of encodings
14974    -1  * @api public
14975    -1  */
14976    -1 
14977    -1 Encoder.prototype.encode = function(obj, callback){
14978    -1   debug('encoding packet %j', obj);
14979    -1 
14980    -1   if (exports.BINARY_EVENT == obj.type || exports.BINARY_ACK == obj.type) {
14981    -1     encodeAsBinary(obj, callback);
14982    -1   }
14983    -1   else {
14984    -1     var encoding = encodeAsString(obj);
14985    -1     callback([encoding]);
14986    -1   }
14987    -1 };
14988    -1 
14989    -1 /**
14990    -1  * Encode packet as string.
14991    -1  *
14992    -1  * @param {Object} packet
14993    -1  * @return {String} encoded
14994    -1  * @api private
14995    -1  */
14996    -1 
14997    -1 function encodeAsString(obj) {
14998    -1   var str = '';
14999    -1   var nsp = false;
15000    -1 
15001    -1   // first is type
15002    -1   str += obj.type;
15003    -1 
15004    -1   // attachments if we have them
15005    -1   if (exports.BINARY_EVENT == obj.type || exports.BINARY_ACK == obj.type) {
15006    -1     str += obj.attachments;
15007    -1     str += '-';
15008    -1   }
15009    -1 
15010    -1   // if we have a namespace other than `/`
15011    -1   // we append it followed by a comma `,`
15012    -1   if (obj.nsp && '/' != obj.nsp) {
15013    -1     nsp = true;
15014    -1     str += obj.nsp;
15015    -1   }
15016    -1 
15017    -1   // immediately followed by the id
15018    -1   if (null != obj.id) {
15019    -1     if (nsp) {
15020    -1       str += ',';
15021    -1       nsp = false;
15022    -1     }
15023    -1     str += obj.id;
15024    -1   }
15025    -1 
15026    -1   // json data
15027    -1   if (null != obj.data) {
15028    -1     if (nsp) str += ',';
15029    -1     str += json.stringify(obj.data);
15030    -1   }
15031    -1 
15032    -1   debug('encoded %j as %s', obj, str);
15033    -1   return str;
15034    -1 }
15035    -1 
15036    -1 /**
15037    -1  * Encode packet as 'buffer sequence' by removing blobs, and
15038    -1  * deconstructing packet into object with placeholders and
15039    -1  * a list of buffers.
15040    -1  *
15041    -1  * @param {Object} packet
15042    -1  * @return {Buffer} encoded
15043    -1  * @api private
15044    -1  */
15045    -1 
15046    -1 function encodeAsBinary(obj, callback) {
15047    -1 
15048    -1   function writeEncoding(bloblessData) {
15049    -1     var deconstruction = binary.deconstructPacket(bloblessData);
15050    -1     var pack = encodeAsString(deconstruction.packet);
15051    -1     var buffers = deconstruction.buffers;
15052    -1 
15053    -1     buffers.unshift(pack); // add packet info to beginning of data list
15054    -1     callback(buffers); // write all the buffers
15055    -1   }
15056    -1 
15057    -1   binary.removeBlobs(obj, writeEncoding);
15058    -1 }
15059    -1 
15060    -1 /**
15061    -1  * A socket.io Decoder instance
15062    -1  *
15063    -1  * @return {Object} decoder
15064    -1  * @api public
15065    -1  */
15066    -1 
15067    -1 function Decoder() {
15068    -1   this.reconstructor = null;
15069    -1 }
15070    -1 
15071    -1 /**
15072    -1  * Mix in `Emitter` with Decoder.
15073    -1  */
15074    -1 
15075    -1 Emitter(Decoder.prototype);
15076    -1 
15077    -1 /**
15078    -1  * Decodes an ecoded packet string into packet JSON.
15079    -1  *
15080    -1  * @param {String} obj - encoded packet
15081    -1  * @return {Object} packet
15082    -1  * @api public
15083    -1  */
15084    -1 
15085    -1 Decoder.prototype.add = function(obj) {
15086    -1   var packet;
15087    -1   if ('string' == typeof obj) {
15088    -1     packet = decodeString(obj);
15089    -1     if (exports.BINARY_EVENT == packet.type || exports.BINARY_ACK == packet.type) { // binary packet's json
15090    -1       this.reconstructor = new BinaryReconstructor(packet);
15091    -1 
15092    -1       // no attachments, labeled binary but no binary data to follow
15093    -1       if (this.reconstructor.reconPack.attachments === 0) {
15094    -1         this.emit('decoded', packet);
15095    -1       }
15096    -1     } else { // non-binary full packet
15097    -1       this.emit('decoded', packet);
15098    -1     }
15099    -1   }
15100    -1   else if (isBuf(obj) || obj.base64) { // raw binary data
15101    -1     if (!this.reconstructor) {
15102    -1       throw new Error('got binary data when not reconstructing a packet');
15103    -1     } else {
15104    -1       packet = this.reconstructor.takeBinaryData(obj);
15105    -1       if (packet) { // received final buffer
15106    -1         this.reconstructor = null;
15107    -1         this.emit('decoded', packet);
15108    -1       }
15109    -1     }
15110    -1   }
15111    -1   else {
15112    -1     throw new Error('Unknown type: ' + obj);
15113    -1   }
15114    -1 };
15115    -1 
15116    -1 /**
15117    -1  * Decode a packet String (JSON data)
15118    -1  *
15119    -1  * @param {String} str
15120    -1  * @return {Object} packet
15121    -1  * @api private
15122    -1  */
15123    -1 
15124    -1 function decodeString(str) {
15125    -1   var p = {};
15126    -1   var i = 0;
15127    -1 
15128    -1   // look up type
15129    -1   p.type = Number(str.charAt(0));
15130    -1   if (null == exports.types[p.type]) return error();
15131    -1 
15132    -1   // look up attachments if type binary
15133    -1   if (exports.BINARY_EVENT == p.type || exports.BINARY_ACK == p.type) {
15134    -1     var buf = '';
15135    -1     while (str.charAt(++i) != '-') {
15136    -1       buf += str.charAt(i);
15137    -1       if (i == str.length) break;
15138    -1     }
15139    -1     if (buf != Number(buf) || str.charAt(i) != '-') {
15140    -1       throw new Error('Illegal attachments');
15141    -1     }
15142    -1     p.attachments = Number(buf);
15143    -1   }
15144    -1 
15145    -1   // look up namespace (if any)
15146    -1   if ('/' == str.charAt(i + 1)) {
15147    -1     p.nsp = '';
15148    -1     while (++i) {
15149    -1       var c = str.charAt(i);
15150    -1       if (',' == c) break;
15151    -1       p.nsp += c;
15152    -1       if (i == str.length) break;
15153    -1     }
15154    -1   } else {
15155    -1     p.nsp = '/';
15156    -1   }
15157    -1 
15158    -1   // look up id
15159    -1   var next = str.charAt(i + 1);
15160    -1   if ('' !== next && Number(next) == next) {
15161    -1     p.id = '';
15162    -1     while (++i) {
15163    -1       var c = str.charAt(i);
15164    -1       if (null == c || Number(c) != c) {
15165    -1         --i;
15166    -1         break;
15167    -1       }
15168    -1       p.id += str.charAt(i);
15169    -1       if (i == str.length) break;
15170    -1     }
15171    -1     p.id = Number(p.id);
15172    -1   }
15173    -1 
15174    -1   // look up json data
15175    -1   if (str.charAt(++i)) {
15176    -1     p = tryParse(p, str.substr(i));
15177    -1   }
15178    -1 
15179    -1   debug('decoded %s as %j', str, p);
15180    -1   return p;
15181    -1 }
15182    -1 
15183    -1 function tryParse(p, str) {
15184    -1   try {
15185    -1     p.data = json.parse(str);
15186    -1   } catch(e){
15187    -1     return error();
15188    -1   }
15189    -1   return p; 
15190    -1 };
15191    -1 
15192    -1 /**
15193    -1  * Deallocates a parser's resources
15194    -1  *
15195    -1  * @api public
15196    -1  */
15197    -1 
15198    -1 Decoder.prototype.destroy = function() {
15199    -1   if (this.reconstructor) {
15200    -1     this.reconstructor.finishedReconstruction();
15201    -1   }
15202    -1 };
15203    -1 
15204    -1 /**
15205    -1  * A manager of a binary event's 'buffer sequence'. Should
15206    -1  * be constructed whenever a packet of type BINARY_EVENT is
15207    -1  * decoded.
15208    -1  *
15209    -1  * @param {Object} packet
15210    -1  * @return {BinaryReconstructor} initialized reconstructor
15211    -1  * @api private
15212    -1  */
15213    -1 
15214    -1 function BinaryReconstructor(packet) {
15215    -1   this.reconPack = packet;
15216    -1   this.buffers = [];
15217    -1 }
15218    -1 
15219    -1 /**
15220    -1  * Method to be called when binary data received from connection
15221    -1  * after a BINARY_EVENT packet.
15222    -1  *
15223    -1  * @param {Buffer | ArrayBuffer} binData - the raw binary data received
15224    -1  * @return {null | Object} returns null if more binary data is expected or
15225    -1  *   a reconstructed packet object if all buffers have been received.
15226    -1  * @api private
15227    -1  */
15228    -1 
15229    -1 BinaryReconstructor.prototype.takeBinaryData = function(binData) {
15230    -1   this.buffers.push(binData);
15231    -1   if (this.buffers.length == this.reconPack.attachments) { // done with buffer list
15232    -1     var packet = binary.reconstructPacket(this.reconPack, this.buffers);
15233    -1     this.finishedReconstruction();
15234    -1     return packet;
15235    -1   }
15236    -1   return null;
15237    -1 };
15238    -1 
15239    -1 /**
15240    -1  * Cleans up binary packet reconstruction variables.
15241    -1  *
15242    -1  * @api private
15243    -1  */
15244    -1 
15245    -1 BinaryReconstructor.prototype.finishedReconstruction = function() {
15246    -1   this.reconPack = null;
15247    -1   this.buffers = [];
15248    -1 };
15249    -1 
15250    -1 function error(data){
15251    -1   return {
15252    -1     type: exports.ERROR,
15253    -1     data: 'parser error'
15254    -1   };
15255    -1 }
15256    -1 
15257    -1 },{"./binary":106,"./is-buffer":108,"component-emitter":10,"debug":109,"json3":33}],108:[function(require,module,exports){
15258    -1 (function (global){
15259    -1 
15260    -1 module.exports = isBuf;
15261    -1 
15262    -1 /**
15263    -1  * Returns true if obj is a buffer or an arraybuffer.
15264    -1  *
15265    -1  * @api private
15266    -1  */
15267    -1 
15268    -1 function isBuf(obj) {
15269    -1   return (global.Buffer && global.Buffer.isBuffer(obj)) ||
15270    -1          (global.ArrayBuffer && obj instanceof ArrayBuffer);
15271    -1 }
15272    -1 
15273    -1 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
15274    -1 },{}],109:[function(require,module,exports){
15275    -1 
15276    -1 /**
15277    -1  * This is the web browser implementation of `debug()`.
15278    -1  *
15279    -1  * Expose `debug()` as the module.
15280    -1  */
15281    -1 
15282    -1 exports = module.exports = require('./debug');
15283    -1 exports.log = log;
15284    -1 exports.formatArgs = formatArgs;
15285    -1 exports.save = save;
15286    -1 exports.load = load;
15287    -1 exports.useColors = useColors;
15288    -1 exports.storage = 'undefined' != typeof chrome
15289    -1                && 'undefined' != typeof chrome.storage
15290    -1                   ? chrome.storage.local
15291    -1                   : localstorage();
15292    -1 
15293    -1 /**
15294    -1  * Colors.
15295    -1  */
15296    -1 
15297    -1 exports.colors = [
15298    -1   'lightseagreen',
15299    -1   'forestgreen',
15300    -1   'goldenrod',
15301    -1   'dodgerblue',
15302    -1   'darkorchid',
15303    -1   'crimson'
15304    -1 ];
15305    -1 
15306    -1 /**
15307    -1  * Currently only WebKit-based Web Inspectors, Firefox >= v31,
15308    -1  * and the Firebug extension (any Firefox version) are known
15309    -1  * to support "%c" CSS customizations.
15310    -1  *
15311    -1  * TODO: add a `localStorage` variable to explicitly enable/disable colors
15312    -1  */
15313    -1 
15314    -1 function useColors() {
15315    -1   // is webkit? http://stackoverflow.com/a/16459606/376773
15316    -1   return ('WebkitAppearance' in document.documentElement.style) ||
15317    -1     // is firebug? http://stackoverflow.com/a/398120/376773
15318    -1     (window.console && (console.firebug || (console.exception && console.table))) ||
15319    -1     // is firefox >= v31?
15320    -1     // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
15321    -1     (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31);
15322    -1 }
15323    -1 
15324    -1 /**
15325    -1  * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
15326    -1  */
15327    -1 
15328    -1 exports.formatters.j = function(v) {
15329    -1   return JSON.stringify(v);
15330    -1 };
15331    -1 
15332    -1 
15333    -1 /**
15334    -1  * Colorize log arguments if enabled.
15335    -1  *
15336    -1  * @api public
15337    -1  */
15338    -1 
15339    -1 function formatArgs() {
15340    -1   var args = arguments;
15341    -1   var useColors = this.useColors;
15342    -1 
15343    -1   args[0] = (useColors ? '%c' : '')
15344    -1     + this.namespace
15345    -1     + (useColors ? ' %c' : ' ')
15346    -1     + args[0]
15347    -1     + (useColors ? '%c ' : ' ')
15348    -1     + '+' + exports.humanize(this.diff);
15349    -1 
15350    -1   if (!useColors) return args;
15351    -1 
15352    -1   var c = 'color: ' + this.color;
15353    -1   args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1));
15354    -1 
15355    -1   // the final "%c" is somewhat tricky, because there could be other
15356    -1   // arguments passed either before or after the %c, so we need to
15357    -1   // figure out the correct index to insert the CSS into
15358    -1   var index = 0;
15359    -1   var lastC = 0;
15360    -1   args[0].replace(/%[a-z%]/g, function(match) {
15361    -1     if ('%%' === match) return;
15362    -1     index++;
15363    -1     if ('%c' === match) {
15364    -1       // we only are interested in the *last* %c
15365    -1       // (the user may have provided their own)
15366    -1       lastC = index;
15367    -1     }
15368    -1   });
15369    -1 
15370    -1   args.splice(lastC, 0, c);
15371    -1   return args;
15372    -1 }
15373    -1 
15374    -1 /**
15375    -1  * Invokes `console.log()` when available.
15376    -1  * No-op when `console.log` is not a "function".
15377    -1  *
15378    -1  * @api public
15379    -1  */
15380    -1 
15381    -1 function log() {
15382    -1   // this hackery is required for IE8/9, where
15383    -1   // the `console.log` function doesn't have 'apply'
15384    -1   return 'object' === typeof console
15385    -1     && console.log
15386    -1     && Function.prototype.apply.call(console.log, console, arguments);
15387    -1 }
15388    -1 
15389    -1 /**
15390    -1  * Save `namespaces`.
15391    -1  *
15392    -1  * @param {String} namespaces
15393    -1  * @api private
15394    -1  */
15395    -1 
15396    -1 function save(namespaces) {
15397    -1   try {
15398    -1     if (null == namespaces) {
15399    -1       exports.storage.removeItem('debug');
15400    -1     } else {
15401    -1       exports.storage.debug = namespaces;
15402    -1     }
15403    -1   } catch(e) {}
15404    -1 }
15405    -1 
15406    -1 /**
15407    -1  * Load `namespaces`.
15408    -1  *
15409    -1  * @return {String} returns the previously persisted debug modes
15410    -1  * @api private
15411    -1  */
15412    -1 
15413    -1 function load() {
15414    -1   var r;
15415    -1   try {
15416    -1     r = exports.storage.debug;
15417    -1   } catch(e) {}
15418    -1   return r;
15419    -1 }
15420    -1 
15421    -1 /**
15422    -1  * Enable namespaces listed in `localStorage.debug` initially.
15423    -1  */
15424    -1 
15425    -1 exports.enable(load());
15426    -1 
15427    -1 /**
15428    -1  * Localstorage attempts to return the localstorage.
15429    -1  *
15430    -1  * This is necessary because safari throws
15431    -1  * when a user disables cookies/localstorage
15432    -1  * and you attempt to access it.
15433    -1  *
15434    -1  * @return {LocalStorage}
15435    -1  * @api private
15436    -1  */
15437    -1 
15438    -1 function localstorage(){
15439    -1   try {
15440    -1     return window.localStorage;
15441    -1   } catch (e) {}
15442    -1 }
15443    -1 
15444    -1 },{"./debug":110}],110:[function(require,module,exports){
15445    -1 
15446    -1 /**
15447    -1  * This is the common logic for both the Node.js and web browser
15448    -1  * implementations of `debug()`.
15449    -1  *
15450    -1  * Expose `debug()` as the module.
15451    -1  */
15452    -1 
15453    -1 exports = module.exports = debug;
15454    -1 exports.coerce = coerce;
15455    -1 exports.disable = disable;
15456    -1 exports.enable = enable;
15457    -1 exports.enabled = enabled;
15458    -1 exports.humanize = require('ms');
15459    -1 
15460    -1 /**
15461    -1  * The currently active debug mode names, and names to skip.
15462    -1  */
15463    -1 
15464    -1 exports.names = [];
15465    -1 exports.skips = [];
15466    -1 
15467    -1 /**
15468    -1  * Map of special "%n" handling functions, for the debug "format" argument.
15469    -1  *
15470    -1  * Valid key names are a single, lowercased letter, i.e. "n".
15471    -1  */
15472    -1 
15473    -1 exports.formatters = {};
15474    -1 
15475    -1 /**
15476    -1  * Previously assigned color.
15477    -1  */
15478    -1 
15479    -1 var prevColor = 0;
15480    -1 
15481    -1 /**
15482    -1  * Previous log timestamp.
15483    -1  */
15484    -1 
15485    -1 var prevTime;
15486    -1 
15487    -1 /**
15488    -1  * Select a color.
15489    -1  *
15490    -1  * @return {Number}
15491    -1  * @api private
15492    -1  */
15493    -1 
15494    -1 function selectColor() {
15495    -1   return exports.colors[prevColor++ % exports.colors.length];
15496    -1 }
15497    -1 
15498    -1 /**
15499    -1  * Create a debugger with the given `namespace`.
15500    -1  *
15501    -1  * @param {String} namespace
15502    -1  * @return {Function}
15503    -1  * @api public
15504    -1  */
15505    -1 
15506    -1 function debug(namespace) {
15507    -1 
15508    -1   // define the `disabled` version
15509    -1   function disabled() {
15510    -1   }
15511    -1   disabled.enabled = false;
15512    -1 
15513    -1   // define the `enabled` version
15514    -1   function enabled() {
15515    -1 
15516    -1     var self = enabled;
15517    -1 
15518    -1     // set `diff` timestamp
15519    -1     var curr = +new Date();
15520    -1     var ms = curr - (prevTime || curr);
15521    -1     self.diff = ms;
15522    -1     self.prev = prevTime;
15523    -1     self.curr = curr;
15524    -1     prevTime = curr;
15525    -1 
15526    -1     // add the `color` if not set
15527    -1     if (null == self.useColors) self.useColors = exports.useColors();
15528    -1     if (null == self.color && self.useColors) self.color = selectColor();
15529    -1 
15530    -1     var args = Array.prototype.slice.call(arguments);
15531    -1 
15532    -1     args[0] = exports.coerce(args[0]);
15533    -1 
15534    -1     if ('string' !== typeof args[0]) {
15535    -1       // anything else let's inspect with %o
15536    -1       args = ['%o'].concat(args);
15537    -1     }
15538    -1 
15539    -1     // apply any `formatters` transformations
15540    -1     var index = 0;
15541    -1     args[0] = args[0].replace(/%([a-z%])/g, function(match, format) {
15542    -1       // if we encounter an escaped % then don't increase the array index
15543    -1       if (match === '%%') return match;
15544    -1       index++;
15545    -1       var formatter = exports.formatters[format];
15546    -1       if ('function' === typeof formatter) {
15547    -1         var val = args[index];
15548    -1         match = formatter.call(self, val);
15549    -1 
15550    -1         // now we need to remove `args[index]` since it's inlined in the `format`
15551    -1         args.splice(index, 1);
15552    -1         index--;
15553    -1       }
15554    -1       return match;
15555    -1     });
15556    -1 
15557    -1     if ('function' === typeof exports.formatArgs) {
15558    -1       args = exports.formatArgs.apply(self, args);
15559    -1     }
15560    -1     var logFn = enabled.log || exports.log || console.log.bind(console);
15561    -1     logFn.apply(self, args);
15562    -1   }
15563    -1   enabled.enabled = true;
15564    -1 
15565    -1   var fn = exports.enabled(namespace) ? enabled : disabled;
15566    -1 
15567    -1   fn.namespace = namespace;
15568    -1 
15569    -1   return fn;
15570    -1 }
15571    -1 
15572    -1 /**
15573    -1  * Enables a debug mode by namespaces. This can include modes
15574    -1  * separated by a colon and wildcards.
15575    -1  *
15576    -1  * @param {String} namespaces
15577    -1  * @api public
15578    -1  */
15579    -1 
15580    -1 function enable(namespaces) {
15581    -1   exports.save(namespaces);
15582    -1 
15583    -1   var split = (namespaces || '').split(/[\s,]+/);
15584    -1   var len = split.length;
15585    -1 
15586    -1   for (var i = 0; i < len; i++) {
15587    -1     if (!split[i]) continue; // ignore empty strings
15588    -1     namespaces = split[i].replace(/\*/g, '.*?');
15589    -1     if (namespaces[0] === '-') {
15590    -1       exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
15591    -1     } else {
15592    -1       exports.names.push(new RegExp('^' + namespaces + '$'));
15593    -1     }
15594    -1   }
15595    -1 }
15596    -1 
15597    -1 /**
15598    -1  * Disable debug output.
15599    -1  *
15600    -1  * @api public
15601    -1  */
15602    -1 
15603    -1 function disable() {
15604    -1   exports.enable('');
15605    -1 }
15606    -1 
15607    -1 /**
15608    -1  * Returns true if the given mode name is enabled, false otherwise.
15609    -1  *
15610    -1  * @param {String} name
15611    -1  * @return {Boolean}
15612    -1  * @api public
15613    -1  */
15614    -1 
15615    -1 function enabled(name) {
15616    -1   var i, len;
15617    -1   for (i = 0, len = exports.skips.length; i < len; i++) {
15618    -1     if (exports.skips[i].test(name)) {
15619    -1       return false;
15620    -1     }
15621    -1   }
15622    -1   for (i = 0, len = exports.names.length; i < len; i++) {
15623    -1     if (exports.names[i].test(name)) {
15624    -1       return true;
15625    -1     }
15626    -1   }
15627    -1   return false;
15628    -1 }
15629    -1 
15630    -1 /**
15631    -1  * Coerce `val`.
15632    -1  *
15633    -1  * @param {Mixed} val
15634    -1  * @return {Mixed}
15635    -1  * @api private
15636    -1  */
15637    -1 
15638    -1 function coerce(val) {
15639    -1   if (val instanceof Error) return val.stack || val.message;
15640    -1   return val;
15641    -1 }
15642    -1 
15643    -1 },{"ms":111}],111:[function(require,module,exports){
15644    -1 /**
15645    -1  * Helpers.
15646    -1  */
15647    -1 
15648    -1 var s = 1000;
15649    -1 var m = s * 60;
15650    -1 var h = m * 60;
15651    -1 var d = h * 24;
15652    -1 var y = d * 365.25;
15653    -1 
15654    -1 /**
15655    -1  * Parse or format the given `val`.
15656    -1  *
15657    -1  * Options:
15658    -1  *
15659    -1  *  - `long` verbose formatting [false]
15660    -1  *
15661    -1  * @param {String|Number} val
15662    -1  * @param {Object} options
15663    -1  * @return {String|Number}
15664    -1  * @api public
15665    -1  */
15666    -1 
15667    -1 module.exports = function(val, options){
15668    -1   options = options || {};
15669    -1   if ('string' == typeof val) return parse(val);
15670    -1   return options.long
15671    -1     ? long(val)
15672    -1     : short(val);
15673    -1 };
15674    -1 
15675    -1 /**
15676    -1  * Parse the given `str` and return milliseconds.
15677    -1  *
15678    -1  * @param {String} str
15679    -1  * @return {Number}
15680    -1  * @api private
15681    -1  */
15682    -1 
15683    -1 function parse(str) {
15684    -1   str = '' + str;
15685    -1   if (str.length > 10000) return;
15686    -1   var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);
15687    -1   if (!match) return;
15688    -1   var n = parseFloat(match[1]);
15689    -1   var type = (match[2] || 'ms').toLowerCase();
15690    -1   switch (type) {
15691    -1     case 'years':
15692    -1     case 'year':
15693    -1     case 'yrs':
15694    -1     case 'yr':
15695    -1     case 'y':
15696    -1       return n * y;
15697    -1     case 'days':
15698    -1     case 'day':
15699    -1     case 'd':
15700    -1       return n * d;
15701    -1     case 'hours':
15702    -1     case 'hour':
15703    -1     case 'hrs':
15704    -1     case 'hr':
15705    -1     case 'h':
15706    -1       return n * h;
15707    -1     case 'minutes':
15708    -1     case 'minute':
15709    -1     case 'mins':
15710    -1     case 'min':
15711    -1     case 'm':
15712    -1       return n * m;
15713    -1     case 'seconds':
15714    -1     case 'second':
15715    -1     case 'secs':
15716    -1     case 'sec':
15717    -1     case 's':
15718    -1       return n * s;
15719    -1     case 'milliseconds':
15720    -1     case 'millisecond':
15721    -1     case 'msecs':
15722    -1     case 'msec':
15723    -1     case 'ms':
15724    -1       return n;
15725    -1   }
15726    -1 }
15727    -1 
15728    -1 /**
15729    -1  * Short format for `ms`.
15730    -1  *
15731    -1  * @param {Number} ms
15732    -1  * @return {String}
15733    -1  * @api private
15734    -1  */
15735    -1 
15736    -1 function short(ms) {
15737    -1   if (ms >= d) return Math.round(ms / d) + 'd';
15738    -1   if (ms >= h) return Math.round(ms / h) + 'h';
15739    -1   if (ms >= m) return Math.round(ms / m) + 'm';
15740    -1   if (ms >= s) return Math.round(ms / s) + 's';
15741    -1   return ms + 'ms';
15742    -1 }
15743    -1 
15744    -1 /**
15745    -1  * Long format for `ms`.
15746    -1  *
15747    -1  * @param {Number} ms
15748    -1  * @return {String}
15749    -1  * @api private
15750    -1  */
15751    -1 
15752    -1 function long(ms) {
15753    -1   return plural(ms, d, 'day')
15754    -1     || plural(ms, h, 'hour')
15755    -1     || plural(ms, m, 'minute')
15756    -1     || plural(ms, s, 'second')
15757    -1     || ms + ' ms';
15758    -1 }
15759    -1 
15760    -1 /**
15761    -1  * Pluralization helper.
15762    -1  */
15763    -1 
15764    -1 function plural(ms, n, name) {
15765    -1   if (ms < n) return;
15766    -1   if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name;
15767    -1   return Math.ceil(ms / n) + ' ' + name + 's';
15768    -1 }
15769    -1 
15770    -1 },{}],112:[function(require,module,exports){
15771    -1 module.exports = toArray
15772    -1 
15773    -1 function toArray(list, index) {
15774    -1     var array = []
15775    -1 
15776    -1     index = index || 0
15777    -1 
15778    -1     for (var i = index || 0; i < list.length; i++) {
15779    -1         array[i - index] = list[i]
15780    -1     }
15781    -1 
15782    -1     return array
15783    -1 }
15784    -1 
15785    -1 },{}],113:[function(require,module,exports){
15786    -1 module.exports=/[\0-\x1F\x7F-\x9F]/
15787    -1 },{}],114:[function(require,module,exports){
15788    -1 module.exports=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804\uDCBD|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/
15789    -1 },{}],115:[function(require,module,exports){
15790    -1 module.exports=/[!-#%-\*,-/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E44\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD807[\uDC41-\uDC45\uDC70\uDC71]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/
15791    -1 },{}],116:[function(require,module,exports){
15792    -1 module.exports=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/
15793    -1 },{}],117:[function(require,module,exports){
15794    -1 'use strict';
15795    -1 
15796    -1 exports.Any = require('./properties/Any/regex');
15797    -1 exports.Cc  = require('./categories/Cc/regex');
15798    -1 exports.Cf  = require('./categories/Cf/regex');
15799    -1 exports.P   = require('./categories/P/regex');
15800    -1 exports.Z   = require('./categories/Z/regex');
15801    -1 
15802    -1 },{"./categories/Cc/regex":113,"./categories/Cf/regex":114,"./categories/P/regex":115,"./categories/Z/regex":116,"./properties/Any/regex":118}],118:[function(require,module,exports){
15803    -1 module.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/
15804    -1 },{}],119:[function(require,module,exports){
15805    -1 (function (global){
15806    -1 /*! https://mths.be/wtf8 v1.0.0 by @mathias */
15807    -1 ;(function(root) {
15808    -1 
15809    -1 	// Detect free variables `exports`
15810    -1 	var freeExports = typeof exports == 'object' && exports;
15811    -1 
15812    -1 	// Detect free variable `module`
15813    -1 	var freeModule = typeof module == 'object' && module &&
15814    -1 		module.exports == freeExports && module;
15815    -1 
15816    -1 	// Detect free variable `global`, from Node.js or Browserified code,
15817    -1 	// and use it as `root`
15818    -1 	var freeGlobal = typeof global == 'object' && global;
15819    -1 	if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
15820    -1 		root = freeGlobal;
15821    -1 	}
15822    -1 
15823    -1 	/*--------------------------------------------------------------------------*/
15824    -1 
15825    -1 	var stringFromCharCode = String.fromCharCode;
15826    -1 
15827    -1 	// Taken from https://mths.be/punycode
15828    -1 	function ucs2decode(string) {
15829    -1 		var output = [];
15830    -1 		var counter = 0;
15831    -1 		var length = string.length;
15832    -1 		var value;
15833    -1 		var extra;
15834    -1 		while (counter < length) {
15835    -1 			value = string.charCodeAt(counter++);
15836    -1 			if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
15837    -1 				// high surrogate, and there is a next character
15838    -1 				extra = string.charCodeAt(counter++);
15839    -1 				if ((extra & 0xFC00) == 0xDC00) { // low surrogate
15840    -1 					output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
15841    -1 				} else {
15842    -1 					// unmatched surrogate; only append this code unit, in case the next
15843    -1 					// code unit is the high surrogate of a surrogate pair
15844    -1 					output.push(value);
15845    -1 					counter--;
15846    -1 				}
15847    -1 			} else {
15848    -1 				output.push(value);
15849    -1 			}
15850    -1 		}
15851    -1 		return output;
15852    -1 	}
15853    -1 
15854    -1 	// Taken from https://mths.be/punycode
15855    -1 	function ucs2encode(array) {
15856    -1 		var length = array.length;
15857    -1 		var index = -1;
15858    -1 		var value;
15859    -1 		var output = '';
15860    -1 		while (++index < length) {
15861    -1 			value = array[index];
15862    -1 			if (value > 0xFFFF) {
15863    -1 				value -= 0x10000;
15864    -1 				output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
15865    -1 				value = 0xDC00 | value & 0x3FF;
15866    -1 			}
15867    -1 			output += stringFromCharCode(value);
15868    -1 		}
15869    -1 		return output;
15870    -1 	}
15871    -1 
15872    -1 	/*--------------------------------------------------------------------------*/
15873    -1 
15874    -1 	function createByte(codePoint, shift) {
15875    -1 		return stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);
15876    -1 	}
15877    -1 
15878    -1 	function encodeCodePoint(codePoint) {
15879    -1 		if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence
15880    -1 			return stringFromCharCode(codePoint);
15881    -1 		}
15882    -1 		var symbol = '';
15883    -1 		if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence
15884    -1 			symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);
15885    -1 		}
15886    -1 		else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence
15887    -1 			symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);
15888    -1 			symbol += createByte(codePoint, 6);
15889    -1 		}
15890    -1 		else if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence
15891    -1 			symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);
15892    -1 			symbol += createByte(codePoint, 12);
15893    -1 			symbol += createByte(codePoint, 6);
15894    -1 		}
15895    -1 		symbol += stringFromCharCode((codePoint & 0x3F) | 0x80);
15896    -1 		return symbol;
15897    -1 	}
15898    -1 
15899    -1 	function wtf8encode(string) {
15900    -1 		var codePoints = ucs2decode(string);
15901    -1 		var length = codePoints.length;
15902    -1 		var index = -1;
15903    -1 		var codePoint;
15904    -1 		var byteString = '';
15905    -1 		while (++index < length) {
15906    -1 			codePoint = codePoints[index];
15907    -1 			byteString += encodeCodePoint(codePoint);
15908    -1 		}
15909    -1 		return byteString;
15910    -1 	}
15911    -1 
15912    -1 	/*--------------------------------------------------------------------------*/
15913    -1 
15914    -1 	function readContinuationByte() {
15915    -1 		if (byteIndex >= byteCount) {
15916    -1 			throw Error('Invalid byte index');
15917    -1 		}
15918    -1 
15919    -1 		var continuationByte = byteArray[byteIndex] & 0xFF;
15920    -1 		byteIndex++;
15921    -1 
15922    -1 		if ((continuationByte & 0xC0) == 0x80) {
15923    -1 			return continuationByte & 0x3F;
15924    -1 		}
15925    -1 
15926    -1 		// If we end up here, it’s not a continuation byte.
15927    -1 		throw Error('Invalid continuation byte');
15928    -1 	}
15929    -1 
15930    -1 	function decodeSymbol() {
15931    -1 		var byte1;
15932    -1 		var byte2;
15933    -1 		var byte3;
15934    -1 		var byte4;
15935    -1 		var codePoint;
15936    -1 
15937    -1 		if (byteIndex > byteCount) {
15938    -1 			throw Error('Invalid byte index');
15939    -1 		}
15940    -1 
15941    -1 		if (byteIndex == byteCount) {
15942    -1 			return false;
15943    -1 		}
15944    -1 
15945    -1 		// Read the first byte.
15946    -1 		byte1 = byteArray[byteIndex] & 0xFF;
15947    -1 		byteIndex++;
15948    -1 
15949    -1 		// 1-byte sequence (no continuation bytes)
15950    -1 		if ((byte1 & 0x80) == 0) {
15951    -1 			return byte1;
15952    -1 		}
15953    -1 
15954    -1 		// 2-byte sequence
15955    -1 		if ((byte1 & 0xE0) == 0xC0) {
15956    -1 			var byte2 = readContinuationByte();
15957    -1 			codePoint = ((byte1 & 0x1F) << 6) | byte2;
15958    -1 			if (codePoint >= 0x80) {
15959    -1 				return codePoint;
15960    -1 			} else {
15961    -1 				throw Error('Invalid continuation byte');
15962    -1 			}
15963    -1 		}
15964    -1 
15965    -1 		// 3-byte sequence (may include unpaired surrogates)
15966    -1 		if ((byte1 & 0xF0) == 0xE0) {
15967    -1 			byte2 = readContinuationByte();
15968    -1 			byte3 = readContinuationByte();
15969    -1 			codePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;
15970    -1 			if (codePoint >= 0x0800) {
15971    -1 				return codePoint;
15972    -1 			} else {
15973    -1 				throw Error('Invalid continuation byte');
15974    -1 			}
15975    -1 		}
15976    -1 
15977    -1 		// 4-byte sequence
15978    -1 		if ((byte1 & 0xF8) == 0xF0) {
15979    -1 			byte2 = readContinuationByte();
15980    -1 			byte3 = readContinuationByte();
15981    -1 			byte4 = readContinuationByte();
15982    -1 			codePoint = ((byte1 & 0x0F) << 0x12) | (byte2 << 0x0C) |
15983    -1 				(byte3 << 0x06) | byte4;
15984    -1 			if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {
15985    -1 				return codePoint;
15986    -1 			}
15987    -1 		}
15988    -1 
15989    -1 		throw Error('Invalid WTF-8 detected');
15990    -1 	}
15991    -1 
15992    -1 	var byteArray;
15993    -1 	var byteCount;
15994    -1 	var byteIndex;
15995    -1 	function wtf8decode(byteString) {
15996    -1 		byteArray = ucs2decode(byteString);
15997    -1 		byteCount = byteArray.length;
15998    -1 		byteIndex = 0;
15999    -1 		var codePoints = [];
16000    -1 		var tmp;
16001    -1 		while ((tmp = decodeSymbol()) !== false) {
16002    -1 			codePoints.push(tmp);
16003    -1 		}
16004    -1 		return ucs2encode(codePoints);
16005    -1 	}
16006    -1 
16007    -1 	/*--------------------------------------------------------------------------*/
16008    -1 
16009    -1 	var wtf8 = {
16010    -1 		'version': '1.0.0',
16011    -1 		'encode': wtf8encode,
16012    -1 		'decode': wtf8decode
16013    -1 	};
16014    -1 
16015    -1 	// Some AMD build optimizers, like r.js, check for specific condition patterns
16016    -1 	// like the following:
16017    -1 	if (
16018    -1 		typeof define == 'function' &&
16019    -1 		typeof define.amd == 'object' &&
16020    -1 		define.amd
16021    -1 	) {
16022    -1 		define(function() {
16023    -1 			return wtf8;
16024    -1 		});
16025    -1 	}	else if (freeExports && !freeExports.nodeType) {
16026    -1 		if (freeModule) { // in Node.js or RingoJS v0.8.0+
16027    -1 			freeModule.exports = wtf8;
16028    -1 		} else { // in Narwhal or RingoJS v0.7.0-
16029    -1 			var object = {};
16030    -1 			var hasOwnProperty = object.hasOwnProperty;
16031    -1 			for (var key in wtf8) {
16032    -1 				hasOwnProperty.call(wtf8, key) && (freeExports[key] = wtf8[key]);
16033    -1 			}
16034    -1 		}
16035    -1 	} else { // in Rhino or a web browser
16036    -1 		root.wtf8 = wtf8;
16037    -1 	}
16038    -1 
16039    -1 }(this));
16040    -1 
16041    -1 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
16042    -1 },{}],120:[function(require,module,exports){
16043    -1 'use strict';
16044    -1 
16045    -1 var alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('')
16046    -1   , length = 64
16047    -1   , map = {}
16048    -1   , seed = 0
16049    -1   , i = 0
16050    -1   , prev;
16051    -1 
16052    -1 /**
16053    -1  * Return a string representing the specified number.
16054    -1  *
16055    -1  * @param {Number} num The number to convert.
16056    -1  * @returns {String} The string representation of the number.
16057    -1  * @api public
16058    -1  */
16059    -1 function encode(num) {
16060    -1   var encoded = '';
16061    -1 
16062    -1   do {
16063    -1     encoded = alphabet[num % length] + encoded;
16064    -1     num = Math.floor(num / length);
16065    -1   } while (num > 0);
16066    -1 
16067    -1   return encoded;
16068    -1 }
16069    -1 
16070    -1 /**
16071    -1  * Return the integer value specified by the given string.
16072    -1  *
16073    -1  * @param {String} str The string to convert.
16074    -1  * @returns {Number} The integer value represented by the string.
16075    -1  * @api public
16076    -1  */
16077    -1 function decode(str) {
16078    -1   var decoded = 0;
16079    -1 
16080    -1   for (i = 0; i < str.length; i++) {
16081    -1     decoded = decoded * length + map[str.charAt(i)];
16082    -1   }
16083    -1 
16084    -1   return decoded;
16085    -1 }
16086    -1 
16087    -1 /**
16088    -1  * Yeast: A tiny growing id generator.
16089    -1  *
16090    -1  * @returns {String} A unique id.
16091    -1  * @api public
16092    -1  */
16093    -1 function yeast() {
16094    -1   var now = encode(+new Date());
16095    -1 
16096    -1   if (now !== prev) return seed = 0, prev = now;
16097    -1   return now +'.'+ encode(seed++);
16098    -1 }
16099    -1 
16100    -1 //
16101    -1 // Map each character to its index.
16102    -1 //
16103    -1 for (; i < length; i++) map[alphabet[i]] = i;
16104    -1 
16105    -1 //
16106    -1 // Expose the `yeast`, `encode` and `decode` functions.
16107    -1 //
16108    -1 yeast.encode = encode;
16109    -1 yeast.decode = decode;
16110    -1 module.exports = yeast;
16111    -1 
16112    -1 },{}],121:[function(require,module,exports){
16113    -1 var preact = require('preact');
16114    -1 var h = require('preact').h;
16115    -1 var MarkdownIt = require('markdown-it');
16116    -1 var io = require('socket.io-client');
16117    -1 
16118    -1 var md = new MarkdownIt();
16119    -1 
16120    -1 var _ = function(s) {
16121    -1 	return s;
16122    -1 };
16123    -1 
16124    -1 var forEach = function(list, fn) {
16125    -1 	for (var i = 0; i < list.length; i++) {
16126    -1 		fn(list[i], i);
16127    -1 	}
16128    -1 };
16129    -1 
16130    -1 var throttle = function(fn, timeout) {
16131    -1 	var called, blocked;
16132    -1 
16133    -1 	var result = function() {
16134    -1 		if (blocked) {
16135    -1 			called = true;
16136    -1 		} else {
16137    -1 			fn();
16138    -1 			blocked = true;
16139    -1 			called = false;
16140    -1 
16141    -1 			setTimeout(function() {
16142    -1 				blocked = false;
16143    -1 
16144    -1 				if (called) {
16145    -1 					result();
16146    -1 				}
16147    -1 			}, timeout);
16148    -1 		}
16149    -1 	};
16150    -1 
16151    -1 	return result;
16152    -1 };
16153    -1 
16154    -1 var getVotes = function(nodes, node) {
16155    -1 	if (!node.votes) {
16156    -1 		node.votes = 1 + nodes.filter(function(follower) {
16157    -1 			return follower.delegate === node.id;
16158    -1 		}).map(function(follower) {
16159    -1 			return getVotes(nodes, follower);
16160    -1 		}).reduce(function(a, b) {
16161    -1 			return a + b;
16162    -1 		}, 0);
16163    -1 	}
16164    -1 
16165    -1 	return node.votes;
16166    -1 };
16167    -1 
16168    -1 var getDelegationChain = function(nodes, node) {
16169    -1 	if (!node.delegationChain) {
16170    -1 		if (node.delegate) {
16171    -1 			var delegate = nodes.find(function(n) {
16172    -1 				return n.id === node.delegate;
16173    -1 			});
16174    -1 			var delegationChain = getDelegationChain(nodes, delegate);
16175    -1 			node.delegationChain = [node.delegate].concat(delegationChain);
16176    -1 		} else {
16177    -1 			node.delegationChain = [];
16178    -1 		}
16179    -1 	}
16180    -1 
16181    -1 	return node.delegationChain;
16182    -1 };
16183    -1 
16184    -1 var getName = function(node) {
16185    -1 	return node.name || _('anonymous');
16186    -1 };
16187    -1 
16188    -1 var tplFollowers = function(nodes, id, ID) {
16189    -1 	var _tplNode = function(node) {
16190    -1 		return tplNode(nodes, node, ID);
16191    -1 	};
16192    -1 	return nodes.filter(function(node) {
16193    -1 		return node.delegate === id;
16194    -1 	}).sort(function(a, b) {
16195    -1 		return getVotes(nodes, b) - getVotes(nodes, a);
16196    -1 	}).map(_tplNode);
16197    -1 };
16198    -1 
16199    -1 var tplNode = function(nodes, node, ID) {
16200    -1 	var classList = [];
16201    -1 	if (node.expanded) {
16202    -1 		classList.push('is-expanded');
16203    -1 	}
16204    -1 	if (node.id === ID) {
16205    -1 		classList.push('node--self');
16206    -1 	}
16207    -1 
16208    -1 	var delegateAttrs = {};
16209    -1 	if (node.id === ID || getDelegationChain(nodes, node).indexOf(ID) !== -1) {
16210    -1 		delegateAttrs.disabled = true;
16211    -1 	}
16212    -1 
16213    -1 	return h('li', {
16214    -1 		key: 'node-' + node.id,
16215    -1 		id: 'node-' + node.id,
16216    -1 		className: 'node ' + classList.join(' '),
16217    -1 		role: 'treeitem',
16218    -1 		'aria-expanded': '' + !!node.expanded,
16219    -1 	}, [
16220    -1 		h('article', {
16221    -1 			className: 'node__body',
16222    -1 		}, [
16223    -1 			h('header', {
16224    -1 				className: 'node__header bar',
16225    -1 			}, [
16226    -1 				h('button', {
16227    -1 					className: 'node__expand bar__item bar__item--button bar__item--left',
16228    -1 					title: _(node.expanded ? 'collapse' : 'expand'),
16229    -1 				}, node.expanded ? '\u25BC' : '\u25B6'),
16230    -1 				h('button', {
16231    -1 					className: 'node__delegate bar__item bar__item--button bar__item--right',
16232    -1 					title: _('delegate to ') + getName(node),
16233    -1 					attributes: delegateAttrs,
16234    -1 				}, '\u2795'),
16235    -1 				h('div', {className: 'node__votes bar__item bar__item--right'}, '' + getVotes(nodes, node)),
16236    -1 				h('div', {className: 'node__name bar__item' + (!node.expanded && node.comment ? '' : ' bar__item--grow')}, getName(node)),
16237    -1 				!node.expanded && node.comment && h('div', {className: 'node__preview bar__item bar__item--grow'}, node.comment.substr(0, 100)),
16238    -1 			]),
16239    -1 			node.expanded && h('div', {
16240    -1 				className: 'node__comment',
16241    -1 				dangerouslySetInnerHTML: {
16242    -1 					__html: md.render(node.comment || '')
16243    -1 				},
16244    -1 			}),
16245    -1 		]),
16246    -1 		h('ul', {
16247    -1 			className: 'tree',
16248    -1 			role: 'group',
16249    -1 		}, tplFollowers(nodes, node.id, ID)),
16250    -1 	]);
16251    -1 };
16252    -1 
16253    -1 var template = function(nodes, ID) {
16254    -1 	return h('ul', {
16255    -1 		className: 'tree',
16256    -1 		role: 'tree',
16257    -1 	}, tplFollowers(nodes, null, ID));
16258    -1 };
16259    -1 
16260    -1 var initVDom = function(wrapper, nodes, ID, afterRender) {
16261    -1 	wrapper.innerHTML = '';
16262    -1 	var tree = template(nodes, ID);
16263    -1 	var element = preact.render(tree, wrapper);
16264    -1 	afterRender();
16265    -1 
16266    -1 	return function(newState) {
16267    -1 		var newTree = template(newState, ID);
16268    -1 		preact.render(newTree, wrapper, element);
16269    -1 		afterRender();
16270    -1 	};
16271    -1 };
16272    -1 
16273    -1 var uid = function() {
16274    -1 	// just enough uniqueness
16275    -1 	var a = Math.random() * Date.now() * 0x1000;
16276    -1 	return Math.floor(a).toString(36);
16277    -1 }
16278    -1 var setCookie = function(key, value, days) {
16279    -1 	localStorage[key] = value;
16280    -1 };
16281    -1 
16282    -1 var getCookie = function(key) {
16283    -1 	return localStorage[key];
16284    -1 };
16285    -1 
16286    -1 document.addEventListener('DOMContentLoaded', function() {
16287    -1 	var TOPIC = document.URL.split('/')[3];
16288    -1 	var ID = document.URL.split('/')[4];
16289    -1 	if (!ID) ID = getCookie('id');
16290    -1 	if (!ID) ID = uid();
16291    -1 	setCookie('id', ID, 100);
16292    -1 
16293    -1 	var socket = io.connect('/');
16294    -1 	window.socket = socket;  // make available for tests
16295    -1 	socket.emit('register', TOPIC, ID);
16296    -1 
16297    -1 	var nodes = JSON.parse(document.querySelector('#json-nodes').dataset.value);
16298    -1 
16299    -1 	var getNode = function(id) {
16300    -1 		var node = nodes.find(function(node) {
16301    -1 			return node.id === id;
16302    -1 		});
16303    -1 		if (!node) {
16304    -1 			node = {
16305    -1 				id: id,
16306    -1 				delegate: null,
16307    -1 			};
16308    -1 			nodes.push(node);
16309    -1 		}
16310    -1 		return node;
16311    -1 	};
16312    -1 
16313    -1 	var invalidateVotes = function() {
16314    -1 		nodes.forEach(function(node) {
16315    -1 			node.votes = null;
16316    -1 			node.delegationChain = null;
16317    -1 		});
16318    -1 	};
16319    -1 
16320    -1 	var ensureVisible = function(node) {
16321    -1 		if (node && node.delegate) {
16322    -1 			var delegatee = getNode(node.delegate);
16323    -1 			delegatee.expanded = true;
16324    -1 			ensureVisible(delegatee);
16325    -1 		}
16326    -1 	};
16327    -1 
16328    -1 	var user = nodes.find(function(node) {
16329    -1 		return node.id === ID;
16330    -1 	});
16331    -1 	if (user) {
16332    -1 		document.querySelector('.user__name input').value = user.name;
16333    -1 		document.querySelector('.user__comment textarea').value = user.comment;
16334    -1 		ensureVisible(user);
16335    -1 	}
16336    -1 
16337    -1 	var updateUser = function() {
16338    -1 		document.querySelector('.user__votes').textContent = getVotes(nodes, user || {});
16339    -1 
16340    -1 		if (user && user.delegate) {
16341    -1 			var delegatee = getNode(user.delegate);
16342    -1 			document.querySelector('.user__delegation').textContent = _('delegated to: ') + getName(delegatee);
16343    -1 		} else {
16344    -1 			document.querySelector('.user__delegation').textContent = _('(no delegation)');
16345    -1 		}
16346    -1 	};
16347    -1 
16348    -1 	var toggleExpand = function(event) {
16349    -1 		var nodeElement = event.target.parentElement.parentElement.parentElement;
16350    -1 		var id = nodeElement.id.substr(5);
16351    -1 		var node = getNode(id);
16352    -1 		node.expanded = !node.expanded;
16353    -1 		update(nodes);
16354    -1 	};
16355    -1 
16356    -1 	var setDelegate = function(event) {
16357    -1 		var nodeElement = event.target.parentElement.parentElement.parentElement;
16358    -1 		var id = nodeElement.id.substr(5);
16359    -1 		socket.emit('setDelegate', id);
16360    -1 	};
16361    -1 
16362    -1 	var update = initVDom(document.querySelector('#tree'), nodes, ID, function() {
16363    -1 		updateUser();
16364    -1 
16365    -1 		forEach(document.querySelectorAll('.node__expand'), function(element) {
16366    -1 			element.addEventListener('click', toggleExpand);
16367    -1 		});
16368    -1 
16369    -1 		forEach(document.querySelectorAll('.node__delegate'), function(element) {
16370    -1 			element.addEventListener('click', setDelegate);
16371    -1 		});
16372    -1 	});
16373    -1 
16374    -1 	document.querySelector('.user__rm').addEventListener('click', function(event) {
16375    -1 		if (confirm(_("Do you really want to delete this opinion?"))) {
16376    -1 			socket.emit('rmNode');
16377    -1 			document.querySelector('.user__name input').value = '';
16378    -1 			document.querySelector('.user__comment textarea').value = '';
16379    -1 		}
16380    -1 	});
16381    -1 
16382    -1 	document.querySelector('.user__name input').addEventListener('change', function(event) {
16383    -1 		socket.emit('setNodeName', event.target.value);
16384    -1 	});
16385    -1 
16386    -1 	document.querySelector('.user__undelegate').addEventListener('click', function(event) {
16387    -1 		socket.emit('rmDelegate');
16388    -1 	});
16389    -1 
16390    -1 	var pushComment = throttle(function() {
16391    -1 		var comment = document.querySelector('.user__comment textarea').value;
16392    -1 		var node = nodes.find(function(n) {
16393    -1 			return n.id === ID;
16394    -1 		});
16395    -1 		// Do not create a new node if the comment is empty.
16396    -1 		// This can happen e.g. on a keydown event from the ctrl or shift keys.
16397    -1 		if (node || comment) {
16398    -1 			socket.emit('setNodeComment', comment);
16399    -1 		}
16400    -1 	}, 1000);
16401    -1 
16402    -1 	document.querySelector('.user__comment textarea').addEventListener('change', pushComment);
16403    -1 	document.querySelector('.user__comment textarea').addEventListener('keydown', pushComment);
16404    -1 
16405    -1 	socket.on('rmNode', function(id) {
16406    -1 		nodes = nodes.filter(function(node) {
16407    -1 			if (node.delegate === id) {
16408    -1 				node.delegate = null;
16409    -1 			}
16410    -1 			return node.id !== id;
16411    -1 		});
16412    -1 		invalidateVotes();
16413    -1 		update(nodes);
16414    -1 	});
16415    -1 	socket.on('setNodeName', function(id, name) {
16416    -1 		getNode(id).name = name;
16417    -1 		update(nodes);
16418    -1 	});
16419    -1 	socket.on('setNodeComment', function(id, comment) {
16420    -1 		getNode(id).comment = comment;
16421    -1 		update(nodes);
16422    -1 	});
16423    -1 	socket.on('setDelegate', function(id, delegate) {
16424    -1 		getNode(id).delegate = delegate;
16425    -1 		invalidateVotes();
16426    -1 		ensureVisible(user);
16427    -1 		update(nodes);
16428    -1 	});
16429    -1 	socket.on('rmDelegate', function(id) {
16430    -1 		getNode(id).delegate = null;
16431    -1 		invalidateVotes();
16432    -1 		update(nodes);
16433    -1 	});
16434    -1 });
16435    -1 
16436    -1 },{"markdown-it":36,"preact":96,"socket.io-client":97}]},{},[121]);