UNPKG

angular-meteor

Version:

Combining the simplicity and power of AngularJS and Meteor

13,338 lines • 1.67 MB
(function () {

/* Imports */
var Meteor = Package.meteor.Meteor;
var global = Package.meteor.global;
var meteorEnv = Package.meteor.meteorEnv;
var _ = Package.underscore._;
var Base64 = Package.base64.Base64;

/* Package-scope variables */
var EJSON, EJSONTest;

(function(){

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                   //
// packages/ejson/ejson.js                                                                                           //
//                                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                     //
/**                                                                                                                  // 1
 * @namespace                                                                                                        // 2
 * @summary Namespace for EJSON functions                                                                            // 3
 */                                                                                                                  // 4
EJSON = {};                                                                                                          // 5
EJSONTest = {};                                                                                                      // 6
                                                                                                                     // 7
                                                                                                                     // 8
                                                                                                                     // 9
// Custom type interface definition                                                                                  // 10
/**                                                                                                                  // 11
 * @class CustomType                                                                                                 // 12
 * @instanceName customType                                                                                          // 13
 * @memberOf EJSON                                                                                                   // 14
 * @summary The interface that a class must satisfy to be able to become an                                          // 15
 * EJSON custom type via EJSON.addType.                                                                              // 16
 */                                                                                                                  // 17
                                                                                                                     // 18
/**                                                                                                                  // 19
 * @function typeName                                                                                                // 20
 * @memberOf EJSON.CustomType                                                                                        // 21
 * @summary Return the tag used to identify this type.  This must match the tag used to register this type with [`EJSON.addType`](#ejson_add_type).
 * @locus Anywhere                                                                                                   // 23
 * @instance                                                                                                         // 24
 */                                                                                                                  // 25
                                                                                                                     // 26
/**                                                                                                                  // 27
 * @function toJSONValue                                                                                             // 28
 * @memberOf EJSON.CustomType                                                                                        // 29
 * @summary Serialize this instance into a JSON-compatible value.                                                    // 30
 * @locus Anywhere                                                                                                   // 31
 * @instance                                                                                                         // 32
 */                                                                                                                  // 33
                                                                                                                     // 34
/**                                                                                                                  // 35
 * @function clone                                                                                                   // 36
 * @memberOf EJSON.CustomType                                                                                        // 37
 * @summary Return a value `r` such that `this.equals(r)` is true, and modifications to `r` do not affect `this` and vice versa.
 * @locus Anywhere                                                                                                   // 39
 * @instance                                                                                                         // 40
 */                                                                                                                  // 41
                                                                                                                     // 42
/**                                                                                                                  // 43
 * @function equals                                                                                                  // 44
 * @memberOf EJSON.CustomType                                                                                        // 45
 * @summary Return `true` if `other` has a value equal to `this`; `false` otherwise.                                 // 46
 * @locus Anywhere                                                                                                   // 47
 * @param {Object} other Another object to compare this to.                                                          // 48
 * @instance                                                                                                         // 49
 */                                                                                                                  // 50
                                                                                                                     // 51
                                                                                                                     // 52
var customTypes = {};                                                                                                // 53
// Add a custom type, using a method of your choice to get to and                                                    // 54
// from a basic JSON-able representation.  The factory argument                                                      // 55
// is a function of JSON-able --> your object                                                                        // 56
// The type you add must have:                                                                                       // 57
// - A toJSONValue() method, so that Meteor can serialize it                                                         // 58
// - a typeName() method, to show how to look it up in our type table.                                               // 59
// It is okay if these methods are monkey-patched on.                                                                // 60
// EJSON.clone will use toJSONValue and the given factory to produce                                                 // 61
// a clone, but you may specify a method clone() that will be                                                        // 62
// used instead.                                                                                                     // 63
// Similarly, EJSON.equals will use toJSONValue to make comparisons,                                                 // 64
// but you may provide a method equals() instead.                                                                    // 65
/**                                                                                                                  // 66
 * @summary Add a custom datatype to EJSON.                                                                          // 67
 * @locus Anywhere                                                                                                   // 68
 * @param {String} name A tag for your custom type; must be unique among custom data types defined in your project, and must match the result of your type's `typeName` method.
 * @param {Function} factory A function that deserializes a JSON-compatible value into an instance of your type.  This should match the serialization performed by your type's `toJSONValue` method.
 */                                                                                                                  // 71
EJSON.addType = function (name, factory) {                                                                           // 72
  if (_.has(customTypes, name))                                                                                      // 73
    throw new Error("Type " + name + " already present");                                                            // 74
  customTypes[name] = factory;                                                                                       // 75
};                                                                                                                   // 76
                                                                                                                     // 77
var isInfOrNan = function (obj) {                                                                                    // 78
  return _.isNaN(obj) || obj === Infinity || obj === -Infinity;                                                      // 79
};                                                                                                                   // 80
                                                                                                                     // 81
var builtinConverters = [                                                                                            // 82
  { // Date                                                                                                          // 83
    matchJSONValue: function (obj) {                                                                                 // 84
      return _.has(obj, '$date') && _.size(obj) === 1;                                                               // 85
    },                                                                                                               // 86
    matchObject: function (obj) {                                                                                    // 87
      return obj instanceof Date;                                                                                    // 88
    },                                                                                                               // 89
    toJSONValue: function (obj) {                                                                                    // 90
      return {$date: obj.getTime()};                                                                                 // 91
    },                                                                                                               // 92
    fromJSONValue: function (obj) {                                                                                  // 93
      return new Date(obj.$date);                                                                                    // 94
    }                                                                                                                // 95
  },                                                                                                                 // 96
  { // NaN, Inf, -Inf. (These are the only objects with typeof !== 'object'                                          // 97
    // which we match.)                                                                                              // 98
    matchJSONValue: function (obj) {                                                                                 // 99
      return _.has(obj, '$InfNaN') && _.size(obj) === 1;                                                             // 100
    },                                                                                                               // 101
    matchObject: isInfOrNan,                                                                                         // 102
    toJSONValue: function (obj) {                                                                                    // 103
      var sign;                                                                                                      // 104
      if (_.isNaN(obj))                                                                                              // 105
        sign = 0;                                                                                                    // 106
      else if (obj === Infinity)                                                                                     // 107
        sign = 1;                                                                                                    // 108
      else                                                                                                           // 109
        sign = -1;                                                                                                   // 110
      return {$InfNaN: sign};                                                                                        // 111
    },                                                                                                               // 112
    fromJSONValue: function (obj) {                                                                                  // 113
      return obj.$InfNaN/0;                                                                                          // 114
    }                                                                                                                // 115
  },                                                                                                                 // 116
  { // Binary                                                                                                        // 117
    matchJSONValue: function (obj) {                                                                                 // 118
      return _.has(obj, '$binary') && _.size(obj) === 1;                                                             // 119
    },                                                                                                               // 120
    matchObject: function (obj) {                                                                                    // 121
      return typeof Uint8Array !== 'undefined' && obj instanceof Uint8Array                                          // 122
        || (obj && _.has(obj, '$Uint8ArrayPolyfill'));                                                               // 123
    },                                                                                                               // 124
    toJSONValue: function (obj) {                                                                                    // 125
      return {$binary: Base64.encode(obj)};                                                                          // 126
    },                                                                                                               // 127
    fromJSONValue: function (obj) {                                                                                  // 128
      return Base64.decode(obj.$binary);                                                                             // 129
    }                                                                                                                // 130
  },                                                                                                                 // 131
  { // Escaping one level                                                                                            // 132
    matchJSONValue: function (obj) {                                                                                 // 133
      return _.has(obj, '$escape') && _.size(obj) === 1;                                                             // 134
    },                                                                                                               // 135
    matchObject: function (obj) {                                                                                    // 136
      if (_.isEmpty(obj) || _.size(obj) > 2) {                                                                       // 137
        return false;                                                                                                // 138
      }                                                                                                              // 139
      return _.any(builtinConverters, function (converter) {                                                         // 140
        return converter.matchJSONValue(obj);                                                                        // 141
      });                                                                                                            // 142
    },                                                                                                               // 143
    toJSONValue: function (obj) {                                                                                    // 144
      var newObj = {};                                                                                               // 145
      _.each(obj, function (value, key) {                                                                            // 146
        newObj[key] = EJSON.toJSONValue(value);                                                                      // 147
      });                                                                                                            // 148
      return {$escape: newObj};                                                                                      // 149
    },                                                                                                               // 150
    fromJSONValue: function (obj) {                                                                                  // 151
      var newObj = {};                                                                                               // 152
      _.each(obj.$escape, function (value, key) {                                                                    // 153
        newObj[key] = EJSON.fromJSONValue(value);                                                                    // 154
      });                                                                                                            // 155
      return newObj;                                                                                                 // 156
    }                                                                                                                // 157
  },                                                                                                                 // 158
  { // Custom                                                                                                        // 159
    matchJSONValue: function (obj) {                                                                                 // 160
      return _.has(obj, '$type') && _.has(obj, '$value') && _.size(obj) === 2;                                       // 161
    },                                                                                                               // 162
    matchObject: function (obj) {                                                                                    // 163
      return EJSON._isCustomType(obj);                                                                               // 164
    },                                                                                                               // 165
    toJSONValue: function (obj) {                                                                                    // 166
      var jsonValue = Meteor._noYieldsAllowed(function () {                                                          // 167
        return obj.toJSONValue();                                                                                    // 168
      });                                                                                                            // 169
      return {$type: obj.typeName(), $value: jsonValue};                                                             // 170
    },                                                                                                               // 171
    fromJSONValue: function (obj) {                                                                                  // 172
      var typeName = obj.$type;                                                                                      // 173
      if (!_.has(customTypes, typeName))                                                                             // 174
        throw new Error("Custom EJSON type " + typeName + " is not defined");                                        // 175
      var converter = customTypes[typeName];                                                                         // 176
      return Meteor._noYieldsAllowed(function () {                                                                   // 177
        return converter(obj.$value);                                                                                // 178
      });                                                                                                            // 179
    }                                                                                                                // 180
  }                                                                                                                  // 181
];                                                                                                                   // 182
                                                                                                                     // 183
EJSON._isCustomType = function (obj) {                                                                               // 184
  return obj &&                                                                                                      // 185
    typeof obj.toJSONValue === 'function' &&                                                                         // 186
    typeof obj.typeName === 'function' &&                                                                            // 187
    _.has(customTypes, obj.typeName());                                                                              // 188
};                                                                                                                   // 189
                                                                                                                     // 190
EJSON._getTypes = function () {                                                                                      // 191
  return customTypes;                                                                                                // 192
};                                                                                                                   // 193
                                                                                                                     // 194
EJSON._getConverters = function () {                                                                                 // 195
  return builtinConverters;                                                                                          // 196
};                                                                                                                   // 197
                                                                                                                     // 198
// for both arrays and objects, in-place modification.                                                               // 199
var adjustTypesToJSONValue =                                                                                         // 200
EJSON._adjustTypesToJSONValue = function (obj) {                                                                     // 201
  // Is it an atom that we need to adjust?                                                                           // 202
  if (obj === null)                                                                                                  // 203
    return null;                                                                                                     // 204
  var maybeChanged = toJSONValueHelper(obj);                                                                         // 205
  if (maybeChanged !== undefined)                                                                                    // 206
    return maybeChanged;                                                                                             // 207
                                                                                                                     // 208
  // Other atoms are unchanged.                                                                                      // 209
  if (typeof obj !== 'object')                                                                                       // 210
    return obj;                                                                                                      // 211
                                                                                                                     // 212
  // Iterate over array or object structure.                                                                         // 213
  _.each(obj, function (value, key) {                                                                                // 214
    if (typeof value !== 'object' && value !== undefined &&                                                          // 215
        !isInfOrNan(value))                                                                                          // 216
      return; // continue                                                                                            // 217
                                                                                                                     // 218
    var changed = toJSONValueHelper(value);                                                                          // 219
    if (changed) {                                                                                                   // 220
      obj[key] = changed;                                                                                            // 221
      return; // on to the next key                                                                                  // 222
    }                                                                                                                // 223
    // if we get here, value is an object but not adjustable                                                         // 224
    // at this level.  recurse.                                                                                      // 225
    adjustTypesToJSONValue(value);                                                                                   // 226
  });                                                                                                                // 227
  return obj;                                                                                                        // 228
};                                                                                                                   // 229
                                                                                                                     // 230
// Either return the JSON-compatible version of the argument, or undefined (if                                       // 231
// the item isn't itself replaceable, but maybe some fields in it are)                                               // 232
var toJSONValueHelper = function (item) {                                                                            // 233
  for (var i = 0; i < builtinConverters.length; i++) {                                                               // 234
    var converter = builtinConverters[i];                                                                            // 235
    if (converter.matchObject(item)) {                                                                               // 236
      return converter.toJSONValue(item);                                                                            // 237
    }                                                                                                                // 238
  }                                                                                                                  // 239
  return undefined;                                                                                                  // 240
};                                                                                                                   // 241
                                                                                                                     // 242
/**                                                                                                                  // 243
 * @summary Serialize an EJSON-compatible value into its plain JSON representation.                                  // 244
 * @locus Anywhere                                                                                                   // 245
 * @param {EJSON} val A value to serialize to plain JSON.                                                            // 246
 */                                                                                                                  // 247
EJSON.toJSONValue = function (item) {                                                                                // 248
  var changed = toJSONValueHelper(item);                                                                             // 249
  if (changed !== undefined)                                                                                         // 250
    return changed;                                                                                                  // 251
  if (typeof item === 'object') {                                                                                    // 252
    item = EJSON.clone(item);                                                                                        // 253
    adjustTypesToJSONValue(item);                                                                                    // 254
  }                                                                                                                  // 255
  return item;                                                                                                       // 256
};                                                                                                                   // 257
                                                                                                                     // 258
// for both arrays and objects. Tries its best to just                                                               // 259
// use the object you hand it, but may return something                                                              // 260
// different if the object you hand it itself needs changing.                                                        // 261
//                                                                                                                   // 262
var adjustTypesFromJSONValue =                                                                                       // 263
EJSON._adjustTypesFromJSONValue = function (obj) {                                                                   // 264
  if (obj === null)                                                                                                  // 265
    return null;                                                                                                     // 266
  var maybeChanged = fromJSONValueHelper(obj);                                                                       // 267
  if (maybeChanged !== obj)                                                                                          // 268
    return maybeChanged;                                                                                             // 269
                                                                                                                     // 270
  // Other atoms are unchanged.                                                                                      // 271
  if (typeof obj !== 'object')                                                                                       // 272
    return obj;                                                                                                      // 273
                                                                                                                     // 274
  _.each(obj, function (value, key) {                                                                                // 275
    if (typeof value === 'object') {                                                                                 // 276
      var changed = fromJSONValueHelper(value);                                                                      // 277
      if (value !== changed) {                                                                                       // 278
        obj[key] = changed;                                                                                          // 279
        return;                                                                                                      // 280
      }                                                                                                              // 281
      // if we get here, value is an object but not adjustable                                                       // 282
      // at this level.  recurse.                                                                                    // 283
      adjustTypesFromJSONValue(value);                                                                               // 284
    }                                                                                                                // 285
  });                                                                                                                // 286
  return obj;                                                                                                        // 287
};                                                                                                                   // 288
                                                                                                                     // 289
// Either return the argument changed to have the non-json                                                           // 290
// rep of itself (the Object version) or the argument itself.                                                        // 291
                                                                                                                     // 292
// DOES NOT RECURSE.  For actually getting the fully-changed value, use                                              // 293
// EJSON.fromJSONValue                                                                                               // 294
var fromJSONValueHelper = function (value) {                                                                         // 295
  if (typeof value === 'object' && value !== null) {                                                                 // 296
    if (_.size(value) <= 2                                                                                           // 297
        && _.all(value, function (v, k) {                                                                            // 298
          return typeof k === 'string' && k.substr(0, 1) === '$';                                                    // 299
        })) {                                                                                                        // 300
      for (var i = 0; i < builtinConverters.length; i++) {                                                           // 301
        var converter = builtinConverters[i];                                                                        // 302
        if (converter.matchJSONValue(value)) {                                                                       // 303
          return converter.fromJSONValue(value);                                                                     // 304
        }                                                                                                            // 305
      }                                                                                                              // 306
    }                                                                                                                // 307
  }                                                                                                                  // 308
  return value;                                                                                                      // 309
};                                                                                                                   // 310
                                                                                                                     // 311
/**                                                                                                                  // 312
 * @summary Deserialize an EJSON value from its plain JSON representation.                                           // 313
 * @locus Anywhere                                                                                                   // 314
 * @param {JSONCompatible} val A value to deserialize into EJSON.                                                    // 315
 */                                                                                                                  // 316
EJSON.fromJSONValue = function (item) {                                                                              // 317
  var changed = fromJSONValueHelper(item);                                                                           // 318
  if (changed === item && typeof item === 'object') {                                                                // 319
    item = EJSON.clone(item);                                                                                        // 320
    adjustTypesFromJSONValue(item);                                                                                  // 321
    return item;                                                                                                     // 322
  } else {                                                                                                           // 323
    return changed;                                                                                                  // 324
  }                                                                                                                  // 325
};                                                                                                                   // 326
                                                                                                                     // 327
/**                                                                                                                  // 328
 * @summary Serialize a value to a string.                                                                           // 329
                                                                                                                     // 330
For EJSON values, the serialization fully represents the value. For non-EJSON values, serializes the same way as `JSON.stringify`.
 * @locus Anywhere                                                                                                   // 332
 * @param {EJSON} val A value to stringify.                                                                          // 333
 * @param {Object} [options]                                                                                         // 334
 * @param {Boolean | Integer | String} options.indent Indents objects and arrays for easy readability.  When `true`, indents by 2 spaces; when an integer, indents by that number of spaces; and when a string, uses the string as the indentation pattern.
 * @param {Boolean} options.canonical When `true`, stringifies keys in an object in sorted order.                    // 336
 */                                                                                                                  // 337
EJSON.stringify = function (item, options) {                                                                         // 338
  var json = EJSON.toJSONValue(item);                                                                                // 339
  if (options && (options.canonical || options.indent)) {                                                            // 340
    return EJSON._canonicalStringify(json, options);                                                                 // 341
  } else {                                                                                                           // 342
    return JSON.stringify(json);                                                                                     // 343
  }                                                                                                                  // 344
};                                                                                                                   // 345
                                                                                                                     // 346
/**                                                                                                                  // 347
 * @summary Parse a string into an EJSON value. Throws an error if the string is not valid EJSON.                    // 348
 * @locus Anywhere                                                                                                   // 349
 * @param {String} str A string to parse into an EJSON value.                                                        // 350
 */                                                                                                                  // 351
EJSON.parse = function (item) {                                                                                      // 352
  if (typeof item !== 'string')                                                                                      // 353
    throw new Error("EJSON.parse argument should be a string");                                                      // 354
  return EJSON.fromJSONValue(JSON.parse(item));                                                                      // 355
};                                                                                                                   // 356
                                                                                                                     // 357
/**                                                                                                                  // 358
 * @summary Returns true if `x` is a buffer of binary data, as returned from [`EJSON.newBinary`](#ejson_new_binary).
 * @param {Object} x The variable to check.                                                                          // 360
 * @locus Anywhere                                                                                                   // 361
 */                                                                                                                  // 362
EJSON.isBinary = function (obj) {                                                                                    // 363
  return !!((typeof Uint8Array !== 'undefined' && obj instanceof Uint8Array) ||                                      // 364
    (obj && obj.$Uint8ArrayPolyfill));                                                                               // 365
};                                                                                                                   // 366
                                                                                                                     // 367
/**                                                                                                                  // 368
 * @summary Return true if `a` and `b` are equal to each other.  Return false otherwise.  Uses the `equals` method on `a` if present, otherwise performs a deep comparison.
 * @locus Anywhere                                                                                                   // 370
 * @param {EJSON} a                                                                                                  // 371
 * @param {EJSON} b                                                                                                  // 372
 * @param {Object} [options]                                                                                         // 373
 * @param {Boolean} options.keyOrderSensitive Compare in key sensitive order, if supported by the JavaScript implementation.  For example, `{a: 1, b: 2}` is equal to `{b: 2, a: 1}` only when `keyOrderSensitive` is `false`.  The default is `false`.
 */                                                                                                                  // 375
EJSON.equals = function (a, b, options) {                                                                            // 376
  var i;                                                                                                             // 377
  var keyOrderSensitive = !!(options && options.keyOrderSensitive);                                                  // 378
  if (a === b)                                                                                                       // 379
    return true;                                                                                                     // 380
  if (_.isNaN(a) && _.isNaN(b))                                                                                      // 381
    return true; // This differs from the IEEE spec for NaN equality, b/c we don't want                              // 382
                 // anything ever with a NaN to be poisoned from becoming equal to anything.                         // 383
  if (!a || !b) // if either one is falsy, they'd have to be === to be equal                                         // 384
    return false;                                                                                                    // 385
  if (!(typeof a === 'object' && typeof b === 'object'))                                                             // 386
    return false;                                                                                                    // 387
  if (a instanceof Date && b instanceof Date)                                                                        // 388
    return a.valueOf() === b.valueOf();                                                                              // 389
  if (EJSON.isBinary(a) && EJSON.isBinary(b)) {                                                                      // 390
    if (a.length !== b.length)                                                                                       // 391
      return false;                                                                                                  // 392
    for (i = 0; i < a.length; i++) {                                                                                 // 393
      if (a[i] !== b[i])                                                                                             // 394
        return false;                                                                                                // 395
    }                                                                                                                // 396
    return true;                                                                                                     // 397
  }                                                                                                                  // 398
  if (typeof (a.equals) === 'function')                                                                              // 399
    return a.equals(b, options);                                                                                     // 400
  if (typeof (b.equals) === 'function')                                                                              // 401
    return b.equals(a, options);                                                                                     // 402
  if (a instanceof Array) {                                                                                          // 403
    if (!(b instanceof Array))                                                                                       // 404
      return false;                                                                                                  // 405
    if (a.length !== b.length)                                                                                       // 406
      return false;                                                                                                  // 407
    for (i = 0; i < a.length; i++) {                                                                                 // 408
      if (!EJSON.equals(a[i], b[i], options))                                                                        // 409
        return false;                                                                                                // 410
    }                                                                                                                // 411
    return true;                                                                                                     // 412
  }                                                                                                                  // 413
  // fallback for custom types that don't implement their own equals                                                 // 414
  switch (EJSON._isCustomType(a) + EJSON._isCustomType(b)) {                                                         // 415
    case 1: return false;                                                                                            // 416
    case 2: return EJSON.equals(EJSON.toJSONValue(a), EJSON.toJSONValue(b));                                         // 417
  }                                                                                                                  // 418
  // fall back to structural equality of objects                                                                     // 419
  var ret;                                                                                                           // 420
  if (keyOrderSensitive) {                                                                                           // 421
    var bKeys = [];                                                                                                  // 422
    _.each(b, function (val, x) {                                                                                    // 423
        bKeys.push(x);                                                                                               // 424
    });                                                                                                              // 425
    i = 0;                                                                                                           // 426
    ret = _.all(a, function (val, x) {                                                                               // 427
      if (i >= bKeys.length) {                                                                                       // 428
        return false;                                                                                                // 429
      }                                                                                                              // 430
      if (x !== bKeys[i]) {                                                                                          // 431
        return false;                                                                                                // 432
      }                                                                                                              // 433
      if (!EJSON.equals(val, b[bKeys[i]], options)) {                                                                // 434
        return false;                                                                                                // 435
      }                                                                                                              // 436
      i++;                                                                                                           // 437
      return true;                                                                                                   // 438
    });                                                                                                              // 439
    return ret && i === bKeys.length;                                                                                // 440
  } else {                                                                                                           // 441
    i = 0;                                                                                                           // 442
    ret = _.all(a, function (val, key) {                                                                             // 443
      if (!_.has(b, key)) {                                                                                          // 444
        return false;                                                                                                // 445
      }                                                                                                              // 446
      if (!EJSON.equals(val, b[key], options)) {                                                                     // 447
        return false;                                                                                                // 448
      }                                                                                                              // 449
      i++;                                                                                                           // 450
      return true;                                                                                                   // 451
    });                                                                                                              // 452
    return ret && _.size(b) === i;                                                                                   // 453
  }                                                                                                                  // 454
};                                                                                                                   // 455
                                                                                                                     // 456
/**                                                                                                                  // 457
 * @summary Return a deep copy of `val`.                                                                             // 458
 * @locus Anywhere                                                                                                   // 459
 * @param {EJSON} val A value to copy.                                                                               // 460
 */                                                                                                                  // 461
EJSON.clone = function (v) {                                                                                         // 462
  var ret;                                                                                                           // 463
  if (typeof v !== "object")                                                                                         // 464
    return v;                                                                                                        // 465
  if (v === null)                                                                                                    // 466
    return null; // null has typeof "object"                                                                         // 467
  if (v instanceof Date)                                                                                             // 468
    return new Date(v.getTime());                                                                                    // 469
  // RegExps are not really EJSON elements (eg we don't define a serialization                                       // 470
  // for them), but they're immutable anyway, so we can support them in clone.                                       // 471
  if (v instanceof RegExp)                                                                                           // 472
    return v;                                                                                                        // 473
  if (EJSON.isBinary(v)) {                                                                                           // 474
    ret = EJSON.newBinary(v.length);                                                                                 // 475
    for (var i = 0; i < v.length; i++) {                                                                             // 476
      ret[i] = v[i];                                                                                                 // 477
    }                                                                                                                // 478
    return ret;                                                                                                      // 479
  }                                                                                                                  // 480
  // XXX: Use something better than underscore's isArray                                                             // 481
  if (_.isArray(v) || _.isArguments(v)) {                                                                            // 482
    // For some reason, _.map doesn't work in this context on Opera (weird test                                      // 483
    // failures).                                                                                                    // 484
    ret = [];                                                                                                        // 485
    for (i = 0; i < v.length; i++)                                                                                   // 486
      ret[i] = EJSON.clone(v[i]);                                                                                    // 487
    return ret;                                                                                                      // 488
  }                                                                                                                  // 489
  // handle general user-defined typed Objects if they have a clone method                                           // 490
  if (typeof v.clone === 'function') {                                                                               // 491
    return v.clone();                                                                                                // 492
  }                                                                                                                  // 493
  // handle other custom types                                                                                       // 494
  if (EJSON._isCustomType(v)) {                                                                                      // 495
    return EJSON.fromJSONValue(EJSON.clone(EJSON.toJSONValue(v)), true);                                             // 496
  }                                                                                                                  // 497
  // handle other objects                                                                                            // 498
  ret = {};                                                                                                          // 499
  _.each(v, function (value, key) {                                                                                  // 500
    ret[key] = EJSON.clone(value);                                                                                   // 501
  });                                                                                                                // 502
  return ret;                                                                                                        // 503
};                                                                                                                   // 504
                                                                                                                     // 505
/**                                                                                                                  // 506
 * @summary Allocate a new buffer of binary data that EJSON can serialize.                                           // 507
 * @locus Anywhere                                                                                                   // 508
 * @param {Number} size The number of bytes of binary data to allocate.                                              // 509
 */                                                                                                                  // 510
// EJSON.newBinary is the public documented API for this functionality,                                              // 511
// but the implementation is in the 'base64' package to avoid                                                        // 512
// introducing a circular dependency. (If the implementation were here,                                              // 513
// then 'base64' would have to use EJSON.newBinary, and 'ejson' would                                                // 514
// also have to use 'base64'.)                                                                                       // 515
EJSON.newBinary = Base64.newBinary;                                                                                  // 516
                                                                                                                     // 517
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}).call(this);






(function(){

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                   //
// packages/ejson/stringify.js                                                                                       //
//                                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                     //
// Based on json2.js from https://github.com/douglascrockford/JSON-js                                                // 1
//                                                                                                                   // 2
//    json2.js                                                                                                       // 3
//    2012-10-08                                                                                                     // 4
//                                                                                                                   // 5
//    Public Domain.                                                                                                 // 6
//                                                                                                                   // 7
//    NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.                                                        // 8
                                                                                                                     // 9
function quote(string) {                                                                                             // 10
  return JSON.stringify(string);                                                                                     // 11
}                                                                                                                    // 12
                                                                                                                     // 13
var str = function (key, holder, singleIndent, outerIndent, canonical) {                                             // 14
                                                                                                                     // 15
  // Produce a string from holder[key].                                                                              // 16
                                                                                                                     // 17
  var i;          // The loop counter.                                                                               // 18
  var k;          // The member key.                                                                                 // 19
  var v;          // The member value.                                                                               // 20
  var length;                                                                                                        // 21
  var innerIndent = outerIndent;                                                                                     // 22
  var partial;                                                                                                       // 23
  var value = holder[key];                                                                                           // 24
                                                                                                                     // 25
  // What happens next depends on the value's type.                                                                  // 26
                                                                                                                     // 27
  switch (typeof value) {                                                                                            // 28
  case 'string':                                                                                                     // 29
    return quote(value);                                                                                             // 30
  case 'number':                                                                                                     // 31
    // JSON numbers must be finite. Encode non-finite numbers as null.                                               // 32
    return isFinite(value) ? String(value) : 'null';                                                                 // 33
  case 'boolean':                                                                                                    // 34
    return String(value);                                                                                            // 35
  // If the type is 'object', we might be dealing with an object or an array or                                      // 36
  // null.                                                                                                           // 37
  case 'object':                                                                                                     // 38
    // Due to a specification blunder in ECMAScript, typeof null is 'object',                                        // 39
    // so watch out for that case.                                                                                   // 40
    if (!value) {                                                                                                    // 41
      return 'null';                                                                                                 // 42
    }                                                                                                                // 43
    // Make an array to hold the partial results of stringifying this object value.                                  // 44
    innerIndent = outerIndent + singleIndent;                                                                        // 45
    partial = [];                                                                                                    // 46
                                                                                                                     // 47
    // Is the value an array?                                                                                        // 48
    if (_.isArray(value) || _.isArguments(value)) {                                                                  // 49
                                                                                                                     // 50
      // The value is an array. Stringify every element. Use null as a placeholder                                   // 51
      // for non-JSON values.                                                                                        // 52
                                                                                                                     // 53
      length = value.length;                                                                                         // 54
      for (i = 0; i < length; i += 1) {                                                                              // 55
        partial[i] = str(i, value, singleIndent, innerIndent, canonical) || 'null';                                  // 56
      }                                                                                                              // 57
                                                                                                                     // 58
      // Join all of the elements together, separated with commas, and wrap them in                                  // 59
      // brackets.                                                                                                   // 60
                                                                                                                     // 61
      if (partial.length === 0) {                                                                                    // 62
        v = '[]';                                                                                                    // 63
      } else if (innerIndent) {                                                                                      // 64
        v = '[\n' + innerIndent + partial.join(',\n' + innerIndent) + '\n' + outerIndent + ']';                      // 65
      } else {                                                                                                       // 66
        v = '[' + partial.join(',') + ']';                                                                           // 67
      }                                                                                                              // 68
      return v;                                                                                                      // 69
    }                                                                                                                // 70
                                                                                                                     // 71
                                                                                                                     // 72
    // Iterate through all of the keys in the object.                                                                // 73
    var keys = _.keys(value);                                                                                        // 74
    if (canonical)                                                                                                   // 75
      keys = keys.sort();                                                                                            // 76
    _.each(keys, function (k) {                                                                                      // 77
      v = str(k, value, singleIndent, innerIndent, canonical);                                                       // 78
      if (v) {                                                                                                       // 79
        partial.push(quote(k) + (innerIndent ? ': ' : ':') + v);                                                     // 80
      }                                                                                                              // 81
    });                                                                                                              // 82
                                                                                                                     // 83
                                                                                                                     // 84
    // Join all of the member texts together, separated with commas,                                                 // 85
    // and wrap them in braces.                                                                                      // 86
                                                                                                                     // 87
    if (partial.length === 0) {                                                                                      // 88
      v = '{}';                                                                                                      // 89
    } else if (innerIndent) {                                                                                        // 90
      v = '{\n' + innerIndent + partial.join(',\n' + innerIndent) + '\n' + outerIndent + '}';                        // 91
    } else {                                                                                                         // 92
      v = '{' + partial.join(',') + '}';                                                                             // 93
    }                                                                                                                // 94
    return v;                                                                                                        // 95
  }                                                                                                                  // 96
}                                                                                                                    // 97
                                                                                                                     // 98
// If the JSON object does not yet have a stringify method, give it one.                                             // 99
                                                                                                                     // 100
EJSON._canonicalStringify = function (value, options) {                                                              // 101
  // Make a fake root object containing our value under the key of ''.                                               // 102
  // Return the result of stringifying the value.                                                                    // 103
  options = _.extend({                                                                                               // 104
    indent: "",                                                                                                      // 105
    canonical: false                                                                                                 // 106
  }, options);                                                                                                       // 107
  if (options.indent === true) {                                                                                     // 108
    options.indent = "  ";                                                                                           // 109
  } else if (typeof options.indent === 'number') {                                                                   // 110
    var newIndent = "";                                                                                              // 111
    for (var i = 0; i < options.indent; i++) {                                                                       // 112
      newIndent += ' ';                                                                                              // 113
    }                                                                                                                // 114
    options.indent = newIndent;                                                                                      // 115
  }                                                                                                                  // 116
  return str('', {'': value}, options.indent, "", options.canonical);                                                // 117
};                                                                                                                   // 118
                                                                                                                     // 119
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}).call(this);


/* Exports */
if (typeof Package === 'undefined') Package = {};
(function (pkg, symbols) {
  for (var s in symbols)
    (s in pkg) || (pkg[s] = symbols[s]);
})(Package.ejson = {}, {
  EJSON: EJSON,
  EJSONTest: EJSONTest
});

})();
(function () {

/* Imports */
var Meteor = Package.meteor.Meteor;
var global = Package.meteor.global;
var meteorEnv = Package.meteor.meteorEnv;
var EJSON = Package.ejson.EJSON;
var IdMap = Package['id-map'].IdMap;
var Random = Package.random.Random;

/* Package-scope variables */
var MongoID;

(function(){

////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                    //
// packages/mongo-id/id.js                                                                            //
//                                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                      //
MongoID = {};                                                                                         // 1
                                                                                                      // 2
MongoID._looksLikeObjectID = function (str) {                                                         // 3
  return str.length === 24 && str.match(/^[0-9a-f]*$/);                                               // 4
};                                                                                                    // 5
                                                                                                      // 6
MongoID.ObjectID = function (hexString) {                                                             // 7
  //random-based impl of Mongo ObjectID                                                               // 8
  var self = this;                                                                                    // 9
  if (hexString) {                                                                                    // 10
    hexString = hexString.toLowerCase();                                                              // 11
    if (!MongoID._looksLikeObjectID(hexString)) {                                                     // 12
      throw new Error("Invalid hexadecimal string for creating an ObjectID");                         // 13
    }                                                                                                 // 14
    // meant to work with _.isEqual(), which relies on structural equality                            // 15
    self._str = hexString;                                                                            // 16
  } else {                                                                                            // 17
    self._str = Random.hexString(24);                                                                 // 18
  }                                                                                                   // 19
};                                                                                                    // 20
                                                                                                      // 21
MongoID.ObjectID.prototype.toString = function () {                                                   // 22
  var self = this;                                                                                    // 23
  return "ObjectID(\"" + self._str + "\")";                                                           // 24
};                                                                                                    // 25
                                                                                                      // 26
MongoID.ObjectID.prototype.equals = function (other) {                                                // 27
  var self = this;                                                                                    // 28
  return other instanceof MongoID.ObjectID &&                                                         // 29
    self.valueOf() === other.valueOf();                                                               // 30
};                                                                                                    // 31
                                                                                                      // 32
MongoID.ObjectID.prototype.clone = function () {                                                      // 33
  var self = this;                                                                                    // 34
  return new MongoID.ObjectID(self._str);                                                             // 35
};                                                                                                    // 36
                                                                                                      // 37
MongoID.ObjectID.prototype.typeName = function() {                                                    // 38
  return "oid";                                                                                       // 39
};                                                                                                    // 40
                                                                                                      // 41
MongoID.ObjectID.prototype.getTimestamp = function() {                                                // 42
  var self = this;                                                                                    // 43
  return parseInt(self._str.substr(0, 8), 16);                                                        // 44
};                                                                                                    // 45
                                                                                                      // 46
MongoID.ObjectID.prototype.valueOf =                                                                  // 47
    MongoID.ObjectID.prototype.toJSONValue =                                                          // 48
    MongoID.ObjectID.prototype.toHexString =                                                          // 49
    function () { return this._str; };                                                                // 50
                                                                                                      // 51
EJSON.addType("oid",  function (str) {                                                                // 52
  return new MongoID.ObjectID(str);                                                                   // 53
});                                                                                                   // 54
                                                                                                      // 55
MongoID.idStringify = function (id) {                                                                 // 56
  if (id instanceof MongoID.ObjectID) {                                                               // 57
    return id.valueOf();                                                                              // 58
  } else if (typeof id === 'string') {                                                                // 59
    if (id === "") {                                                                                  // 60
      return id;                                                                                      // 61
    } else if (id.substr(0, 1) === "-" || // escape previously dashed strings                         // 62
               id.substr(0, 1) === "~" || // escape escaped numbers, true, false                      // 63
               MongoID._looksLikeObjectID(id) || // escape object-id-form strings                     // 64
               id.substr(0, 1) === '{') { // escape object-form strings, for maybe implementing later
      return "-" + id;                                                                                // 66
    } else {                                                                                          // 67
      return id; // other strings go through unchanged.                                               // 68
    }                                                                                                 // 69
  } else if (id === undefined) {                                                                      // 70
    return '-';                                                                                       // 71
  } else if (typeof id === 'object' && id !== null) {                                                 // 72
    throw new Error("Meteor does not currently support objects other than ObjectID as ids");          // 73
  } else { // Numbers, true, false, null                                                              // 74
    return "~" + JSON.stringify(id);                                                                  // 75
  }                                                                                                   // 76
};                                                                                                    // 77
                                                                                                      // 78
                                                                                                      // 79
MongoID.idParse = function (id) {                                                                     // 80
  if (id === "") {                                                                                    // 81
    return id;                                                                                        // 82
  } else if (id === '-') {                                                                            // 83
    return undefined;                                                                                 // 84
  } else if (id.substr(0, 1) === '-') {                                                               // 85
    return id.substr(1);                                                                              // 86
  } else if (id.substr(0, 1) === '~') {                                                               // 87
    return JSON.parse(id.substr(1));                                                                  // 88
  } else if (MongoID._looksLikeObjectID(id)) {                                                        // 89
    return new MongoID.ObjectID(id);                                                                  // 90
  } else {                                                                                            // 91
    return id;                                                                                        // 92
  }                                                                                                   // 93
};                                                                                                    // 94
                                                                                                      // 95
                                                                                                      // 96
////////////////////////////////////////////////////////////////////////////////////////////////////////

}).call(this);


/* Exports */
if (typeof Package === 'undefined') Package = {};
(function (pkg, symbols) {
  for (var s in symbols)
    (s in pkg) || (pkg[s] = symbols[s]);
})(Package['mongo-id'] = {}, {
  MongoID: MongoID
});

})();
(function () {

/* Imports */
var Meteor = Package.meteor.Meteor;
var global = Package.meteor.global;
var meteorEnv = Package.meteor.meteorEnv;
var _ = Package.underscore._;
var EJSON = Package.ejson.EJSON;

/* Package-scope variables */
var DiffSequence;

(function(){

/////////////////////////////////////////////////////////////////////////////////////
//                                                                                 //
// packages/diff-sequence/diff.js                                                  //
//                                                                                 //
/////////////////////////////////////////////////////////////////////////////////////
                                                                                   //
DiffSequence = {};                                                                 // 1
                                                                                   // 2
// ordered: bool.                                                                  // 3
// old_results and new_results: collections of documents.                          // 4
//    if ordered, they are arrays.                                                 // 5
//    if unordered, they are IdMaps                                                // 6
DiffSequence.diffQueryChanges = function (ordered, oldResults, newResults,         // 7
                                              observer, options) {                 // 8
  if (ordered)                                                                     // 9
    DiffSequence.diffQueryOrderedChanges(                                          // 10
      oldResults, newResults, observer, options);                                  // 11
  else                                                                             // 12
    DiffSequence.diffQueryUnorderedChanges(                                        // 13
      oldResults, newResults, observer, options);                                  // 14
};                                                                                 // 15
                                                                                   // 16
DiffSequence.diffQueryUnorderedChanges = function (oldResults, newResults,         // 17
                                                       observer, options) {        // 18
  options = options || {};                                                         // 19
  var projectionFn = options.projectionFn || EJSON.clone;                          // 20
                                                                                   // 21
  if (observer.movedBefore) {                                                      // 22
    throw new Error("_diffQueryUnordered called with a movedBefore observer!");    // 23
  }                                                                                // 24
                                                                                   // 25
  newResults.forEach(function (newDoc, id) {                                       // 26
    var oldDoc = oldResults.get(id);                                               // 27
    if (oldDoc) {                                                                  // 28
      if (observer.changed && !EJSON.equals(oldDoc, newDoc)) {                     // 29
        var projectedNew = projectionFn(newDoc);                                   // 30
        var projectedOld = projectionFn(oldDoc);                                   // 31
        var changedFields =                                                        // 32
              DiffSequence.makeChangedFields(projectedNew, projectedOld);          // 33
        if (! _.isEmpty(changedFields)) {                                          // 34
          observer.changed(id, changedFields);                                     // 35
        }                                                                          // 36
      }                                                                            // 37
    } else if (observer.added) {                                                   // 38
      var fields = projectionFn(newDoc);                                           // 39
      delete fields._id;                                                           // 40
      observer.added(newDoc._id, fields);                                          // 41
    }                                                                              // 42
  });                                                                              // 43
                                                                                   // 44
  if (observer.removed) {                                                          // 45
    oldResults.forEach(function (oldDoc, id) {                                     // 46
      if (!newResults.has(id))                                                     // 47
        observer.removed(id);                                                      // 48
    });                                                                            // 49
  }                                                                                // 50
};                                                                                 // 51
                                                                                   // 52
                                                                                   // 53
DiffSequence.diffQueryOrderedChanges = function (old_results, new_results,         // 54
                                                     observer, options) {          // 55
  options = options || {};                                                         // 56
  var projectionFn = options.projectionFn || EJSON.clone;                          // 57
                                                                                   // 58
  var new_presence_of_id = {};                                                     // 59
  _.each(new_results, function (doc) {                                             // 60
    if (new_presence_of_id[doc._id])                                               // 61
      Meteor._debug("Duplicate _id in new_results");                               // 62
    new_presence_of_id[doc._id] = true;                                            // 63
  });                                                                              // 64
                                                                                   // 65
  var old_index_of_id = {};                                                        // 66
  _.each(old_results, function (doc, i) {                                          // 67
    if (doc._id in old_index_of_id)                                                // 68
      Meteor._debug("Duplicate _id in old_results");                               // 69
    old_index_of_id[doc._id] = i;                                                  // 70
  });                                                                              // 71
                                                                                   // 72
  // ALGORITHM:                                                                    // 73
  //                                                                               // 74
  // To determine which docs should be considered "moved" (and which               // 75
  // merely change position because of other docs moving) we run                   // 76
  // a "longest common subsequence" (LCS) algorithm.  The LCS of the               // 77
  // old doc IDs and the new doc IDs gives the docs that should NOT be             // 78
  // considered moved.                                                             // 79
                                                                                   // 80
  // To actually call the appropriate callbacks to get from the old state to the   // 81
  // new state:                                                                    // 82
                                                                                   // 83
  // First, we call removed() on all the items that only appear in the old         // 84
  // state.                                                                        // 85
                                                                                   // 86
  // Then, once we have the items that should not move, we walk through the new    // 87
  // results array group-by-group, where a "group" is a set of items that have     // 88
  // moved, anchored on the end by an item that should not move.  One by one, we   // 89
  // move each of those elements into place "before" the anchoring end-of-group    // 90
  // item, and fire changed events on them if necessary.  Then we fire a changed   // 91
  // event on the anchor, and move on to the next group.  There is always at       // 92
  // least one group; the last group is anchored by a virtual "null" id at the     // 93
  // end.                                                                          // 94
                                                                                   // 95
  // Asymptotically: O(N k) where k is number of ops, or potentially               // 96
  // O(N log N) if inner loop of LCS were made to be binary search.                // 97
                                                                                   // 98
                                                                                   // 99
  //////// LCS (longest common sequence, with respect to _id)                      // 100
  // (see Wikipedia article on Longest Increasing Subsequence,                     // 101
  // where the LIS is taken of the sequence of old indices of the                  // 102
  // docs in new_results)                                                          // 103
  //                                                                               // 104
  // unmoved: the output of the algorithm; members of the LCS,                     // 105
  // in the form of indices into new_results                                       // 106
  var unmoved = [];                                                                // 107
  // max_seq_len: length of LCS found so far                                       // 108
  var max_seq_len = 0;                                                             // 109
  // seq_ends[i]: the index into new_results of the last doc in a                  // 110
  // common subsequence of length of i+1 <= max_seq_len                            // 111
  var N = new_results.length;                                                      // 112
  var seq_ends = new Array(N);                                                     // 113
  // ptrs:  the common subsequence ending with new_results[n] extends              // 114
  // a common subsequence ending with new_results[ptr[n]], unless                  // 115
  // ptr[n] is -1.                                                                 // 116
  var ptrs = new Array(N);                                                         // 117
  // virtual sequence of old indices of new results                                // 118
  var old_idx_seq = function(i_new) {                                              // 119
    return old_index_of_id[new_results[i_new]._id];                                // 120
  };                                                                               // 121
  // for each item in new_results, use it to extend a common subsequence           // 122
  // of length j <= max_seq_len                                                    // 123
  for(var i=0; i<N; i++) {                                                         // 124
    if (old_index_of_id[new_results[i]._id] !== undefined) {                       // 125
      var j = max_seq_len;                                                         // 126
      // this inner loop would traditionally be a binary search,                   // 127
      // but scanning backwards we will likely find a subseq to extend             // 128
      // pretty soon, bounded for example by the total number of ops.              // 129
      // If this were to be changed to a binary search, we'd still want            // 130
      // to scan backwards a bit as an optimization.                               // 131
      while (j > 0) {                                                              // 132
        if (old_idx_seq(seq_ends[j-1]) < old_idx_seq(i))                           // 133
          break;                                                                   // 134
        j--;                                                                       // 135
      }                                                                            // 136
                                                                                   // 137
      ptrs[i] = (j === 0 ? -1 : seq_ends[j-1]);                                    // 138
      seq_ends[j] = i;                                                             // 139
      if (j+1 > max_seq_len)                                                       // 140
        max_seq_len = j+1;                                                         // 141
    }                                                                              // 142
  }                                                                                // 143
                                                                                   // 144
  // pull out the LCS/LIS into unmoved                                             // 145
  var idx = (max_seq_len === 0 ? -1 : seq_ends[max_seq_len-1]);                    // 146
  while (idx >= 0) {                                                               // 147
    unmoved.push(idx);                                                             // 148
    idx = ptrs[idx];                                                               // 149
  }                                                                                // 150
  // the unmoved item list is built backwards, so fix that                         // 151
  unmoved.reverse();                                                               // 152
                                                                                   // 153
  // the last group is always anchored by the end of the result list, which is     // 154
  // an id of "null"                                                               // 155
  unmoved.push(new_results.length);                                                // 156
                                                                                   // 157
  _.each(old_results, function (doc) {                                             // 158
    if (!new_presence_of_id[doc._id])                                              // 159
      observer.removed && observer.removed(doc._id);                               // 160
  });                                                                              // 161
  // for each group of things in the new_results that is anchored by an unmoved    // 162
  // element, iterate through the things before it.                                // 163
  var startOfGroup = 0;                                                            // 164
  _.each(unmoved, function (endOfGroup) {                                          // 165
    var groupId = new_results[endOfGroup] ? new_results[endOfGroup]._id : null;    // 166
    var oldDoc, newDoc, fields, projectedNew, projectedOld;                        // 167
    for (var i = startOfGroup; i < endOfGroup; i++) {                              // 168
      newDoc = new_results[i];                                                     // 169
      if (!_.has(old_index_of_id, newDoc._id)) {                                   // 170
        fields = projectionFn(newDoc);                                             // 171
        delete fields._id;                                                         // 172
        observer.addedBefore && observer.addedBefore(newDoc._id, fields, groupId);
        observer.added && observer.added(newDoc._id, fields);                      // 174
      } else {                                                                     // 175
        // moved                                                                   // 176
        oldDoc = old_results[old_index_of_id[newDoc._id]];                         // 177
        projectedNew = projectionFn(newDoc);                                       // 178
        projectedOld = projectionFn(oldDoc);                                       // 179
        fields = DiffSequence.makeChangedFields(projectedNew, projectedOld);       // 180
        if (!_.isEmpty(fields)) {                                                  // 181
          observer.changed && observer.changed(newDoc._id, fields);                // 182
        }                                                                          // 183
        observer.movedBefore && observer.movedBefore(newDoc._id, groupId);         // 184
      }                                                                            // 185
    }                                                                              // 186
    if (groupId) {                                                                 // 187
      newDoc = new_results[endOfGroup];                                            // 188
      oldDoc = old_results[old_index_of_id[newDoc._id]];                           // 189
      projectedNew = projectionFn(newDoc);                                         // 190
      projectedOld = projectionFn(oldDoc);                                         // 191
      fields = DiffSequence.makeChangedFields(projectedNew, projectedOld);         // 192
      if (!_.isEmpty(fields)) {                                                    // 193
        observer.changed && observer.changed(newDoc._id, fields);                  // 194
      }                                                                            // 195
    }                                                                              // 196
    startOfGroup = endOfGroup+1;                                                   // 197
  });                                                                              // 198
                                                                                   // 199
                                                                                   // 200
};                                                                                 // 201
                                                                                   // 202
                                                                                   // 203
// General helper for diff-ing two objects.                                        // 204
// callbacks is an object like so:                                                 // 205
// { leftOnly: function (key, leftValue) {...},                                    // 206
//   rightOnly: function (key, rightValue) {...},                                  // 207
//   both: function (key, leftValue, rightValue) {...},                            // 208
// }                                                                               // 209
DiffSequence.diffObjects = function (left, right, callbacks) {                     // 210
  _.each(left, function (leftValue, key) {                                         // 211
    if (_.has(right, key))                                                         // 212
      callbacks.both && callbacks.both(key, leftValue, right[key]);                // 213
    else                                                                           // 214
      callbacks.leftOnly && callbacks.leftOnly(key, leftValue);                    // 215
  });                                                                              // 216
  if (callbacks.rightOnly) {                                                       // 217
    _.each(right, function(rightValue, key) {                                      // 218
      if (!_.has(left, key))                                                       // 219
        callbacks.rightOnly(key, rightValue);                                      // 220
    });                                                                            // 221
  }                                                                                // 222
};                                                                                 // 223
                                                                                   // 224
                                                                                   // 225
DiffSequence.makeChangedFields = function (newDoc, oldDoc) {                       // 226
  var fields = {};                                                                 // 227
  DiffSequence.diffObjects(oldDoc, newDoc, {                                       // 228
    leftOnly: function (key, value) {                                              // 229
      fields[key] = undefined;                                                     // 230
    },                                                                             // 231
    rightOnly: function (key, value) {                                             // 232
      fields[key] = value;                                                         // 233
    },                                                                             // 234
    both: function (key, leftValue, rightValue) {                                  // 235
      if (!EJSON.equals(leftValue, rightValue))                                    // 236
        fields[key] = rightValue;                                                  // 237
    }                                                                              // 238
  });                                                                              // 239
  return fields;                                                                   // 240
};                                                                                 // 241
                                                                                   // 242
DiffSequence.applyChanges = function (doc, changeFields) {                         // 243
  _.each(changeFields, function (value, key) {                                     // 244
    if (value === undefined)                                                       // 245
      delete doc[key];                                                             // 246
    else                                                                           // 247
      doc[key] = value;                                                            // 248
  });                                                                              // 249
};                                                                                 // 250
                                                                                   // 251
                                                                                   // 252
/////////////////////////////////////////////////////////////////////////////////////

}).call(this);


/* Exports */
if (typeof Package === 'undefined') Package = {};
(function (pkg, symbols) {
  for (var s in symbols)
    (s in pkg) || (pkg[s] = symbols[s]);
})(Package['diff-sequence'] = {}, {
  DiffSequence: DiffSequence
});

})();
(function () {

/* Imports */
var Meteor = Package.meteor.Meteor;
var global = Package.meteor.global;
var meteorEnv = Package.meteor.meteorEnv;
var Tracker = Package.tracker.Tracker;
var Deps = Package.tracker.Deps;
var MongoID = Package['mongo-id'].MongoID;
var DiffSequence = Package['diff-sequence'].DiffSequence;
var _ = Package.underscore._;
var Random = Package.random.Random;

/* Package-scope variables */
var ObserveSequence, seqChangedToEmpty, seqChangedToArray, seqChangedToCursor;

(function(){

///////////////////////////////////////////////////////////////////////////////////
//                                                                               //
// packages/observe-sequence/observe_sequence.js                                 //
//                                                                               //
///////////////////////////////////////////////////////////////////////////////////
                                                                                 //
var warn = function () {                                                         // 1
  if (ObserveSequence._suppressWarnings) {                                       // 2
    ObserveSequence._suppressWarnings--;                                         // 3
  } else {                                                                       // 4
    if (typeof console !== 'undefined' && console.warn)                          // 5
      console.warn.apply(console, arguments);                                    // 6
                                                                                 // 7
    ObserveSequence._loggedWarnings++;                                           // 8
  }                                                                              // 9
};                                                                               // 10
                                                                                 // 11
var idStringify = MongoID.idStringify;                                           // 12
var idParse = MongoID.idParse;                                                   // 13
                                                                                 // 14
ObserveSequence = {                                                              // 15
  _suppressWarnings: 0,                                                          // 16
  _loggedWarnings: 0,                                                            // 17
                                                                                 // 18
  // A mechanism similar to cursor.observe which receives a reactive             // 19
  // function returning a sequence type and firing appropriate callbacks         // 20
  // when the value changes.                                                     // 21
  //                                                                             // 22
  // @param sequenceFunc {Function} a reactive function returning a              // 23
  //     sequence type. The currently supported sequence types are:              // 24
  //     Array, Cursor, and null.                                                // 25
  //                                                                             // 26
  // @param callbacks {Object} similar to a specific subset of                   // 27
  //     callbacks passed to `cursor.observe`                                    // 28
  //     (http://docs.meteor.com/#observe), with minor variations to             // 29
  //     support the fact that not all sequences contain objects with            // 30
  //     _id fields.  Specifically:                                              // 31
  //                                                                             // 32
  //     * addedAt(id, item, atIndex, beforeId)                                  // 33
  //     * changedAt(id, newItem, oldItem, atIndex)                              // 34
  //     * removedAt(id, oldItem, atIndex)                                       // 35
  //     * movedTo(id, item, fromIndex, toIndex, beforeId)                       // 36
  //                                                                             // 37
  // @returns {Object(stop: Function)} call 'stop' on the return value           // 38
  //     to stop observing this sequence function.                               // 39
  //                                                                             // 40
  // We don't make any assumptions about our ability to compare sequence         // 41
  // elements (ie, we don't assume EJSON.equals works; maybe there is extra      // 42
  // state/random methods on the objects) so unlike cursor.observe, we may       // 43
  // sometimes call changedAt() when nothing actually changed.                   // 44
  // XXX consider if we *can* make the stronger assumption and avoid             // 45
  //     no-op changedAt calls (in some cases?)                                  // 46
  //                                                                             // 47
  // XXX currently only supports the callbacks used by our                       // 48
  // implementation of {{#each}}, but this can be expanded.                      // 49
  //                                                                             // 50
  // XXX #each doesn't use the indices (though we'll eventually need             // 51
  // a way to get them when we support `@index`), but calling                    // 52
  // `cursor.observe` causes the index to be calculated on every                 // 53
  // callback using a linear scan (unless you turn it off by passing             // 54
  // `_no_indices`).  Any way to avoid calculating indices on a pure             // 55
  // cursor observe like we used to?                                             // 56
  observe: function (sequenceFunc, callbacks) {                                  // 57
    var lastSeq = null;                                                          // 58
    var activeObserveHandle = null;                                              // 59
                                                                                 // 60
    // 'lastSeqArray' contains the previous value of the sequence                // 61
    // we're observing. It is an array of objects with '_id' and                 // 62
    // 'item' fields.  'item' is the element in the array, or the                // 63
    // document in the cursor.                                                   // 64
    //                                                                           // 65
    // '_id' is whichever of the following is relevant, unless it has            // 66
    // already appeared -- in which case it's randomly generated.                // 67
    //                                                                           // 68
    // * if 'item' is an object:                                                 // 69
    //   * an '_id' field, if present                                            // 70
    //   * otherwise, the index in the array                                     // 71
    //                                                                           // 72
    // * if 'item' is a number or string, use that value                         // 73
    //                                                                           // 74
    // XXX this can be generalized by allowing {{#each}} to accept a             // 75
    // general 'key' argument which could be a function, a dotted                // 76
    // field name, or the special @index value.                                  // 77
    var lastSeqArray = []; // elements are objects of form {_id, item}           // 78
    var computation = Tracker.autorun(function () {                              // 79
      var seq = sequenceFunc();                                                  // 80
                                                                                 // 81
      Tracker.nonreactive(function () {                                          // 82
        var seqArray; // same structure as `lastSeqArray` above.                 // 83
                                                                                 // 84
        if (activeObserveHandle) {                                               // 85
          // If we were previously observing a cursor, replace lastSeqArray with
          // more up-to-date information.  Then stop the old observe.            // 87
          lastSeqArray = _.map(lastSeq.fetch(), function (doc) {                 // 88
            return {_id: doc._id, item: doc};                                    // 89
          });                                                                    // 90
          activeObserveHandle.stop();                                            // 91
          activeObserveHandle = null;                                            // 92
        }                                                                        // 93
                                                                                 // 94
        if (!seq) {                                                              // 95
          seqArray = seqChangedToEmpty(lastSeqArray, callbacks);                 // 96
        } else if (seq instanceof Array) {                                       // 97
          seqArray = seqChangedToArray(lastSeqArray, seq, callbacks);            // 98
        } else if (isStoreCursor(seq)) {                                         // 99
          var result /* [seqArray, activeObserveHandle] */ =                     // 100
                seqChangedToCursor(lastSeqArray, seq, callbacks);                // 101
          seqArray = result[0];                                                  // 102
          activeObserveHandle = result[1];                                       // 103
        } else {                                                                 // 104
          throw badSequenceError();                                              // 105
        }                                                                        // 106
                                                                                 // 107
        diffArray(lastSeqArray, seqArray, callbacks);                            // 108
        lastSeq = seq;                                                           // 109
        lastSeqArray = seqArray;                                                 // 110
      });                                                                        // 111
    });                                                                          // 112
                                                                                 // 113
    return {                                                                     // 114
      stop: function () {                                                        // 115
        computation.stop();                                                      // 116
        if (activeObserveHandle)                                                 // 117
          activeObserveHandle.stop();                                            // 118
      }                                                                          // 119
    };                                                                           // 120
  },                                                                             // 121
                                                                                 // 122
  // Fetch the items of `seq` into an array, where `seq` is of one of the        // 123
  // sequence types accepted by `observe`.  If `seq` is a cursor, a              // 124
  // dependency is established.                                                  // 125
  fetch: function (seq) {                                                        // 126
    if (!seq) {                                                                  // 127
      return [];                                                                 // 128
    } else if (seq instanceof Array) {                                           // 129
      return seq;                                                                // 130
    } else if (isStoreCursor(seq)) {                                             // 131
      return seq.fetch();                                                        // 132
    } else {                                                                     // 133
      throw badSequenceError();                                                  // 134
    }                                                                            // 135
  }                                                                              // 136
};                                                                               // 137
                                                                                 // 138
var badSequenceError = function () {                                             // 139
  return new Error("{{#each}} currently only accepts " +                         // 140
                   "arrays, cursors or falsey values.");                         // 141
};                                                                               // 142
                                                                                 // 143
var isStoreCursor = function (cursor) {                                          // 144
  return cursor && _.isObject(cursor) &&                                         // 145
    _.isFunction(cursor.observe) && _.isFunction(cursor.fetch);                  // 146
};                                                                               // 147
                                                                                 // 148
// Calculates the differences between `lastSeqArray` and                         // 149
// `seqArray` and calls appropriate functions from `callbacks`.                  // 150
// Reuses Minimongo's diff algorithm implementation.                             // 151
var diffArray = function (lastSeqArray, seqArray, callbacks) {                   // 152
  var diffFn = Package['diff-sequence'].DiffSequence.diffQueryOrderedChanges;    // 153
  var oldIdObjects = [];                                                         // 154
  var newIdObjects = [];                                                         // 155
  var posOld = {}; // maps from idStringify'd ids                                // 156
  var posNew = {}; // ditto                                                      // 157
  var posCur = {};                                                               // 158
  var lengthCur = lastSeqArray.length;                                           // 159
                                                                                 // 160
  _.each(seqArray, function (doc, i) {                                           // 161
    newIdObjects.push({_id: doc._id});                                           // 162
    posNew[idStringify(doc._id)] = i;                                            // 163
  });                                                                            // 164
  _.each(lastSeqArray, function (doc, i) {                                       // 165
    oldIdObjects.push({_id: doc._id});                                           // 166
    posOld[idStringify(doc._id)] = i;                                            // 167
    posCur[idStringify(doc._id)] = i;                                            // 168
  });                                                                            // 169
                                                                                 // 170
  // Arrays can contain arbitrary objects. We don't diff the                     // 171
  // objects. Instead we always fire 'changedAt' callback on every               // 172
  // object. The consumer of `observe-sequence` should deal with                 // 173
  // it appropriately.                                                           // 174
  diffFn(oldIdObjects, newIdObjects, {                                           // 175
    addedBefore: function (id, doc, before) {                                    // 176
      var position = before ? posCur[idStringify(before)] : lengthCur;           // 177
                                                                                 // 178
      if (before) {                                                              // 179
        // If not adding at the end, we need to update indexes.                  // 180
        // XXX this can still be improved greatly!                               // 181
        _.each(posCur, function (pos, id) {                                      // 182
          if (pos >= position)                                                   // 183
            posCur[id]++;                                                        // 184
        });                                                                      // 185
      }                                                                          // 186
                                                                                 // 187
      lengthCur++;                                                               // 188
      posCur[idStringify(id)] = position;                                        // 189
                                                                                 // 190
      callbacks.addedAt(                                                         // 191
        id,                                                                      // 192
        seqArray[posNew[idStringify(id)]].item,                                  // 193
        position,                                                                // 194
        before);                                                                 // 195
    },                                                                           // 196
    movedBefore: function (id, before) {                                         // 197
      if (id === before)                                                         // 198
        return;                                                                  // 199
                                                                                 // 200
      var oldPosition = posCur[idStringify(id)];                                 // 201
      var newPosition = before ? posCur[idStringify(before)] : lengthCur;        // 202
                                                                                 // 203
      // Moving the item forward. The new element is losing one position as it   // 204
      // was removed from the old position before being inserted at the new      // 205
      // position.                                                               // 206
      // Ex.:   0  *1*  2   3   4                                                // 207
      //        0   2   3  *1*  4                                                // 208
      // The original issued callback is "1" before "4".                         // 209
      // The position of "1" is 1, the position of "4" is 4.                     // 210
      // The generated move is (1) -> (3)                                        // 211
      if (newPosition > oldPosition) {                                           // 212
        newPosition--;                                                           // 213
      }                                                                          // 214
                                                                                 // 215
      // Fix up the positions of elements between the old and the new positions  // 216
      // of the moved element.                                                   // 217
      //                                                                         // 218
      // There are two cases:                                                    // 219
      //   1. The element is moved forward. Then all the positions in between    // 220
      //   are moved back.                                                       // 221
      //   2. The element is moved back. Then the positions in between *and* the
      //   element that is currently standing on the moved element's future      // 223
      //   position are moved forward.                                           // 224
      _.each(posCur, function (elCurPosition, id) {                              // 225
        if (oldPosition < elCurPosition && elCurPosition < newPosition)          // 226
          posCur[id]--;                                                          // 227
        else if (newPosition <= elCurPosition && elCurPosition < oldPosition)    // 228
          posCur[id]++;                                                          // 229
      });                                                                        // 230
                                                                                 // 231
      // Finally, update the position of the moved element.                      // 232
      posCur[idStringify(id)] = newPosition;                                     // 233
                                                                                 // 234
      callbacks.movedTo(                                                         // 235
        id,                                                                      // 236
        seqArray[posNew[idStringify(id)]].item,                                  // 237
        oldPosition,                                                             // 238
        newPosition,                                                             // 239
        before);                                                                 // 240
    },                                                                           // 241
    removed: function (id) {                                                     // 242
      var prevPosition = posCur[idStringify(id)];                                // 243
                                                                                 // 244
      _.each(posCur, function (pos, id) {                                        // 245
        if (pos >= prevPosition)                                                 // 246
          posCur[id]--;                                                          // 247
      });                                                                        // 248
                                                                                 // 249
      delete posCur[idStringify(id)];                                            // 250
      lengthCur--;                                                               // 251
                                                                                 // 252
      callbacks.removedAt(                                                       // 253
        id,                                                                      // 254
        lastSeqArray[posOld[idStringify(id)]].item,                              // 255
        prevPosition);                                                           // 256
    }                                                                            // 257
  });                                                                            // 258
                                                                                 // 259
  _.each(posNew, function (pos, idString) {                                      // 260
    var id = idParse(idString);                                                  // 261
    if (_.has(posOld, idString)) {                                               // 262
      // specifically for primitive types, compare equality before               // 263
      // firing the 'changedAt' callback. otherwise, always fire it              // 264
      // because doing a deep EJSON comparison is not guaranteed to              // 265
      // work (an array can contain arbitrary objects, and 'transform'           // 266
      // can be used on cursors). also, deep diffing is not                      // 267
      // necessarily the most efficient (if only a specific subfield             // 268
      // of the object is later accessed).                                       // 269
      var newItem = seqArray[pos].item;                                          // 270
      var oldItem = lastSeqArray[posOld[idString]].item;                         // 271
                                                                                 // 272
      if (typeof newItem === 'object' || newItem !== oldItem)                    // 273
          callbacks.changedAt(id, newItem, oldItem, pos);                        // 274
      }                                                                          // 275
  });                                                                            // 276
};                                                                               // 277
                                                                                 // 278
seqChangedToEmpty = function (lastSeqArray, callbacks) {                         // 279
  return [];                                                                     // 280
};                                                                               // 281
                                                                                 // 282
seqChangedToArray = function (lastSeqArray, array, callbacks) {                  // 283
  var idsUsed = {};                                                              // 284
  var seqArray = _.map(array, function (item, index) {                           // 285
    var id;                                                                      // 286
    if (typeof item === 'string') {                                              // 287
      // ensure not empty, since other layers (eg DomRange) assume this as well  // 288
      id = "-" + item;                                                           // 289
    } else if (typeof item === 'number' ||                                       // 290
               typeof item === 'boolean' ||                                      // 291
               item === undefined) {                                             // 292
      id = item;                                                                 // 293
    } else if (typeof item === 'object') {                                       // 294
      id = (item && ('_id' in item)) ? item._id : index;                         // 295
    } else {                                                                     // 296
      throw new Error("{{#each}} doesn't support arrays with " +                 // 297
                      "elements of type " + typeof item);                        // 298
    }                                                                            // 299
                                                                                 // 300
    var idString = idStringify(id);                                              // 301
    if (idsUsed[idString]) {                                                     // 302
      if (typeof item === 'object' && '_id' in item)                             // 303
        warn("duplicate id " + id + " in", array);                               // 304
      id = Random.id();                                                          // 305
    } else {                                                                     // 306
      idsUsed[idString] = true;                                                  // 307
    }                                                                            // 308
                                                                                 // 309
    return { _id: id, item: item };                                              // 310
  });                                                                            // 311
                                                                                 // 312
  return seqArray;                                                               // 313
};                                                                               // 314
                                                                                 // 315
seqChangedToCursor = function (lastSeqArray, cursor, callbacks) {                // 316
  var initial = true; // are we observing initial data from cursor?              // 317
  var seqArray = [];                                                             // 318
                                                                                 // 319
  var observeHandle = cursor.observe({                                           // 320
    addedAt: function (document, atIndex, before) {                              // 321
      if (initial) {                                                             // 322
        // keep track of initial data so that we can diff once                   // 323
        // we exit `observe`.                                                    // 324
        if (before !== null)                                                     // 325
          throw new Error("Expected initial data from observe in order");        // 326
        seqArray.push({ _id: document._id, item: document });                    // 327
      } else {                                                                   // 328
        callbacks.addedAt(document._id, document, atIndex, before);              // 329
      }                                                                          // 330
    },                                                                           // 331
    changedAt: function (newDocument, oldDocument, atIndex) {                    // 332
      callbacks.changedAt(newDocument._id, newDocument, oldDocument,             // 333
                          atIndex);                                              // 334
    },                                                                           // 335
    removedAt: function (oldDocument, atIndex) {                                 // 336
      callbacks.removedAt(oldDocument._id, oldDocument, atIndex);                // 337
    },                                                                           // 338
    movedTo: function (document, fromIndex, toIndex, before) {                   // 339
      callbacks.movedTo(                                                         // 340
        document._id, document, fromIndex, toIndex, before);                     // 341
    }                                                                            // 342
  });                                                                            // 343
  initial = false;                                                               // 344
                                                                                 // 345
  return [seqArray, observeHandle];                                              // 346
};                                                                               // 347
                                                                                 // 348
///////////////////////////////////////////////////////////////////////////////////

}).call(this);


/* Exports */
if (typeof Package === 'undefined') Package = {};
(function (pkg, symbols) {
  for (var s in symbols)
    (s in pkg) || (pkg[s] = symbols[s]);
})(Package['observe-sequence'] = {}, {
  ObserveSequence: ObserveSequence
});

})();
(function () {

/* Imports */
var Meteor = Package.meteor.Meteor;
var global = Package.meteor.global;
var meteorEnv = Package.meteor.meteorEnv;



/* Exports */
if (typeof Package === 'undefined') Package = {};
Package.ecmascript = {};

})();
(function () {

/* Imports */
var Meteor = Package.meteor.Meteor;
var global = Package.meteor.global;
var meteorEnv = Package.meteor.meteorEnv;
var meteorInstall = Package.modules.meteorInstall;
var Buffer = Package.modules.Buffer;
var process = Package.modules.process;
var Promise = Package.promise.Promise;

/* Package-scope variables */
var meteorBabelHelpers;

var require = meteorInstall({"node_modules":{"meteor":{"babel-runtime":{"babel-runtime.js":["regenerator/runtime-module",function(require,exports,module){

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                         //
// packages/babel-runtime/babel-runtime.js                                                                 //
//                                                                                                         //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                           //
var hasOwn = Object.prototype.hasOwnProperty;                                                              // 1
var S = typeof Symbol === "function" ? Symbol : {};                                                        // 2
var iteratorSymbol = S.iterator || "@@iterator";                                                           // 3
                                                                                                           // 4
function canDefineNonEnumerableProperties() {                                                              // 5
  var testObj = {};                                                                                        // 6
  var testPropName = "t";                                                                                  // 7
                                                                                                           // 8
  try {                                                                                                    // 9
    Object.defineProperty(testObj, testPropName, {                                                         // 10
      enumerable: false,                                                                                   // 11
      value: testObj                                                                                       // 12
    });                                                                                                    // 13
                                                                                                           // 14
    for (var k in testObj) {                                                                               // 15
      if (k === testPropName) {                                                                            // 16
        return false;                                                                                      // 17
      }                                                                                                    // 18
    }                                                                                                      // 19
  } catch (e) {                                                                                            // 20
    return false;                                                                                          // 21
  }                                                                                                        // 22
                                                                                                           // 23
  return testObj[testPropName] === testObj;                                                                // 24
}                                                                                                          // 25
                                                                                                           // 26
meteorBabelHelpers = {                                                                                     // 27
  // Meteor-specific runtime helper for wrapping the object of for-in                                      // 28
  // loops, so that inherited Array methods defined by es5-shim can be                                     // 29
  // ignored in browsers where they cannot be defined as non-enumerable.                                   // 30
  sanitizeForInObject: canDefineNonEnumerableProperties()                                                  // 31
    ? function (value) { return value; }                                                                   // 32
    : function (obj) {                                                                                     // 33
      if (Array.isArray(obj)) {                                                                            // 34
        var newObj = {};                                                                                   // 35
        var keys = Object.keys(obj);                                                                       // 36
        var keyCount = keys.length;                                                                        // 37
        for (var i = 0; i < keyCount; ++i) {                                                               // 38
          var key = keys[i];                                                                               // 39
          newObj[key] = obj[key];                                                                          // 40
        }                                                                                                  // 41
        return newObj;                                                                                     // 42
      }                                                                                                    // 43
                                                                                                           // 44
      return obj;                                                                                          // 45
    }                                                                                                      // 46
};                                                                                                         // 47
                                                                                                           // 48
var BabelRuntime = {                                                                                       // 49
  // es6.templateLiterals                                                                                  // 50
  // Constructs the object passed to the tag function in a tagged                                          // 51
  // template literal.                                                                                     // 52
  taggedTemplateLiteralLoose: function (strings, raw) {                                                    // 53
    // Babel's own version of this calls Object.freeze on `strings` and                                    // 54
    // `strings.raw`, but it doesn't seem worth the compatibility and                                      // 55
    // performance concerns.  If you're writing code against this helper,                                  // 56
    // don't add properties to these objects.                                                              // 57
    strings.raw = raw;                                                                                     // 58
    return strings;                                                                                        // 59
  },                                                                                                       // 60
                                                                                                           // 61
  // es6.classes                                                                                           // 62
  // Checks that a class constructor is being called with `new`, and throws                                // 63
  // an error if it is not.                                                                                // 64
  classCallCheck: function (instance, Constructor) {                                                       // 65
    if (!(instance instanceof Constructor)) {                                                              // 66
      throw new TypeError("Cannot call a class as a function");                                            // 67
    }                                                                                                      // 68
  },                                                                                                       // 69
                                                                                                           // 70
  // es6.classes                                                                                           // 71
  inherits: function (subClass, superClass) {                                                              // 72
    if (typeof superClass !== "function" && superClass !== null) {                                         // 73
      throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
    }                                                                                                      // 75
                                                                                                           // 76
    if (superClass) {                                                                                      // 77
      if (Object.create) {                                                                                 // 78
        // All but IE 8                                                                                    // 79
        subClass.prototype = Object.create(superClass.prototype, {                                         // 80
          constructor: {                                                                                   // 81
            value: subClass,                                                                               // 82
            enumerable: false,                                                                             // 83
            writable: true,                                                                                // 84
            configurable: true                                                                             // 85
          }                                                                                                // 86
        });                                                                                                // 87
      } else {                                                                                             // 88
        // IE 8 path.  Slightly worse for modern browsers, because `constructor`                           // 89
        // is enumerable and shows up in the inspector unnecessarily.                                      // 90
        // It's not an "own" property of any instance though.                                              // 91
        //                                                                                                 // 92
        // For correctness when writing code,                                                              // 93
        // don't enumerate all the own-and-inherited properties of an instance                             // 94
        // of a class and expect not to find `constructor` (but who does that?).                           // 95
        var F = function () {                                                                              // 96
          this.constructor = subClass;                                                                     // 97
        };                                                                                                 // 98
        F.prototype = superClass.prototype;                                                                // 99
        subClass.prototype = new F();                                                                      // 100
      }                                                                                                    // 101
                                                                                                           // 102
      // For modern browsers, this would be `subClass.__proto__ = superClass`,                             // 103
      // but IE <=10 don't support `__proto__`, and in this case the difference                            // 104
      // would be detectable; code that works in modern browsers could easily                              // 105
      // fail on IE 8 if we ever used the `__proto__` trick.                                               // 106
      //                                                                                                   // 107
      // There's no perfect way to make static methods inherited if they are                               // 108
      // assigned after declaration of the classes.  The best we can do is                                 // 109
      // to copy them.  In other words, when you write `class Foo                                          // 110
      // extends Bar`, we copy the static methods from Bar onto Foo, but future                            // 111
      // ones are not copied.                                                                              // 112
      //                                                                                                   // 113
      // For correctness when writing code, don't add static methods to a class                            // 114
      // after you subclass it.                                                                            // 115
                                                                                                           // 116
      // The ecmascript-runtime package provides adequate polyfills for                                    // 117
      // all of these Object.* functions (and Array#forEach), and anyone                                   // 118
      // using babel-runtime is almost certainly using it because of the                                   // 119
      // ecmascript package, which also implies ecmascript-runtime.                                        // 120
      Object.getOwnPropertyNames(superClass).forEach(function (k) {                                        // 121
        // This property descriptor dance preserves getter/setter behavior                                 // 122
        // in browsers that support accessor properties (all except                                        // 123
        // IE8). In IE8, the superClass can't have accessor properties                                     // 124
        // anyway, so this code is still safe.                                                             // 125
        var descriptor = Object.getOwnPropertyDescriptor(superClass, k);                                   // 126
        if (descriptor && typeof descriptor === "object") {                                                // 127
          if (Object.getOwnPropertyDescriptor(subClass, k)) {                                              // 128
            // If subClass already has a property by this name, then it                                    // 129
            // would not be inherited, so it should not be copied. This                                    // 130
            // notably excludes properties like .prototype and .name.                                      // 131
            return;                                                                                        // 132
          }                                                                                                // 133
                                                                                                           // 134
          Object.defineProperty(subClass, k, descriptor);                                                  // 135
        }                                                                                                  // 136
      });                                                                                                  // 137
    }                                                                                                      // 138
  },                                                                                                       // 139
                                                                                                           // 140
  createClass: (function () {                                                                              // 141
    var hasDefineProperty = false;                                                                         // 142
    try {                                                                                                  // 143
      // IE 8 has a broken Object.defineProperty, so feature-test by                                       // 144
      // trying to call it.                                                                                // 145
      Object.defineProperty({}, 'x', {});                                                                  // 146
      hasDefineProperty = true;                                                                            // 147
    } catch (e) {}                                                                                         // 148
                                                                                                           // 149
    function defineProperties(target, props) {                                                             // 150
      for (var i = 0; i < props.length; i++) {                                                             // 151
        var descriptor = props[i];                                                                         // 152
        descriptor.enumerable = descriptor.enumerable || false;                                            // 153
        descriptor.configurable = true;                                                                    // 154
        if ("value" in descriptor) descriptor.writable = true;                                             // 155
        Object.defineProperty(target, descriptor.key, descriptor);                                         // 156
      }                                                                                                    // 157
    }                                                                                                      // 158
                                                                                                           // 159
    return function (Constructor, protoProps, staticProps) {                                               // 160
      if (! hasDefineProperty) {                                                                           // 161
        // e.g. `class Foo { get bar() {} }`.  If you try to use getters and                               // 162
        // setters in IE 8, you will get a big nasty error, with or without                                // 163
        // Babel.  I don't know of any other syntax features besides getters                               // 164
        // and setters that will trigger this error.                                                       // 165
        throw new Error(                                                                                   // 166
          "Your browser does not support this type of class property.  " +                                 // 167
            "For example, Internet Explorer 8 does not support getters and " +                             // 168
            "setters.");                                                                                   // 169
      }                                                                                                    // 170
                                                                                                           // 171
      if (protoProps) defineProperties(Constructor.prototype, protoProps);                                 // 172
      if (staticProps) defineProperties(Constructor, staticProps);                                         // 173
      return Constructor;                                                                                  // 174
    };                                                                                                     // 175
  })(),                                                                                                    // 176
                                                                                                           // 177
  "typeof": function (obj) {                                                                               // 178
    return obj && obj.constructor === Symbol ? "symbol" : typeof obj;                                      // 179
  },                                                                                                       // 180
                                                                                                           // 181
  possibleConstructorReturn: function (self, call) {                                                       // 182
    if (! self) {                                                                                          // 183
      throw new ReferenceError(                                                                            // 184
        "this hasn't been initialised - super() hasn't been called"                                        // 185
      );                                                                                                   // 186
    }                                                                                                      // 187
                                                                                                           // 188
    var callType = typeof call;                                                                            // 189
    if (call &&                                                                                            // 190
        callType === "function" ||                                                                         // 191
        callType === "object") {                                                                           // 192
      return call;                                                                                         // 193
    }                                                                                                      // 194
                                                                                                           // 195
    return self;                                                                                           // 196
  },                                                                                                       // 197
                                                                                                           // 198
  interopRequireDefault: function (obj) {                                                                  // 199
    return obj && obj.__esModule ? obj : { 'default': obj };                                               // 200
  },                                                                                                       // 201
                                                                                                           // 202
  interopRequireWildcard: function (obj) {                                                                 // 203
    if (obj && obj.__esModule) {                                                                           // 204
      return obj;                                                                                          // 205
    }                                                                                                      // 206
                                                                                                           // 207
    var newObj = {};                                                                                       // 208
                                                                                                           // 209
    if (obj != null) {                                                                                     // 210
      for (var key in obj) {                                                                               // 211
        if (hasOwn.call(obj, key)) {                                                                       // 212
          newObj[key] = obj[key];                                                                          // 213
        }                                                                                                  // 214
      }                                                                                                    // 215
    }                                                                                                      // 216
                                                                                                           // 217
    newObj["default"] = obj;                                                                               // 218
    return newObj;                                                                                         // 219
  },                                                                                                       // 220
                                                                                                           // 221
  interopExportWildcard: function (obj, defaults) {                                                        // 222
    var newObj = defaults({}, obj);                                                                        // 223
    delete newObj["default"];                                                                              // 224
    return newObj;                                                                                         // 225
  },                                                                                                       // 226
                                                                                                           // 227
  defaults: function (obj, defaults) {                                                                     // 228
    Object.getOwnPropertyNames(defaults).forEach(function (key) {                                          // 229
      var desc = Object.getOwnPropertyDescriptor(defaults, key);                                           // 230
      if (desc && desc.configurable && typeof obj[key] === "undefined") {                                  // 231
        Object.defineProperty(obj, key, desc);                                                             // 232
      }                                                                                                    // 233
    });                                                                                                    // 234
                                                                                                           // 235
    return obj;                                                                                            // 236
  },                                                                                                       // 237
                                                                                                           // 238
  // es7.objectRestSpread and react (JSX)                                                                  // 239
  "extends": Object.assign || (function (target) {                                                         // 240
    for (var i = 1; i < arguments.length; i++) {                                                           // 241
      var source = arguments[i];                                                                           // 242
      for (var key in source) {                                                                            // 243
        if (hasOwn.call(source, key)) {                                                                    // 244
          target[key] = source[key];                                                                       // 245
        }                                                                                                  // 246
      }                                                                                                    // 247
    }                                                                                                      // 248
    return target;                                                                                         // 249
  }),                                                                                                      // 250
                                                                                                           // 251
  // es6.destructuring                                                                                     // 252
  objectWithoutProperties: function (obj, keys) {                                                          // 253
    var target = {};                                                                                       // 254
    outer: for (var i in obj) {                                                                            // 255
      if (! hasOwn.call(obj, i)) continue;                                                                 // 256
      for (var j = 0; j < keys.length; j++) {                                                              // 257
        if (keys[j] === i) continue outer;                                                                 // 258
      }                                                                                                    // 259
      target[i] = obj[i];                                                                                  // 260
    }                                                                                                      // 261
    return target;                                                                                         // 262
  },                                                                                                       // 263
                                                                                                           // 264
  // es6.destructuring                                                                                     // 265
  objectDestructuringEmpty: function (obj) {                                                               // 266
    if (obj == null) throw new TypeError("Cannot destructure undefined");                                  // 267
  },                                                                                                       // 268
                                                                                                           // 269
  // es6.spread                                                                                            // 270
  bind: Function.prototype.bind || (function () {                                                          // 271
    var isCallable = function (value) { return typeof value === 'function'; };                             // 272
    var $Object = Object;                                                                                  // 273
    var to_string = Object.prototype.toString;                                                             // 274
    var array_slice = Array.prototype.slice;                                                               // 275
    var array_concat = Array.prototype.concat;                                                             // 276
    var array_push = Array.prototype.push;                                                                 // 277
    var max = Math.max;                                                                                    // 278
    var Empty = function Empty() {};                                                                       // 279
                                                                                                           // 280
    // Copied from es5-shim.js (3ac7942).  See original for more comments.                                 // 281
    return function bind(that) {                                                                           // 282
      var target = this;                                                                                   // 283
      if (!isCallable(target)) {                                                                           // 284
        throw new TypeError('Function.prototype.bind called on incompatible ' + target);                   // 285
      }                                                                                                    // 286
                                                                                                           // 287
      var args = array_slice.call(arguments, 1);                                                           // 288
                                                                                                           // 289
      var bound;                                                                                           // 290
      var binder = function () {                                                                           // 291
                                                                                                           // 292
        if (this instanceof bound) {                                                                       // 293
          var result = target.apply(                                                                       // 294
            this,                                                                                          // 295
            array_concat.call(args, array_slice.call(arguments))                                           // 296
          );                                                                                               // 297
          if ($Object(result) === result) {                                                                // 298
            return result;                                                                                 // 299
          }                                                                                                // 300
          return this;                                                                                     // 301
        } else {                                                                                           // 302
          return target.apply(                                                                             // 303
            that,                                                                                          // 304
            array_concat.call(args, array_slice.call(arguments))                                           // 305
          );                                                                                               // 306
        }                                                                                                  // 307
      };                                                                                                   // 308
                                                                                                           // 309
      var boundLength = max(0, target.length - args.length);                                               // 310
                                                                                                           // 311
      var boundArgs = [];                                                                                  // 312
      for (var i = 0; i < boundLength; i++) {                                                              // 313
        array_push.call(boundArgs, '$' + i);                                                               // 314
      }                                                                                                    // 315
                                                                                                           // 316
      // Create a Function from source code so that it has the right `.length`.                            // 317
      // Probably not important for Babel.  This code violates CSPs that ban                               // 318
      // `eval`, but the browsers that need this polyfill don't have CSP!                                  // 319
      bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this, arguments); }')(binder);
                                                                                                           // 321
      if (target.prototype) {                                                                              // 322
        Empty.prototype = target.prototype;                                                                // 323
        bound.prototype = new Empty();                                                                     // 324
        Empty.prototype = null;                                                                            // 325
      }                                                                                                    // 326
                                                                                                           // 327
      return bound;                                                                                        // 328
    };                                                                                                     // 329
                                                                                                           // 330
  })(),                                                                                                    // 331
                                                                                                           // 332
  toConsumableArray: function (arr) {                                                                      // 333
    if (Array.isArray(arr)) {                                                                              // 334
      for (var i = arr.length - 1, arr2 = Array(i + 1); i >= 0; --i) {                                     // 335
        arr2[i] = arr[i];                                                                                  // 336
      }                                                                                                    // 337
                                                                                                           // 338
      return arr2;                                                                                         // 339
    }                                                                                                      // 340
                                                                                                           // 341
    return Array.from(arr);                                                                                // 342
  },                                                                                                       // 343
                                                                                                           // 344
  toArray: function (arr) {                                                                                // 345
    return Array.isArray(arr) ? arr : Array.from(arr);                                                     // 346
  },                                                                                                       // 347
                                                                                                           // 348
  slicedToArray: function (iterable, limit) {                                                              // 349
    if (Array.isArray(iterable)) {                                                                         // 350
      return iterable;                                                                                     // 351
    }                                                                                                      // 352
                                                                                                           // 353
    if (iterable) {                                                                                        // 354
      var it = iterable[iteratorSymbol]();                                                                 // 355
      var result = [];                                                                                     // 356
      var info;                                                                                            // 357
                                                                                                           // 358
      if (typeof limit !== "number") {                                                                     // 359
        limit = Infinity;                                                                                  // 360
      }                                                                                                    // 361
                                                                                                           // 362
      while (result.length < limit &&                                                                      // 363
             ! (info = it.next()).done) {                                                                  // 364
        result.push(info.value);                                                                           // 365
      }                                                                                                    // 366
                                                                                                           // 367
      return result;                                                                                       // 368
    }                                                                                                      // 369
                                                                                                           // 370
    throw new TypeError(                                                                                   // 371
      "Invalid attempt to destructure non-iterable instance"                                               // 372
    );                                                                                                     // 373
  },                                                                                                       // 374
                                                                                                           // 375
  slice: Array.prototype.slice                                                                             // 376
};                                                                                                         // 377
                                                                                                           // 378
// Use meteorInstall to install all of the above helper functions within                                   // 379
// node_modules/babel-runtime/helpers.                                                                     // 380
Object.keys(BabelRuntime).forEach(function (helperName) {                                                  // 381
  var helpers = {};                                                                                        // 382
                                                                                                           // 383
  helpers[helperName + ".js"] = function (require, exports, module) {                                      // 384
    module.exports = BabelRuntime[helperName];                                                             // 385
  };                                                                                                       // 386
                                                                                                           // 387
  meteorInstall({                                                                                          // 388
    node_modules: {                                                                                        // 389
      "babel-runtime": {                                                                                   // 390
        helpers: helpers                                                                                   // 391
      }                                                                                                    // 392
    }                                                                                                      // 393
  });                                                                                                      // 394
});                                                                                                        // 395
                                                                                                           // 396
// Use meteorInstall to install the regenerator runtime at                                                 // 397
// node_modules/babel-runtime/regenerator.                                                                 // 398
meteorInstall({                                                                                            // 399
  node_modules: {                                                                                          // 400
    "babel-runtime": {                                                                                     // 401
      "regenerator.js": function (r, e, module) {                                                          // 402
        // Note that we use the require function provided to the                                           // 403
        // babel-runtime.js file, not the one named 'r' above.                                             // 404
        var runtime = require("regenerator/runtime-module");                                               // 405
                                                                                                           // 406
        // If Promise.asyncApply is defined, use it to wrap calls to                                       // 407
        // runtime.async so that the entire async function will run in its                                 // 408
        // own Fiber, not just the code that comes after the first await.                                  // 409
        if (typeof Promise === "function" &&                                                               // 410
            typeof Promise.asyncApply === "function") {                                                    // 411
          var realAsync = runtime.async;                                                                   // 412
          runtime.async = function () {                                                                    // 413
            return Promise.asyncApply(realAsync, runtime, arguments);                                      // 414
          };                                                                                               // 415
        }                                                                                                  // 416
                                                                                                           // 417
        module.exports = runtime;                                                                          // 418
      }                                                                                                    // 419
    }                                                                                                      // 420
  }                                                                                                        // 421
});                                                                                                        // 422
                                                                                                           // 423
/////////////////////////////////////////////////////////////////////////////////////////////////////////////

}],"node_modules":{"regenerator":{"runtime-module.js":["./runtime",function(require,exports,module){

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                         //
// node_modules/meteor/babel-runtime/node_modules/regenerator/runtime-module.js                            //
//                                                                                                         //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                           //
// This method of obtaining a reference to the global object needs to be                                   // 1
// kept identical to the way it is obtained in runtime.js                                                  // 2
var g =                                                                                                    // 3
  typeof global === "object" ? global :                                                                    // 4
  typeof window === "object" ? window :                                                                    // 5
  typeof self === "object" ? self : this;                                                                  // 6
                                                                                                           // 7
// Use `getOwnPropertyNames` because not all browsers support calling                                      // 8
// `hasOwnProperty` on the global `self` object in a worker. See #183.                                     // 9
var hadRuntime = g.regeneratorRuntime &&                                                                   // 10
  Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0;                                        // 11
                                                                                                           // 12
// Save the old regeneratorRuntime in case it needs to be restored later.                                  // 13
var oldRuntime = hadRuntime && g.regeneratorRuntime;                                                       // 14
                                                                                                           // 15
// Force reevalutation of runtime.js.                                                                      // 16
g.regeneratorRuntime = undefined;                                                                          // 17
                                                                                                           // 18
module.exports = require("./runtime");                                                                     // 19
                                                                                                           // 20
if (hadRuntime) {                                                                                          // 21
  // Restore the original runtime.                                                                         // 22
  g.regeneratorRuntime = oldRuntime;                                                                       // 23
} else {                                                                                                   // 24
  // Remove the global property added by runtime.js.                                                       // 25
  try {                                                                                                    // 26
    delete g.regeneratorRuntime;                                                                           // 27
  } catch(e) {                                                                                             // 28
    g.regeneratorRuntime = undefined;                                                                      // 29
  }                                                                                                        // 30
}                                                                                                          // 31
                                                                                                           // 32
/////////////////////////////////////////////////////////////////////////////////////////////////////////////

}],"runtime.js":function(require,exports,module){

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                         //
// node_modules/meteor/babel-runtime/node_modules/regenerator/runtime.js                                   //
//                                                                                                         //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                           //
/**                                                                                                        // 1
 * Copyright (c) 2014, Facebook, Inc.                                                                      // 2
 * All rights reserved.                                                                                    // 3
 *                                                                                                         // 4
 * This source code is licensed under the BSD-style license found in the                                   // 5
 * https://raw.github.com/facebook/regenerator/master/LICENSE file. An                                     // 6
 * additional grant of patent rights can be found in the PATENTS file in                                   // 7
 * the same directory.                                                                                     // 8
 */                                                                                                        // 9
                                                                                                           // 10
!(function(global) {                                                                                       // 11
  "use strict";                                                                                            // 12
                                                                                                           // 13
  var hasOwn = Object.prototype.hasOwnProperty;                                                            // 14
  var undefined; // More compressible than void 0.                                                         // 15
  var $Symbol = typeof Symbol === "function" ? Symbol : {};                                                // 16
  var iteratorSymbol = $Symbol.iterator || "@@iterator";                                                   // 17
  var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";                                          // 18
                                                                                                           // 19
  var inModule = typeof module === "object";                                                               // 20
  var runtime = global.regeneratorRuntime;                                                                 // 21
  if (runtime) {                                                                                           // 22
    if (inModule) {                                                                                        // 23
      // If regeneratorRuntime is defined globally and we're in a module,                                  // 24
      // make the exports object identical to regeneratorRuntime.                                          // 25
      module.exports = runtime;                                                                            // 26
    }                                                                                                      // 27
    // Don't bother evaluating the rest of this file if the runtime was                                    // 28
    // already defined globally.                                                                           // 29
    return;                                                                                                // 30
  }                                                                                                        // 31
                                                                                                           // 32
  // Define the runtime globally (as expected by generated code) as either                                 // 33
  // module.exports (if we're in a module) or a new, empty object.                                         // 34
  runtime = global.regeneratorRuntime = inModule ? module.exports : {};                                    // 35
                                                                                                           // 36
  function wrap(innerFn, outerFn, self, tryLocsList) {                                                     // 37
    // If outerFn provided, then outerFn.prototype instanceof Generator.                                   // 38
    var generator = Object.create((outerFn || Generator).prototype);                                       // 39
    var context = new Context(tryLocsList || []);                                                          // 40
                                                                                                           // 41
    // The ._invoke method unifies the implementations of the .next,                                       // 42
    // .throw, and .return methods.                                                                        // 43
    generator._invoke = makeInvokeMethod(innerFn, self, context);                                          // 44
                                                                                                           // 45
    return generator;                                                                                      // 46
  }                                                                                                        // 47
  runtime.wrap = wrap;                                                                                     // 48
                                                                                                           // 49
  // Try/catch helper to minimize deoptimizations. Returns a completion                                    // 50
  // record like context.tryEntries[i].completion. This interface could                                    // 51
  // have been (and was previously) designed to take a closure to be                                       // 52
  // invoked without arguments, but in all the cases we care about we                                      // 53
  // already have an existing method we want to call, so there's no need                                   // 54
  // to create a new function object. We can even get away with assuming                                   // 55
  // the method takes exactly one argument, since that happens to be true                                  // 56
  // in every case, so we don't have to touch the arguments object. The                                    // 57
  // only additional allocation required is the completion record, which                                   // 58
  // has a stable shape and so hopefully should be cheap to allocate.                                      // 59
  function tryCatch(fn, obj, arg) {                                                                        // 60
    try {                                                                                                  // 61
      return { type: "normal", arg: fn.call(obj, arg) };                                                   // 62
    } catch (err) {                                                                                        // 63
      return { type: "throw", arg: err };                                                                  // 64
    }                                                                                                      // 65
  }                                                                                                        // 66
                                                                                                           // 67
  var GenStateSuspendedStart = "suspendedStart";                                                           // 68
  var GenStateSuspendedYield = "suspendedYield";                                                           // 69
  var GenStateExecuting = "executing";                                                                     // 70
  var GenStateCompleted = "completed";                                                                     // 71
                                                                                                           // 72
  // Returning this object from the innerFn has the same effect as                                         // 73
  // breaking out of the dispatch switch statement.                                                        // 74
  var ContinueSentinel = {};                                                                               // 75
                                                                                                           // 76
  // Dummy constructor functions that we use as the .constructor and                                       // 77
  // .constructor.prototype properties for functions that return Generator                                 // 78
  // objects. For full spec compliance, you may wish to configure your                                     // 79
  // minifier not to mangle the names of these two functions.                                              // 80
  function Generator() {}                                                                                  // 81
  function GeneratorFunction() {}                                                                          // 82
  function GeneratorFunctionPrototype() {}                                                                 // 83
                                                                                                           // 84
  var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype;                                     // 85
  GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;                               // 86
  GeneratorFunctionPrototype.constructor = GeneratorFunction;                                              // 87
  GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction";     // 88
                                                                                                           // 89
  // Helper for defining the .next, .throw, and .return methods of the                                     // 90
  // Iterator interface in terms of a single ._invoke method.                                              // 91
  function defineIteratorMethods(prototype) {                                                              // 92
    ["next", "throw", "return"].forEach(function(method) {                                                 // 93
      prototype[method] = function(arg) {                                                                  // 94
        return this._invoke(method, arg);                                                                  // 95
      };                                                                                                   // 96
    });                                                                                                    // 97
  }                                                                                                        // 98
                                                                                                           // 99
  runtime.isGeneratorFunction = function(genFun) {                                                         // 100
    var ctor = typeof genFun === "function" && genFun.constructor;                                         // 101
    return ctor                                                                                            // 102
      ? ctor === GeneratorFunction ||                                                                      // 103
        // For the native GeneratorFunction constructor, the best we can                                   // 104
        // do is to check its .name property.                                                              // 105
        (ctor.displayName || ctor.name) === "GeneratorFunction"                                            // 106
      : false;                                                                                             // 107
  };                                                                                                       // 108
                                                                                                           // 109
  runtime.mark = function(genFun) {                                                                        // 110
    if (Object.setPrototypeOf) {                                                                           // 111
      Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);                                           // 112
    } else {                                                                                               // 113
      genFun.__proto__ = GeneratorFunctionPrototype;                                                       // 114
      if (!(toStringTagSymbol in genFun)) {                                                                // 115
        genFun[toStringTagSymbol] = "GeneratorFunction";                                                   // 116
      }                                                                                                    // 117
    }                                                                                                      // 118
    genFun.prototype = Object.create(Gp);                                                                  // 119
    return genFun;                                                                                         // 120
  };                                                                                                       // 121
                                                                                                           // 122
  // Within the body of any async function, `await x` is transformed to                                    // 123
  // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test                                     // 124
  // `value instanceof AwaitArgument` to determine if the yielded value is                                 // 125
  // meant to be awaited. Some may consider the name of this method too                                    // 126
  // cutesy, but they are curmudgeons.                                                                     // 127
  runtime.awrap = function(arg) {                                                                          // 128
    return new AwaitArgument(arg);                                                                         // 129
  };                                                                                                       // 130
                                                                                                           // 131
  function AwaitArgument(arg) {                                                                            // 132
    this.arg = arg;                                                                                        // 133
  }                                                                                                        // 134
                                                                                                           // 135
  function AsyncIterator(generator) {                                                                      // 136
    function invoke(method, arg, resolve, reject) {                                                        // 137
      var record = tryCatch(generator[method], generator, arg);                                            // 138
      if (record.type === "throw") {                                                                       // 139
        reject(record.arg);                                                                                // 140
      } else {                                                                                             // 141
        var result = record.arg;                                                                           // 142
        var value = result.value;                                                                          // 143
        if (value instanceof AwaitArgument) {                                                              // 144
          return Promise.resolve(value.arg).then(function(value) {                                         // 145
            invoke("next", value, resolve, reject);                                                        // 146
          }, function(err) {                                                                               // 147
            invoke("throw", err, resolve, reject);                                                         // 148
          });                                                                                              // 149
        }                                                                                                  // 150
                                                                                                           // 151
        return Promise.resolve(value).then(function(unwrapped) {                                           // 152
          // When a yielded Promise is resolved, its final value becomes                                   // 153
          // the .value of the Promise<{value,done}> result for the                                        // 154
          // current iteration. If the Promise is rejected, however, the                                   // 155
          // result for this iteration will be rejected with the same                                      // 156
          // reason. Note that rejections of yielded Promises are not                                      // 157
          // thrown back into the generator function, as is the case                                       // 158
          // when an awaited Promise is rejected. This difference in                                       // 159
          // behavior between yield and await is important, because it                                     // 160
          // allows the consumer to decide what to do with the yielded                                     // 161
          // rejection (swallow it and continue, manually .throw it back                                   // 162
          // into the generator, abandon iteration, whatever). With                                        // 163
          // await, by contrast, there is no opportunity to examine the                                    // 164
          // rejection reason outside the generator function, so the                                       // 165
          // only option is to throw it from the await expression, and                                     // 166
          // let the generator function handle the exception.                                              // 167
          result.value = unwrapped;                                                                        // 168
          resolve(result);                                                                                 // 169
        }, reject);                                                                                        // 170
      }                                                                                                    // 171
    }                                                                                                      // 172
                                                                                                           // 173
    if (typeof process === "object" && process.domain) {                                                   // 174
      invoke = process.domain.bind(invoke);                                                                // 175
    }                                                                                                      // 176
                                                                                                           // 177
    var previousPromise;                                                                                   // 178
                                                                                                           // 179
    function enqueue(method, arg) {                                                                        // 180
      function callInvokeWithMethodAndArg() {                                                              // 181
        return new Promise(function(resolve, reject) {                                                     // 182
          invoke(method, arg, resolve, reject);                                                            // 183
        });                                                                                                // 184
      }                                                                                                    // 185
                                                                                                           // 186
      return previousPromise =                                                                             // 187
        // If enqueue has been called before, then we want to wait until                                   // 188
        // all previous Promises have been resolved before calling invoke,                                 // 189
        // so that results are always delivered in the correct order. If                                   // 190
        // enqueue has not been called before, then it is important to                                     // 191
        // call invoke immediately, without waiting on a callback to fire,                                 // 192
        // so that the async generator function has the opportunity to do                                  // 193
        // any necessary setup in a predictable way. This predictability                                   // 194
        // is why the Promise constructor synchronously invokes its                                        // 195
        // executor callback, and why async functions synchronously                                        // 196
        // execute code before the first await. Since we implement simple                                  // 197
        // async functions in terms of async generators, it is especially                                  // 198
        // important to get this right, even though it requires care.                                      // 199
        previousPromise ? previousPromise.then(                                                            // 200
          callInvokeWithMethodAndArg,                                                                      // 201
          // Avoid propagating failures to Promises returned by later                                      // 202
          // invocations of the iterator.                                                                  // 203
          callInvokeWithMethodAndArg                                                                       // 204
        ) : callInvokeWithMethodAndArg();                                                                  // 205
    }                                                                                                      // 206
                                                                                                           // 207
    // Define the unified helper method that is used to implement .next,                                   // 208
    // .throw, and .return (see defineIteratorMethods).                                                    // 209
    this._invoke = enqueue;                                                                                // 210
  }                                                                                                        // 211
                                                                                                           // 212
  defineIteratorMethods(AsyncIterator.prototype);                                                          // 213
                                                                                                           // 214
  // Note that simple async functions are implemented on top of                                            // 215
  // AsyncIterator objects; they just return a Promise for the value of                                    // 216
  // the final result produced by the iterator.                                                            // 217
  runtime.async = function(innerFn, outerFn, self, tryLocsList) {                                          // 218
    var iter = new AsyncIterator(                                                                          // 219
      wrap(innerFn, outerFn, self, tryLocsList)                                                            // 220
    );                                                                                                     // 221
                                                                                                           // 222
    return runtime.isGeneratorFunction(outerFn)                                                            // 223
      ? iter // If outerFn is a generator, return the full iterator.                                       // 224
      : iter.next().then(function(result) {                                                                // 225
          return result.done ? result.value : iter.next();                                                 // 226
        });                                                                                                // 227
  };                                                                                                       // 228
                                                                                                           // 229
  function makeInvokeMethod(innerFn, self, context) {                                                      // 230
    var state = GenStateSuspendedStart;                                                                    // 231
                                                                                                           // 232
    return function invoke(method, arg) {                                                                  // 233
      if (state === GenStateExecuting) {                                                                   // 234
        throw new Error("Generator is already running");                                                   // 235
      }                                                                                                    // 236
                                                                                                           // 237
      if (state === GenStateCompleted) {                                                                   // 238
        if (method === "throw") {                                                                          // 239
          throw arg;                                                                                       // 240
        }                                                                                                  // 241
                                                                                                           // 242
        // Be forgiving, per 25.3.3.3.3 of the spec:                                                       // 243
        // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume                       // 244
        return doneResult();                                                                               // 245
      }                                                                                                    // 246
                                                                                                           // 247
      while (true) {                                                                                       // 248
        var delegate = context.delegate;                                                                   // 249
        if (delegate) {                                                                                    // 250
          if (method === "return" ||                                                                       // 251
              (method === "throw" && delegate.iterator[method] === undefined)) {                           // 252
            // A return or throw (when the delegate iterator has no throw                                  // 253
            // method) always terminates the yield* loop.                                                  // 254
            context.delegate = null;                                                                       // 255
                                                                                                           // 256
            // If the delegate iterator has a return method, give it a                                     // 257
            // chance to clean up.                                                                         // 258
            var returnMethod = delegate.iterator["return"];                                                // 259
            if (returnMethod) {                                                                            // 260
              var record = tryCatch(returnMethod, delegate.iterator, arg);                                 // 261
              if (record.type === "throw") {                                                               // 262
                // If the return method threw an exception, let that                                       // 263
                // exception prevail over the original return or throw.                                    // 264
                method = "throw";                                                                          // 265
                arg = record.arg;                                                                          // 266
                continue;                                                                                  // 267
              }                                                                                            // 268
            }                                                                                              // 269
                                                                                                           // 270
            if (method === "return") {                                                                     // 271
              // Continue with the outer return, now that the delegate                                     // 272
              // iterator has been terminated.                                                             // 273
              continue;                                                                                    // 274
            }                                                                                              // 275
          }                                                                                                // 276
                                                                                                           // 277
          var record = tryCatch(                                                                           // 278
            delegate.iterator[method],                                                                     // 279
            delegate.iterator,                                                                             // 280
            arg                                                                                            // 281
          );                                                                                               // 282
                                                                                                           // 283
          if (record.type === "throw") {                                                                   // 284
            context.delegate = null;                                                                       // 285
                                                                                                           // 286
            // Like returning generator.throw(uncaught), but without the                                   // 287
            // overhead of an extra function call.                                                         // 288
            method = "throw";                                                                              // 289
            arg = record.arg;                                                                              // 290
            continue;                                                                                      // 291
          }                                                                                                // 292
                                                                                                           // 293
          // Delegate generator ran and handled its own exceptions so                                      // 294
          // regardless of what the method was, we continue as if it is                                    // 295
          // "next" with an undefined arg.                                                                 // 296
          method = "next";                                                                                 // 297
          arg = undefined;                                                                                 // 298
                                                                                                           // 299
          var info = record.arg;                                                                           // 300
          if (info.done) {                                                                                 // 301
            context[delegate.resultName] = info.value;                                                     // 302
            context.next = delegate.nextLoc;                                                               // 303
          } else {                                                                                         // 304
            state = GenStateSuspendedYield;                                                                // 305
            return info;                                                                                   // 306
          }                                                                                                // 307
                                                                                                           // 308
          context.delegate = null;                                                                         // 309
        }                                                                                                  // 310
                                                                                                           // 311
        if (method === "next") {                                                                           // 312
          if (state === GenStateSuspendedYield) {                                                          // 313
            context.sent = arg;                                                                            // 314
          } else {                                                                                         // 315
            context.sent = undefined;                                                                      // 316
          }                                                                                                // 317
                                                                                                           // 318
        } else if (method === "throw") {                                                                   // 319
          if (state === GenStateSuspendedStart) {                                                          // 320
            state = GenStateCompleted;                                                                     // 321
            throw arg;                                                                                     // 322
          }                                                                                                // 323
                                                                                                           // 324
          if (context.dispatchException(arg)) {                                                            // 325
            // If the dispatched exception was caught by a catch block,                                    // 326
            // then let that catch block handle the exception normally.                                    // 327
            method = "next";                                                                               // 328
            arg = undefined;                                                                               // 329
          }                                                                                                // 330
                                                                                                           // 331
        } else if (method === "return") {                                                                  // 332
          context.abrupt("return", arg);                                                                   // 333
        }                                                                                                  // 334
                                                                                                           // 335
        state = GenStateExecuting;                                                                         // 336
                                                                                                           // 337
        var record = tryCatch(innerFn, self, context);                                                     // 338
        if (record.type === "normal") {                                                                    // 339
          // If an exception is thrown from innerFn, we leave state ===                                    // 340
          // GenStateExecuting and loop back for another invocation.                                       // 341
          state = context.done                                                                             // 342
            ? GenStateCompleted                                                                            // 343
            : GenStateSuspendedYield;                                                                      // 344
                                                                                                           // 345
          var info = {                                                                                     // 346
            value: record.arg,                                                                             // 347
            done: context.done                                                                             // 348
          };                                                                                               // 349
                                                                                                           // 350
          if (record.arg === ContinueSentinel) {                                                           // 351
            if (context.delegate && method === "next") {                                                   // 352
              // Deliberately forget the last sent value so that we don't                                  // 353
              // accidentally pass it on to the delegate.                                                  // 354
              arg = undefined;                                                                             // 355
            }                                                                                              // 356
          } else {                                                                                         // 357
            return info;                                                                                   // 358
          }                                                                                                // 359
                                                                                                           // 360
        } else if (record.type === "throw") {                                                              // 361
          state = GenStateCompleted;                                                                       // 362
          // Dispatch the exception by looping back around to the                                          // 363
          // context.dispatchException(arg) call above.                                                    // 364
          method = "throw";                                                                                // 365
          arg = record.arg;                                                                                // 366
        }                                                                                                  // 367
      }                                                                                                    // 368
    };                                                                                                     // 369
  }                                                                                                        // 370
                                                                                                           // 371
  // Define Generator.prototype.{next,throw,return} in terms of the                                        // 372
  // unified ._invoke helper method.                                                                       // 373
  defineIteratorMethods(Gp);                                                                               // 374
                                                                                                           // 375
  Gp[iteratorSymbol] = function() {                                                                        // 376
    return this;                                                                                           // 377
  };                                                                                                       // 378
                                                                                                           // 379
  Gp[toStringTagSymbol] = "Generator";                                                                     // 380
                                                                                                           // 381
  Gp.toString = function() {                                                                               // 382
    return "[object Generator]";                                                                           // 383
  };                                                                                                       // 384
                                                                                                           // 385
  function pushTryEntry(locs) {                                                                            // 386
    var entry = { tryLoc: locs[0] };                                                                       // 387
                                                                                                           // 388
    if (1 in locs) {                                                                                       // 389
      entry.catchLoc = locs[1];                                                                            // 390
    }                                                                                                      // 391
                                                                                                           // 392
    if (2 in locs) {                                                                                       // 393
      entry.finallyLoc = locs[2];                                                                          // 394
      entry.afterLoc = locs[3];                                                                            // 395
    }                                                                                                      // 396
                                                                                                           // 397
    this.tryEntries.push(entry);                                                                           // 398
  }                                                                                                        // 399
                                                                                                           // 400
  function resetTryEntry(entry) {                                                                          // 401
    var record = entry.completion || {};                                                                   // 402
    record.type = "normal";                                                                                // 403
    delete record.arg;                                                                                     // 404
    entry.completion = record;                                                                             // 405
  }                                                                                                        // 406
                                                                                                           // 407
  function Context(tryLocsList) {                                                                          // 408
    // The root entry object (effectively a try statement without a catch                                  // 409
    // or a finally block) gives us a place to store values thrown from                                    // 410
    // locations where there is no enclosing try statement.                                                // 411
    this.tryEntries = [{ tryLoc: "root" }];                                                                // 412
    tryLocsList.forEach(pushTryEntry, this);                                                               // 413
    this.reset(true);                                                                                      // 414
  }                                                                                                        // 415
                                                                                                           // 416
  runtime.keys = function(object) {                                                                        // 417
    var keys = [];                                                                                         // 418
    for (var key in object) {                                                                              // 419
      keys.push(key);                                                                                      // 420
    }                                                                                                      // 421
    keys.reverse();                                                                                        // 422
                                                                                                           // 423
    // Rather than returning an object with a next method, we keep                                         // 424
    // things simple and return the next function itself.                                                  // 425
    return function next() {                                                                               // 426
      while (keys.length) {                                                                                // 427
        var key = keys.pop();                                                                              // 428
        if (key in object) {                                                                               // 429
          next.value = key;                                                                                // 430
          next.done = false;                                                                               // 431
          return next;                                                                                     // 432
        }                                                                                                  // 433
      }                                                                                                    // 434
                                                                                                           // 435
      // To avoid creating an additional object, we just hang the .value                                   // 436
      // and .done properties off the next function object itself. This                                    // 437
      // also ensures that the minifier will not anonymize the function.                                   // 438
      next.done = true;                                                                                    // 439
      return next;                                                                                         // 440
    };                                                                                                     // 441
  };                                                                                                       // 442
                                                                                                           // 443
  function values(iterable) {                                                                              // 444
    if (iterable) {                                                                                        // 445
      var iteratorMethod = iterable[iteratorSymbol];                                                       // 446
      if (iteratorMethod) {                                                                                // 447
        return iteratorMethod.call(iterable);                                                              // 448
      }                                                                                                    // 449
                                                                                                           // 450
      if (typeof iterable.next === "function") {                                                           // 451
        return iterable;                                                                                   // 452
      }                                                                                                    // 453
                                                                                                           // 454
      if (!isNaN(iterable.length)) {                                                                       // 455
        var i = -1, next = function next() {                                                               // 456
          while (++i < iterable.length) {                                                                  // 457
            if (hasOwn.call(iterable, i)) {                                                                // 458
              next.value = iterable[i];                                                                    // 459
              next.done = false;                                                                           // 460
              return next;                                                                                 // 461
            }                                                                                              // 462
          }                                                                                                // 463
                                                                                                           // 464
          next.value = undefined;                                                                          // 465
          next.done = true;                                                                                // 466
                                                                                                           // 467
          return next;                                                                                     // 468
        };                                                                                                 // 469
                                                                                                           // 470
        return next.next = next;                                                                           // 471
      }                                                                                                    // 472
    }                                                                                                      // 473
                                                                                                           // 474
    // Return an iterator with no values.                                                                  // 475
    return { next: doneResult };                                                                           // 476
  }                                                                                                        // 477
  runtime.values = values;                                                                                 // 478
                                                                                                           // 479
  function doneResult() {                                                                                  // 480
    return { value: undefined, done: true };                                                               // 481
  }                                                                                                        // 482
                                                                                                           // 483
  Context.prototype = {                                                                                    // 484
    constructor: Context,                                                                                  // 485
                                                                                                           // 486
    reset: function(skipTempReset) {                                                                       // 487
      this.prev = 0;                                                                                       // 488
      this.next = 0;                                                                                       // 489
      this.sent = undefined;                                                                               // 490
      this.done = false;                                                                                   // 491
      this.delegate = null;                                                                                // 492
                                                                                                           // 493
      this.tryEntries.forEach(resetTryEntry);                                                              // 494
                                                                                                           // 495
      if (!skipTempReset) {                                                                                // 496
        for (var name in this) {                                                                           // 497
          // Not sure about the optimal order of these conditions:                                         // 498
          if (name.charAt(0) === "t" &&                                                                    // 499
              hasOwn.call(this, name) &&                                                                   // 500
              !isNaN(+name.slice(1))) {                                                                    // 501
            this[name] = undefined;                                                                        // 502
          }                                                                                                // 503
        }                                                                                                  // 504
      }                                                                                                    // 505
    },                                                                                                     // 506
                                                                                                           // 507
    stop: function() {                                                                                     // 508
      this.done = true;                                                                                    // 509
                                                                                                           // 510
      var rootEntry = this.tryEntries[0];                                                                  // 511
      var rootRecord = rootEntry.completion;                                                               // 512
      if (rootRecord.type === "throw") {                                                                   // 513
        throw rootRecord.arg;                                                                              // 514
      }                                                                                                    // 515
                                                                                                           // 516
      return this.rval;                                                                                    // 517
    },                                                                                                     // 518
                                                                                                           // 519
    dispatchException: function(exception) {                                                               // 520
      if (this.done) {                                                                                     // 521
        throw exception;                                                                                   // 522
      }                                                                                                    // 523
                                                                                                           // 524
      var context = this;                                                                                  // 525
      function handle(loc, caught) {                                                                       // 526
        record.type = "throw";                                                                             // 527
        record.arg = exception;                                                                            // 528
        context.next = loc;                                                                                // 529
        return !!caught;                                                                                   // 530
      }                                                                                                    // 531
                                                                                                           // 532
      for (var i = this.tryEntries.length - 1; i >= 0; --i) {                                              // 533
        var entry = this.tryEntries[i];                                                                    // 534
        var record = entry.completion;                                                                     // 535
                                                                                                           // 536
        if (entry.tryLoc === "root") {                                                                     // 537
          // Exception thrown outside of any try block that could handle                                   // 538
          // it, so set the completion value of the entire function to                                     // 539
          // throw the exception.                                                                          // 540
          return handle("end");                                                                            // 541
        }                                                                                                  // 542
                                                                                                           // 543
        if (entry.tryLoc <= this.prev) {                                                                   // 544
          var hasCatch = hasOwn.call(entry, "catchLoc");                                                   // 545
          var hasFinally = hasOwn.call(entry, "finallyLoc");                                               // 546
                                                                                                           // 547
          if (hasCatch && hasFinally) {                                                                    // 548
            if (this.prev < entry.catchLoc) {                                                              // 549
              return handle(entry.catchLoc, true);                                                         // 550
            } else if (this.prev < entry.finallyLoc) {                                                     // 551
              return handle(entry.finallyLoc);                                                             // 552
            }                                                                                              // 553
                                                                                                           // 554
          } else if (hasCatch) {                                                                           // 555
            if (this.prev < entry.catchLoc) {                                                              // 556
              return handle(entry.catchLoc, true);                                                         // 557
            }                                                                                              // 558
                                                                                                           // 559
          } else if (hasFinally) {                                                                         // 560
            if (this.prev < entry.finallyLoc) {                                                            // 561
              return handle(entry.finallyLoc);                                                             // 562
            }                                                                                              // 563
                                                                                                           // 564
          } else {                                                                                         // 565
            throw new Error("try statement without catch or finally");                                     // 566
          }                                                                                                // 567
        }                                                                                                  // 568
      }                                                                                                    // 569
    },                                                                                                     // 570
                                                                                                           // 571
    abrupt: function(type, arg) {                                                                          // 572
      for (var i = this.tryEntries.length - 1; i >= 0; --i) {                                              // 573
        var entry = this.tryEntries[i];                                                                    // 574
        if (entry.tryLoc <= this.prev &&                                                                   // 575
            hasOwn.call(entry, "finallyLoc") &&                                                            // 576
            this.prev < entry.finallyLoc) {                                                                // 577
          var finallyEntry = entry;                                                                        // 578
          break;                                                                                           // 579
        }                                                                                                  // 580
      }                                                                                                    // 581
                                                                                                           // 582
      if (finallyEntry &&                                                                                  // 583
          (type === "break" ||                                                                             // 584
           type === "continue") &&                                                                         // 585
          finallyEntry.tryLoc <= arg &&                                                                    // 586
          arg <= finallyEntry.finallyLoc) {                                                                // 587
        // Ignore the finally entry if control is not jumping to a                                         // 588
        // location outside the try/catch block.                                                           // 589
        finallyEntry = null;                                                                               // 590
      }                                                                                                    // 591
                                                                                                           // 592
      var record = finallyEntry ? finallyEntry.completion : {};                                            // 593
      record.type = type;                                                                                  // 594
      record.arg = arg;                                                                                    // 595
                                                                                                           // 596
      if (finallyEntry) {                                                                                  // 597
        this.next = finallyEntry.finallyLoc;                                                               // 598
      } else {                                                                                             // 599
        this.complete(record);                                                                             // 600
      }                                                                                                    // 601
                                                                                                           // 602
      return ContinueSentinel;                                                                             // 603
    },                                                                                                     // 604
                                                                                                           // 605
    complete: function(record, afterLoc) {                                                                 // 606
      if (record.type === "throw") {                                                                       // 607
        throw record.arg;                                                                                  // 608
      }                                                                                                    // 609
                                                                                                           // 610
      if (record.type === "break" ||                                                                       // 611
          record.type === "continue") {                                                                    // 612
        this.next = record.arg;                                                                            // 613
      } else if (record.type === "return") {                                                               // 614
        this.rval = record.arg;                                                                            // 615
        this.next = "end";                                                                                 // 616
      } else if (record.type === "normal" && afterLoc) {                                                   // 617
        this.next = afterLoc;                                                                              // 618
      }                                                                                                    // 619
    },                                                                                                     // 620
                                                                                                           // 621
    finish: function(finallyLoc) {                                                                         // 622
      for (var i = this.tryEntries.length - 1; i >= 0; --i) {                                              // 623
        var entry = this.tryEntries[i];                                                                    // 624
        if (entry.finallyLoc === finallyLoc) {                                                             // 625
          this.complete(entry.completion, entry.afterLoc);                                                 // 626
          resetTryEntry(entry);                                                                            // 627
          return ContinueSentinel;                                                                         // 628
        }                                                                                                  // 629
      }                                                                                                    // 630
    },                                                                                                     // 631
                                                                                                           // 632
    "catch": function(tryLoc) {                                                                            // 633
      for (var i = this.tryEntries.length - 1; i >= 0; --i) {                                              // 634
        var entry = this.tryEntries[i];                                                                    // 635
        if (entry.tryLoc === tryLoc) {                                                                     // 636
          var record = entry.completion;                                                                   // 637
          if (record.type === "throw") {                                                                   // 638
            var thrown = record.arg;                                                                       // 639
            resetTryEntry(entry);                                                                          // 640
          }                                                                                                // 641
          return thrown;                                                                                   // 642
        }                                                                                                  // 643
      }                                                                                                    // 644
                                                                                                           // 645
      // The context.catch method must only be called with a location                                      // 646
      // argument that corresponds to a known catch block.                                                 // 647
      throw new Error("illegal catch attempt");                                                            // 648
    },                                                                                                     // 649
                                                                                                           // 650
    delegateYield: function(iterable, resultName, nextLoc) {                                               // 651
      this.delegate = {                                                                                    // 652
        iterator: values(iterable),                                                                        // 653
        resultName: resultName,                                                                            // 654
        nextLoc: nextLoc                                                                                   // 655
      };                                                                                                   // 656
                                                                                                           // 657
      return ContinueSentinel;                                                                             // 658
    }                                                                                                      // 659
  };                                                                                                       // 660
})(                                                                                                        // 661
  // Among the various tricks for obtaining a reference to the global                                      // 662
  // object, this seems to be the most reliable technique that does not                                    // 663
  // use indirect eval (which violates Content Security Policy).                                           // 664
  typeof global === "object" ? global :                                                                    // 665
  typeof window === "object" ? window :                                                                    // 666
  typeof self === "object" ? self : this                                                                   // 667
);                                                                                                         // 668
                                                                                                           // 669
/////////////////////////////////////////////////////////////////////////////////////////////////////////////

}}}}}}},{"extensions":[".js",".json"]});
require("./node_modules/meteor/babel-runtime/babel-runtime.js");

/* Exports */
if (typeof Package === 'undefined') Package = {};
(function (pkg, symbols) {
  for (var s in symbols)
    (s in pkg) || (pkg[s] = symbols[s]);
})(Package['babel-runtime'] = {}, {
  meteorBabelHelpers: meteorBabelHelpers
});

})();
(function () {

/* Imports */
var Meteor = Package.meteor.Meteor;
var global = Package.meteor.global;
var meteorEnv = Package.meteor.meteorEnv;
var meteorInstall = Package.modules.meteorInstall;
var Buffer = Package.modules.Buffer;
var process = Package.modules.process;
var Promise = Package.promise.Promise;

/* Package-scope variables */
var Symbol, Map, Set, __g, __e;

var require = meteorInstall({"node_modules":{"meteor":{"ecmascript-runtime":{"runtime.js":["meteor-ecmascript-runtime",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// packages/ecmascript-runtime/runtime.js                                                            //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// TODO Allow just api.mainModule("meteor-ecmascript-runtime");                                      // 1
module.exports = require("meteor-ecmascript-runtime");                                               // 2
                                                                                                     // 3
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"node_modules":{"meteor-ecmascript-runtime":{"package.json":function(require,exports){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// ../npm/node_modules/meteor-ecmascript-runtime/package.json                                        //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
exports.name = "meteor-ecmascript-runtime";                                                          // 1
exports.version = "0.2.6";                                                                           // 2
exports.main = "server.js";                                                                          // 3
                                                                                                     // 4
///////////////////////////////////////////////////////////////////////////////////////////////////////

},"server.js":["core-js/es6/object","core-js/es6/array","core-js/es6/string","core-js/es6/function","core-js/es6/symbol","core-js/es6/map","core-js/es6/set",function(require,exports){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/server.js           //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
require("core-js/es6/object");                                                                       // 1
require("core-js/es6/array");                                                                        // 2
require("core-js/es6/string");                                                                       // 3
require("core-js/es6/function");                                                                     // 4
                                                                                                     // 5
Symbol = exports.Symbol = require("core-js/es6/symbol");                                             // 6
Map = exports.Map = require("core-js/es6/map");                                                      // 7
Set = exports.Set = require("core-js/es6/set");                                                      // 8
                                                                                                     // 9
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"node_modules":{"core-js":{"es6":{"object.js":["../modules/es6.symbol","../modules/es6.object.assign","../modules/es6.object.is","../modules/es6.object.set-prototype-of","../modules/es6.object.to-string","../modules/es6.object.freeze","../modules/es6.object.seal","../modules/es6.object.prevent-extensions","../modules/es6.object.is-frozen","../modules/es6.object.is-sealed","../modules/es6.object.is-extensible","../modules/es6.object.get-own-property-descriptor","../modules/es6.object.get-prototype-of","../modules/es6.object.keys","../modules/es6.object.get-own-property-names","../modules/$.core",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
require('../modules/es6.symbol');                                                                    // 1
require('../modules/es6.object.assign');                                                             // 2
require('../modules/es6.object.is');                                                                 // 3
require('../modules/es6.object.set-prototype-of');                                                   // 4
require('../modules/es6.object.to-string');                                                          // 5
require('../modules/es6.object.freeze');                                                             // 6
require('../modules/es6.object.seal');                                                               // 7
require('../modules/es6.object.prevent-extensions');                                                 // 8
require('../modules/es6.object.is-frozen');                                                          // 9
require('../modules/es6.object.is-sealed');                                                          // 10
require('../modules/es6.object.is-extensible');                                                      // 11
require('../modules/es6.object.get-own-property-descriptor');                                        // 12
require('../modules/es6.object.get-prototype-of');                                                   // 13
require('../modules/es6.object.keys');                                                               // 14
require('../modules/es6.object.get-own-property-names');                                             // 15
                                                                                                     // 16
module.exports = require('../modules/$.core').Object;                                                // 17
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"array.js":["../modules/es6.string.iterator","../modules/es6.array.from","../modules/es6.array.of","../modules/es6.array.species","../modules/es6.array.iterator","../modules/es6.array.copy-within","../modules/es6.array.fill","../modules/es6.array.find","../modules/es6.array.find-index","../modules/$.core",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
require('../modules/es6.string.iterator');                                                           // 1
require('../modules/es6.array.from');                                                                // 2
require('../modules/es6.array.of');                                                                  // 3
require('../modules/es6.array.species');                                                             // 4
require('../modules/es6.array.iterator');                                                            // 5
require('../modules/es6.array.copy-within');                                                         // 6
require('../modules/es6.array.fill');                                                                // 7
require('../modules/es6.array.find');                                                                // 8
require('../modules/es6.array.find-index');                                                          // 9
module.exports = require('../modules/$.core').Array;                                                 // 10
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"string.js":["../modules/es6.string.from-code-point","../modules/es6.string.raw","../modules/es6.string.trim","../modules/es6.string.iterator","../modules/es6.string.code-point-at","../modules/es6.string.ends-with","../modules/es6.string.includes","../modules/es6.string.repeat","../modules/es6.string.starts-with","../modules/es6.regexp.match","../modules/es6.regexp.replace","../modules/es6.regexp.search","../modules/es6.regexp.split","../modules/$.core",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
require('../modules/es6.string.from-code-point');                                                    // 1
require('../modules/es6.string.raw');                                                                // 2
require('../modules/es6.string.trim');                                                               // 3
require('../modules/es6.string.iterator');                                                           // 4
require('../modules/es6.string.code-point-at');                                                      // 5
require('../modules/es6.string.ends-with');                                                          // 6
require('../modules/es6.string.includes');                                                           // 7
require('../modules/es6.string.repeat');                                                             // 8
require('../modules/es6.string.starts-with');                                                        // 9
require('../modules/es6.regexp.match');                                                              // 10
require('../modules/es6.regexp.replace');                                                            // 11
require('../modules/es6.regexp.search');                                                             // 12
require('../modules/es6.regexp.split');                                                              // 13
module.exports = require('../modules/$.core').String;                                                // 14
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"function.js":["../modules/es6.function.name","../modules/es6.function.has-instance","../modules/$.core",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
require('../modules/es6.function.name');                                                             // 1
require('../modules/es6.function.has-instance');                                                     // 2
module.exports = require('../modules/$.core').Function;                                              // 3
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"symbol.js":["../modules/es6.symbol","../modules/$.core",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
require('../modules/es6.symbol');                                                                    // 1
module.exports = require('../modules/$.core').Symbol;                                                // 2
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"map.js":["../modules/es6.object.to-string","../modules/es6.string.iterator","../modules/web.dom.iterable","../modules/es6.map","../modules/$.core",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
require('../modules/es6.object.to-string');                                                          // 1
require('../modules/es6.string.iterator');                                                           // 2
require('../modules/web.dom.iterable');                                                              // 3
require('../modules/es6.map');                                                                       // 4
module.exports = require('../modules/$.core').Map;                                                   // 5
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"set.js":["../modules/es6.object.to-string","../modules/es6.string.iterator","../modules/web.dom.iterable","../modules/es6.set","../modules/$.core",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
require('../modules/es6.object.to-string');                                                          // 1
require('../modules/es6.string.iterator');                                                           // 2
require('../modules/web.dom.iterable');                                                              // 3
require('../modules/es6.set');                                                                       // 4
module.exports = require('../modules/$.core').Set;                                                   // 5
///////////////////////////////////////////////////////////////////////////////////////////////////////

}]},"modules":{"es6.symbol.js":["./$","./$.global","./$.has","./$.support-desc","./$.def","./$.redef","./$.fails","./$.shared","./$.tag","./$.uid","./$.wks","./$.keyof","./$.get-names","./$.enum-keys","./$.is-array","./$.is-object","./$.an-object","./$.to-iobject","./$.property-desc","./$.library",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
'use strict';                                                                                        // 1
// ECMAScript 6 symbols shim                                                                         // 2
var $              = require('./$')                                                                  // 3
  , global         = require('./$.global')                                                           // 4
  , has            = require('./$.has')                                                              // 5
  , SUPPORT_DESC   = require('./$.support-desc')                                                     // 6
  , $def           = require('./$.def')                                                              // 7
  , $redef         = require('./$.redef')                                                            // 8
  , $fails         = require('./$.fails')                                                            // 9
  , shared         = require('./$.shared')                                                           // 10
  , setTag         = require('./$.tag')                                                              // 11
  , uid            = require('./$.uid')                                                              // 12
  , wks            = require('./$.wks')                                                              // 13
  , keyOf          = require('./$.keyof')                                                            // 14
  , $names         = require('./$.get-names')                                                        // 15
  , enumKeys       = require('./$.enum-keys')                                                        // 16
  , isArray        = require('./$.is-array')                                                         // 17
  , isObject       = require('./$.is-object')                                                        // 18
  , anObject       = require('./$.an-object')                                                        // 19
  , toIObject      = require('./$.to-iobject')                                                       // 20
  , createDesc     = require('./$.property-desc')                                                    // 21
  , getDesc        = $.getDesc                                                                       // 22
  , setDesc        = $.setDesc                                                                       // 23
  , _create        = $.create                                                                        // 24
  , getNames       = $names.get                                                                      // 25
  , $Symbol        = global.Symbol                                                                   // 26
  , $JSON          = global.JSON                                                                     // 27
  , _stringify     = $JSON && $JSON.stringify                                                        // 28
  , setter         = false                                                                           // 29
  , HIDDEN         = wks('_hidden')                                                                  // 30
  , isEnum         = $.isEnum                                                                        // 31
  , SymbolRegistry = shared('symbol-registry')                                                       // 32
  , AllSymbols     = shared('symbols')                                                               // 33
  , useNative      = typeof $Symbol == 'function'                                                    // 34
  , ObjectProto    = Object.prototype;                                                               // 35
                                                                                                     // 36
// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687                       // 37
var setSymbolDesc = SUPPORT_DESC && $fails(function(){                                               // 38
  return _create(setDesc({}, 'a', {                                                                  // 39
    get: function(){ return setDesc(this, 'a', {value: 7}).a; }                                      // 40
  })).a != 7;                                                                                        // 41
}) ? function(it, key, D){                                                                           // 42
  var protoDesc = getDesc(ObjectProto, key);                                                         // 43
  if(protoDesc)delete ObjectProto[key];                                                              // 44
  setDesc(it, key, D);                                                                               // 45
  if(protoDesc && it !== ObjectProto)setDesc(ObjectProto, key, protoDesc);                           // 46
} : setDesc;                                                                                         // 47
                                                                                                     // 48
var wrap = function(tag){                                                                            // 49
  var sym = AllSymbols[tag] = _create($Symbol.prototype);                                            // 50
  sym._k = tag;                                                                                      // 51
  SUPPORT_DESC && setter && setSymbolDesc(ObjectProto, tag, {                                        // 52
    configurable: true,                                                                              // 53
    set: function(value){                                                                            // 54
      if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false;                      // 55
      setSymbolDesc(this, tag, createDesc(1, value));                                                // 56
    }                                                                                                // 57
  });                                                                                                // 58
  return sym;                                                                                        // 59
};                                                                                                   // 60
                                                                                                     // 61
var isSymbol = function(it){                                                                         // 62
  return typeof it == 'symbol';                                                                      // 63
};                                                                                                   // 64
                                                                                                     // 65
var $defineProperty = function defineProperty(it, key, D){                                           // 66
  if(D && has(AllSymbols, key)){                                                                     // 67
    if(!D.enumerable){                                                                               // 68
      if(!has(it, HIDDEN))setDesc(it, HIDDEN, createDesc(1, {}));                                    // 69
      it[HIDDEN][key] = true;                                                                        // 70
    } else {                                                                                         // 71
      if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false;                                 // 72
      D = _create(D, {enumerable: createDesc(0, false)});                                            // 73
    } return setSymbolDesc(it, key, D);                                                              // 74
  } return setDesc(it, key, D);                                                                      // 75
};                                                                                                   // 76
var $defineProperties = function defineProperties(it, P){                                            // 77
  anObject(it);                                                                                      // 78
  var keys = enumKeys(P = toIObject(P))                                                              // 79
    , i    = 0                                                                                       // 80
    , l = keys.length                                                                                // 81
    , key;                                                                                           // 82
  while(l > i)$defineProperty(it, key = keys[i++], P[key]);                                          // 83
  return it;                                                                                         // 84
};                                                                                                   // 85
var $create = function create(it, P){                                                                // 86
  return P === undefined ? _create(it) : $defineProperties(_create(it), P);                          // 87
};                                                                                                   // 88
var $propertyIsEnumerable = function propertyIsEnumerable(key){                                      // 89
  var E = isEnum.call(this, key);                                                                    // 90
  return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key]     // 91
    ? E : true;                                                                                      // 92
};                                                                                                   // 93
var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){                          // 94
  var D = getDesc(it = toIObject(it), key);                                                          // 95
  if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true;         // 96
  return D;                                                                                          // 97
};                                                                                                   // 98
var $getOwnPropertyNames = function getOwnPropertyNames(it){                                         // 99
  var names  = getNames(toIObject(it))                                                               // 100
    , result = []                                                                                    // 101
    , i      = 0                                                                                     // 102
    , key;                                                                                           // 103
  while(names.length > i)if(!has(AllSymbols, key = names[i++]) && key != HIDDEN)result.push(key);    // 104
  return result;                                                                                     // 105
};                                                                                                   // 106
var $getOwnPropertySymbols = function getOwnPropertySymbols(it){                                     // 107
  var names  = getNames(toIObject(it))                                                               // 108
    , result = []                                                                                    // 109
    , i      = 0                                                                                     // 110
    , key;                                                                                           // 111
  while(names.length > i)if(has(AllSymbols, key = names[i++]))result.push(AllSymbols[key]);          // 112
  return result;                                                                                     // 113
};                                                                                                   // 114
var $stringify = function stringify(it){                                                             // 115
  var args = [it]                                                                                    // 116
    , i    = 1                                                                                       // 117
    , replacer, $replacer;                                                                           // 118
  while(arguments.length > i)args.push(arguments[i++]);                                              // 119
  replacer = args[1];                                                                                // 120
  if(typeof replacer == 'function')$replacer = replacer;                                             // 121
  if($replacer || !isArray(replacer))replacer = function(key, value){                                // 122
    if($replacer)value = $replacer.call(this, key, value);                                           // 123
    if(!isSymbol(value))return value;                                                                // 124
  };                                                                                                 // 125
  args[1] = replacer;                                                                                // 126
  return _stringify.apply($JSON, args);                                                              // 127
};                                                                                                   // 128
var buggyJSON = $fails(function(){                                                                   // 129
  var S = $Symbol();                                                                                 // 130
  // MS Edge converts symbol values to JSON as {}                                                    // 131
  // WebKit converts symbol values to JSON as null                                                   // 132
  // V8 throws on boxed symbols                                                                      // 133
  return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}';
});                                                                                                  // 135
                                                                                                     // 136
// 19.4.1.1 Symbol([description])                                                                    // 137
if(!useNative){                                                                                      // 138
  $Symbol = function Symbol(){                                                                       // 139
    if(isSymbol(this))throw TypeError('Symbol is not a constructor');                                // 140
    return wrap(uid(arguments[0]));                                                                  // 141
  };                                                                                                 // 142
  $redef($Symbol.prototype, 'toString', function toString(){                                         // 143
    return this._k;                                                                                  // 144
  });                                                                                                // 145
                                                                                                     // 146
  isSymbol = function(it){                                                                           // 147
    return it instanceof $Symbol;                                                                    // 148
  };                                                                                                 // 149
                                                                                                     // 150
  $.create     = $create;                                                                            // 151
  $.isEnum     = $propertyIsEnumerable;                                                              // 152
  $.getDesc    = $getOwnPropertyDescriptor;                                                          // 153
  $.setDesc    = $defineProperty;                                                                    // 154
  $.setDescs   = $defineProperties;                                                                  // 155
  $.getNames   = $names.get = $getOwnPropertyNames;                                                  // 156
  $.getSymbols = $getOwnPropertySymbols;                                                             // 157
                                                                                                     // 158
  if(SUPPORT_DESC && !require('./$.library')){                                                       // 159
    $redef(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);                        // 160
  }                                                                                                  // 161
}                                                                                                    // 162
                                                                                                     // 163
var symbolStatics = {                                                                                // 164
  // 19.4.2.1 Symbol.for(key)                                                                        // 165
  'for': function(key){                                                                              // 166
    return has(SymbolRegistry, key += '')                                                            // 167
      ? SymbolRegistry[key]                                                                          // 168
      : SymbolRegistry[key] = $Symbol(key);                                                          // 169
  },                                                                                                 // 170
  // 19.4.2.5 Symbol.keyFor(sym)                                                                     // 171
  keyFor: function keyFor(key){                                                                      // 172
    return keyOf(SymbolRegistry, key);                                                               // 173
  },                                                                                                 // 174
  useSetter: function(){ setter = true; },                                                           // 175
  useSimple: function(){ setter = false; }                                                           // 176
};                                                                                                   // 177
// 19.4.2.2 Symbol.hasInstance                                                                       // 178
// 19.4.2.3 Symbol.isConcatSpreadable                                                                // 179
// 19.4.2.4 Symbol.iterator                                                                          // 180
// 19.4.2.6 Symbol.match                                                                             // 181
// 19.4.2.8 Symbol.replace                                                                           // 182
// 19.4.2.9 Symbol.search                                                                            // 183
// 19.4.2.10 Symbol.species                                                                          // 184
// 19.4.2.11 Symbol.split                                                                            // 185
// 19.4.2.12 Symbol.toPrimitive                                                                      // 186
// 19.4.2.13 Symbol.toStringTag                                                                      // 187
// 19.4.2.14 Symbol.unscopables                                                                      // 188
$.each.call((                                                                                        // 189
    'hasInstance,isConcatSpreadable,iterator,match,replace,search,' +                                // 190
    'species,split,toPrimitive,toStringTag,unscopables'                                              // 191
  ).split(','), function(it){                                                                        // 192
    var sym = wks(it);                                                                               // 193
    symbolStatics[it] = useNative ? sym : wrap(sym);                                                 // 194
  }                                                                                                  // 195
);                                                                                                   // 196
                                                                                                     // 197
setter = true;                                                                                       // 198
                                                                                                     // 199
$def($def.G + $def.W, {Symbol: $Symbol});                                                            // 200
                                                                                                     // 201
$def($def.S, 'Symbol', symbolStatics);                                                               // 202
                                                                                                     // 203
$def($def.S + $def.F * !useNative, 'Object', {                                                       // 204
  // 19.1.2.2 Object.create(O [, Properties])                                                        // 205
  create: $create,                                                                                   // 206
  // 19.1.2.4 Object.defineProperty(O, P, Attributes)                                                // 207
  defineProperty: $defineProperty,                                                                   // 208
  // 19.1.2.3 Object.defineProperties(O, Properties)                                                 // 209
  defineProperties: $defineProperties,                                                               // 210
  // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)                                                  // 211
  getOwnPropertyDescriptor: $getOwnPropertyDescriptor,                                               // 212
  // 19.1.2.7 Object.getOwnPropertyNames(O)                                                          // 213
  getOwnPropertyNames: $getOwnPropertyNames,                                                         // 214
  // 19.1.2.8 Object.getOwnPropertySymbols(O)                                                        // 215
  getOwnPropertySymbols: $getOwnPropertySymbols                                                      // 216
});                                                                                                  // 217
                                                                                                     // 218
// 24.3.2 JSON.stringify(value [, replacer [, space]])                                               // 219
$JSON && $def($def.S + $def.F * (!useNative || buggyJSON), 'JSON', {stringify: $stringify});         // 220
                                                                                                     // 221
// 19.4.3.5 Symbol.prototype[@@toStringTag]                                                          // 222
setTag($Symbol, 'Symbol');                                                                           // 223
// 20.2.1.9 Math[@@toStringTag]                                                                      // 224
setTag(Math, 'Math', true);                                                                          // 225
// 24.3.3 JSON[@@toStringTag]                                                                        // 226
setTag(global.JSON, 'JSON', true);                                                                   // 227
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.js":function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
var $Object = Object;                                                                                // 1
module.exports = {                                                                                   // 2
  create:     $Object.create,                                                                        // 3
  getProto:   $Object.getPrototypeOf,                                                                // 4
  isEnum:     {}.propertyIsEnumerable,                                                               // 5
  getDesc:    $Object.getOwnPropertyDescriptor,                                                      // 6
  setDesc:    $Object.defineProperty,                                                                // 7
  setDescs:   $Object.defineProperties,                                                              // 8
  getKeys:    $Object.keys,                                                                          // 9
  getNames:   $Object.getOwnPropertyNames,                                                           // 10
  getSymbols: $Object.getOwnPropertySymbols,                                                         // 11
  each:       [].forEach                                                                             // 12
};                                                                                                   // 13
///////////////////////////////////////////////////////////////////////////////////////////////////////

},"$.global.js":function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028                              // 1
var UNDEFINED = 'undefined';                                                                         // 2
var global = module.exports = typeof window != UNDEFINED && window.Math == Math                      // 3
  ? window : typeof self != UNDEFINED && self.Math == Math ? self : Function('return this')();       // 4
if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef                              // 5
///////////////////////////////////////////////////////////////////////////////////////////////////////

},"$.has.js":function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
var hasOwnProperty = {}.hasOwnProperty;                                                              // 1
module.exports = function(it, key){                                                                  // 2
  return hasOwnProperty.call(it, key);                                                               // 3
};                                                                                                   // 4
///////////////////////////////////////////////////////////////////////////////////////////////////////

},"$.support-desc.js":["./$.fails",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// Thank's IE8 for his funny defineProperty                                                          // 1
module.exports = !require('./$.fails')(function(){                                                   // 2
  return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;                      // 3
});                                                                                                  // 4
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.fails.js":function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
module.exports = function(exec){                                                                     // 1
  try {                                                                                              // 2
    return !!exec();                                                                                 // 3
  } catch(e){                                                                                        // 4
    return true;                                                                                     // 5
  }                                                                                                  // 6
};                                                                                                   // 7
///////////////////////////////////////////////////////////////////////////////////////////////////////

},"$.def.js":["./$.global","./$.core","./$.hide","./$.redef",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
var global     = require('./$.global')                                                               // 1
  , core       = require('./$.core')                                                                 // 2
  , hide       = require('./$.hide')                                                                 // 3
  , $redef     = require('./$.redef')                                                                // 4
  , PROTOTYPE  = 'prototype';                                                                        // 5
var ctx = function(fn, that){                                                                        // 6
  return function(){                                                                                 // 7
    return fn.apply(that, arguments);                                                                // 8
  };                                                                                                 // 9
};                                                                                                   // 10
var $def = function(type, name, source){                                                             // 11
  var key, own, out, exp                                                                             // 12
    , isGlobal = type & $def.G                                                                       // 13
    , isProto  = type & $def.P                                                                       // 14
    , target   = isGlobal ? global : type & $def.S                                                   // 15
        ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]                      // 16
    , exports  = isGlobal ? core : core[name] || (core[name] = {});                                  // 17
  if(isGlobal)source = name;                                                                         // 18
  for(key in source){                                                                                // 19
    // contains in native                                                                            // 20
    own = !(type & $def.F) && target && key in target;                                               // 21
    // export native or passed                                                                       // 22
    out = (own ? target : source)[key];                                                              // 23
    // bind timers to global for call from export context                                            // 24
    if(type & $def.B && own)exp = ctx(out, global);                                                  // 25
    else exp = isProto && typeof out == 'function' ? ctx(Function.call, out) : out;                  // 26
    // extend global                                                                                 // 27
    if(target && !own)$redef(target, key, out);                                                      // 28
    // export                                                                                        // 29
    if(exports[key] != out)hide(exports, key, exp);                                                  // 30
    if(isProto)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out;                         // 31
  }                                                                                                  // 32
};                                                                                                   // 33
global.core = core;                                                                                  // 34
// type bitmap                                                                                       // 35
$def.F = 1;  // forced                                                                               // 36
$def.G = 2;  // global                                                                               // 37
$def.S = 4;  // static                                                                               // 38
$def.P = 8;  // proto                                                                                // 39
$def.B = 16; // bind                                                                                 // 40
$def.W = 32; // wrap                                                                                 // 41
module.exports = $def;                                                                               // 42
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.core.js":function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
var core = module.exports = {version: '1.2.1'};                                                      // 1
if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef                                // 2
///////////////////////////////////////////////////////////////////////////////////////////////////////

},"$.hide.js":["./$","./$.property-desc","./$.support-desc",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
var $          = require('./$')                                                                      // 1
  , createDesc = require('./$.property-desc');                                                       // 2
module.exports = require('./$.support-desc') ? function(object, key, value){                         // 3
  return $.setDesc(object, key, createDesc(1, value));                                               // 4
} : function(object, key, value){                                                                    // 5
  object[key] = value;                                                                               // 6
  return object;                                                                                     // 7
};                                                                                                   // 8
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.property-desc.js":function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
module.exports = function(bitmap, value){                                                            // 1
  return {                                                                                           // 2
    enumerable  : !(bitmap & 1),                                                                     // 3
    configurable: !(bitmap & 2),                                                                     // 4
    writable    : !(bitmap & 4),                                                                     // 5
    value       : value                                                                              // 6
  };                                                                                                 // 7
};                                                                                                   // 8
///////////////////////////////////////////////////////////////////////////////////////////////////////

},"$.redef.js":["./$.global","./$.hide","./$.uid","./$.core",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// add fake Function#toString                                                                        // 1
// for correct work wrapped methods / constructors with methods like LoDash isNative                 // 2
var global    = require('./$.global')                                                                // 3
  , hide      = require('./$.hide')                                                                  // 4
  , SRC       = require('./$.uid')('src')                                                            // 5
  , TO_STRING = 'toString'                                                                           // 6
  , $toString = Function[TO_STRING]                                                                  // 7
  , TPL       = ('' + $toString).split(TO_STRING);                                                   // 8
                                                                                                     // 9
require('./$.core').inspectSource = function(it){                                                    // 10
  return $toString.call(it);                                                                         // 11
};                                                                                                   // 12
                                                                                                     // 13
(module.exports = function(O, key, val, safe){                                                       // 14
  if(typeof val == 'function'){                                                                      // 15
    hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));                                    // 16
    if(!('name' in val))val.name = key;                                                              // 17
  }                                                                                                  // 18
  if(O === global){                                                                                  // 19
    O[key] = val;                                                                                    // 20
  } else {                                                                                           // 21
    if(!safe)delete O[key];                                                                          // 22
    hide(O, key, val);                                                                               // 23
  }                                                                                                  // 24
})(Function.prototype, TO_STRING, function toString(){                                               // 25
  return typeof this == 'function' && this[SRC] || $toString.call(this);                             // 26
});                                                                                                  // 27
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.uid.js":function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
var id = 0                                                                                           // 1
  , px = Math.random();                                                                              // 2
module.exports = function(key){                                                                      // 3
  return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));             // 4
};                                                                                                   // 5
///////////////////////////////////////////////////////////////////////////////////////////////////////

},"$.shared.js":["./$.global",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
var global = require('./$.global')                                                                   // 1
  , SHARED = '__core-js_shared__'                                                                    // 2
  , store  = global[SHARED] || (global[SHARED] = {});                                                // 3
module.exports = function(key){                                                                      // 4
  return store[key] || (store[key] = {});                                                            // 5
};                                                                                                   // 6
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.tag.js":["./$.has","./$.hide","./$.wks",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
var has  = require('./$.has')                                                                        // 1
  , hide = require('./$.hide')                                                                       // 2
  , TAG  = require('./$.wks')('toStringTag');                                                        // 3
                                                                                                     // 4
module.exports = function(it, tag, stat){                                                            // 5
  if(it && !has(it = stat ? it : it.prototype, TAG))hide(it, TAG, tag);                              // 6
};                                                                                                   // 7
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.wks.js":["./$.shared","./$.global","./$.uid",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
var store  = require('./$.shared')('wks')                                                            // 1
  , Symbol = require('./$.global').Symbol;                                                           // 2
module.exports = function(name){                                                                     // 3
  return store[name] || (store[name] =                                                               // 4
    Symbol && Symbol[name] || (Symbol || require('./$.uid'))('Symbol.' + name));                     // 5
};                                                                                                   // 6
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.keyof.js":["./$","./$.to-iobject",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
var $         = require('./$')                                                                       // 1
  , toIObject = require('./$.to-iobject');                                                           // 2
module.exports = function(object, el){                                                               // 3
  var O      = toIObject(object)                                                                     // 4
    , keys   = $.getKeys(O)                                                                          // 5
    , length = keys.length                                                                           // 6
    , index  = 0                                                                                     // 7
    , key;                                                                                           // 8
  while(length > index)if(O[key = keys[index++]] === el)return key;                                  // 9
};                                                                                                   // 10
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.to-iobject.js":["./$.iobject","./$.defined",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// to indexed object, toObject with fallback for non-array-like ES3 strings                          // 1
var IObject = require('./$.iobject')                                                                 // 2
  , defined = require('./$.defined');                                                                // 3
module.exports = function(it){                                                                       // 4
  return IObject(defined(it));                                                                       // 5
};                                                                                                   // 6
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.iobject.js":["./$.cof",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// indexed object, fallback for non-array-like ES3 strings                                           // 1
var cof = require('./$.cof');                                                                        // 2
module.exports = 0 in Object('z') ? Object : function(it){                                           // 3
  return cof(it) == 'String' ? it.split('') : Object(it);                                            // 4
};                                                                                                   // 5
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.cof.js":function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
var toString = {}.toString;                                                                          // 1
                                                                                                     // 2
module.exports = function(it){                                                                       // 3
  return toString.call(it).slice(8, -1);                                                             // 4
};                                                                                                   // 5
///////////////////////////////////////////////////////////////////////////////////////////////////////

},"$.defined.js":function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 7.2.1 RequireObjectCoercible(argument)                                                            // 1
module.exports = function(it){                                                                       // 2
  if(it == undefined)throw TypeError("Can't call method on  " + it);                                 // 3
  return it;                                                                                         // 4
};                                                                                                   // 5
///////////////////////////////////////////////////////////////////////////////////////////////////////

},"$.get-names.js":["./$.to-iobject","./$",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window                         // 1
var toString  = {}.toString                                                                          // 2
  , toIObject = require('./$.to-iobject')                                                            // 3
  , getNames  = require('./$').getNames;                                                             // 4
                                                                                                     // 5
var windowNames = typeof window == 'object' && Object.getOwnPropertyNames                            // 6
  ? Object.getOwnPropertyNames(window) : [];                                                         // 7
                                                                                                     // 8
var getWindowNames = function(it){                                                                   // 9
  try {                                                                                              // 10
    return getNames(it);                                                                             // 11
  } catch(e){                                                                                        // 12
    return windowNames.slice();                                                                      // 13
  }                                                                                                  // 14
};                                                                                                   // 15
                                                                                                     // 16
module.exports.get = function getOwnPropertyNames(it){                                               // 17
  if(windowNames && toString.call(it) == '[object Window]')return getWindowNames(it);                // 18
  return getNames(toIObject(it));                                                                    // 19
};                                                                                                   // 20
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.enum-keys.js":["./$",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// all enumerable object keys, includes symbols                                                      // 1
var $ = require('./$');                                                                              // 2
module.exports = function(it){                                                                       // 3
  var keys       = $.getKeys(it)                                                                     // 4
    , getSymbols = $.getSymbols;                                                                     // 5
  if(getSymbols){                                                                                    // 6
    var symbols = getSymbols(it)                                                                     // 7
      , isEnum  = $.isEnum                                                                           // 8
      , i       = 0                                                                                  // 9
      , key;                                                                                         // 10
    while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))keys.push(key);                  // 11
  }                                                                                                  // 12
  return keys;                                                                                       // 13
};                                                                                                   // 14
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.is-array.js":["./$.cof",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 7.2.2 IsArray(argument)                                                                           // 1
var cof = require('./$.cof');                                                                        // 2
module.exports = Array.isArray || function(arg){                                                     // 3
  return cof(arg) == 'Array';                                                                        // 4
};                                                                                                   // 5
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.is-object.js":function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
module.exports = function(it){                                                                       // 1
  return typeof it === 'object' ? it !== null : typeof it === 'function';                            // 2
};                                                                                                   // 3
///////////////////////////////////////////////////////////////////////////////////////////////////////

},"$.an-object.js":["./$.is-object",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
var isObject = require('./$.is-object');                                                             // 1
module.exports = function(it){                                                                       // 2
  if(!isObject(it))throw TypeError(it + ' is not an object!');                                       // 3
  return it;                                                                                         // 4
};                                                                                                   // 5
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.library.js":function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
module.exports = false;                                                                              // 1
///////////////////////////////////////////////////////////////////////////////////////////////////////

},"es6.object.assign.js":["./$.def","./$.assign",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 19.1.3.1 Object.assign(target, source)                                                            // 1
var $def = require('./$.def');                                                                       // 2
                                                                                                     // 3
$def($def.S + $def.F, 'Object', {assign: require('./$.assign')});                                    // 4
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.assign.js":["./$.to-object","./$.iobject","./$.enum-keys","./$.has","./$.fails",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 19.1.2.1 Object.assign(target, source, ...)                                                       // 1
var toObject = require('./$.to-object')                                                              // 2
  , IObject  = require('./$.iobject')                                                                // 3
  , enumKeys = require('./$.enum-keys')                                                              // 4
  , has      = require('./$.has');                                                                   // 5
                                                                                                     // 6
// should work with symbols and should have deterministic property order (V8 bug)                    // 7
module.exports = require('./$.fails')(function(){                                                    // 8
  var a = Object.assign                                                                              // 9
    , A = {}                                                                                         // 10
    , B = {}                                                                                         // 11
    , S = Symbol()                                                                                   // 12
    , K = 'abcdefghijklmnopqrst';                                                                    // 13
  A[S] = 7;                                                                                          // 14
  K.split('').forEach(function(k){ B[k] = k; });                                                     // 15
  return a({}, A)[S] != 7 || Object.keys(a({}, B)).join('') != K;                                    // 16
}) ? function assign(target, source){   // eslint-disable-line no-unused-vars                        // 17
  var T = toObject(target)                                                                           // 18
    , l = arguments.length                                                                           // 19
    , i = 1;                                                                                         // 20
  while(l > i){                                                                                      // 21
    var S      = IObject(arguments[i++])                                                             // 22
      , keys   = enumKeys(S)                                                                         // 23
      , length = keys.length                                                                         // 24
      , j      = 0                                                                                   // 25
      , key;                                                                                         // 26
    while(length > j)if(has(S, key = keys[j++]))T[key] = S[key];                                     // 27
  }                                                                                                  // 28
  return T;                                                                                          // 29
} : Object.assign;                                                                                   // 30
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.to-object.js":["./$.defined",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 7.1.13 ToObject(argument)                                                                         // 1
var defined = require('./$.defined');                                                                // 2
module.exports = function(it){                                                                       // 3
  return Object(defined(it));                                                                        // 4
};                                                                                                   // 5
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.object.is.js":["./$.def","./$.same",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 19.1.3.10 Object.is(value1, value2)                                                               // 1
var $def = require('./$.def');                                                                       // 2
$def($def.S, 'Object', {                                                                             // 3
  is: require('./$.same')                                                                            // 4
});                                                                                                  // 5
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.same.js":function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
module.exports = Object.is || function is(x, y){                                                     // 1
  return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;                                    // 2
};                                                                                                   // 3
///////////////////////////////////////////////////////////////////////////////////////////////////////

},"es6.object.set-prototype-of.js":["./$.def","./$.set-proto",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 19.1.3.19 Object.setPrototypeOf(O, proto)                                                         // 1
var $def = require('./$.def');                                                                       // 2
$def($def.S, 'Object', {setPrototypeOf: require('./$.set-proto').set});                              // 3
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.set-proto.js":["./$","./$.is-object","./$.an-object","./$.ctx",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// Works with __proto__ only. Old v8 can't work with null proto objects.                             // 1
/* eslint-disable no-proto */                                                                        // 2
var getDesc  = require('./$').getDesc                                                                // 3
  , isObject = require('./$.is-object')                                                              // 4
  , anObject = require('./$.an-object');                                                             // 5
var check = function(O, proto){                                                                      // 6
  anObject(O);                                                                                       // 7
  if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!");        // 8
};                                                                                                   // 9
module.exports = {                                                                                   // 10
  set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line no-proto                 // 11
    function(test, buggy, set){                                                                      // 12
      try {                                                                                          // 13
        set = require('./$.ctx')(Function.call, getDesc(Object.prototype, '__proto__').set, 2);      // 14
        set(test, []);                                                                               // 15
        buggy = !(test instanceof Array);                                                            // 16
      } catch(e){ buggy = true; }                                                                    // 17
      return function setPrototypeOf(O, proto){                                                      // 18
        check(O, proto);                                                                             // 19
        if(buggy)O.__proto__ = proto;                                                                // 20
        else set(O, proto);                                                                          // 21
        return O;                                                                                    // 22
      };                                                                                             // 23
    }({}, false) : undefined),                                                                       // 24
  check: check                                                                                       // 25
};                                                                                                   // 26
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.ctx.js":["./$.a-function",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// optional / simple context binding                                                                 // 1
var aFunction = require('./$.a-function');                                                           // 2
module.exports = function(fn, that, length){                                                         // 3
  aFunction(fn);                                                                                     // 4
  if(that === undefined)return fn;                                                                   // 5
  switch(length){                                                                                    // 6
    case 1: return function(a){                                                                      // 7
      return fn.call(that, a);                                                                       // 8
    };                                                                                               // 9
    case 2: return function(a, b){                                                                   // 10
      return fn.call(that, a, b);                                                                    // 11
    };                                                                                               // 12
    case 3: return function(a, b, c){                                                                // 13
      return fn.call(that, a, b, c);                                                                 // 14
    };                                                                                               // 15
  }                                                                                                  // 16
  return function(/* ...args */){                                                                    // 17
    return fn.apply(that, arguments);                                                                // 18
  };                                                                                                 // 19
};                                                                                                   // 20
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.a-function.js":function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
module.exports = function(it){                                                                       // 1
  if(typeof it != 'function')throw TypeError(it + ' is not a function!');                            // 2
  return it;                                                                                         // 3
};                                                                                                   // 4
///////////////////////////////////////////////////////////////////////////////////////////////////////

},"es6.object.to-string.js":["./$.classof","./$.wks","./$.redef",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
'use strict';                                                                                        // 1
// 19.1.3.6 Object.prototype.toString()                                                              // 2
var classof = require('./$.classof')                                                                 // 3
  , test    = {};                                                                                    // 4
test[require('./$.wks')('toStringTag')] = 'z';                                                       // 5
if(test + '' != '[object z]'){                                                                       // 6
  require('./$.redef')(Object.prototype, 'toString', function toString(){                            // 7
    return '[object ' + classof(this) + ']';                                                         // 8
  }, true);                                                                                          // 9
}                                                                                                    // 10
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.classof.js":["./$.cof","./$.wks",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// getting tag from 19.1.3.6 Object.prototype.toString()                                             // 1
var cof = require('./$.cof')                                                                         // 2
  , TAG = require('./$.wks')('toStringTag')                                                          // 3
  // ES3 wrong here                                                                                  // 4
  , ARG = cof(function(){ return arguments; }()) == 'Arguments';                                     // 5
                                                                                                     // 6
module.exports = function(it){                                                                       // 7
  var O, T, B;                                                                                       // 8
  return it === undefined ? 'Undefined' : it === null ? 'Null'                                       // 9
    // @@toStringTag case                                                                            // 10
    : typeof (T = (O = Object(it))[TAG]) == 'string' ? T                                             // 11
    // builtinTag case                                                                               // 12
    : ARG ? cof(O)                                                                                   // 13
    // ES3 arguments fallback                                                                        // 14
    : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;                   // 15
};                                                                                                   // 16
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.object.freeze.js":["./$.is-object","./$.object-sap",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 19.1.2.5 Object.freeze(O)                                                                         // 1
var isObject = require('./$.is-object');                                                             // 2
                                                                                                     // 3
require('./$.object-sap')('freeze', function($freeze){                                               // 4
  return function freeze(it){                                                                        // 5
    return $freeze && isObject(it) ? $freeze(it) : it;                                               // 6
  };                                                                                                 // 7
});                                                                                                  // 8
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.object-sap.js":["./$.def","./$.core","./$.fails",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// most Object methods by ES6 should accept primitives                                               // 1
module.exports = function(KEY, exec){                                                                // 2
  var $def = require('./$.def')                                                                      // 3
    , fn   = (require('./$.core').Object || {})[KEY] || Object[KEY]                                  // 4
    , exp  = {};                                                                                     // 5
  exp[KEY] = exec(fn);                                                                               // 6
  $def($def.S + $def.F * require('./$.fails')(function(){ fn(1); }), 'Object', exp);                 // 7
};                                                                                                   // 8
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.object.seal.js":["./$.is-object","./$.object-sap",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 19.1.2.17 Object.seal(O)                                                                          // 1
var isObject = require('./$.is-object');                                                             // 2
                                                                                                     // 3
require('./$.object-sap')('seal', function($seal){                                                   // 4
  return function seal(it){                                                                          // 5
    return $seal && isObject(it) ? $seal(it) : it;                                                   // 6
  };                                                                                                 // 7
});                                                                                                  // 8
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.object.prevent-extensions.js":["./$.is-object","./$.object-sap",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 19.1.2.15 Object.preventExtensions(O)                                                             // 1
var isObject = require('./$.is-object');                                                             // 2
                                                                                                     // 3
require('./$.object-sap')('preventExtensions', function($preventExtensions){                         // 4
  return function preventExtensions(it){                                                             // 5
    return $preventExtensions && isObject(it) ? $preventExtensions(it) : it;                         // 6
  };                                                                                                 // 7
});                                                                                                  // 8
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.object.is-frozen.js":["./$.is-object","./$.object-sap",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 19.1.2.12 Object.isFrozen(O)                                                                      // 1
var isObject = require('./$.is-object');                                                             // 2
                                                                                                     // 3
require('./$.object-sap')('isFrozen', function($isFrozen){                                           // 4
  return function isFrozen(it){                                                                      // 5
    return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true;                                  // 6
  };                                                                                                 // 7
});                                                                                                  // 8
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.object.is-sealed.js":["./$.is-object","./$.object-sap",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 19.1.2.13 Object.isSealed(O)                                                                      // 1
var isObject = require('./$.is-object');                                                             // 2
                                                                                                     // 3
require('./$.object-sap')('isSealed', function($isSealed){                                           // 4
  return function isSealed(it){                                                                      // 5
    return isObject(it) ? $isSealed ? $isSealed(it) : false : true;                                  // 6
  };                                                                                                 // 7
});                                                                                                  // 8
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.object.is-extensible.js":["./$.is-object","./$.object-sap",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 19.1.2.11 Object.isExtensible(O)                                                                  // 1
var isObject = require('./$.is-object');                                                             // 2
                                                                                                     // 3
require('./$.object-sap')('isExtensible', function($isExtensible){                                   // 4
  return function isExtensible(it){                                                                  // 5
    return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false;                          // 6
  };                                                                                                 // 7
});                                                                                                  // 8
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.object.get-own-property-descriptor.js":["./$.to-iobject","./$.object-sap",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)                                                    // 1
var toIObject = require('./$.to-iobject');                                                           // 2
                                                                                                     // 3
require('./$.object-sap')('getOwnPropertyDescriptor', function($getOwnPropertyDescriptor){           // 4
  return function getOwnPropertyDescriptor(it, key){                                                 // 5
    return $getOwnPropertyDescriptor(toIObject(it), key);                                            // 6
  };                                                                                                 // 7
});                                                                                                  // 8
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.object.get-prototype-of.js":["./$.to-object","./$.object-sap",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 19.1.2.9 Object.getPrototypeOf(O)                                                                 // 1
var toObject = require('./$.to-object');                                                             // 2
                                                                                                     // 3
require('./$.object-sap')('getPrototypeOf', function($getPrototypeOf){                               // 4
  return function getPrototypeOf(it){                                                                // 5
    return $getPrototypeOf(toObject(it));                                                            // 6
  };                                                                                                 // 7
});                                                                                                  // 8
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.object.keys.js":["./$.to-object","./$.object-sap",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 19.1.2.14 Object.keys(O)                                                                          // 1
var toObject = require('./$.to-object');                                                             // 2
                                                                                                     // 3
require('./$.object-sap')('keys', function($keys){                                                   // 4
  return function keys(it){                                                                          // 5
    return $keys(toObject(it));                                                                      // 6
  };                                                                                                 // 7
});                                                                                                  // 8
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.object.get-own-property-names.js":["./$.object-sap","./$.get-names",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 19.1.2.7 Object.getOwnPropertyNames(O)                                                            // 1
require('./$.object-sap')('getOwnPropertyNames', function(){                                         // 2
  return require('./$.get-names').get;                                                               // 3
});                                                                                                  // 4
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.string.iterator.js":["./$.string-at","./$.iter-define",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
'use strict';                                                                                        // 1
var $at  = require('./$.string-at')(true);                                                           // 2
                                                                                                     // 3
// 21.1.3.27 String.prototype[@@iterator]()                                                          // 4
require('./$.iter-define')(String, 'String', function(iterated){                                     // 5
  this._t = String(iterated); // target                                                              // 6
  this._i = 0;                // next index                                                          // 7
// 21.1.5.2.1 %StringIteratorPrototype%.next()                                                       // 8
}, function(){                                                                                       // 9
  var O     = this._t                                                                                // 10
    , index = this._i                                                                                // 11
    , point;                                                                                         // 12
  if(index >= O.length)return {value: undefined, done: true};                                        // 13
  point = $at(O, index);                                                                             // 14
  this._i += point.length;                                                                           // 15
  return {value: point, done: false};                                                                // 16
});                                                                                                  // 17
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.string-at.js":["./$.to-integer","./$.defined",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// true  -> String#at                                                                                // 1
// false -> String#codePointAt                                                                       // 2
var toInteger = require('./$.to-integer')                                                            // 3
  , defined   = require('./$.defined');                                                              // 4
module.exports = function(TO_STRING){                                                                // 5
  return function(that, pos){                                                                        // 6
    var s = String(defined(that))                                                                    // 7
      , i = toInteger(pos)                                                                           // 8
      , l = s.length                                                                                 // 9
      , a, b;                                                                                        // 10
    if(i < 0 || i >= l)return TO_STRING ? '' : undefined;                                            // 11
    a = s.charCodeAt(i);                                                                             // 12
    return a < 0xd800 || a > 0xdbff || i + 1 === l                                                   // 13
      || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff                                            // 14
        ? TO_STRING ? s.charAt(i) : a                                                                // 15
        : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;               // 16
  };                                                                                                 // 17
};                                                                                                   // 18
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.to-integer.js":function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 7.1.4 ToInteger                                                                                   // 1
var ceil  = Math.ceil                                                                                // 2
  , floor = Math.floor;                                                                              // 3
module.exports = function(it){                                                                       // 4
  return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);                                          // 5
};                                                                                                   // 6
///////////////////////////////////////////////////////////////////////////////////////////////////////

},"$.iter-define.js":["./$.library","./$.def","./$.redef","./$.hide","./$.has","./$.wks","./$.iterators","./$.iter-create","./$","./$.tag",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
'use strict';                                                                                        // 1
var LIBRARY         = require('./$.library')                                                         // 2
  , $def            = require('./$.def')                                                             // 3
  , $redef          = require('./$.redef')                                                           // 4
  , hide            = require('./$.hide')                                                            // 5
  , has             = require('./$.has')                                                             // 6
  , SYMBOL_ITERATOR = require('./$.wks')('iterator')                                                 // 7
  , Iterators       = require('./$.iterators')                                                       // 8
  , BUGGY           = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`     // 9
  , FF_ITERATOR     = '@@iterator'                                                                   // 10
  , KEYS            = 'keys'                                                                         // 11
  , VALUES          = 'values';                                                                      // 12
var returnThis = function(){ return this; };                                                         // 13
module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCE){                    // 14
  require('./$.iter-create')(Constructor, NAME, next);                                               // 15
  var createMethod = function(kind){                                                                 // 16
    switch(kind){                                                                                    // 17
      case KEYS: return function keys(){ return new Constructor(this, kind); };                      // 18
      case VALUES: return function values(){ return new Constructor(this, kind); };                  // 19
    } return function entries(){ return new Constructor(this, kind); };                              // 20
  };                                                                                                 // 21
  var TAG      = NAME + ' Iterator'                                                                  // 22
    , proto    = Base.prototype                                                                      // 23
    , _native  = proto[SYMBOL_ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]           // 24
    , _default = _native || createMethod(DEFAULT)                                                    // 25
    , methods, key;                                                                                  // 26
  // Fix native                                                                                      // 27
  if(_native){                                                                                       // 28
    var IteratorPrototype = require('./$').getProto(_default.call(new Base));                        // 29
    // Set @@toStringTag to native iterators                                                         // 30
    require('./$.tag')(IteratorPrototype, TAG, true);                                                // 31
    // FF fix                                                                                        // 32
    if(!LIBRARY && has(proto, FF_ITERATOR))hide(IteratorPrototype, SYMBOL_ITERATOR, returnThis);     // 33
  }                                                                                                  // 34
  // Define iterator                                                                                 // 35
  if(!LIBRARY || FORCE)hide(proto, SYMBOL_ITERATOR, _default);                                       // 36
  // Plug for library                                                                                // 37
  Iterators[NAME] = _default;                                                                        // 38
  Iterators[TAG]  = returnThis;                                                                      // 39
  if(DEFAULT){                                                                                       // 40
    methods = {                                                                                      // 41
      keys:    IS_SET            ? _default : createMethod(KEYS),                                    // 42
      values:  DEFAULT == VALUES ? _default : createMethod(VALUES),                                  // 43
      entries: DEFAULT != VALUES ? _default : createMethod('entries')                                // 44
    };                                                                                               // 45
    if(FORCE)for(key in methods){                                                                    // 46
      if(!(key in proto))$redef(proto, key, methods[key]);                                           // 47
    } else $def($def.P + $def.F * BUGGY, NAME, methods);                                             // 48
  }                                                                                                  // 49
};                                                                                                   // 50
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.iterators.js":function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
module.exports = {};                                                                                 // 1
///////////////////////////////////////////////////////////////////////////////////////////////////////

},"$.iter-create.js":["./$","./$.hide","./$.wks","./$.property-desc","./$.tag",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
'use strict';                                                                                        // 1
var $ = require('./$')                                                                               // 2
  , IteratorPrototype = {};                                                                          // 3
                                                                                                     // 4
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()                                                      // 5
require('./$.hide')(IteratorPrototype, require('./$.wks')('iterator'), function(){ return this; });  // 6
                                                                                                     // 7
module.exports = function(Constructor, NAME, next){                                                  // 8
  Constructor.prototype = $.create(IteratorPrototype, {next: require('./$.property-desc')(1,next)});
  require('./$.tag')(Constructor, NAME + ' Iterator');                                               // 10
};                                                                                                   // 11
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.array.from.js":["./$.ctx","./$.def","./$.to-object","./$.iter-call","./$.is-array-iter","./$.to-length","./core.get-iterator-method","./$.iter-detect",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
'use strict';                                                                                        // 1
var ctx         = require('./$.ctx')                                                                 // 2
  , $def        = require('./$.def')                                                                 // 3
  , toObject    = require('./$.to-object')                                                           // 4
  , call        = require('./$.iter-call')                                                           // 5
  , isArrayIter = require('./$.is-array-iter')                                                       // 6
  , toLength    = require('./$.to-length')                                                           // 7
  , getIterFn   = require('./core.get-iterator-method');                                             // 8
$def($def.S + $def.F * !require('./$.iter-detect')(function(iter){ Array.from(iter); }), 'Array', {  // 9
  // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)                          // 10
  from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){                        // 11
    var O       = toObject(arrayLike)                                                                // 12
      , C       = typeof this == 'function' ? this : Array                                           // 13
      , mapfn   = arguments[1]                                                                       // 14
      , mapping = mapfn !== undefined                                                                // 15
      , index   = 0                                                                                  // 16
      , iterFn  = getIterFn(O)                                                                       // 17
      , length, result, step, iterator;                                                              // 18
    if(mapping)mapfn = ctx(mapfn, arguments[2], 2);                                                  // 19
    // if object isn't iterable or it's array with default iterator - use simple case                // 20
    if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){                                 // 21
      for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){       // 22
        result[index] = mapping ? call(iterator, mapfn, [step.value, index], true) : step.value;     // 23
      }                                                                                              // 24
    } else {                                                                                         // 25
      length = toLength(O.length);                                                                   // 26
      for(result = new C(length); length > index; index++){                                          // 27
        result[index] = mapping ? mapfn(O[index], index) : O[index];                                 // 28
      }                                                                                              // 29
    }                                                                                                // 30
    result.length = index;                                                                           // 31
    return result;                                                                                   // 32
  }                                                                                                  // 33
});                                                                                                  // 34
                                                                                                     // 35
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.iter-call.js":["./$.an-object",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// call something on iterator step with safe closing on error                                        // 1
var anObject = require('./$.an-object');                                                             // 2
module.exports = function(iterator, fn, value, entries){                                             // 3
  try {                                                                                              // 4
    return entries ? fn(anObject(value)[0], value[1]) : fn(value);                                   // 5
  // 7.4.6 IteratorClose(iterator, completion)                                                       // 6
  } catch(e){                                                                                        // 7
    var ret = iterator['return'];                                                                    // 8
    if(ret !== undefined)anObject(ret.call(iterator));                                               // 9
    throw e;                                                                                         // 10
  }                                                                                                  // 11
};                                                                                                   // 12
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.is-array-iter.js":["./$.iterators","./$.wks",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// check on default Array iterator                                                                   // 1
var Iterators = require('./$.iterators')                                                             // 2
  , ITERATOR  = require('./$.wks')('iterator');                                                      // 3
module.exports = function(it){                                                                       // 4
  return (Iterators.Array || Array.prototype[ITERATOR]) === it;                                      // 5
};                                                                                                   // 6
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.to-length.js":["./$.to-integer",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 7.1.15 ToLength                                                                                   // 1
var toInteger = require('./$.to-integer')                                                            // 2
  , min       = Math.min;                                                                            // 3
module.exports = function(it){                                                                       // 4
  return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991    // 5
};                                                                                                   // 6
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"core.get-iterator-method.js":["./$.classof","./$.wks","./$.iterators","./$.core",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
var classof   = require('./$.classof')                                                               // 1
  , ITERATOR  = require('./$.wks')('iterator')                                                       // 2
  , Iterators = require('./$.iterators');                                                            // 3
module.exports = require('./$.core').getIteratorMethod = function(it){                               // 4
  if(it != undefined)return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)];              // 5
};                                                                                                   // 6
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.iter-detect.js":["./$.wks",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
var SYMBOL_ITERATOR = require('./$.wks')('iterator')                                                 // 1
  , SAFE_CLOSING    = false;                                                                         // 2
try {                                                                                                // 3
  var riter = [7][SYMBOL_ITERATOR]();                                                                // 4
  riter['return'] = function(){ SAFE_CLOSING = true; };                                              // 5
  Array.from(riter, function(){ throw 2; });                                                         // 6
} catch(e){ /* empty */ }                                                                            // 7
module.exports = function(exec){                                                                     // 8
  if(!SAFE_CLOSING)return false;                                                                     // 9
  var safe = false;                                                                                  // 10
  try {                                                                                              // 11
    var arr  = [7]                                                                                   // 12
      , iter = arr[SYMBOL_ITERATOR]();                                                               // 13
    iter.next = function(){ safe = true; };                                                          // 14
    arr[SYMBOL_ITERATOR] = function(){ return iter; };                                               // 15
    exec(arr);                                                                                       // 16
  } catch(e){ /* empty */ }                                                                          // 17
  return safe;                                                                                       // 18
};                                                                                                   // 19
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.array.of.js":["./$.def","./$.fails",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
'use strict';                                                                                        // 1
var $def = require('./$.def');                                                                       // 2
                                                                                                     // 3
// WebKit Array.of isn't generic                                                                     // 4
$def($def.S + $def.F * require('./$.fails')(function(){                                              // 5
  function F(){}                                                                                     // 6
  return !(Array.of.call(F) instanceof F);                                                           // 7
}), 'Array', {                                                                                       // 8
  // 22.1.2.3 Array.of( ...items)                                                                    // 9
  of: function of(/* ...args */){                                                                    // 10
    var index  = 0                                                                                   // 11
      , length = arguments.length                                                                    // 12
      , result = new (typeof this == 'function' ? this : Array)(length);                             // 13
    while(length > index)result[index] = arguments[index++];                                         // 14
    result.length = length;                                                                          // 15
    return result;                                                                                   // 16
  }                                                                                                  // 17
});                                                                                                  // 18
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.array.species.js":["./$.species",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
require('./$.species')(Array);                                                                       // 1
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.species.js":["./$","./$.wks","./$.support-desc",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
'use strict';                                                                                        // 1
var $       = require('./$')                                                                         // 2
  , SPECIES = require('./$.wks')('species');                                                         // 3
module.exports = function(C){                                                                        // 4
  if(require('./$.support-desc') && !(SPECIES in C))$.setDesc(C, SPECIES, {                          // 5
    configurable: true,                                                                              // 6
    get: function(){ return this; }                                                                  // 7
  });                                                                                                // 8
};                                                                                                   // 9
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.array.iterator.js":["./$.unscope","./$.iter-step","./$.iterators","./$.to-iobject","./$.iter-define",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
'use strict';                                                                                        // 1
var setUnscope = require('./$.unscope')                                                              // 2
  , step       = require('./$.iter-step')                                                            // 3
  , Iterators  = require('./$.iterators')                                                            // 4
  , toIObject  = require('./$.to-iobject');                                                          // 5
                                                                                                     // 6
// 22.1.3.4 Array.prototype.entries()                                                                // 7
// 22.1.3.13 Array.prototype.keys()                                                                  // 8
// 22.1.3.29 Array.prototype.values()                                                                // 9
// 22.1.3.30 Array.prototype[@@iterator]()                                                           // 10
require('./$.iter-define')(Array, 'Array', function(iterated, kind){                                 // 11
  this._t = toIObject(iterated); // target                                                           // 12
  this._i = 0;                   // next index                                                       // 13
  this._k = kind;                // kind                                                             // 14
// 22.1.5.2.1 %ArrayIteratorPrototype%.next()                                                        // 15
}, function(){                                                                                       // 16
  var O     = this._t                                                                                // 17
    , kind  = this._k                                                                                // 18
    , index = this._i++;                                                                             // 19
  if(!O || index >= O.length){                                                                       // 20
    this._t = undefined;                                                                             // 21
    return step(1);                                                                                  // 22
  }                                                                                                  // 23
  if(kind == 'keys'  )return step(0, index);                                                         // 24
  if(kind == 'values')return step(0, O[index]);                                                      // 25
  return step(0, [index, O[index]]);                                                                 // 26
}, 'values');                                                                                        // 27
                                                                                                     // 28
// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)                               // 29
Iterators.Arguments = Iterators.Array;                                                               // 30
                                                                                                     // 31
setUnscope('keys');                                                                                  // 32
setUnscope('values');                                                                                // 33
setUnscope('entries');                                                                               // 34
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.unscope.js":["./$.wks","./$.hide",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 22.1.3.31 Array.prototype[@@unscopables]                                                          // 1
var UNSCOPABLES = require('./$.wks')('unscopables');                                                 // 2
if([][UNSCOPABLES] == undefined)require('./$.hide')(Array.prototype, UNSCOPABLES, {});               // 3
module.exports = function(key){                                                                      // 4
  [][UNSCOPABLES][key] = true;                                                                       // 5
};                                                                                                   // 6
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.iter-step.js":function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
module.exports = function(done, value){                                                              // 1
  return {value: value, done: !!done};                                                               // 2
};                                                                                                   // 3
///////////////////////////////////////////////////////////////////////////////////////////////////////

},"es6.array.copy-within.js":["./$.def","./$.array-copy-within","./$.unscope",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)                             // 1
'use strict';                                                                                        // 2
var $def = require('./$.def');                                                                       // 3
                                                                                                     // 4
$def($def.P, 'Array', {copyWithin: require('./$.array-copy-within')});                               // 5
                                                                                                     // 6
require('./$.unscope')('copyWithin');                                                                // 7
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.array-copy-within.js":["./$.to-object","./$.to-index","./$.to-length",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)                             // 1
'use strict';                                                                                        // 2
var toObject = require('./$.to-object')                                                              // 3
  , toIndex  = require('./$.to-index')                                                               // 4
  , toLength = require('./$.to-length');                                                             // 5
                                                                                                     // 6
module.exports = [].copyWithin || function copyWithin(target/*= 0*/, start/*= 0, end = @length*/){   // 7
  var O     = toObject(this)                                                                         // 8
    , len   = toLength(O.length)                                                                     // 9
    , to    = toIndex(target, len)                                                                   // 10
    , from  = toIndex(start, len)                                                                    // 11
    , end   = arguments[2]                                                                           // 12
    , count = Math.min((end === undefined ? len : toIndex(end, len)) - from, len - to)               // 13
    , inc   = 1;                                                                                     // 14
  if(from < to && to < from + count){                                                                // 15
    inc  = -1;                                                                                       // 16
    from += count - 1;                                                                               // 17
    to   += count - 1;                                                                               // 18
  }                                                                                                  // 19
  while(count-- > 0){                                                                                // 20
    if(from in O)O[to] = O[from];                                                                    // 21
    else delete O[to];                                                                               // 22
    to   += inc;                                                                                     // 23
    from += inc;                                                                                     // 24
  } return O;                                                                                        // 25
};                                                                                                   // 26
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.to-index.js":["./$.to-integer",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
var toInteger = require('./$.to-integer')                                                            // 1
  , max       = Math.max                                                                             // 2
  , min       = Math.min;                                                                            // 3
module.exports = function(index, length){                                                            // 4
  index = toInteger(index);                                                                          // 5
  return index < 0 ? max(index + length, 0) : min(index, length);                                    // 6
};                                                                                                   // 7
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.array.fill.js":["./$.def","./$.array-fill","./$.unscope",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)                                // 1
var $def = require('./$.def');                                                                       // 2
                                                                                                     // 3
$def($def.P, 'Array', {fill: require('./$.array-fill')});                                            // 4
                                                                                                     // 5
require('./$.unscope')('fill');                                                                      // 6
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.array-fill.js":["./$.to-object","./$.to-index","./$.to-length",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)                                // 1
'use strict';                                                                                        // 2
var toObject = require('./$.to-object')                                                              // 3
  , toIndex  = require('./$.to-index')                                                               // 4
  , toLength = require('./$.to-length');                                                             // 5
module.exports = [].fill || function fill(value /*, start = 0, end = @length */){                    // 6
  var O      = toObject(this, true)                                                                  // 7
    , length = toLength(O.length)                                                                    // 8
    , index  = toIndex(arguments[1], length)                                                         // 9
    , end    = arguments[2]                                                                          // 10
    , endPos = end === undefined ? length : toIndex(end, length);                                    // 11
  while(endPos > index)O[index++] = value;                                                           // 12
  return O;                                                                                          // 13
};                                                                                                   // 14
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.array.find.js":["./$.def","./$.array-methods","./$.unscope",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
'use strict';                                                                                        // 1
// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined)                                     // 2
var KEY    = 'find'                                                                                  // 3
  , $def   = require('./$.def')                                                                      // 4
  , forced = true                                                                                    // 5
  , $find  = require('./$.array-methods')(5);                                                        // 6
// Shouldn't skip holes                                                                              // 7
if(KEY in [])Array(1)[KEY](function(){ forced = false; });                                           // 8
$def($def.P + $def.F * forced, 'Array', {                                                            // 9
  find: function find(callbackfn/*, that = undefined */){                                            // 10
    return $find(this, callbackfn, arguments[1]);                                                    // 11
  }                                                                                                  // 12
});                                                                                                  // 13
require('./$.unscope')(KEY);                                                                         // 14
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.array-methods.js":["./$.ctx","./$.is-object","./$.iobject","./$.to-object","./$.to-length","./$.is-array","./$.wks",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 0 -> Array#forEach                                                                                // 1
// 1 -> Array#map                                                                                    // 2
// 2 -> Array#filter                                                                                 // 3
// 3 -> Array#some                                                                                   // 4
// 4 -> Array#every                                                                                  // 5
// 5 -> Array#find                                                                                   // 6
// 6 -> Array#findIndex                                                                              // 7
var ctx      = require('./$.ctx')                                                                    // 8
  , isObject = require('./$.is-object')                                                              // 9
  , IObject  = require('./$.iobject')                                                                // 10
  , toObject = require('./$.to-object')                                                              // 11
  , toLength = require('./$.to-length')                                                              // 12
  , isArray  = require('./$.is-array')                                                               // 13
  , SPECIES  = require('./$.wks')('species');                                                        // 14
// 9.4.2.3 ArraySpeciesCreate(originalArray, length)                                                 // 15
var ASC = function(original, length){                                                                // 16
  var C;                                                                                             // 17
  if(isArray(original) && isObject(C = original.constructor)){                                       // 18
    C = C[SPECIES];                                                                                  // 19
    if(C === null)C = undefined;                                                                     // 20
  } return new(C === undefined ? Array : C)(length);                                                 // 21
};                                                                                                   // 22
module.exports = function(TYPE){                                                                     // 23
  var IS_MAP        = TYPE == 1                                                                      // 24
    , IS_FILTER     = TYPE == 2                                                                      // 25
    , IS_SOME       = TYPE == 3                                                                      // 26
    , IS_EVERY      = TYPE == 4                                                                      // 27
    , IS_FIND_INDEX = TYPE == 6                                                                      // 28
    , NO_HOLES      = TYPE == 5 || IS_FIND_INDEX;                                                    // 29
  return function($this, callbackfn, that){                                                          // 30
    var O      = toObject($this)                                                                     // 31
      , self   = IObject(O)                                                                          // 32
      , f      = ctx(callbackfn, that, 3)                                                            // 33
      , length = toLength(self.length)                                                               // 34
      , index  = 0                                                                                   // 35
      , result = IS_MAP ? ASC($this, length) : IS_FILTER ? ASC($this, 0) : undefined                 // 36
      , val, res;                                                                                    // 37
    for(;length > index; index++)if(NO_HOLES || index in self){                                      // 38
      val = self[index];                                                                             // 39
      res = f(val, index, O);                                                                        // 40
      if(TYPE){                                                                                      // 41
        if(IS_MAP)result[index] = res;            // map                                             // 42
        else if(res)switch(TYPE){                                                                    // 43
          case 3: return true;                    // some                                            // 44
          case 5: return val;                     // find                                            // 45
          case 6: return index;                   // findIndex                                       // 46
          case 2: result.push(val);               // filter                                          // 47
        } else if(IS_EVERY)return false;          // every                                           // 48
      }                                                                                              // 49
    }                                                                                                // 50
    return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;                             // 51
  };                                                                                                 // 52
};                                                                                                   // 53
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.array.find-index.js":["./$.def","./$.array-methods","./$.unscope",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
'use strict';                                                                                        // 1
// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined)                                // 2
var KEY    = 'findIndex'                                                                             // 3
  , $def   = require('./$.def')                                                                      // 4
  , forced = true                                                                                    // 5
  , $find  = require('./$.array-methods')(6);                                                        // 6
// Shouldn't skip holes                                                                              // 7
if(KEY in [])Array(1)[KEY](function(){ forced = false; });                                           // 8
$def($def.P + $def.F * forced, 'Array', {                                                            // 9
  findIndex: function findIndex(callbackfn/*, that = undefined */){                                  // 10
    return $find(this, callbackfn, arguments[1]);                                                    // 11
  }                                                                                                  // 12
});                                                                                                  // 13
require('./$.unscope')(KEY);                                                                         // 14
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.string.from-code-point.js":["./$.def","./$.to-index",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
var $def    = require('./$.def')                                                                     // 1
  , toIndex = require('./$.to-index')                                                                // 2
  , fromCharCode = String.fromCharCode                                                               // 3
  , $fromCodePoint = String.fromCodePoint;                                                           // 4
                                                                                                     // 5
// length should be 1, old FF problem                                                                // 6
$def($def.S + $def.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {                 // 7
  // 21.1.2.2 String.fromCodePoint(...codePoints)                                                    // 8
  fromCodePoint: function fromCodePoint(x){ // eslint-disable-line no-unused-vars                    // 9
    var res = []                                                                                     // 10
      , len = arguments.length                                                                       // 11
      , i   = 0                                                                                      // 12
      , code;                                                                                        // 13
    while(len > i){                                                                                  // 14
      code = +arguments[i++];                                                                        // 15
      if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point');     // 16
      res.push(code < 0x10000                                                                        // 17
        ? fromCharCode(code)                                                                         // 18
        : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)                    // 19
      );                                                                                             // 20
    } return res.join('');                                                                           // 21
  }                                                                                                  // 22
});                                                                                                  // 23
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.string.raw.js":["./$.def","./$.to-iobject","./$.to-length",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
var $def      = require('./$.def')                                                                   // 1
  , toIObject = require('./$.to-iobject')                                                            // 2
  , toLength  = require('./$.to-length');                                                            // 3
                                                                                                     // 4
$def($def.S, 'String', {                                                                             // 5
  // 21.1.2.4 String.raw(callSite, ...substitutions)                                                 // 6
  raw: function raw(callSite){                                                                       // 7
    var tpl = toIObject(callSite.raw)                                                                // 8
      , len = toLength(tpl.length)                                                                   // 9
      , sln = arguments.length                                                                       // 10
      , res = []                                                                                     // 11
      , i   = 0;                                                                                     // 12
    while(len > i){                                                                                  // 13
      res.push(String(tpl[i++]));                                                                    // 14
      if(i < sln)res.push(String(arguments[i]));                                                     // 15
    } return res.join('');                                                                           // 16
  }                                                                                                  // 17
});                                                                                                  // 18
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.string.trim.js":["./$.string-trim",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
'use strict';                                                                                        // 1
// 21.1.3.25 String.prototype.trim()                                                                 // 2
require('./$.string-trim')('trim', function($trim){                                                  // 3
  return function trim(){                                                                            // 4
    return $trim(this, 3);                                                                           // 5
  };                                                                                                 // 6
});                                                                                                  // 7
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.string-trim.js":["./$.def","./$.defined","./$.fails",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 1 -> String#trimLeft                                                                              // 1
// 2 -> String#trimRight                                                                             // 2
// 3 -> String#trim                                                                                  // 3
var trim = function(string, TYPE){                                                                   // 4
  string = String(defined(string));                                                                  // 5
  if(TYPE & 1)string = string.replace(ltrim, '');                                                    // 6
  if(TYPE & 2)string = string.replace(rtrim, '');                                                    // 7
  return string;                                                                                     // 8
};                                                                                                   // 9
                                                                                                     // 10
var $def    = require('./$.def')                                                                     // 11
  , defined = require('./$.defined')                                                                 // 12
  , spaces  = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' +                   // 13
      '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'               // 14
  , space   = '[' + spaces + ']'                                                                     // 15
  , non     = '\u200b\u0085'                                                                         // 16
  , ltrim   = RegExp('^' + space + space + '*')                                                      // 17
  , rtrim   = RegExp(space + space + '*$');                                                          // 18
                                                                                                     // 19
module.exports = function(KEY, exec){                                                                // 20
  var exp  = {};                                                                                     // 21
  exp[KEY] = exec(trim);                                                                             // 22
  $def($def.P + $def.F * require('./$.fails')(function(){                                            // 23
    return !!spaces[KEY]() || non[KEY]() != non;                                                     // 24
  }), 'String', exp);                                                                                // 25
};                                                                                                   // 26
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.string.code-point-at.js":["./$.def","./$.string-at",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
'use strict';                                                                                        // 1
var $def = require('./$.def')                                                                        // 2
  , $at  = require('./$.string-at')(false);                                                          // 3
$def($def.P, 'String', {                                                                             // 4
  // 21.1.3.3 String.prototype.codePointAt(pos)                                                      // 5
  codePointAt: function codePointAt(pos){                                                            // 6
    return $at(this, pos);                                                                           // 7
  }                                                                                                  // 8
});                                                                                                  // 9
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.string.ends-with.js":["./$.def","./$.to-length","./$.string-context","./$.fails-is-regexp",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition])                                  // 1
'use strict';                                                                                        // 2
var $def      = require('./$.def')                                                                   // 3
  , toLength  = require('./$.to-length')                                                             // 4
  , context   = require('./$.string-context')                                                        // 5
  , ENDS_WITH = 'endsWith'                                                                           // 6
  , $endsWith = ''[ENDS_WITH];                                                                       // 7
                                                                                                     // 8
$def($def.P + $def.F * require('./$.fails-is-regexp')(ENDS_WITH), 'String', {                        // 9
  endsWith: function endsWith(searchString /*, endPosition = @length */){                            // 10
    var that = context(this, searchString, ENDS_WITH)                                                // 11
      , endPosition = arguments[1]                                                                   // 12
      , len    = toLength(that.length)                                                               // 13
      , end    = endPosition === undefined ? len : Math.min(toLength(endPosition), len)              // 14
      , search = String(searchString);                                                               // 15
    return $endsWith                                                                                 // 16
      ? $endsWith.call(that, search, end)                                                            // 17
      : that.slice(end - search.length, end) === search;                                             // 18
  }                                                                                                  // 19
});                                                                                                  // 20
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.string-context.js":["./$.is-regexp","./$.defined",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// helper for String#{startsWith, endsWith, includes}                                                // 1
var isRegExp = require('./$.is-regexp')                                                              // 2
  , defined  = require('./$.defined');                                                               // 3
                                                                                                     // 4
module.exports = function(that, searchString, NAME){                                                 // 5
  if(isRegExp(searchString))throw TypeError('String#' + NAME + " doesn't accept regex!");            // 6
  return String(defined(that));                                                                      // 7
};                                                                                                   // 8
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.is-regexp.js":["./$.is-object","./$.cof","./$.wks",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 7.2.8 IsRegExp(argument)                                                                          // 1
var isObject = require('./$.is-object')                                                              // 2
  , cof      = require('./$.cof')                                                                    // 3
  , MATCH    = require('./$.wks')('match');                                                          // 4
module.exports = function(it){                                                                       // 5
  var isRegExp;                                                                                      // 6
  return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');  // 7
};                                                                                                   // 8
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.fails-is-regexp.js":["./$.wks",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
module.exports = function(KEY){                                                                      // 1
  var re = /./;                                                                                      // 2
  try {                                                                                              // 3
    '/./'[KEY](re);                                                                                  // 4
  } catch(e){                                                                                        // 5
    try {                                                                                            // 6
      re[require('./$.wks')('match')] = false;                                                       // 7
      return !'/./'[KEY](re);                                                                        // 8
    } catch(e){ /* empty */ }                                                                        // 9
  } return true;                                                                                     // 10
};                                                                                                   // 11
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.string.includes.js":["./$.def","./$.string-context","./$.fails-is-regexp",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 21.1.3.7 String.prototype.includes(searchString, position = 0)                                    // 1
'use strict';                                                                                        // 2
var $def     = require('./$.def')                                                                    // 3
  , context  = require('./$.string-context')                                                         // 4
  , INCLUDES = 'includes';                                                                           // 5
                                                                                                     // 6
$def($def.P + $def.F * require('./$.fails-is-regexp')(INCLUDES), 'String', {                         // 7
  includes: function includes(searchString /*, position = 0 */){                                     // 8
    return !!~context(this, searchString, INCLUDES).indexOf(searchString, arguments[1]);             // 9
  }                                                                                                  // 10
});                                                                                                  // 11
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.string.repeat.js":["./$.def","./$.string-repeat",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
var $def = require('./$.def');                                                                       // 1
                                                                                                     // 2
$def($def.P, 'String', {                                                                             // 3
  // 21.1.3.13 String.prototype.repeat(count)                                                        // 4
  repeat: require('./$.string-repeat')                                                               // 5
});                                                                                                  // 6
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.string-repeat.js":["./$.to-integer","./$.defined",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
'use strict';                                                                                        // 1
var toInteger = require('./$.to-integer')                                                            // 2
  , defined   = require('./$.defined');                                                              // 3
                                                                                                     // 4
module.exports = function repeat(count){                                                             // 5
  var str = String(defined(this))                                                                    // 6
    , res = ''                                                                                       // 7
    , n   = toInteger(count);                                                                        // 8
  if(n < 0 || n == Infinity)throw RangeError("Count can't be negative");                             // 9
  for(;n > 0; (n >>>= 1) && (str += str))if(n & 1)res += str;                                        // 10
  return res;                                                                                        // 11
};                                                                                                   // 12
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.string.starts-with.js":["./$.def","./$.to-length","./$.string-context","./$.fails-is-regexp",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// 21.1.3.18 String.prototype.startsWith(searchString [, position ])                                 // 1
'use strict';                                                                                        // 2
var $def        = require('./$.def')                                                                 // 3
  , toLength    = require('./$.to-length')                                                           // 4
  , context     = require('./$.string-context')                                                      // 5
  , STARTS_WITH = 'startsWith'                                                                       // 6
  , $startsWith = ''[STARTS_WITH];                                                                   // 7
                                                                                                     // 8
$def($def.P + $def.F * require('./$.fails-is-regexp')(STARTS_WITH), 'String', {                      // 9
  startsWith: function startsWith(searchString /*, position = 0 */){                                 // 10
    var that   = context(this, searchString, STARTS_WITH)                                            // 11
      , index  = toLength(Math.min(arguments[1], that.length))                                       // 12
      , search = String(searchString);                                                               // 13
    return $startsWith                                                                               // 14
      ? $startsWith.call(that, search, index)                                                        // 15
      : that.slice(index, index + search.length) === search;                                         // 16
  }                                                                                                  // 17
});                                                                                                  // 18
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.regexp.match.js":["./$.fix-re-wks",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// @@match logic                                                                                     // 1
require('./$.fix-re-wks')('match', 1, function(defined, MATCH){                                      // 2
  // 21.1.3.11 String.prototype.match(regexp)                                                        // 3
  return function match(regexp){                                                                     // 4
    'use strict';                                                                                    // 5
    var O  = defined(this)                                                                           // 6
      , fn = regexp == undefined ? undefined : regexp[MATCH];                                        // 7
    return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));             // 8
  };                                                                                                 // 9
});                                                                                                  // 10
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.fix-re-wks.js":["./$.defined","./$.wks","./$.fails","./$.redef","./$.hide",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
'use strict';                                                                                        // 1
module.exports = function(KEY, length, exec){                                                        // 2
  var defined  = require('./$.defined')                                                              // 3
    , SYMBOL   = require('./$.wks')(KEY)                                                             // 4
    , original = ''[KEY];                                                                            // 5
  if(require('./$.fails')(function(){                                                                // 6
    var O = {};                                                                                      // 7
    O[SYMBOL] = function(){ return 7; };                                                             // 8
    return ''[KEY](O) != 7;                                                                          // 9
  })){                                                                                               // 10
    require('./$.redef')(String.prototype, KEY, exec(defined, SYMBOL, original));                    // 11
    require('./$.hide')(RegExp.prototype, SYMBOL, length == 2                                        // 12
      // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)                                  // 13
      // 21.2.5.11 RegExp.prototype[@@split](string, limit)                                          // 14
      ? function(string, arg){ return original.call(string, this, arg); }                            // 15
      // 21.2.5.6 RegExp.prototype[@@match](string)                                                  // 16
      // 21.2.5.9 RegExp.prototype[@@search](string)                                                 // 17
      : function(string){ return original.call(string, this); }                                      // 18
    );                                                                                               // 19
  }                                                                                                  // 20
};                                                                                                   // 21
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.regexp.replace.js":["./$.fix-re-wks",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// @@replace logic                                                                                   // 1
require('./$.fix-re-wks')('replace', 2, function(defined, REPLACE, $replace){                        // 2
  // 21.1.3.14 String.prototype.replace(searchValue, replaceValue)                                   // 3
  return function replace(searchValue, replaceValue){                                                // 4
    'use strict';                                                                                    // 5
    var O  = defined(this)                                                                           // 6
      , fn = searchValue == undefined ? undefined : searchValue[REPLACE];                            // 7
    return fn !== undefined                                                                          // 8
      ? fn.call(searchValue, O, replaceValue)                                                        // 9
      : $replace.call(String(O), searchValue, replaceValue);                                         // 10
  };                                                                                                 // 11
});                                                                                                  // 12
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.regexp.search.js":["./$.fix-re-wks",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// @@search logic                                                                                    // 1
require('./$.fix-re-wks')('search', 1, function(defined, SEARCH){                                    // 2
  // 21.1.3.15 String.prototype.search(regexp)                                                       // 3
  return function search(regexp){                                                                    // 4
    'use strict';                                                                                    // 5
    var O  = defined(this)                                                                           // 6
      , fn = regexp == undefined ? undefined : regexp[SEARCH];                                       // 7
    return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));            // 8
  };                                                                                                 // 9
});                                                                                                  // 10
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.regexp.split.js":["./$.fix-re-wks",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
// @@split logic                                                                                     // 1
require('./$.fix-re-wks')('split', 2, function(defined, SPLIT, $split){                              // 2
  // 21.1.3.17 String.prototype.split(separator, limit)                                              // 3
  return function split(separator, limit){                                                           // 4
    'use strict';                                                                                    // 5
    var O  = defined(this)                                                                           // 6
      , fn = separator == undefined ? undefined : separator[SPLIT];                                  // 7
    return fn !== undefined                                                                          // 8
      ? fn.call(separator, O, limit)                                                                 // 9
      : $split.call(String(O), separator, limit);                                                    // 10
  };                                                                                                 // 11
});                                                                                                  // 12
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.function.name.js":["./$","./$.property-desc","./$.has","./$.support-desc",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
var setDesc    = require('./$').setDesc                                                              // 1
  , createDesc = require('./$.property-desc')                                                        // 2
  , has        = require('./$.has')                                                                  // 3
  , FProto     = Function.prototype                                                                  // 4
  , nameRE     = /^\s*function ([^ (]*)/                                                             // 5
  , NAME       = 'name';                                                                             // 6
// 19.2.4.2 name                                                                                     // 7
NAME in FProto || require('./$.support-desc') && setDesc(FProto, NAME, {                             // 8
  configurable: true,                                                                                // 9
  get: function(){                                                                                   // 10
    var match = ('' + this).match(nameRE)                                                            // 11
      , name  = match ? match[1] : '';                                                               // 12
    has(this, NAME) || setDesc(this, NAME, createDesc(5, name));                                     // 13
    return name;                                                                                     // 14
  }                                                                                                  // 15
});                                                                                                  // 16
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.function.has-instance.js":["./$","./$.is-object","./$.wks",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
'use strict';                                                                                        // 1
var $             = require('./$')                                                                   // 2
  , isObject      = require('./$.is-object')                                                         // 3
  , HAS_INSTANCE  = require('./$.wks')('hasInstance')                                                // 4
  , FunctionProto = Function.prototype;                                                              // 5
// 19.2.3.6 Function.prototype[@@hasInstance](V)                                                     // 6
if(!(HAS_INSTANCE in FunctionProto))$.setDesc(FunctionProto, HAS_INSTANCE, {value: function(O){      // 7
  if(typeof this != 'function' || !isObject(O))return false;                                         // 8
  if(!isObject(this.prototype))return O instanceof this;                                             // 9
  // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this:             // 10
  while(O = $.getProto(O))if(this.prototype === O)return true;                                       // 11
  return false;                                                                                      // 12
}});                                                                                                 // 13
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"web.dom.iterable.js":["./es6.array.iterator","./$.global","./$.hide","./$.iterators","./$.wks",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
require('./es6.array.iterator');                                                                     // 1
var global      = require('./$.global')                                                              // 2
  , hide        = require('./$.hide')                                                                // 3
  , Iterators   = require('./$.iterators')                                                           // 4
  , ITERATOR    = require('./$.wks')('iterator')                                                     // 5
  , NL          = global.NodeList                                                                    // 6
  , HTC         = global.HTMLCollection                                                              // 7
  , NLProto     = NL && NL.prototype                                                                 // 8
  , HTCProto    = HTC && HTC.prototype                                                               // 9
  , ArrayValues = Iterators.NodeList = Iterators.HTMLCollection = Iterators.Array;                   // 10
if(NL && !(ITERATOR in NLProto))hide(NLProto, ITERATOR, ArrayValues);                                // 11
if(HTC && !(ITERATOR in HTCProto))hide(HTCProto, ITERATOR, ArrayValues);                             // 12
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.map.js":["./$.collection-strong","./$.collection",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
'use strict';                                                                                        // 1
var strong = require('./$.collection-strong');                                                       // 2
                                                                                                     // 3
// 23.1 Map Objects                                                                                  // 4
require('./$.collection')('Map', function(get){                                                      // 5
  return function Map(){ return get(this, arguments[0]); };                                          // 6
}, {                                                                                                 // 7
  // 23.1.3.6 Map.prototype.get(key)                                                                 // 8
  get: function get(key){                                                                            // 9
    var entry = strong.getEntry(this, key);                                                          // 10
    return entry && entry.v;                                                                         // 11
  },                                                                                                 // 12
  // 23.1.3.9 Map.prototype.set(key, value)                                                          // 13
  set: function set(key, value){                                                                     // 14
    return strong.def(this, key === 0 ? 0 : key, value);                                             // 15
  }                                                                                                  // 16
}, strong, true);                                                                                    // 17
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.collection-strong.js":["./$","./$.hide","./$.ctx","./$.species","./$.strict-new","./$.defined","./$.for-of","./$.iter-step","./$.uid","./$.has","./$.is-object","./$.support-desc","./$.mix","./$.iter-define","./$.core",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
'use strict';                                                                                        // 1
var $            = require('./$')                                                                    // 2
  , hide         = require('./$.hide')                                                               // 3
  , ctx          = require('./$.ctx')                                                                // 4
  , species      = require('./$.species')                                                            // 5
  , strictNew    = require('./$.strict-new')                                                         // 6
  , defined      = require('./$.defined')                                                            // 7
  , forOf        = require('./$.for-of')                                                             // 8
  , step         = require('./$.iter-step')                                                          // 9
  , ID           = require('./$.uid')('id')                                                          // 10
  , $has         = require('./$.has')                                                                // 11
  , isObject     = require('./$.is-object')                                                          // 12
  , isExtensible = Object.isExtensible || isObject                                                   // 13
  , SUPPORT_DESC = require('./$.support-desc')                                                       // 14
  , SIZE         = SUPPORT_DESC ? '_s' : 'size'                                                      // 15
  , id           = 0;                                                                                // 16
                                                                                                     // 17
var fastKey = function(it, create){                                                                  // 18
  // return primitive with prefix                                                                    // 19
  if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;     // 20
  if(!$has(it, ID)){                                                                                 // 21
    // can't set id to frozen object                                                                 // 22
    if(!isExtensible(it))return 'F';                                                                 // 23
    // not necessary to add id                                                                       // 24
    if(!create)return 'E';                                                                           // 25
    // add missing object id                                                                         // 26
    hide(it, ID, ++id);                                                                              // 27
  // return object id with prefix                                                                    // 28
  } return 'O' + it[ID];                                                                             // 29
};                                                                                                   // 30
                                                                                                     // 31
var getEntry = function(that, key){                                                                  // 32
  // fast case                                                                                       // 33
  var index = fastKey(key), entry;                                                                   // 34
  if(index !== 'F')return that._i[index];                                                            // 35
  // frozen object case                                                                              // 36
  for(entry = that._f; entry; entry = entry.n){                                                      // 37
    if(entry.k == key)return entry;                                                                  // 38
  }                                                                                                  // 39
};                                                                                                   // 40
                                                                                                     // 41
module.exports = {                                                                                   // 42
  getConstructor: function(wrapper, NAME, IS_MAP, ADDER){                                            // 43
    var C = wrapper(function(that, iterable){                                                        // 44
      strictNew(that, C, NAME);                                                                      // 45
      that._i = $.create(null); // index                                                             // 46
      that._f = undefined;      // first entry                                                       // 47
      that._l = undefined;      // last entry                                                        // 48
      that[SIZE] = 0;           // size                                                              // 49
      if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);                           // 50
    });                                                                                              // 51
    require('./$.mix')(C.prototype, {                                                                // 52
      // 23.1.3.1 Map.prototype.clear()                                                              // 53
      // 23.2.3.2 Set.prototype.clear()                                                              // 54
      clear: function clear(){                                                                       // 55
        for(var that = this, data = that._i, entry = that._f; entry; entry = entry.n){               // 56
          entry.r = true;                                                                            // 57
          if(entry.p)entry.p = entry.p.n = undefined;                                                // 58
          delete data[entry.i];                                                                      // 59
        }                                                                                            // 60
        that._f = that._l = undefined;                                                               // 61
        that[SIZE] = 0;                                                                              // 62
      },                                                                                             // 63
      // 23.1.3.3 Map.prototype.delete(key)                                                          // 64
      // 23.2.3.4 Set.prototype.delete(value)                                                        // 65
      'delete': function(key){                                                                       // 66
        var that  = this                                                                             // 67
          , entry = getEntry(that, key);                                                             // 68
        if(entry){                                                                                   // 69
          var next = entry.n                                                                         // 70
            , prev = entry.p;                                                                        // 71
          delete that._i[entry.i];                                                                   // 72
          entry.r = true;                                                                            // 73
          if(prev)prev.n = next;                                                                     // 74
          if(next)next.p = prev;                                                                     // 75
          if(that._f == entry)that._f = next;                                                        // 76
          if(that._l == entry)that._l = prev;                                                        // 77
          that[SIZE]--;                                                                              // 78
        } return !!entry;                                                                            // 79
      },                                                                                             // 80
      // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)                             // 81
      // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)                             // 82
      forEach: function forEach(callbackfn /*, that = undefined */){                                 // 83
        var f = ctx(callbackfn, arguments[1], 3)                                                     // 84
          , entry;                                                                                   // 85
        while(entry = entry ? entry.n : this._f){                                                    // 86
          f(entry.v, entry.k, this);                                                                 // 87
          // revert to the last existing entry                                                       // 88
          while(entry && entry.r)entry = entry.p;                                                    // 89
        }                                                                                            // 90
      },                                                                                             // 91
      // 23.1.3.7 Map.prototype.has(key)                                                             // 92
      // 23.2.3.7 Set.prototype.has(value)                                                           // 93
      has: function has(key){                                                                        // 94
        return !!getEntry(this, key);                                                                // 95
      }                                                                                              // 96
    });                                                                                              // 97
    if(SUPPORT_DESC)$.setDesc(C.prototype, 'size', {                                                 // 98
      get: function(){                                                                               // 99
        return defined(this[SIZE]);                                                                  // 100
      }                                                                                              // 101
    });                                                                                              // 102
    return C;                                                                                        // 103
  },                                                                                                 // 104
  def: function(that, key, value){                                                                   // 105
    var entry = getEntry(that, key)                                                                  // 106
      , prev, index;                                                                                 // 107
    // change existing entry                                                                         // 108
    if(entry){                                                                                       // 109
      entry.v = value;                                                                               // 110
    // create new entry                                                                              // 111
    } else {                                                                                         // 112
      that._l = entry = {                                                                            // 113
        i: index = fastKey(key, true), // <- index                                                   // 114
        k: key,                        // <- key                                                     // 115
        v: value,                      // <- value                                                   // 116
        p: prev = that._l,             // <- previous entry                                          // 117
        n: undefined,                  // <- next entry                                              // 118
        r: false                       // <- removed                                                 // 119
      };                                                                                             // 120
      if(!that._f)that._f = entry;                                                                   // 121
      if(prev)prev.n = entry;                                                                        // 122
      that[SIZE]++;                                                                                  // 123
      // add to index                                                                                // 124
      if(index !== 'F')that._i[index] = entry;                                                       // 125
    } return that;                                                                                   // 126
  },                                                                                                 // 127
  getEntry: getEntry,                                                                                // 128
  setStrong: function(C, NAME, IS_MAP){                                                              // 129
    // add .keys, .values, .entries, [@@iterator]                                                    // 130
    // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11            // 131
    require('./$.iter-define')(C, NAME, function(iterated, kind){                                    // 132
      this._t = iterated;  // target                                                                 // 133
      this._k = kind;      // kind                                                                   // 134
      this._l = undefined; // previous                                                               // 135
    }, function(){                                                                                   // 136
      var that  = this                                                                               // 137
        , kind  = that._k                                                                            // 138
        , entry = that._l;                                                                           // 139
      // revert to the last existing entry                                                           // 140
      while(entry && entry.r)entry = entry.p;                                                        // 141
      // get next entry                                                                              // 142
      if(!that._t || !(that._l = entry = entry ? entry.n : that._t._f)){                             // 143
        // or finish the iteration                                                                   // 144
        that._t = undefined;                                                                         // 145
        return step(1);                                                                              // 146
      }                                                                                              // 147
      // return step by kind                                                                         // 148
      if(kind == 'keys'  )return step(0, entry.k);                                                   // 149
      if(kind == 'values')return step(0, entry.v);                                                   // 150
      return step(0, [entry.k, entry.v]);                                                            // 151
    }, IS_MAP ? 'entries' : 'values' , !IS_MAP, true);                                               // 152
                                                                                                     // 153
    // add [@@species], 23.1.2.2, 23.2.2.2                                                           // 154
    species(C);                                                                                      // 155
    species(require('./$.core')[NAME]); // for wrapper                                               // 156
  }                                                                                                  // 157
};                                                                                                   // 158
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.strict-new.js":function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
module.exports = function(it, Constructor, name){                                                    // 1
  if(!(it instanceof Constructor))throw TypeError(name + ": use the 'new' operator!");               // 2
  return it;                                                                                         // 3
};                                                                                                   // 4
///////////////////////////////////////////////////////////////////////////////////////////////////////

},"$.for-of.js":["./$.ctx","./$.iter-call","./$.is-array-iter","./$.an-object","./$.to-length","./core.get-iterator-method",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
var ctx         = require('./$.ctx')                                                                 // 1
  , call        = require('./$.iter-call')                                                           // 2
  , isArrayIter = require('./$.is-array-iter')                                                       // 3
  , anObject    = require('./$.an-object')                                                           // 4
  , toLength    = require('./$.to-length')                                                           // 5
  , getIterFn   = require('./core.get-iterator-method');                                             // 6
module.exports = function(iterable, entries, fn, that){                                              // 7
  var iterFn = getIterFn(iterable)                                                                   // 8
    , f      = ctx(fn, that, entries ? 2 : 1)                                                        // 9
    , index  = 0                                                                                     // 10
    , length, step, iterator;                                                                        // 11
  if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!');                    // 12
  // fast case for arrays with default iterator                                                      // 13
  if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){           // 14
    entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);                  // 15
  } else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){                    // 16
    call(iterator, f, step.value, entries);                                                          // 17
  }                                                                                                  // 18
};                                                                                                   // 19
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.mix.js":["./$.redef",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
var $redef = require('./$.redef');                                                                   // 1
module.exports = function(target, src){                                                              // 2
  for(var key in src)$redef(target, key, src[key]);                                                  // 3
  return target;                                                                                     // 4
};                                                                                                   // 5
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"$.collection.js":["./$.global","./$.def","./$.for-of","./$.strict-new","./$.redef","./$.fails","./$.mix","./$.iter-detect","./$.tag",function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
'use strict';                                                                                        // 1
var global     = require('./$.global')                                                               // 2
  , $def       = require('./$.def')                                                                  // 3
  , forOf      = require('./$.for-of')                                                               // 4
  , strictNew  = require('./$.strict-new');                                                          // 5
                                                                                                     // 6
module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){                          // 7
  var Base  = global[NAME]                                                                           // 8
    , C     = Base                                                                                   // 9
    , ADDER = IS_MAP ? 'set' : 'add'                                                                 // 10
    , proto = C && C.prototype                                                                       // 11
    , O     = {};                                                                                    // 12
  var fixMethod = function(KEY){                                                                     // 13
    var fn = proto[KEY];                                                                             // 14
    require('./$.redef')(proto, KEY,                                                                 // 15
      KEY == 'delete' ? function(a){ return fn.call(this, a === 0 ? 0 : a); }                        // 16
      : KEY == 'has' ? function has(a){ return fn.call(this, a === 0 ? 0 : a); }                     // 17
      : KEY == 'get' ? function get(a){ return fn.call(this, a === 0 ? 0 : a); }                     // 18
      : KEY == 'add' ? function add(a){ fn.call(this, a === 0 ? 0 : a); return this; }               // 19
      : function set(a, b){ fn.call(this, a === 0 ? 0 : a, b); return this; }                        // 20
    );                                                                                               // 21
  };                                                                                                 // 22
  if(typeof C != 'function' || !(IS_WEAK || proto.forEach && !require('./$.fails')(function(){       // 23
    new C().entries().next();                                                                        // 24
  }))){                                                                                              // 25
    // create collection constructor                                                                 // 26
    C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);                                         // 27
    require('./$.mix')(C.prototype, methods);                                                        // 28
  } else {                                                                                           // 29
    var inst  = new C                                                                                // 30
      , chain = inst[ADDER](IS_WEAK ? {} : -0, 1)                                                    // 31
      , buggyZero;                                                                                   // 32
    // wrap for init collections from iterable                                                       // 33
    if(!require('./$.iter-detect')(function(iter){ new C(iter); })){ // eslint-disable-line no-new   // 34
      C = wrapper(function(target, iterable){                                                        // 35
        strictNew(target, C, NAME);                                                                  // 36
        var that = new Base;                                                                         // 37
        if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);                         // 38
        return that;                                                                                 // 39
      });                                                                                            // 40
      C.prototype = proto;                                                                           // 41
      proto.constructor = C;                                                                         // 42
    }                                                                                                // 43
    IS_WEAK || inst.forEach(function(val, key){                                                      // 44
      buggyZero = 1 / key === -Infinity;                                                             // 45
    });                                                                                              // 46
    // fix converting -0 key to +0                                                                   // 47
    if(buggyZero){                                                                                   // 48
      fixMethod('delete');                                                                           // 49
      fixMethod('has');                                                                              // 50
      IS_MAP && fixMethod('get');                                                                    // 51
    }                                                                                                // 52
    // + fix .add & .set for chaining                                                                // 53
    if(buggyZero || chain !== inst)fixMethod(ADDER);                                                 // 54
    // weak collections should not contains .clear method                                            // 55
    if(IS_WEAK && proto.clear)delete proto.clear;                                                    // 56
  }                                                                                                  // 57
                                                                                                     // 58
  require('./$.tag')(C, NAME);                                                                       // 59
                                                                                                     // 60
  O[NAME] = C;                                                                                       // 61
  $def($def.G + $def.W + $def.F * (C != Base), O);                                                   // 62
                                                                                                     // 63
  if(!IS_WEAK)common.setStrong(C, NAME, IS_MAP);                                                     // 64
                                                                                                     // 65
  return C;                                                                                          // 66
};                                                                                                   // 67
///////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6.set.js":["./$.collection-strong","./$.collection",function(require){

///////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                   //
// node_modules/meteor/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-j //
//                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                     //
'use strict';                                                                                        // 1
var strong = require('./$.collection-strong');                                                       // 2
                                                                                                     // 3
// 23.2 Set Objects                                                                                  // 4
require('./$.collection')('Set', function(get){                                                      // 5
  return function Set(){ return get(this, arguments[0]); };                                          // 6
}, {                                                                                                 // 7
  // 23.2.3.1 Set.prototype.add(value)                                                               // 8
  add: function add(value){                                                                          // 9
    return strong.def(this, value = value === 0 ? 0 : value, value);                                 // 10
  }                                                                                                  // 11
}, strong);                                                                                          // 12
///////////////////////////////////////////////////////////////////////////////////////////////////////

}]}}}}}}}}},{"extensions":[".js",".json"]});
var exports = require("./node_modules/meteor/ecmascript-runtime/runtime.js");

/* Exports */
if (typeof Package === 'undefined') Package = {};
(function (pkg, symbols) {
  for (var s in symbols)
    (s in pkg) || (pkg[s] = symbols[s]);
})(Package['ecmascript-runtime'] = exports, {
  Symbol: Symbol,
  Map: Map,
  Set: Set
});

})();
(function () {

/* Imports */
var Meteor = Package.meteor.Meteor;
var global = Package.meteor.global;
var meteorEnv = Package.meteor.meteorEnv;
var meteorInstall = Package.modules.meteorInstall;
var Buffer = Package.modules.Buffer;
var process = Package.modules.process;

/* Package-scope variables */
var exports, Promise;

var require = meteorInstall({"node_modules":{"meteor":{"promise":{"client.js":["meteor-promise",function(require,exports){

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                  //
// packages/promise/client.js                                                                                       //
//                                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                    //
exports.Promise = require("meteor-promise");                                                                        // 1
                                                                                                                    // 2
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}],"node_modules":{"meteor-promise":{"package.json":function(require,exports){

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                  //
// ../npm/node_modules/meteor-promise/package.json                                                                  //
//                                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                    //
exports.name = "meteor-promise";                                                                                    // 1
exports.version = "0.6.3";                                                                                          // 2
exports.main = "promise_client.js";                                                                                 // 3
                                                                                                                    // 4
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

},"promise_client.js":["./promise.js",function(require,exports,module){

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                  //
// node_modules/meteor/promise/node_modules/meteor-promise/promise_client.js                                        //
//                                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                    //
var MeteorPromise = require("./promise.js");                                                                        // 1
                                                                                                                    // 2
var es6PromiseThen = MeteorPromise.prototype.then;                                                                  // 3
MeteorPromise.prototype.then = function (onResolved, onRejected) {                                                  // 4
  if (typeof Meteor === "object" &&                                                                                 // 5
      typeof Meteor.bindEnvironment === "function") {                                                               // 6
    return es6PromiseThen.call(                                                                                     // 7
      this,                                                                                                         // 8
      onResolved && Meteor.bindEnvironment(onResolved, raise),                                                      // 9
      onRejected && Meteor.bindEnvironment(onRejected, raise)                                                       // 10
    );                                                                                                              // 11
  }                                                                                                                 // 12
  return es6PromiseThen.call(this, onResolved, onRejected);                                                         // 13
};                                                                                                                  // 14
                                                                                                                    // 15
function raise(exception) {                                                                                         // 16
  throw exception;                                                                                                  // 17
}                                                                                                                   // 18
                                                                                                                    // 19
module.exports = exports = MeteorPromise;                                                                           // 20
                                                                                                                    // 21
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}],"promise.js":["promise",function(require,exports,module){

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                  //
// node_modules/meteor/promise/node_modules/meteor-promise/promise.js                                               //
//                                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                    //
var hasOwn = Object.prototype.hasOwnProperty;                                                                       // 1
                                                                                                                    // 2
var g =                                                                                                             // 3
  typeof global === "object" ? global :                                                                             // 4
  typeof window === "object" ? window :                                                                             // 5
  typeof self === "object" ? self : this;                                                                           // 6
                                                                                                                    // 7
var GlobalPromise = g.Promise;                                                                                      // 8
var NpmPromise = require("promise");                                                                                // 9
                                                                                                                    // 10
function copyMethods(target, source) {                                                                              // 11
  Object.keys(source).forEach(function (key) {                                                                      // 12
    var value = source[key];                                                                                        // 13
    if (typeof value === "function" &&                                                                              // 14
        ! hasOwn.call(target, key)) {                                                                               // 15
      target[key] = value;                                                                                          // 16
    }                                                                                                               // 17
  });                                                                                                               // 18
}                                                                                                                   // 19
                                                                                                                    // 20
if (typeof GlobalPromise === "function") {                                                                          // 21
  copyMethods(GlobalPromise, NpmPromise);                                                                           // 22
  copyMethods(GlobalPromise.prototype, NpmPromise.prototype);                                                       // 23
  module.exports = GlobalPromise;                                                                                   // 24
} else {                                                                                                            // 25
  module.exports = NpmPromise;                                                                                      // 26
}                                                                                                                   // 27
                                                                                                                    // 28
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}],"node_modules":{"promise":{"package.json":function(require,exports){

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                  //
// ../npm/node_modules/meteor-promise/node_modules/promise/package.json                                             //
//                                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                    //
exports.name = "promise";                                                                                           // 1
exports.version = "7.1.1";                                                                                          // 2
exports.main = "index.js";                                                                                          // 3
                                                                                                                    // 4
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

},"index.js":["./lib",function(require,exports,module){

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                  //
// node_modules/meteor/promise/node_modules/meteor-promise/node_modules/promise/index.js                            //
//                                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                    //
'use strict';                                                                                                       // 1
                                                                                                                    // 2
module.exports = require('./lib')                                                                                   // 3
                                                                                                                    // 4
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}],"lib":{"index.js":["./core.js","./done.js","./finally.js","./es6-extensions.js","./node-extensions.js","./synchronous.js",function(require,exports,module){

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                  //
// node_modules/meteor/promise/node_modules/meteor-promise/node_modules/promise/lib/index.js                        //
//                                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                    //
'use strict';                                                                                                       // 1
                                                                                                                    // 2
module.exports = require('./core.js');                                                                              // 3
require('./done.js');                                                                                               // 4
require('./finally.js');                                                                                            // 5
require('./es6-extensions.js');                                                                                     // 6
require('./node-extensions.js');                                                                                    // 7
require('./synchronous.js');                                                                                        // 8
                                                                                                                    // 9
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}],"core.js":["asap/raw",function(require,exports,module){

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                  //
// node_modules/meteor/promise/node_modules/meteor-promise/node_modules/promise/lib/core.js                         //
//                                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                    //
'use strict';                                                                                                       // 1
                                                                                                                    // 2
var asap = require('asap/raw');                                                                                     // 3
                                                                                                                    // 4
function noop() {}                                                                                                  // 5
                                                                                                                    // 6
// States:                                                                                                          // 7
//                                                                                                                  // 8
// 0 - pending                                                                                                      // 9
// 1 - fulfilled with _value                                                                                        // 10
// 2 - rejected with _value                                                                                         // 11
// 3 - adopted the state of another promise, _value                                                                 // 12
//                                                                                                                  // 13
// once the state is no longer pending (0) it is immutable                                                          // 14
                                                                                                                    // 15
// All `_` prefixed properties will be reduced to `_{random number}`                                                // 16
// at build time to obfuscate them and discourage their use.                                                        // 17
// We don't use symbols or Object.defineProperty to fully hide them                                                 // 18
// because the performance isn't good enough.                                                                       // 19
                                                                                                                    // 20
                                                                                                                    // 21
// to avoid using try/catch inside critical functions, we                                                           // 22
// extract them to here.                                                                                            // 23
var LAST_ERROR = null;                                                                                              // 24
var IS_ERROR = {};                                                                                                  // 25
function getThen(obj) {                                                                                             // 26
  try {                                                                                                             // 27
    return obj.then;                                                                                                // 28
  } catch (ex) {                                                                                                    // 29
    LAST_ERROR = ex;                                                                                                // 30
    return IS_ERROR;                                                                                                // 31
  }                                                                                                                 // 32
}                                                                                                                   // 33
                                                                                                                    // 34
function tryCallOne(fn, a) {                                                                                        // 35
  try {                                                                                                             // 36
    return fn(a);                                                                                                   // 37
  } catch (ex) {                                                                                                    // 38
    LAST_ERROR = ex;                                                                                                // 39
    return IS_ERROR;                                                                                                // 40
  }                                                                                                                 // 41
}                                                                                                                   // 42
function tryCallTwo(fn, a, b) {                                                                                     // 43
  try {                                                                                                             // 44
    fn(a, b);                                                                                                       // 45
  } catch (ex) {                                                                                                    // 46
    LAST_ERROR = ex;                                                                                                // 47
    return IS_ERROR;                                                                                                // 48
  }                                                                                                                 // 49
}                                                                                                                   // 50
                                                                                                                    // 51
module.exports = Promise;                                                                                           // 52
                                                                                                                    // 53
function Promise(fn) {                                                                                              // 54
  if (typeof this !== 'object') {                                                                                   // 55
    throw new TypeError('Promises must be constructed via new');                                                    // 56
  }                                                                                                                 // 57
  if (typeof fn !== 'function') {                                                                                   // 58
    throw new TypeError('not a function');                                                                          // 59
  }                                                                                                                 // 60
  this._45 = 0;                                                                                                     // 61
  this._81 = 0;                                                                                                     // 62
  this._65 = null;                                                                                                  // 63
  this._54 = null;                                                                                                  // 64
  if (fn === noop) return;                                                                                          // 65
  doResolve(fn, this);                                                                                              // 66
}                                                                                                                   // 67
Promise._10 = null;                                                                                                 // 68
Promise._97 = null;                                                                                                 // 69
Promise._61 = noop;                                                                                                 // 70
                                                                                                                    // 71
Promise.prototype.then = function(onFulfilled, onRejected) {                                                        // 72
  if (this.constructor !== Promise) {                                                                               // 73
    return safeThen(this, onFulfilled, onRejected);                                                                 // 74
  }                                                                                                                 // 75
  var res = new Promise(noop);                                                                                      // 76
  handle(this, new Handler(onFulfilled, onRejected, res));                                                          // 77
  return res;                                                                                                       // 78
};                                                                                                                  // 79
                                                                                                                    // 80
function safeThen(self, onFulfilled, onRejected) {                                                                  // 81
  return new self.constructor(function (resolve, reject) {                                                          // 82
    var res = new Promise(noop);                                                                                    // 83
    res.then(resolve, reject);                                                                                      // 84
    handle(self, new Handler(onFulfilled, onRejected, res));                                                        // 85
  });                                                                                                               // 86
};                                                                                                                  // 87
function handle(self, deferred) {                                                                                   // 88
  while (self._81 === 3) {                                                                                          // 89
    self = self._65;                                                                                                // 90
  }                                                                                                                 // 91
  if (Promise._10) {                                                                                                // 92
    Promise._10(self);                                                                                              // 93
  }                                                                                                                 // 94
  if (self._81 === 0) {                                                                                             // 95
    if (self._45 === 0) {                                                                                           // 96
      self._45 = 1;                                                                                                 // 97
      self._54 = deferred;                                                                                          // 98
      return;                                                                                                       // 99
    }                                                                                                               // 100
    if (self._45 === 1) {                                                                                           // 101
      self._45 = 2;                                                                                                 // 102
      self._54 = [self._54, deferred];                                                                              // 103
      return;                                                                                                       // 104
    }                                                                                                               // 105
    self._54.push(deferred);                                                                                        // 106
    return;                                                                                                         // 107
  }                                                                                                                 // 108
  handleResolved(self, deferred);                                                                                   // 109
}                                                                                                                   // 110
                                                                                                                    // 111
function handleResolved(self, deferred) {                                                                           // 112
  asap(function() {                                                                                                 // 113
    var cb = self._81 === 1 ? deferred.onFulfilled : deferred.onRejected;                                           // 114
    if (cb === null) {                                                                                              // 115
      if (self._81 === 1) {                                                                                         // 116
        resolve(deferred.promise, self._65);                                                                        // 117
      } else {                                                                                                      // 118
        reject(deferred.promise, self._65);                                                                         // 119
      }                                                                                                             // 120
      return;                                                                                                       // 121
    }                                                                                                               // 122
    var ret = tryCallOne(cb, self._65);                                                                             // 123
    if (ret === IS_ERROR) {                                                                                         // 124
      reject(deferred.promise, LAST_ERROR);                                                                         // 125
    } else {                                                                                                        // 126
      resolve(deferred.promise, ret);                                                                               // 127
    }                                                                                                               // 128
  });                                                                                                               // 129
}                                                                                                                   // 130
function resolve(self, newValue) {                                                                                  // 131
  // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
  if (newValue === self) {                                                                                          // 133
    return reject(                                                                                                  // 134
      self,                                                                                                         // 135
      new TypeError('A promise cannot be resolved with itself.')                                                    // 136
    );                                                                                                              // 137
  }                                                                                                                 // 138
  if (                                                                                                              // 139
    newValue &&                                                                                                     // 140
    (typeof newValue === 'object' || typeof newValue === 'function')                                                // 141
  ) {                                                                                                               // 142
    var then = getThen(newValue);                                                                                   // 143
    if (then === IS_ERROR) {                                                                                        // 144
      return reject(self, LAST_ERROR);                                                                              // 145
    }                                                                                                               // 146
    if (                                                                                                            // 147
      then === self.then &&                                                                                         // 148
      newValue instanceof Promise                                                                                   // 149
    ) {                                                                                                             // 150
      self._81 = 3;                                                                                                 // 151
      self._65 = newValue;                                                                                          // 152
      finale(self);                                                                                                 // 153
      return;                                                                                                       // 154
    } else if (typeof then === 'function') {                                                                        // 155
      doResolve(then.bind(newValue), self);                                                                         // 156
      return;                                                                                                       // 157
    }                                                                                                               // 158
  }                                                                                                                 // 159
  self._81 = 1;                                                                                                     // 160
  self._65 = newValue;                                                                                              // 161
  finale(self);                                                                                                     // 162
}                                                                                                                   // 163
                                                                                                                    // 164
function reject(self, newValue) {                                                                                   // 165
  self._81 = 2;                                                                                                     // 166
  self._65 = newValue;                                                                                              // 167
  if (Promise._97) {                                                                                                // 168
    Promise._97(self, newValue);                                                                                    // 169
  }                                                                                                                 // 170
  finale(self);                                                                                                     // 171
}                                                                                                                   // 172
function finale(self) {                                                                                             // 173
  if (self._45 === 1) {                                                                                             // 174
    handle(self, self._54);                                                                                         // 175
    self._54 = null;                                                                                                // 176
  }                                                                                                                 // 177
  if (self._45 === 2) {                                                                                             // 178
    for (var i = 0; i < self._54.length; i++) {                                                                     // 179
      handle(self, self._54[i]);                                                                                    // 180
    }                                                                                                               // 181
    self._54 = null;                                                                                                // 182
  }                                                                                                                 // 183
}                                                                                                                   // 184
                                                                                                                    // 185
function Handler(onFulfilled, onRejected, promise){                                                                 // 186
  this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;                                        // 187
  this.onRejected = typeof onRejected === 'function' ? onRejected : null;                                           // 188
  this.promise = promise;                                                                                           // 189
}                                                                                                                   // 190
                                                                                                                    // 191
/**                                                                                                                 // 192
 * Take a potentially misbehaving resolver function and make sure                                                   // 193
 * onFulfilled and onRejected are only called once.                                                                 // 194
 *                                                                                                                  // 195
 * Makes no guarantees about asynchrony.                                                                            // 196
 */                                                                                                                 // 197
function doResolve(fn, promise) {                                                                                   // 198
  var done = false;                                                                                                 // 199
  var res = tryCallTwo(fn, function (value) {                                                                       // 200
    if (done) return;                                                                                               // 201
    done = true;                                                                                                    // 202
    resolve(promise, value);                                                                                        // 203
  }, function (reason) {                                                                                            // 204
    if (done) return;                                                                                               // 205
    done = true;                                                                                                    // 206
    reject(promise, reason);                                                                                        // 207
  })                                                                                                                // 208
  if (!done && res === IS_ERROR) {                                                                                  // 209
    done = true;                                                                                                    // 210
    reject(promise, LAST_ERROR);                                                                                    // 211
  }                                                                                                                 // 212
}                                                                                                                   // 213
                                                                                                                    // 214
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}],"done.js":["./core.js",function(require,exports,module){

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                  //
// node_modules/meteor/promise/node_modules/meteor-promise/node_modules/promise/lib/done.js                         //
//                                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                    //
'use strict';                                                                                                       // 1
                                                                                                                    // 2
var Promise = require('./core.js');                                                                                 // 3
                                                                                                                    // 4
module.exports = Promise;                                                                                           // 5
Promise.prototype.done = function (onFulfilled, onRejected) {                                                       // 6
  var self = arguments.length ? this.then.apply(this, arguments) : this;                                            // 7
  self.then(null, function (err) {                                                                                  // 8
    setTimeout(function () {                                                                                        // 9
      throw err;                                                                                                    // 10
    }, 0);                                                                                                          // 11
  });                                                                                                               // 12
};                                                                                                                  // 13
                                                                                                                    // 14
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}],"finally.js":["./core.js",function(require,exports,module){

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                  //
// node_modules/meteor/promise/node_modules/meteor-promise/node_modules/promise/lib/finally.js                      //
//                                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                    //
'use strict';                                                                                                       // 1
                                                                                                                    // 2
var Promise = require('./core.js');                                                                                 // 3
                                                                                                                    // 4
module.exports = Promise;                                                                                           // 5
Promise.prototype['finally'] = function (f) {                                                                       // 6
  return this.then(function (value) {                                                                               // 7
    return Promise.resolve(f()).then(function () {                                                                  // 8
      return value;                                                                                                 // 9
    });                                                                                                             // 10
  }, function (err) {                                                                                               // 11
    return Promise.resolve(f()).then(function () {                                                                  // 12
      throw err;                                                                                                    // 13
    });                                                                                                             // 14
  });                                                                                                               // 15
};                                                                                                                  // 16
                                                                                                                    // 17
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}],"es6-extensions.js":["./core.js",function(require,exports,module){

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                  //
// node_modules/meteor/promise/node_modules/meteor-promise/node_modules/promise/lib/es6-extensions.js               //
//                                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                    //
'use strict';                                                                                                       // 1
                                                                                                                    // 2
//This file contains the ES6 extensions to the core Promises/A+ API                                                 // 3
                                                                                                                    // 4
var Promise = require('./core.js');                                                                                 // 5
                                                                                                                    // 6
module.exports = Promise;                                                                                           // 7
                                                                                                                    // 8
/* Static Functions */                                                                                              // 9
                                                                                                                    // 10
var TRUE = valuePromise(true);                                                                                      // 11
var FALSE = valuePromise(false);                                                                                    // 12
var NULL = valuePromise(null);                                                                                      // 13
var UNDEFINED = valuePromise(undefined);                                                                            // 14
var ZERO = valuePromise(0);                                                                                         // 15
var EMPTYSTRING = valuePromise('');                                                                                 // 16
                                                                                                                    // 17
function valuePromise(value) {                                                                                      // 18
  var p = new Promise(Promise._61);                                                                                 // 19
  p._81 = 1;                                                                                                        // 20
  p._65 = value;                                                                                                    // 21
  return p;                                                                                                         // 22
}                                                                                                                   // 23
Promise.resolve = function (value) {                                                                                // 24
  if (value instanceof Promise) return value;                                                                       // 25
                                                                                                                    // 26
  if (value === null) return NULL;                                                                                  // 27
  if (value === undefined) return UNDEFINED;                                                                        // 28
  if (value === true) return TRUE;                                                                                  // 29
  if (value === false) return FALSE;                                                                                // 30
  if (value === 0) return ZERO;                                                                                     // 31
  if (value === '') return EMPTYSTRING;                                                                             // 32
                                                                                                                    // 33
  if (typeof value === 'object' || typeof value === 'function') {                                                   // 34
    try {                                                                                                           // 35
      var then = value.then;                                                                                        // 36
      if (typeof then === 'function') {                                                                             // 37
        return new Promise(then.bind(value));                                                                       // 38
      }                                                                                                             // 39
    } catch (ex) {                                                                                                  // 40
      return new Promise(function (resolve, reject) {                                                               // 41
        reject(ex);                                                                                                 // 42
      });                                                                                                           // 43
    }                                                                                                               // 44
  }                                                                                                                 // 45
  return valuePromise(value);                                                                                       // 46
};                                                                                                                  // 47
                                                                                                                    // 48
Promise.all = function (arr) {                                                                                      // 49
  var args = Array.prototype.slice.call(arr);                                                                       // 50
                                                                                                                    // 51
  return new Promise(function (resolve, reject) {                                                                   // 52
    if (args.length === 0) return resolve([]);                                                                      // 53
    var remaining = args.length;                                                                                    // 54
    function res(i, val) {                                                                                          // 55
      if (val && (typeof val === 'object' || typeof val === 'function')) {                                          // 56
        if (val instanceof Promise && val.then === Promise.prototype.then) {                                        // 57
          while (val._81 === 3) {                                                                                   // 58
            val = val._65;                                                                                          // 59
          }                                                                                                         // 60
          if (val._81 === 1) return res(i, val._65);                                                                // 61
          if (val._81 === 2) reject(val._65);                                                                       // 62
          val.then(function (val) {                                                                                 // 63
            res(i, val);                                                                                            // 64
          }, reject);                                                                                               // 65
          return;                                                                                                   // 66
        } else {                                                                                                    // 67
          var then = val.then;                                                                                      // 68
          if (typeof then === 'function') {                                                                         // 69
            var p = new Promise(then.bind(val));                                                                    // 70
            p.then(function (val) {                                                                                 // 71
              res(i, val);                                                                                          // 72
            }, reject);                                                                                             // 73
            return;                                                                                                 // 74
          }                                                                                                         // 75
        }                                                                                                           // 76
      }                                                                                                             // 77
      args[i] = val;                                                                                                // 78
      if (--remaining === 0) {                                                                                      // 79
        resolve(args);                                                                                              // 80
      }                                                                                                             // 81
    }                                                                                                               // 82
    for (var i = 0; i < args.length; i++) {                                                                         // 83
      res(i, args[i]);                                                                                              // 84
    }                                                                                                               // 85
  });                                                                                                               // 86
};                                                                                                                  // 87
                                                                                                                    // 88
Promise.reject = function (value) {                                                                                 // 89
  return new Promise(function (resolve, reject) {                                                                   // 90
    reject(value);                                                                                                  // 91
  });                                                                                                               // 92
};                                                                                                                  // 93
                                                                                                                    // 94
Promise.race = function (values) {                                                                                  // 95
  return new Promise(function (resolve, reject) {                                                                   // 96
    values.forEach(function(value){                                                                                 // 97
      Promise.resolve(value).then(resolve, reject);                                                                 // 98
    });                                                                                                             // 99
  });                                                                                                               // 100
};                                                                                                                  // 101
                                                                                                                    // 102
/* Prototype Methods */                                                                                             // 103
                                                                                                                    // 104
Promise.prototype['catch'] = function (onRejected) {                                                                // 105
  return this.then(null, onRejected);                                                                               // 106
};                                                                                                                  // 107
                                                                                                                    // 108
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}],"node-extensions.js":["./core.js","asap",function(require,exports,module){

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                  //
// node_modules/meteor/promise/node_modules/meteor-promise/node_modules/promise/lib/node-extensions.js              //
//                                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                    //
'use strict';                                                                                                       // 1
                                                                                                                    // 2
// This file contains then/promise specific extensions that are only useful                                         // 3
// for node.js interop                                                                                              // 4
                                                                                                                    // 5
var Promise = require('./core.js');                                                                                 // 6
var asap = require('asap');                                                                                         // 7
                                                                                                                    // 8
module.exports = Promise;                                                                                           // 9
                                                                                                                    // 10
/* Static Functions */                                                                                              // 11
                                                                                                                    // 12
Promise.denodeify = function (fn, argumentCount) {                                                                  // 13
  if (                                                                                                              // 14
    typeof argumentCount === 'number' && argumentCount !== Infinity                                                 // 15
  ) {                                                                                                               // 16
    return denodeifyWithCount(fn, argumentCount);                                                                   // 17
  } else {                                                                                                          // 18
    return denodeifyWithoutCount(fn);                                                                               // 19
  }                                                                                                                 // 20
}                                                                                                                   // 21
                                                                                                                    // 22
var callbackFn = (                                                                                                  // 23
  'function (err, res) {' +                                                                                         // 24
  'if (err) { rj(err); } else { rs(res); }' +                                                                       // 25
  '}'                                                                                                               // 26
);                                                                                                                  // 27
function denodeifyWithCount(fn, argumentCount) {                                                                    // 28
  var args = [];                                                                                                    // 29
  for (var i = 0; i < argumentCount; i++) {                                                                         // 30
    args.push('a' + i);                                                                                             // 31
  }                                                                                                                 // 32
  var body = [                                                                                                      // 33
    'return function (' + args.join(',') + ') {',                                                                   // 34
    'var self = this;',                                                                                             // 35
    'return new Promise(function (rs, rj) {',                                                                       // 36
    'var res = fn.call(',                                                                                           // 37
    ['self'].concat(args).concat([callbackFn]).join(','),                                                           // 38
    ');',                                                                                                           // 39
    'if (res &&',                                                                                                   // 40
    '(typeof res === "object" || typeof res === "function") &&',                                                    // 41
    'typeof res.then === "function"',                                                                               // 42
    ') {rs(res);}',                                                                                                 // 43
    '});',                                                                                                          // 44
    '};'                                                                                                            // 45
  ].join('');                                                                                                       // 46
  return Function(['Promise', 'fn'], body)(Promise, fn);                                                            // 47
}                                                                                                                   // 48
function denodeifyWithoutCount(fn) {                                                                                // 49
  var fnLength = Math.max(fn.length - 1, 3);                                                                        // 50
  var args = [];                                                                                                    // 51
  for (var i = 0; i < fnLength; i++) {                                                                              // 52
    args.push('a' + i);                                                                                             // 53
  }                                                                                                                 // 54
  var body = [                                                                                                      // 55
    'return function (' + args.join(',') + ') {',                                                                   // 56
    'var self = this;',                                                                                             // 57
    'var args;',                                                                                                    // 58
    'var argLength = arguments.length;',                                                                            // 59
    'if (arguments.length > ' + fnLength + ') {',                                                                   // 60
    'args = new Array(arguments.length + 1);',                                                                      // 61
    'for (var i = 0; i < arguments.length; i++) {',                                                                 // 62
    'args[i] = arguments[i];',                                                                                      // 63
    '}',                                                                                                            // 64
    '}',                                                                                                            // 65
    'return new Promise(function (rs, rj) {',                                                                       // 66
    'var cb = ' + callbackFn + ';',                                                                                 // 67
    'var res;',                                                                                                     // 68
    'switch (argLength) {',                                                                                         // 69
    args.concat(['extra']).map(function (_, index) {                                                                // 70
      return (                                                                                                      // 71
        'case ' + (index) + ':' +                                                                                   // 72
        'res = fn.call(' + ['self'].concat(args.slice(0, index)).concat('cb').join(',') + ');' +                    // 73
        'break;'                                                                                                    // 74
      );                                                                                                            // 75
    }).join(''),                                                                                                    // 76
    'default:',                                                                                                     // 77
    'args[argLength] = cb;',                                                                                        // 78
    'res = fn.apply(self, args);',                                                                                  // 79
    '}',                                                                                                            // 80
                                                                                                                    // 81
    'if (res &&',                                                                                                   // 82
    '(typeof res === "object" || typeof res === "function") &&',                                                    // 83
    'typeof res.then === "function"',                                                                               // 84
    ') {rs(res);}',                                                                                                 // 85
    '});',                                                                                                          // 86
    '};'                                                                                                            // 87
  ].join('');                                                                                                       // 88
                                                                                                                    // 89
  return Function(                                                                                                  // 90
    ['Promise', 'fn'],                                                                                              // 91
    body                                                                                                            // 92
  )(Promise, fn);                                                                                                   // 93
}                                                                                                                   // 94
                                                                                                                    // 95
Promise.nodeify = function (fn) {                                                                                   // 96
  return function () {                                                                                              // 97
    var args = Array.prototype.slice.call(arguments);                                                               // 98
    var callback =                                                                                                  // 99
      typeof args[args.length - 1] === 'function' ? args.pop() : null;                                              // 100
    var ctx = this;                                                                                                 // 101
    try {                                                                                                           // 102
      return fn.apply(this, arguments).nodeify(callback, ctx);                                                      // 103
    } catch (ex) {                                                                                                  // 104
      if (callback === null || typeof callback == 'undefined') {                                                    // 105
        return new Promise(function (resolve, reject) {                                                             // 106
          reject(ex);                                                                                               // 107
        });                                                                                                         // 108
      } else {                                                                                                      // 109
        asap(function () {                                                                                          // 110
          callback.call(ctx, ex);                                                                                   // 111
        })                                                                                                          // 112
      }                                                                                                             // 113
    }                                                                                                               // 114
  }                                                                                                                 // 115
}                                                                                                                   // 116
                                                                                                                    // 117
Promise.prototype.nodeify = function (callback, ctx) {                                                              // 118
  if (typeof callback != 'function') return this;                                                                   // 119
                                                                                                                    // 120
  this.then(function (value) {                                                                                      // 121
    asap(function () {                                                                                              // 122
      callback.call(ctx, null, value);                                                                              // 123
    });                                                                                                             // 124
  }, function (err) {                                                                                               // 125
    asap(function () {                                                                                              // 126
      callback.call(ctx, err);                                                                                      // 127
    });                                                                                                             // 128
  });                                                                                                               // 129
}                                                                                                                   // 130
                                                                                                                    // 131
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}],"synchronous.js":["./core.js",function(require,exports,module){

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                  //
// node_modules/meteor/promise/node_modules/meteor-promise/node_modules/promise/lib/synchronous.js                  //
//                                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                    //
'use strict';                                                                                                       // 1
                                                                                                                    // 2
var Promise = require('./core.js');                                                                                 // 3
                                                                                                                    // 4
module.exports = Promise;                                                                                           // 5
Promise.enableSynchronous = function () {                                                                           // 6
  Promise.prototype.isPending = function() {                                                                        // 7
    return this.getState() == 0;                                                                                    // 8
  };                                                                                                                // 9
                                                                                                                    // 10
  Promise.prototype.isFulfilled = function() {                                                                      // 11
    return this.getState() == 1;                                                                                    // 12
  };                                                                                                                // 13
                                                                                                                    // 14
  Promise.prototype.isRejected = function() {                                                                       // 15
    return this.getState() == 2;                                                                                    // 16
  };                                                                                                                // 17
                                                                                                                    // 18
  Promise.prototype.getValue = function () {                                                                        // 19
    if (this._81 === 3) {                                                                                           // 20
      return this._65.getValue();                                                                                   // 21
    }                                                                                                               // 22
                                                                                                                    // 23
    if (!this.isFulfilled()) {                                                                                      // 24
      throw new Error('Cannot get a value of an unfulfilled promise.');                                             // 25
    }                                                                                                               // 26
                                                                                                                    // 27
    return this._65;                                                                                                // 28
  };                                                                                                                // 29
                                                                                                                    // 30
  Promise.prototype.getReason = function () {                                                                       // 31
    if (this._81 === 3) {                                                                                           // 32
      return this._65.getReason();                                                                                  // 33
    }                                                                                                               // 34
                                                                                                                    // 35
    if (!this.isRejected()) {                                                                                       // 36
      throw new Error('Cannot get a rejection reason of a non-rejected promise.');                                  // 37
    }                                                                                                               // 38
                                                                                                                    // 39
    return this._65;                                                                                                // 40
  };                                                                                                                // 41
                                                                                                                    // 42
  Promise.prototype.getState = function () {                                                                        // 43
    if (this._81 === 3) {                                                                                           // 44
      return this._65.getState();                                                                                   // 45
    }                                                                                                               // 46
    if (this._81 === -1 || this._81 === -2) {                                                                       // 47
      return 0;                                                                                                     // 48
    }                                                                                                               // 49
                                                                                                                    // 50
    return this._81;                                                                                                // 51
  };                                                                                                                // 52
};                                                                                                                  // 53
                                                                                                                    // 54
Promise.disableSynchronous = function() {                                                                           // 55
  Promise.prototype.isPending = undefined;                                                                          // 56
  Promise.prototype.isFulfilled = undefined;                                                                        // 57
  Promise.prototype.isRejected = undefined;                                                                         // 58
  Promise.prototype.getValue = undefined;                                                                           // 59
  Promise.prototype.getReason = undefined;                                                                          // 60
  Promise.prototype.getState = undefined;                                                                           // 61
};                                                                                                                  // 62
                                                                                                                    // 63
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}]},"node_modules":{"asap":{"raw.js":["domain",function(require,exports,module){

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                  //
// node_modules/meteor/promise/node_modules/meteor-promise/node_modules/promise/node_modules/asap/raw.js            //
//                                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                    //
"use strict";                                                                                                       // 1
                                                                                                                    // 2
var domain; // The domain module is executed on demand                                                              // 3
var hasSetImmediate = typeof setImmediate === "function";                                                           // 4
                                                                                                                    // 5
// Use the fastest means possible to execute a task in its own turn, with                                           // 6
// priority over other events including network IO events in Node.js.                                               // 7
//                                                                                                                  // 8
// An exception thrown by a task will permanently interrupt the processing of                                       // 9
// subsequent tasks. The higher level `asap` function ensures that if an                                            // 10
// exception is thrown by a task, that the task queue will continue flushing as                                     // 11
// soon as possible, but if you use `rawAsap` directly, you are responsible to                                      // 12
// either ensure that no exceptions are thrown from your task, or to manually                                       // 13
// call `rawAsap.requestFlush` if an exception is thrown.                                                           // 14
module.exports = rawAsap;                                                                                           // 15
function rawAsap(task) {                                                                                            // 16
    if (!queue.length) {                                                                                            // 17
        requestFlush();                                                                                             // 18
        flushing = true;                                                                                            // 19
    }                                                                                                               // 20
    // Avoids a function call                                                                                       // 21
    queue[queue.length] = task;                                                                                     // 22
}                                                                                                                   // 23
                                                                                                                    // 24
var queue = [];                                                                                                     // 25
// Once a flush has been requested, no further calls to `requestFlush` are                                          // 26
// necessary until the next `flush` completes.                                                                      // 27
var flushing = false;                                                                                               // 28
// The position of the next task to execute in the task queue. This is                                              // 29
// preserved between calls to `flush` so that it can be resumed if                                                  // 30
// a task throws an exception.                                                                                      // 31
var index = 0;                                                                                                      // 32
// If a task schedules additional tasks recursively, the task queue can grow                                        // 33
// unbounded. To prevent memory excaustion, the task queue will periodically                                        // 34
// truncate already-completed tasks.                                                                                // 35
var capacity = 1024;                                                                                                // 36
                                                                                                                    // 37
// The flush function processes all tasks that have been scheduled with                                             // 38
// `rawAsap` unless and until one of those tasks throws an exception.                                               // 39
// If a task throws an exception, `flush` ensures that its state will remain                                        // 40
// consistent and will resume where it left off when called again.                                                  // 41
// However, `flush` does not make any arrangements to be called again if an                                         // 42
// exception is thrown.                                                                                             // 43
function flush() {                                                                                                  // 44
    while (index < queue.length) {                                                                                  // 45
        var currentIndex = index;                                                                                   // 46
        // Advance the index before calling the task. This ensures that we will                                     // 47
        // begin flushing on the next task the task throws an error.                                                // 48
        index = index + 1;                                                                                          // 49
        queue[currentIndex].call();                                                                                 // 50
        // Prevent leaking memory for long chains of recursive calls to `asap`.                                     // 51
        // If we call `asap` within tasks scheduled by `asap`, the queue will                                       // 52
        // grow, but to avoid an O(n) walk for every task we execute, we don't                                      // 53
        // shift tasks off the queue after they have been executed.                                                 // 54
        // Instead, we periodically shift 1024 tasks off the queue.                                                 // 55
        if (index > capacity) {                                                                                     // 56
            // Manually shift all values starting at the index back to the                                          // 57
            // beginning of the queue.                                                                              // 58
            for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {                        // 59
                queue[scan] = queue[scan + index];                                                                  // 60
            }                                                                                                       // 61
            queue.length -= index;                                                                                  // 62
            index = 0;                                                                                              // 63
        }                                                                                                           // 64
    }                                                                                                               // 65
    queue.length = 0;                                                                                               // 66
    index = 0;                                                                                                      // 67
    flushing = false;                                                                                               // 68
}                                                                                                                   // 69
                                                                                                                    // 70
rawAsap.requestFlush = requestFlush;                                                                                // 71
function requestFlush() {                                                                                           // 72
    // Ensure flushing is not bound to any domain.                                                                  // 73
    // It is not sufficient to exit the domain, because domains exist on a stack.                                   // 74
    // To execute code outside of any domain, the following dance is necessary.                                     // 75
    var parentDomain = process.domain;                                                                              // 76
    if (parentDomain) {                                                                                             // 77
        if (!domain) {                                                                                              // 78
            // Lazy execute the domain module.                                                                      // 79
            // Only employed if the user elects to use domains.                                                     // 80
            domain = require("domain");                                                                             // 81
        }                                                                                                           // 82
        domain.active = process.domain = null;                                                                      // 83
    }                                                                                                               // 84
                                                                                                                    // 85
    // `setImmediate` is slower that `process.nextTick`, but `process.nextTick`                                     // 86
    // cannot handle recursion.                                                                                     // 87
    // `requestFlush` will only be called recursively from `asap.js`, to resume                                     // 88
    // flushing after an error is thrown into a domain.                                                             // 89
    // Conveniently, `setImmediate` was introduced in the same version                                              // 90
    // `process.nextTick` started throwing recursion errors.                                                        // 91
    if (flushing && hasSetImmediate) {                                                                              // 92
        setImmediate(flush);                                                                                        // 93
    } else {                                                                                                        // 94
        process.nextTick(flush);                                                                                    // 95
    }                                                                                                               // 96
                                                                                                                    // 97
    if (parentDomain) {                                                                                             // 98
        domain.active = process.domain = parentDomain;                                                              // 99
    }                                                                                                               // 100
}                                                                                                                   // 101
                                                                                                                    // 102
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}],"package.json":function(require,exports){

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                  //
// ../npm/node_modules/meteor-promise/node_modules/promise/node_modules/asap/package.json                           //
//                                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                    //
exports.name = "asap";                                                                                              // 1
exports.version = "2.0.3";                                                                                          // 2
exports.main = "./asap.js";                                                                                         // 3
                                                                                                                    // 4
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

},"asap.js":["./raw",function(require,exports,module){

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                  //
// node_modules/meteor/promise/node_modules/meteor-promise/node_modules/promise/node_modules/asap/asap.js           //
//                                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                    //
"use strict";                                                                                                       // 1
                                                                                                                    // 2
var rawAsap = require("./raw");                                                                                     // 3
var freeTasks = [];                                                                                                 // 4
                                                                                                                    // 5
/**                                                                                                                 // 6
 * Calls a task as soon as possible after returning, in its own event, with                                         // 7
 * priority over IO events. An exception thrown in a task can be handled by                                         // 8
 * `process.on("uncaughtException") or `domain.on("error")`, but will otherwise                                     // 9
 * crash the process. If the error is handled, all subsequent tasks will                                            // 10
 * resume.                                                                                                          // 11
 *                                                                                                                  // 12
 * @param {{call}} task A callable object, typically a function that takes no                                       // 13
 * arguments.                                                                                                       // 14
 */                                                                                                                 // 15
module.exports = asap;                                                                                              // 16
function asap(task) {                                                                                               // 17
    var rawTask;                                                                                                    // 18
    if (freeTasks.length) {                                                                                         // 19
        rawTask = freeTasks.pop();                                                                                  // 20
    } else {                                                                                                        // 21
        rawTask = new RawTask();                                                                                    // 22
    }                                                                                                               // 23
    rawTask.task = task;                                                                                            // 24
    rawTask.domain = process.domain;                                                                                // 25
    rawAsap(rawTask);                                                                                               // 26
}                                                                                                                   // 27
                                                                                                                    // 28
function RawTask() {                                                                                                // 29
    this.task = null;                                                                                               // 30
    this.domain = null;                                                                                             // 31
}                                                                                                                   // 32
                                                                                                                    // 33
RawTask.prototype.call = function () {                                                                              // 34
    if (this.domain) {                                                                                              // 35
        this.domain.enter();                                                                                        // 36
    }                                                                                                               // 37
    var threw = true;                                                                                               // 38
    try {                                                                                                           // 39
        this.task.call();                                                                                           // 40
        threw = false;                                                                                              // 41
        // If the task throws an exception (presumably) Node.js restores the                                        // 42
        // domain stack for the next event.                                                                         // 43
        if (this.domain) {                                                                                          // 44
            this.domain.exit();                                                                                     // 45
        }                                                                                                           // 46
    } finally {                                                                                                     // 47
        // We use try/finally and a threw flag to avoid messing up stack traces                                     // 48
        // when we catch and release errors.                                                                        // 49
        if (threw) {                                                                                                // 50
            // In Node.js, uncaught exceptions are considered fatal errors.                                         // 51
            // Re-throw them to interrupt flushing!                                                                 // 52
            // Ensure that flushing continues if an uncaught exception is                                           // 53
            // suppressed listening process.on("uncaughtException") or                                              // 54
            // domain.on("error").                                                                                  // 55
            rawAsap.requestFlush();                                                                                 // 56
        }                                                                                                           // 57
        // If the task threw an error, we do not want to exit the domain here.                                      // 58
        // Exiting the domain would prevent the domain from catching the error.                                     // 59
        this.task = null;                                                                                           // 60
        this.domain = null;                                                                                         // 61
        freeTasks.push(this);                                                                                       // 62
    }                                                                                                               // 63
};                                                                                                                  // 64
                                                                                                                    // 65
                                                                                                                    // 66
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}]}}}}}}}}}},{"extensions":[".js",".json"]});
var exports = require("./node_modules/meteor/promise/client.js");

/* Exports */
if (typeof Package === 'undefined') Package = {};
(function (pkg, symbols) {
  for (var s in symbols)
    (s in pkg) || (pkg[s] = symbols[s]);
})(Package.promise = exports, {
  Promise: Promise
});

})();
//////////////////////////////////////////////////////////////////////////
//                                                                      //
// This is a generated file. You can view the original                  //
// source in your browser if your browser supports source maps.         //
// Source maps are supported by all recent versions of Chrome, Safari,  //
// and Firefox, and by Internet Explorer 11.                            //
//                                                                      //
//////////////////////////////////////////////////////////////////////////


(function () {

/* Imports */
var Meteor = Package.meteor.Meteor;
var global = Package.meteor.global;
var meteorEnv = Package.meteor.meteorEnv;
var _ = Package.underscore._;
var Tracker = Package.tracker.Tracker;
var Deps = Package.tracker.Deps;
var EJSON = Package.ejson.EJSON;
var meteorInstall = Package.modules.meteorInstall;
var Buffer = Package.modules.Buffer;
var process = Package.modules.process;
var Symbol = Package['ecmascript-runtime'].Symbol;
var Map = Package['ecmascript-runtime'].Map;
var Set = Package['ecmascript-runtime'].Set;
var meteorBabelHelpers = Package['babel-runtime'].meteorBabelHelpers;
var Promise = Package.promise.Promise;

/* Package-scope variables */
var ReactiveDict;

var require = meteorInstall({"node_modules":{"meteor":{"reactive-dict":{"reactive-dict.js":["babel-runtime/helpers/typeof",function(require){

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                  //
// packages/reactive-dict/reactive-dict.js                                                                          //
//                                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                    //
var _typeof2 = require('babel-runtime/helpers/typeof');                                                             //
                                                                                                                    //
var _typeof3 = _interopRequireDefault(_typeof2);                                                                    //
                                                                                                                    //
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }                   //
                                                                                                                    //
// XXX come up with a serialization method which canonicalizes object key                                           //
// order, which would allow us to use objects as values for equals.                                                 //
var stringify = function stringify(value) {                                                                         // 3
  if (value === undefined) return 'undefined';                                                                      // 4
  return EJSON.stringify(value);                                                                                    // 6
};                                                                                                                  //
var parse = function parse(serialized) {                                                                            // 8
  if (serialized === undefined || serialized === 'undefined') return undefined;                                     // 9
  return EJSON.parse(serialized);                                                                                   // 11
};                                                                                                                  //
                                                                                                                    //
var changed = function changed(v) {                                                                                 // 14
  v && v.changed();                                                                                                 // 15
};                                                                                                                  //
                                                                                                                    //
// XXX COMPAT WITH 0.9.1 : accept migrationData instead of dictName                                                 //
ReactiveDict = function (_ReactiveDict) {                                                                           // 19
  function ReactiveDict(_x) {                                                                                       //
    return _ReactiveDict.apply(this, arguments);                                                                    //
  }                                                                                                                 //
                                                                                                                    //
  ReactiveDict.toString = function () {                                                                             //
    return _ReactiveDict.toString();                                                                                //
  };                                                                                                                //
                                                                                                                    //
  return ReactiveDict;                                                                                              //
}(function (dictName) {                                                                                             //
  // this.keys: key -> value                                                                                        //
  if (dictName) {                                                                                                   // 21
    if (typeof dictName === 'string') {                                                                             // 22
      // the normal case, argument is a string name.                                                                //
      // _registerDictForMigrate will throw an error on duplicate name.                                             //
      ReactiveDict._registerDictForMigrate(dictName, this);                                                         // 25
      this.keys = ReactiveDict._loadMigratedDict(dictName) || {};                                                   // 26
      this.name = dictName;                                                                                         // 27
    } else if ((typeof dictName === 'undefined' ? 'undefined' : (0, _typeof3['default'])(dictName)) === 'object') {
      // back-compat case: dictName is actually migrationData                                                       //
      this.keys = dictName;                                                                                         // 30
    } else {                                                                                                        //
      throw new Error("Invalid ReactiveDict argument: " + dictName);                                                // 32
    }                                                                                                               //
  } else {                                                                                                          //
    // no name given; no migration will be performed                                                                //
    this.keys = {};                                                                                                 // 36
  }                                                                                                                 //
                                                                                                                    //
  this.allDeps = new Tracker.Dependency();                                                                          // 39
  this.keyDeps = {}; // key -> Dependency                                                                           // 40
  this.keyValueDeps = {}; // key -> Dependency                                                                      // 19
});                                                                                                                 // 19
                                                                                                                    //
_.extend(ReactiveDict.prototype, {                                                                                  // 44
  // set() began as a key/value method, but we are now overloading it                                               //
  // to take an object of key/value pairs, similar to backbone                                                      //
  // http://backbonejs.org/#Model-set                                                                               //
                                                                                                                    //
  set: function () {                                                                                                // 49
    function set(keyOrObject, value) {                                                                              // 49
      var self = this;                                                                                              // 50
                                                                                                                    //
      if ((typeof keyOrObject === 'undefined' ? 'undefined' : (0, _typeof3['default'])(keyOrObject)) === 'object' && value === undefined) {
        // Called as `dict.set({...})`                                                                              //
        self._setObject(keyOrObject);                                                                               // 54
        return;                                                                                                     // 55
      }                                                                                                             //
      // the input isn't an object, so it must be a key                                                             //
      // and we resume with the rest of the function                                                                //
      var key = keyOrObject;                                                                                        // 49
                                                                                                                    //
      value = stringify(value);                                                                                     // 61
                                                                                                                    //
      var keyExisted = _.has(self.keys, key);                                                                       // 63
      var oldSerializedValue = keyExisted ? self.keys[key] : 'undefined';                                           // 64
      var isNewValue = value !== oldSerializedValue;                                                                // 65
                                                                                                                    //
      self.keys[key] = value;                                                                                       // 67
                                                                                                                    //
      if (isNewValue || !keyExisted) {                                                                              // 69
        self.allDeps.changed();                                                                                     // 70
      }                                                                                                             //
                                                                                                                    //
      if (isNewValue) {                                                                                             // 73
        changed(self.keyDeps[key]);                                                                                 // 74
        if (self.keyValueDeps[key]) {                                                                               // 75
          changed(self.keyValueDeps[key][oldSerializedValue]);                                                      // 76
          changed(self.keyValueDeps[key][value]);                                                                   // 77
        }                                                                                                           //
      }                                                                                                             //
    }                                                                                                               //
                                                                                                                    //
    return set;                                                                                                     //
  }(),                                                                                                              //
                                                                                                                    //
  setDefault: function () {                                                                                         // 82
    function setDefault(key, value) {                                                                               // 82
      var self = this;                                                                                              // 83
      if (!_.has(self.keys, key)) {                                                                                 // 84
        self.set(key, value);                                                                                       // 85
      }                                                                                                             //
    }                                                                                                               //
                                                                                                                    //
    return setDefault;                                                                                              //
  }(),                                                                                                              //
                                                                                                                    //
  get: function () {                                                                                                // 89
    function get(key) {                                                                                             // 89
      var self = this;                                                                                              // 90
      self._ensureKey(key);                                                                                         // 91
      self.keyDeps[key].depend();                                                                                   // 92
      return parse(self.keys[key]);                                                                                 // 93
    }                                                                                                               //
                                                                                                                    //
    return get;                                                                                                     //
  }(),                                                                                                              //
                                                                                                                    //
  equals: function () {                                                                                             // 96
    function equals(key, value) {                                                                                   // 96
      var self = this;                                                                                              // 97
                                                                                                                    //
      // Mongo.ObjectID is in the 'mongo' package                                                                   //
      var ObjectID = null;                                                                                          // 96
      if (Package.mongo) {                                                                                          // 101
        ObjectID = Package.mongo.Mongo.ObjectID;                                                                    // 102
      }                                                                                                             //
                                                                                                                    //
      // We don't allow objects (or arrays that might include objects) for                                          //
      // .equals, because JSON.stringify doesn't canonicalize object key                                            //
      // order. (We can make equals have the right return value by parsing the                                      //
      // current value and using EJSON.equals, but we won't have a canonical                                        //
      // element of keyValueDeps[key] to store the dependency.) You can still use                                   //
      // "EJSON.equals(reactiveDict.get(key), value)".                                                              //
      //                                                                                                            //
      // XXX we could allow arrays as long as we recursively check that there                                       //
      // are no objects                                                                                             //
      if (typeof value !== 'string' && typeof value !== 'number' && typeof value !== 'boolean' && typeof value !== 'undefined' && !(value instanceof Date) && !(ObjectID && value instanceof ObjectID) && value !== null) {
        throw new Error("ReactiveDict.equals: value must be scalar");                                               // 121
      }                                                                                                             //
      var serializedValue = stringify(value);                                                                       // 123
                                                                                                                    //
      if (Tracker.active) {                                                                                         // 125
        self._ensureKey(key);                                                                                       // 126
                                                                                                                    //
        if (!_.has(self.keyValueDeps[key], serializedValue)) self.keyValueDeps[key][serializedValue] = new Tracker.Dependency();
                                                                                                                    //
        var isNew = self.keyValueDeps[key][serializedValue].depend();                                               // 131
        if (isNew) {                                                                                                // 132
          Tracker.onInvalidate(function () {                                                                        // 133
            // clean up [key][serializedValue] if it's now empty, so we don't                                       //
            // use O(n) memory for n = values seen ever                                                             //
            if (!self.keyValueDeps[key][serializedValue].hasDependents()) delete self.keyValueDeps[key][serializedValue];
          });                                                                                                       //
        }                                                                                                           //
      }                                                                                                             //
                                                                                                                    //
      var oldValue = undefined;                                                                                     // 142
      if (_.has(self.keys, key)) oldValue = parse(self.keys[key]);                                                  // 143
      return EJSON.equals(oldValue, value);                                                                         // 144
    }                                                                                                               //
                                                                                                                    //
    return equals;                                                                                                  //
  }(),                                                                                                              //
                                                                                                                    //
  all: function () {                                                                                                // 147
    function all() {                                                                                                // 147
      this.allDeps.depend();                                                                                        // 148
      var ret = {};                                                                                                 // 149
      _.each(this.keys, function (value, key) {                                                                     // 150
        ret[key] = parse(value);                                                                                    // 151
      });                                                                                                           //
      return ret;                                                                                                   // 153
    }                                                                                                               //
                                                                                                                    //
    return all;                                                                                                     //
  }(),                                                                                                              //
                                                                                                                    //
  clear: function () {                                                                                              // 156
    function clear() {                                                                                              // 156
      var self = this;                                                                                              // 157
                                                                                                                    //
      var oldKeys = self.keys;                                                                                      // 159
      self.keys = {};                                                                                               // 160
                                                                                                                    //
      self.allDeps.changed();                                                                                       // 162
                                                                                                                    //
      _.each(oldKeys, function (value, key) {                                                                       // 164
        changed(self.keyDeps[key]);                                                                                 // 165
        if (self.keyValueDeps[key]) {                                                                               // 166
          changed(self.keyValueDeps[key][value]);                                                                   // 167
          changed(self.keyValueDeps[key]['undefined']);                                                             // 168
        }                                                                                                           //
      });                                                                                                           //
    }                                                                                                               //
                                                                                                                    //
    return clear;                                                                                                   //
  }(),                                                                                                              //
                                                                                                                    //
  'delete': function () {                                                                                           // 174
    function _delete(key) {                                                                                         // 174
      var self = this;                                                                                              // 175
      var didRemove = false;                                                                                        // 176
                                                                                                                    //
      if (_.has(self.keys, key)) {                                                                                  // 178
        var oldValue = self.keys[key];                                                                              // 179
        delete self.keys[key];                                                                                      // 180
        changed(self.keyDeps[key]);                                                                                 // 181
        if (self.keyValueDeps[key]) {                                                                               // 182
          changed(self.keyValueDeps[key][oldValue]);                                                                // 183
          changed(self.keyValueDeps[key]['undefined']);                                                             // 184
        }                                                                                                           //
        self.allDeps.changed();                                                                                     // 186
        didRemove = true;                                                                                           // 187
      }                                                                                                             //
                                                                                                                    //
      return didRemove;                                                                                             // 190
    }                                                                                                               //
                                                                                                                    //
    return _delete;                                                                                                 //
  }(),                                                                                                              //
                                                                                                                    //
  _setObject: function () {                                                                                         // 193
    function _setObject(object) {                                                                                   // 193
      var self = this;                                                                                              // 194
                                                                                                                    //
      _.each(object, function (value, key) {                                                                        // 196
        self.set(key, value);                                                                                       // 197
      });                                                                                                           //
    }                                                                                                               //
                                                                                                                    //
    return _setObject;                                                                                              //
  }(),                                                                                                              //
                                                                                                                    //
  _ensureKey: function () {                                                                                         // 201
    function _ensureKey(key) {                                                                                      // 201
      var self = this;                                                                                              // 202
      if (!(key in self.keyDeps)) {                                                                                 // 203
        self.keyDeps[key] = new Tracker.Dependency();                                                               // 204
        self.keyValueDeps[key] = {};                                                                                // 205
      }                                                                                                             //
    }                                                                                                               //
                                                                                                                    //
    return _ensureKey;                                                                                              //
  }(),                                                                                                              //
                                                                                                                    //
  // Get a JSON value that can be passed to the constructor to                                                      //
  // create a new ReactiveDict with the same contents as this one                                                   //
  _getMigrationData: function () {                                                                                  // 211
    function _getMigrationData() {                                                                                  // 211
      // XXX sanitize and make sure it's JSONible?                                                                  //
      return this.keys;                                                                                             // 213
    }                                                                                                               //
                                                                                                                    //
    return _getMigrationData;                                                                                       //
  }()                                                                                                               //
});                                                                                                                 //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}],"migration.js":function(){

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                  //
// packages/reactive-dict/migration.js                                                                              //
//                                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                    //
ReactiveDict._migratedDictData = {}; // name -> data                                                                // 1
ReactiveDict._dictsToMigrate = {}; // name -> ReactiveDict                                                          // 2
                                                                                                                    //
ReactiveDict._loadMigratedDict = function (dictName) {                                                              // 4
  if (_.has(ReactiveDict._migratedDictData, dictName)) return ReactiveDict._migratedDictData[dictName];             // 5
                                                                                                                    //
  return null;                                                                                                      // 8
};                                                                                                                  //
                                                                                                                    //
ReactiveDict._registerDictForMigrate = function (dictName, dict) {                                                  // 11
  if (_.has(ReactiveDict._dictsToMigrate, dictName)) throw new Error("Duplicate ReactiveDict name: " + dictName);   // 12
                                                                                                                    //
  ReactiveDict._dictsToMigrate[dictName] = dict;                                                                    // 15
};                                                                                                                  //
                                                                                                                    //
if (Meteor.isClient && Package.reload) {                                                                            // 18
  // Put old migrated data into ReactiveDict._migratedDictData,                                                     //
  // where it can be accessed by ReactiveDict._loadMigratedDict.                                                    //
  var migrationData = Package.reload.Reload._migrationData('reactive-dict');                                        // 21
  if (migrationData && migrationData.dicts) ReactiveDict._migratedDictData = migrationData.dicts;                   // 22
                                                                                                                    //
  // On migration, assemble the data from all the dicts that have been                                              //
  // registered.                                                                                                    //
  Package.reload.Reload._onMigrate('reactive-dict', function () {                                                   // 18
    var dictsToMigrate = ReactiveDict._dictsToMigrate;                                                              // 28
    var dataToMigrate = {};                                                                                         // 29
                                                                                                                    //
    for (var dictName in meteorBabelHelpers.sanitizeForInObject(dictsToMigrate)) {                                  // 31
      dataToMigrate[dictName] = dictsToMigrate[dictName]._getMigrationData();                                       // 32
    }return [true, { dicts: dataToMigrate }];                                                                       //
  });                                                                                                               //
}                                                                                                                   //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}}}}},{"extensions":[".js",".json"]});
require("./node_modules/meteor/reactive-dict/reactive-dict.js");
require("./node_modules/meteor/reactive-dict/migration.js");

/* Exports */
if (typeof Package === 'undefined') Package = {};
(function (pkg, symbols) {
  for (var s in symbols)
    (s in pkg) || (pkg[s] = symbols[s]);
})(Package['reactive-dict'] = {}, {
  ReactiveDict: ReactiveDict
});

})();
(function () {

/* Imports */
var Meteor = Package.meteor.Meteor;
var global = Package.meteor.global;
var meteorEnv = Package.meteor.meteorEnv;
var _ = Package.underscore._;
var ReactiveDict = Package['reactive-dict'].ReactiveDict;
var EJSON = Package.ejson.EJSON;

/* Package-scope variables */
var Session;

(function(){

/////////////////////////////////////////////////////////////////////////////////
//                                                                             //
// packages/session/session.js                                                 //
//                                                                             //
/////////////////////////////////////////////////////////////////////////////////
                                                                               //
Session = new ReactiveDict('session');                                         // 1
                                                                               // 2
// Documentation here is really awkward because the methods are defined        // 3
// elsewhere                                                                   // 4
                                                                               // 5
/**                                                                            // 6
 * @memberOf Session                                                           // 7
 * @method set                                                                 // 8
 * @summary Set a variable in the session. Notify any listeners that the value
 * has changed (eg: redraw templates, and rerun any                            // 10
 * [`Tracker.autorun`](#tracker_autorun) computations, that called             // 11
 * [`Session.get`](#session_get) on this `key`.)                               // 12
 * @locus Client                                                               // 13
 * @param {String} key The key to set, eg, `selectedItem`                      // 14
 * @param {EJSONable | undefined} value The new value for `key`                // 15
 */                                                                            // 16
                                                                               // 17
/**                                                                            // 18
 * @memberOf Session                                                           // 19
 * @method setDefault                                                          // 20
 * @summary Set a variable in the session if it hasn't been set before.        // 21
 * Otherwise works exactly the same as [`Session.set`](#session_set).          // 22
 * @locus Client                                                               // 23
 * @param {String} key The key to set, eg, `selectedItem`                      // 24
 * @param {EJSONable | undefined} value The new value for `key`                // 25
 */                                                                            // 26
                                                                               // 27
/**                                                                            // 28
 * @memberOf Session                                                           // 29
 * @method get                                                                 // 30
 * @summary Get the value of a session variable. If inside a [reactive         // 31
 * computation](#reactivity), invalidate the computation the next time the     // 32
 * value of the variable is changed by [`Session.set`](#session_set). This     // 33
 * returns a clone of the session value, so if it's an object or an array,     // 34
 * mutating the returned value has no effect on the value stored in the        // 35
 * session.                                                                    // 36
 * @locus Client                                                               // 37
 * @param {String} key The name of the session variable to return              // 38
 */                                                                            // 39
                                                                               // 40
/**                                                                            // 41
 * @memberOf Session                                                           // 42
 * @method equals                                                              // 43
 * @summary Test if a session variable is equal to a value. If inside a        // 44
 * [reactive computation](#reactivity), invalidate the computation the next    // 45
 * time the variable changes to or from the value.                             // 46
 * @locus Client                                                               // 47
 * @param {String} key The name of the session variable to test                // 48
 * @param {String | Number | Boolean | null | undefined} value The value to    // 49
 * test against                                                                // 50
 */                                                                            // 51
                                                                               // 52
/////////////////////////////////////////////////////////////////////////////////

}).call(this);


/* Exports */
if (typeof Package === 'undefined') Package = {};
(function (pkg, symbols) {
  for (var s in symbols)
    (s in pkg) || (pkg[s] = symbols[s]);
})(Package.session = {}, {
  Session: Session
});

})();
(function () {

/* Imports */
var Meteor = Package.meteor.Meteor;
var global = Package.meteor.global;
var meteorEnv = Package.meteor.meteorEnv;
var Tracker = Package.tracker.Tracker;
var Deps = Package.tracker.Deps;

/* Package-scope variables */
var ReactiveVar;

(function(){

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                              //
// packages/reactive-var/reactive-var.js                                                                        //
//                                                                                                              //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                //
/*                                                                                                              // 1
 * ## [new] ReactiveVar(initialValue, [equalsFunc])                                                             // 2
 *                                                                                                              // 3
 * A ReactiveVar holds a single value that can be get and set,                                                  // 4
 * such that calling `set` will invalidate any Computations that                                                // 5
 * called `get`, according to the usual contract for reactive                                                   // 6
 * data sources.                                                                                                // 7
 *                                                                                                              // 8
 * A ReactiveVar is much like a Session variable -- compare `foo.get()`                                         // 9
 * to `Session.get("foo")` -- but it doesn't have a global name and isn't                                       // 10
 * automatically migrated across hot code pushes.  Also, while Session                                          // 11
 * variables can only hold JSON or EJSON, ReactiveVars can hold any value.                                      // 12
 *                                                                                                              // 13
 * An important property of ReactiveVars, which is sometimes the reason                                         // 14
 * to use one, is that setting the value to the same value as before has                                        // 15
 * no effect, meaning ReactiveVars can be used to absorb extra                                                  // 16
 * invalidations that wouldn't serve a purpose.  However, by default,                                           // 17
 * ReactiveVars are extremely conservative about what changes they                                              // 18
 * absorb.  Calling `set` with an object argument will *always* trigger                                         // 19
 * invalidations, because even if the new value is `===` the old value,                                         // 20
 * the object may have been mutated.  You can change the default behavior                                       // 21
 * by passing a function of two arguments, `oldValue` and `newValue`,                                           // 22
 * to the constructor as `equalsFunc`.                                                                          // 23
 *                                                                                                              // 24
 * This class is extremely basic right now, but the idea is to evolve                                           // 25
 * it into the ReactiveVar of Geoff's Lickable Forms proposal.                                                  // 26
 */                                                                                                             // 27
                                                                                                                // 28
/**                                                                                                             // 29
 * @class                                                                                                       // 30
 * @instanceName reactiveVar                                                                                    // 31
 * @summary Constructor for a ReactiveVar, which represents a single reactive variable.                         // 32
 * @locus Client                                                                                                // 33
 * @param {Any} initialValue The initial value to set.  `equalsFunc` is ignored when setting the initial value.
 * @param {Function} [equalsFunc] Optional.  A function of two arguments, called on the old value and the new value whenever the ReactiveVar is set.  If it returns true, no set is performed.  If omitted, the default `equalsFunc` returns true if its arguments are `===` and are of type number, boolean, string, undefined, or null.
 */                                                                                                             // 36
ReactiveVar = function (initialValue, equalsFunc) {                                                             // 37
  if (! (this instanceof ReactiveVar))                                                                          // 38
    // called without `new`                                                                                     // 39
    return new ReactiveVar(initialValue, equalsFunc);                                                           // 40
                                                                                                                // 41
  this.curValue = initialValue;                                                                                 // 42
  this.equalsFunc = equalsFunc;                                                                                 // 43
  this.dep = new Tracker.Dependency;                                                                            // 44
};                                                                                                              // 45
                                                                                                                // 46
ReactiveVar._isEqual = function (oldValue, newValue) {                                                          // 47
  var a = oldValue, b = newValue;                                                                               // 48
  // Two values are "equal" here if they are `===` and are                                                      // 49
  // number, boolean, string, undefined, or null.                                                               // 50
  if (a !== b)                                                                                                  // 51
    return false;                                                                                               // 52
  else                                                                                                          // 53
    return ((!a) || (typeof a === 'number') || (typeof a === 'boolean') ||                                      // 54
            (typeof a === 'string'));                                                                           // 55
};                                                                                                              // 56
                                                                                                                // 57
/**                                                                                                             // 58
 * @summary Returns the current value of the ReactiveVar, establishing a reactive dependency.                   // 59
 * @locus Client                                                                                                // 60
 */                                                                                                             // 61
ReactiveVar.prototype.get = function () {                                                                       // 62
  if (Tracker.active)                                                                                           // 63
    this.dep.depend();                                                                                          // 64
                                                                                                                // 65
  return this.curValue;                                                                                         // 66
};                                                                                                              // 67
                                                                                                                // 68
/**                                                                                                             // 69
 * @summary Sets the current value of the ReactiveVar, invalidating the Computations that called `get` if `newValue` is different from the old value.
 * @locus Client                                                                                                // 71
 * @param {Any} newValue                                                                                        // 72
 */                                                                                                             // 73
ReactiveVar.prototype.set = function (newValue) {                                                               // 74
  var oldValue = this.curValue;                                                                                 // 75
                                                                                                                // 76
  if ((this.equalsFunc || ReactiveVar._isEqual)(oldValue, newValue))                                            // 77
    // value is same as last time                                                                               // 78
    return;                                                                                                     // 79
                                                                                                                // 80
  this.curValue = newValue;                                                                                     // 81
  this.dep.changed();                                                                                           // 82
};                                                                                                              // 83
                                                                                                                // 84
ReactiveVar.prototype.toString = function () {                                                                  // 85
  return 'ReactiveVar{' + this.get() + '}';                                                                     // 86
};                                                                                                              // 87
                                                                                                                // 88
ReactiveVar.prototype._numListeners = function() {                                                              // 89
  // Tests want to know.                                                                                        // 90
  // Accesses a private field of Tracker.Dependency.                                                            // 91
  var count = 0;                                                                                                // 92
  for (var id in this.dep._dependentsById)                                                                      // 93
    count++;                                                                                                    // 94
  return count;                                                                                                 // 95
};                                                                                                              // 96
                                                                                                                // 97
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}).call(this);


/* Exports */
if (typeof Package === 'undefined') Package = {};
(function (pkg, symbols) {
  for (var s in symbols)
    (s in pkg) || (pkg[s] = symbols[s]);
})(Package['reactive-var'] = {}, {
  ReactiveVar: ReactiveVar
});

})();
(function () {

/* Imports */
var Meteor = Package.meteor.Meteor;
var global = Package.meteor.global;
var meteorEnv = Package.meteor.meteorEnv;
var Mongo = Package.mongo.Mongo;
var Tracker = Package.tracker.Tracker;
var Deps = Package.tracker.Deps;
var LocalCollection = Package.minimongo.LocalCollection;
var Minimongo = Package.minimongo.Minimongo;

/* Package-scope variables */
var CollectionExtensions;

(function(){

//////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                  //
// packages/lai_collection-extensions/packages/lai_collection-extensions.js                         //
//                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                    //
(function () {                                                                                      // 1
                                                                                                    // 2
///////////////////////////////////////////////////////////////////////////////////////////////     // 3
//                                                                                           //     // 4
// packages/lai:collection-extensions/collection-extensions.js                               //     // 5
//                                                                                           //     // 6
///////////////////////////////////////////////////////////////////////////////////////////////     // 7
                                                                                             //     // 8
// The collection extensions namespace                                                       // 1   // 9
CollectionExtensions = {};                                                                   // 2   // 10
                                                                                             // 3   // 11
// Stores all the collection extensions                                                      // 4   // 12
CollectionExtensions._extensions = [];                                                       // 5   // 13
                                                                                             // 6   // 14
// This is where you would add custom functionality to                                       // 7   // 15
// Mongo.Collection/Meteor.Collection                                                        // 8   // 16
Meteor.addCollectionExtension = function (customFunction) {                                  // 9   // 17
  if (typeof customFunction !== 'function') {                                                // 10  // 18
    throw new Meteor.Error(                                                                  // 11  // 19
      'collection-extension-wrong-argument',                                                 // 12  // 20
      'You must pass a function \
       into Meteor.addCollectionExtension().');                                              // 14  // 22
  }                                                                                          // 15  // 23
  CollectionExtensions._extensions.push(customFunction);                                     // 16  // 24
  // If Meteor.users exists, apply the extension right away                                  // 17  // 25
  if (typeof Meteor.users !== 'undefined') {                                                 // 18  // 26
    customFunction.apply(Meteor.users, ['users']);                                           // 19  // 27
  }                                                                                          // 20  // 28
};                                                                                           // 21  // 29
                                                                                             // 22  // 30
// Utility function to add a prototype function to your                                      // 23  // 31
// Meteor/Mongo.Collection object                                                            // 24  // 32
Meteor.addCollectionPrototype = function (name, customFunction) {                            // 25  // 33
  if (typeof name !== 'string') {                                                            // 26  // 34
    throw new Meteor.Error(                                                                  // 27  // 35
      'collection-extension-wrong-argument',                                                 // 28  // 36
      'You must pass a string as the first argument \
       into Meteor.addCollectionPrototype().');                                              // 30  // 38
  }                                                                                          // 31  // 39
  if (typeof customFunction !== 'function') {                                                // 32  // 40
    throw new Meteor.Error(                                                                  // 33  // 41
      'collection-extension-wrong-argument',                                                 // 34  // 42
      'You must pass a function as the second argument \
       into Meteor.addCollectionPrototype().');                                              // 36  // 44
  }                                                                                          // 37  // 45
  (typeof Mongo !== 'undefined' ?                                                            // 38  // 46
    Mongo.Collection :                                                                       // 39  // 47
    Meteor.Collection).prototype[name] = customFunction;                                     // 40  // 48
};                                                                                           // 41  // 49
                                                                                             // 42  // 50
// This is used to reassign the prototype of unfortunately                                   // 43  // 51
// and unstoppably already instantiated Mongo instances                                      // 44  // 52
// i.e. Meteor.users                                                                         // 45  // 53
CollectionExtensions._reassignCollectionPrototype = function (instance, constr) {            // 46  // 54
  var hasSetPrototypeOf = typeof Object.setPrototypeOf === 'function';                       // 47  // 55
                                                                                             // 48  // 56
  if (!constr) constr = typeof Mongo !== 'undefined' ? Mongo.Collection : Meteor.Collection; // 49  // 57
                                                                                             // 50  // 58
  // __proto__ is not available in < IE11                                                    // 51  // 59
  // Note: Assigning a prototype dynamically has performance implications                    // 52  // 60
  if (hasSetPrototypeOf) {                                                                   // 53  // 61
    Object.setPrototypeOf(instance, constr.prototype);                                       // 54  // 62
  } else if (instance.__proto__) {                                                           // 55  // 63
    instance.__proto__ = constr.prototype;                                                   // 56  // 64
  }                                                                                          // 57  // 65
};                                                                                           // 58  // 66
                                                                                             // 59  // 67
// This monkey-patches the Collection constructor                                            // 60  // 68
// This code is the same monkey-patching code                                                // 61  // 69
// that matb33:collection-hooks uses, which works pretty nicely                              // 62  // 70
CollectionExtensions._wrapCollection = function (ns, as) {                                   // 63  // 71
  // Save the original prototype                                                             // 64  // 72
  if (!as._CollectionPrototype) as._CollectionPrototype = new as.Collection(null);           // 65  // 73
                                                                                             // 66  // 74
  var constructor = as.Collection;                                                           // 67  // 75
  var proto = as._CollectionPrototype;                                                       // 68  // 76
                                                                                             // 69  // 77
  ns.Collection = function () {                                                              // 70  // 78
    var ret = constructor.apply(this, arguments);                                            // 71  // 79
    // This is where all the collection extensions get processed                             // 72  // 80
    CollectionExtensions._processCollectionExtensions(this, arguments);                      // 73  // 81
    return ret;                                                                              // 74  // 82
  };                                                                                         // 75  // 83
                                                                                             // 76  // 84
  ns.Collection.prototype = proto;                                                           // 77  // 85
  ns.Collection.prototype.constructor = ns.Collection;                                       // 78  // 86
                                                                                             // 79  // 87
  for (var prop in constructor) {                                                            // 80  // 88
    if (constructor.hasOwnProperty(prop)) {                                                  // 81  // 89
      ns.Collection[prop] = constructor[prop];                                               // 82  // 90
    }                                                                                        // 83  // 91
  }                                                                                          // 84  // 92
};                                                                                           // 85  // 93
                                                                                             // 86  // 94
CollectionExtensions._processCollectionExtensions = function (self, args) {                  // 87  // 95
  // Using old-school operations for better performance                                      // 88  // 96
  // Please don't judge me ;P                                                                // 89  // 97
  var args = args ? [].slice.call(args, 0) : undefined;                                      // 90  // 98
  var extensions = CollectionExtensions._extensions;                                         // 91  // 99
  for (var i = 0, len = extensions.length; i < len; i++) {                                   // 92  // 100
    extensions[i].apply(self, args);                                                         // 93  // 101
  }                                                                                          // 94  // 102
};                                                                                           // 95  // 103
                                                                                             // 96  // 104
if (typeof Mongo !== 'undefined') {                                                          // 97  // 105
  CollectionExtensions._wrapCollection(Meteor, Mongo);                                       // 98  // 106
  CollectionExtensions._wrapCollection(Mongo, Mongo);                                        // 99  // 107
} else {                                                                                     // 100
  CollectionExtensions._wrapCollection(Meteor, Meteor);                                      // 101
}                                                                                            // 102
                                                                                             // 103
if (typeof Meteor.users !== 'undefined') {                                                   // 104
  // Ensures that Meteor.users instanceof Mongo.Collection                                   // 105
  CollectionExtensions._reassignCollectionPrototype(Meteor.users);                           // 106
}                                                                                            // 107
///////////////////////////////////////////////////////////////////////////////////////////////     // 116
                                                                                                    // 117
}).call(this);                                                                                      // 118
                                                                                                    // 119
//////////////////////////////////////////////////////////////////////////////////////////////////////

}).call(this);


/* Exports */
if (typeof Package === 'undefined') Package = {};
Package['lai:collection-extensions'] = {};

})();
(function () {

/* Imports */
var Meteor = Package.meteor.Meteor;
var global = Package.meteor.global;
var meteorEnv = Package.meteor.meteorEnv;
var Mongo = Package.mongo.Mongo;
var _ = Package.underscore._;

(function(){

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                  //
// packages/dburles_mongo-collection-instances/packages/dburles_mongo-collection-instances.js                       //
//                                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                    //
(function () {                                                                                                      // 1
                                                                                                                    // 2
////////////////////////////////////////////////////////////////////////////////////////////////////////////////    // 3
//                                                                                                            //    // 4
// packages/dburles:mongo-collection-instances/mongo-instances.js                                             //    // 5
//                                                                                                            //    // 6
////////////////////////////////////////////////////////////////////////////////////////////////////////////////    // 7
                                                                                                              //    // 8
var instances = [];                                                                                           // 1  // 9
                                                                                                              // 2  // 10
Meteor.addCollectionExtension(function (name, options) {                                                      // 3  // 11
  instances.push({                                                                                            // 4  // 12
    name: name,                                                                                               // 5  // 13
    instance: this,                                                                                           // 6  // 14
    options: options                                                                                          // 7  // 15
  });                                                                                                         // 8  // 16
});                                                                                                           // 9  // 17
                                                                                                              // 10
Mongo.Collection.get = function(name, options) {                                                              // 11
  options = options || {};                                                                                    // 12
  var collection = _.find(instances, function(instance) {                                                     // 13
    if (options.connection)                                                                                   // 14
      return instance.name === name &&                                                                        // 15
        instance.options && instance.options.connection._lastSessionId === options.connection._lastSessionId; // 16
    return instance.name === name;                                                                            // 17
  });                                                                                                         // 18
                                                                                                              // 19
  return collection && collection.instance;                                                                   // 20
};                                                                                                            // 21
                                                                                                              // 22
Mongo.Collection.getAll = function() {                                                                        // 23
  return instances;                                                                                           // 24
};                                                                                                            // 25
                                                                                                              // 26
// Meteor.Collection will lack ownProperties that are added back to Mongo.Collection                          // 27
Meteor.Collection = Mongo.Collection;                                                                         // 28
////////////////////////////////////////////////////////////////////////////////////////////////////////////////    // 37
                                                                                                                    // 38
}).call(this);                                                                                                      // 39
                                                                                                                    // 40
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}).call(this);


/* Exports */
if (typeof Package === 'undefined') Package = {};
Package['dburles:mongo-collection-instances'] = {};

})();
(function () {

/* Imports */
var Meteor = Package.meteor.Meteor;
var global = Package.meteor.global;
var meteorEnv = Package.meteor.meteorEnv;

(function(){

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                 //
// packages/benjamine_jsondiffpatch/public/build/jsondiffpatch-full.js                                             //
//                                                                                                                 //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                   //
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.jsondiffpatch=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var environment = require('./environment');                                                                        // 2
                                                                                                                   // 3
if (environment.isBrowser) {                                                                                       // 4
  /* global window */                                                                                              // 5
  /* jshint camelcase: false */                                                                                    // 6
  window.diff_match_patch = require('../public/external/diff_match_patch_uncompressed');                           // 7
  /* jshint camelcase: true */                                                                                     // 8
}                                                                                                                  // 9
                                                                                                                   // 10
module.exports = require('./main');                                                                                // 11
                                                                                                                   // 12
},{"../public/external/diff_match_patch_uncompressed":2,"./environment":9,"./main":16}],2:[function(require,module,exports){
/**                                                                                                                // 14
 * Diff Match and Patch                                                                                            // 15
 *                                                                                                                 // 16
 * Copyright 2006 Google Inc.                                                                                      // 17
 * http://code.google.com/p/google-diff-match-patch/                                                               // 18
 *                                                                                                                 // 19
 * Licensed under the Apache License, Version 2.0 (the "License");                                                 // 20
 * you may not use this file except in compliance with the License.                                                // 21
 * You may obtain a copy of the License at                                                                         // 22
 *                                                                                                                 // 23
 *   http://www.apache.org/licenses/LICENSE-2.0                                                                    // 24
 *                                                                                                                 // 25
 * Unless required by applicable law or agreed to in writing, software                                             // 26
 * distributed under the License is distributed on an "AS IS" BASIS,                                               // 27
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.                                        // 28
 * See the License for the specific language governing permissions and                                             // 29
 * limitations under the License.                                                                                  // 30
 */                                                                                                                // 31
                                                                                                                   // 32
/**                                                                                                                // 33
 * @fileoverview Computes the difference between two texts to create a patch.                                      // 34
 * Applies the patch onto another text, allowing for errors.                                                       // 35
 * @author fraser@google.com (Neil Fraser)                                                                         // 36
 */                                                                                                                // 37
                                                                                                                   // 38
/**                                                                                                                // 39
 * Class containing the diff, match and patch methods.                                                             // 40
 * @constructor                                                                                                    // 41
 */                                                                                                                // 42
function diff_match_patch() {                                                                                      // 43
                                                                                                                   // 44
  // Defaults.                                                                                                     // 45
  // Redefine these in your program to override the defaults.                                                      // 46
                                                                                                                   // 47
  // Number of seconds to map a diff before giving up (0 for infinity).                                            // 48
  this.Diff_Timeout = 1.0;                                                                                         // 49
  // Cost of an empty edit operation in terms of edit characters.                                                  // 50
  this.Diff_EditCost = 4;                                                                                          // 51
  // At what point is no match declared (0.0 = perfection, 1.0 = very loose).                                      // 52
  this.Match_Threshold = 0.5;                                                                                      // 53
  // How far to search for a match (0 = exact location, 1000+ = broad match).                                      // 54
  // A match this many characters away from the expected location will add                                         // 55
  // 1.0 to the score (0.0 is a perfect match).                                                                    // 56
  this.Match_Distance = 1000;                                                                                      // 57
  // When deleting a large block of text (over ~64 characters), how close does                                     // 58
  // the contents have to match the expected contents. (0.0 = perfection,                                          // 59
  // 1.0 = very loose).  Note that Match_Threshold controls how closely the                                        // 60
  // end points of a delete need to match.                                                                         // 61
  this.Patch_DeleteThreshold = 0.5;                                                                                // 62
  // Chunk size for context length.                                                                                // 63
  this.Patch_Margin = 4;                                                                                           // 64
                                                                                                                   // 65
  // The number of bits in an int.                                                                                 // 66
  this.Match_MaxBits = 32;                                                                                         // 67
}                                                                                                                  // 68
                                                                                                                   // 69
                                                                                                                   // 70
//  DIFF FUNCTIONS                                                                                                 // 71
                                                                                                                   // 72
                                                                                                                   // 73
/**                                                                                                                // 74
 * The data structure representing a diff is an array of tuples:                                                   // 75
 * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]                                     // 76
 * which means: delete 'Hello', add 'Goodbye' and keep ' world.'                                                   // 77
 */                                                                                                                // 78
var DIFF_DELETE = -1;                                                                                              // 79
var DIFF_INSERT = 1;                                                                                               // 80
var DIFF_EQUAL = 0;                                                                                                // 81
                                                                                                                   // 82
/** @typedef {!Array.<number|string>} */                                                                           // 83
diff_match_patch.Diff;                                                                                             // 84
                                                                                                                   // 85
                                                                                                                   // 86
/**                                                                                                                // 87
 * Find the differences between two texts.  Simplifies the problem by stripping                                    // 88
 * any common prefix or suffix off the texts before diffing.                                                       // 89
 * @param {string} text1 Old string to be diffed.                                                                  // 90
 * @param {string} text2 New string to be diffed.                                                                  // 91
 * @param {boolean=} opt_checklines Optional speedup flag. If present and false,                                   // 92
 *     then don't run a line-level diff first to identify the changed areas.                                       // 93
 *     Defaults to true, which does a faster, slightly less optimal diff.                                          // 94
 * @param {number} opt_deadline Optional time when the diff should be complete                                     // 95
 *     by.  Used internally for recursive calls.  Users should set DiffTimeout                                     // 96
 *     instead.                                                                                                    // 97
 * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.                                                 // 98
 */                                                                                                                // 99
diff_match_patch.prototype.diff_main = function(text1, text2, opt_checklines,                                      // 100
    opt_deadline) {                                                                                                // 101
  // Set a deadline by which time the diff must be complete.                                                       // 102
  if (typeof opt_deadline == 'undefined') {                                                                        // 103
    if (this.Diff_Timeout <= 0) {                                                                                  // 104
      opt_deadline = Number.MAX_VALUE;                                                                             // 105
    } else {                                                                                                       // 106
      opt_deadline = (new Date).getTime() + this.Diff_Timeout * 1000;                                              // 107
    }                                                                                                              // 108
  }                                                                                                                // 109
  var deadline = opt_deadline;                                                                                     // 110
                                                                                                                   // 111
  // Check for null inputs.                                                                                        // 112
  if (text1 == null || text2 == null) {                                                                            // 113
    throw new Error('Null input. (diff_main)');                                                                    // 114
  }                                                                                                                // 115
                                                                                                                   // 116
  // Check for equality (speedup).                                                                                 // 117
  if (text1 == text2) {                                                                                            // 118
    if (text1) {                                                                                                   // 119
      return [[DIFF_EQUAL, text1]];                                                                                // 120
    }                                                                                                              // 121
    return [];                                                                                                     // 122
  }                                                                                                                // 123
                                                                                                                   // 124
  if (typeof opt_checklines == 'undefined') {                                                                      // 125
    opt_checklines = true;                                                                                         // 126
  }                                                                                                                // 127
  var checklines = opt_checklines;                                                                                 // 128
                                                                                                                   // 129
  // Trim off common prefix (speedup).                                                                             // 130
  var commonlength = this.diff_commonPrefix(text1, text2);                                                         // 131
  var commonprefix = text1.substring(0, commonlength);                                                             // 132
  text1 = text1.substring(commonlength);                                                                           // 133
  text2 = text2.substring(commonlength);                                                                           // 134
                                                                                                                   // 135
  // Trim off common suffix (speedup).                                                                             // 136
  commonlength = this.diff_commonSuffix(text1, text2);                                                             // 137
  var commonsuffix = text1.substring(text1.length - commonlength);                                                 // 138
  text1 = text1.substring(0, text1.length - commonlength);                                                         // 139
  text2 = text2.substring(0, text2.length - commonlength);                                                         // 140
                                                                                                                   // 141
  // Compute the diff on the middle block.                                                                         // 142
  var diffs = this.diff_compute_(text1, text2, checklines, deadline);                                              // 143
                                                                                                                   // 144
  // Restore the prefix and suffix.                                                                                // 145
  if (commonprefix) {                                                                                              // 146
    diffs.unshift([DIFF_EQUAL, commonprefix]);                                                                     // 147
  }                                                                                                                // 148
  if (commonsuffix) {                                                                                              // 149
    diffs.push([DIFF_EQUAL, commonsuffix]);                                                                        // 150
  }                                                                                                                // 151
  this.diff_cleanupMerge(diffs);                                                                                   // 152
  return diffs;                                                                                                    // 153
};                                                                                                                 // 154
                                                                                                                   // 155
                                                                                                                   // 156
/**                                                                                                                // 157
 * Find the differences between two texts.  Assumes that the texts do not                                          // 158
 * have any common prefix or suffix.                                                                               // 159
 * @param {string} text1 Old string to be diffed.                                                                  // 160
 * @param {string} text2 New string to be diffed.                                                                  // 161
 * @param {boolean} checklines Speedup flag.  If false, then don't run a                                           // 162
 *     line-level diff first to identify the changed areas.                                                        // 163
 *     If true, then run a faster, slightly less optimal diff.                                                     // 164
 * @param {number} deadline Time when the diff should be complete by.                                              // 165
 * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.                                                 // 166
 * @private                                                                                                        // 167
 */                                                                                                                // 168
diff_match_patch.prototype.diff_compute_ = function(text1, text2, checklines,                                      // 169
    deadline) {                                                                                                    // 170
  var diffs;                                                                                                       // 171
                                                                                                                   // 172
  if (!text1) {                                                                                                    // 173
    // Just add some text (speedup).                                                                               // 174
    return [[DIFF_INSERT, text2]];                                                                                 // 175
  }                                                                                                                // 176
                                                                                                                   // 177
  if (!text2) {                                                                                                    // 178
    // Just delete some text (speedup).                                                                            // 179
    return [[DIFF_DELETE, text1]];                                                                                 // 180
  }                                                                                                                // 181
                                                                                                                   // 182
  var longtext = text1.length > text2.length ? text1 : text2;                                                      // 183
  var shorttext = text1.length > text2.length ? text2 : text1;                                                     // 184
  var i = longtext.indexOf(shorttext);                                                                             // 185
  if (i != -1) {                                                                                                   // 186
    // Shorter text is inside the longer text (speedup).                                                           // 187
    diffs = [[DIFF_INSERT, longtext.substring(0, i)],                                                              // 188
             [DIFF_EQUAL, shorttext],                                                                              // 189
             [DIFF_INSERT, longtext.substring(i + shorttext.length)]];                                             // 190
    // Swap insertions for deletions if diff is reversed.                                                          // 191
    if (text1.length > text2.length) {                                                                             // 192
      diffs[0][0] = diffs[2][0] = DIFF_DELETE;                                                                     // 193
    }                                                                                                              // 194
    return diffs;                                                                                                  // 195
  }                                                                                                                // 196
                                                                                                                   // 197
  if (shorttext.length == 1) {                                                                                     // 198
    // Single character string.                                                                                    // 199
    // After the previous speedup, the character can't be an equality.                                             // 200
    return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];                                                           // 201
  }                                                                                                                // 202
  longtext = shorttext = null;  // Garbage collect.                                                                // 203
                                                                                                                   // 204
  // Check to see if the problem can be split in two.                                                              // 205
  var hm = this.diff_halfMatch_(text1, text2);                                                                     // 206
  if (hm) {                                                                                                        // 207
    // A half-match was found, sort out the return data.                                                           // 208
    var text1_a = hm[0];                                                                                           // 209
    var text1_b = hm[1];                                                                                           // 210
    var text2_a = hm[2];                                                                                           // 211
    var text2_b = hm[3];                                                                                           // 212
    var mid_common = hm[4];                                                                                        // 213
    // Send both pairs off for separate processing.                                                                // 214
    var diffs_a = this.diff_main(text1_a, text2_a, checklines, deadline);                                          // 215
    var diffs_b = this.diff_main(text1_b, text2_b, checklines, deadline);                                          // 216
    // Merge the results.                                                                                          // 217
    return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);                                                    // 218
  }                                                                                                                // 219
                                                                                                                   // 220
  if (checklines && text1.length > 100 && text2.length > 100) {                                                    // 221
    return this.diff_lineMode_(text1, text2, deadline);                                                            // 222
  }                                                                                                                // 223
                                                                                                                   // 224
  return this.diff_bisect_(text1, text2, deadline);                                                                // 225
};                                                                                                                 // 226
                                                                                                                   // 227
                                                                                                                   // 228
/**                                                                                                                // 229
 * Do a quick line-level diff on both strings, then rediff the parts for                                           // 230
 * greater accuracy.                                                                                               // 231
 * This speedup can produce non-minimal diffs.                                                                     // 232
 * @param {string} text1 Old string to be diffed.                                                                  // 233
 * @param {string} text2 New string to be diffed.                                                                  // 234
 * @param {number} deadline Time when the diff should be complete by.                                              // 235
 * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.                                                 // 236
 * @private                                                                                                        // 237
 */                                                                                                                // 238
diff_match_patch.prototype.diff_lineMode_ = function(text1, text2, deadline) {                                     // 239
  // Scan the text on a line-by-line basis first.                                                                  // 240
  var a = this.diff_linesToChars_(text1, text2);                                                                   // 241
  text1 = /** @type {string} */(a[0]);                                                                             // 242
  text2 = /** @type {string} */(a[1]);                                                                             // 243
  var linearray = /** @type {!Array.<string>} */(a[2]);                                                            // 244
                                                                                                                   // 245
  var diffs = this.diff_bisect_(text1, text2, deadline);                                                           // 246
                                                                                                                   // 247
  // Convert the diff back to original text.                                                                       // 248
  this.diff_charsToLines_(diffs, linearray);                                                                       // 249
  // Eliminate freak matches (e.g. blank lines)                                                                    // 250
  this.diff_cleanupSemantic(diffs);                                                                                // 251
                                                                                                                   // 252
  // Rediff any replacement blocks, this time character-by-character.                                              // 253
  // Add a dummy entry at the end.                                                                                 // 254
  diffs.push([DIFF_EQUAL, '']);                                                                                    // 255
  var pointer = 0;                                                                                                 // 256
  var count_delete = 0;                                                                                            // 257
  var count_insert = 0;                                                                                            // 258
  var text_delete = '';                                                                                            // 259
  var text_insert = '';                                                                                            // 260
  while (pointer < diffs.length) {                                                                                 // 261
    switch (diffs[pointer][0]) {                                                                                   // 262
      case DIFF_INSERT:                                                                                            // 263
        count_insert++;                                                                                            // 264
        text_insert += diffs[pointer][1];                                                                          // 265
        break;                                                                                                     // 266
      case DIFF_DELETE:                                                                                            // 267
        count_delete++;                                                                                            // 268
        text_delete += diffs[pointer][1];                                                                          // 269
        break;                                                                                                     // 270
      case DIFF_EQUAL:                                                                                             // 271
        // Upon reaching an equality, check for prior redundancies.                                                // 272
        if (count_delete >= 1 && count_insert >= 1) {                                                              // 273
          // Delete the offending records and add the merged ones.                                                 // 274
          var a = this.diff_main(text_delete, text_insert, false, deadline);                                       // 275
          diffs.splice(pointer - count_delete - count_insert,                                                      // 276
                       count_delete + count_insert);                                                               // 277
          pointer = pointer - count_delete - count_insert;                                                         // 278
          for (var j = a.length - 1; j >= 0; j--) {                                                                // 279
            diffs.splice(pointer, 0, a[j]);                                                                        // 280
          }                                                                                                        // 281
          pointer = pointer + a.length;                                                                            // 282
        }                                                                                                          // 283
        count_insert = 0;                                                                                          // 284
        count_delete = 0;                                                                                          // 285
        text_delete = '';                                                                                          // 286
        text_insert = '';                                                                                          // 287
        break;                                                                                                     // 288
    }                                                                                                              // 289
    pointer++;                                                                                                     // 290
  }                                                                                                                // 291
  diffs.pop();  // Remove the dummy entry at the end.                                                              // 292
                                                                                                                   // 293
  return diffs;                                                                                                    // 294
};                                                                                                                 // 295
                                                                                                                   // 296
                                                                                                                   // 297
/**                                                                                                                // 298
 * Find the 'middle snake' of a diff, split the problem in two                                                     // 299
 * and return the recursively constructed diff.                                                                    // 300
 * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.                                         // 301
 * @param {string} text1 Old string to be diffed.                                                                  // 302
 * @param {string} text2 New string to be diffed.                                                                  // 303
 * @param {number} deadline Time at which to bail if not yet complete.                                             // 304
 * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.                                                 // 305
 * @private                                                                                                        // 306
 */                                                                                                                // 307
diff_match_patch.prototype.diff_bisect_ = function(text1, text2, deadline) {                                       // 308
  // Cache the text lengths to prevent multiple calls.                                                             // 309
  var text1_length = text1.length;                                                                                 // 310
  var text2_length = text2.length;                                                                                 // 311
  var max_d = Math.ceil((text1_length + text2_length) / 2);                                                        // 312
  var v_offset = max_d;                                                                                            // 313
  var v_length = 2 * max_d;                                                                                        // 314
  var v1 = new Array(v_length);                                                                                    // 315
  var v2 = new Array(v_length);                                                                                    // 316
  // Setting all elements to -1 is faster in Chrome & Firefox than mixing                                          // 317
  // integers and undefined.                                                                                       // 318
  for (var x = 0; x < v_length; x++) {                                                                             // 319
    v1[x] = -1;                                                                                                    // 320
    v2[x] = -1;                                                                                                    // 321
  }                                                                                                                // 322
  v1[v_offset + 1] = 0;                                                                                            // 323
  v2[v_offset + 1] = 0;                                                                                            // 324
  var delta = text1_length - text2_length;                                                                         // 325
  // If the total number of characters is odd, then the front path will collide                                    // 326
  // with the reverse path.                                                                                        // 327
  var front = (delta % 2 != 0);                                                                                    // 328
  // Offsets for start and end of k loop.                                                                          // 329
  // Prevents mapping of space beyond the grid.                                                                    // 330
  var k1start = 0;                                                                                                 // 331
  var k1end = 0;                                                                                                   // 332
  var k2start = 0;                                                                                                 // 333
  var k2end = 0;                                                                                                   // 334
  for (var d = 0; d < max_d; d++) {                                                                                // 335
    // Bail out if deadline is reached.                                                                            // 336
    if ((new Date()).getTime() > deadline) {                                                                       // 337
      break;                                                                                                       // 338
    }                                                                                                              // 339
                                                                                                                   // 340
    // Walk the front path one step.                                                                               // 341
    for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {                                                        // 342
      var k1_offset = v_offset + k1;                                                                               // 343
      var x1;                                                                                                      // 344
      if (k1 == -d || k1 != d && v1[k1_offset - 1] < v1[k1_offset + 1]) {                                          // 345
        x1 = v1[k1_offset + 1];                                                                                    // 346
      } else {                                                                                                     // 347
        x1 = v1[k1_offset - 1] + 1;                                                                                // 348
      }                                                                                                            // 349
      var y1 = x1 - k1;                                                                                            // 350
      while (x1 < text1_length && y1 < text2_length &&                                                             // 351
             text1.charAt(x1) == text2.charAt(y1)) {                                                               // 352
        x1++;                                                                                                      // 353
        y1++;                                                                                                      // 354
      }                                                                                                            // 355
      v1[k1_offset] = x1;                                                                                          // 356
      if (x1 > text1_length) {                                                                                     // 357
        // Ran off the right of the graph.                                                                         // 358
        k1end += 2;                                                                                                // 359
      } else if (y1 > text2_length) {                                                                              // 360
        // Ran off the bottom of the graph.                                                                        // 361
        k1start += 2;                                                                                              // 362
      } else if (front) {                                                                                          // 363
        var k2_offset = v_offset + delta - k1;                                                                     // 364
        if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] != -1) {                                       // 365
          // Mirror x2 onto top-left coordinate system.                                                            // 366
          var x2 = text1_length - v2[k2_offset];                                                                   // 367
          if (x1 >= x2) {                                                                                          // 368
            // Overlap detected.                                                                                   // 369
            return this.diff_bisectSplit_(text1, text2, x1, y1, deadline);                                         // 370
          }                                                                                                        // 371
        }                                                                                                          // 372
      }                                                                                                            // 373
    }                                                                                                              // 374
                                                                                                                   // 375
    // Walk the reverse path one step.                                                                             // 376
    for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {                                                        // 377
      var k2_offset = v_offset + k2;                                                                               // 378
      var x2;                                                                                                      // 379
      if (k2 == -d || k2 != d && v2[k2_offset - 1] < v2[k2_offset + 1]) {                                          // 380
        x2 = v2[k2_offset + 1];                                                                                    // 381
      } else {                                                                                                     // 382
        x2 = v2[k2_offset - 1] + 1;                                                                                // 383
      }                                                                                                            // 384
      var y2 = x2 - k2;                                                                                            // 385
      while (x2 < text1_length && y2 < text2_length &&                                                             // 386
             text1.charAt(text1_length - x2 - 1) ==                                                                // 387
             text2.charAt(text2_length - y2 - 1)) {                                                                // 388
        x2++;                                                                                                      // 389
        y2++;                                                                                                      // 390
      }                                                                                                            // 391
      v2[k2_offset] = x2;                                                                                          // 392
      if (x2 > text1_length) {                                                                                     // 393
        // Ran off the left of the graph.                                                                          // 394
        k2end += 2;                                                                                                // 395
      } else if (y2 > text2_length) {                                                                              // 396
        // Ran off the top of the graph.                                                                           // 397
        k2start += 2;                                                                                              // 398
      } else if (!front) {                                                                                         // 399
        var k1_offset = v_offset + delta - k2;                                                                     // 400
        if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] != -1) {                                       // 401
          var x1 = v1[k1_offset];                                                                                  // 402
          var y1 = v_offset + x1 - k1_offset;                                                                      // 403
          // Mirror x2 onto top-left coordinate system.                                                            // 404
          x2 = text1_length - x2;                                                                                  // 405
          if (x1 >= x2) {                                                                                          // 406
            // Overlap detected.                                                                                   // 407
            return this.diff_bisectSplit_(text1, text2, x1, y1, deadline);                                         // 408
          }                                                                                                        // 409
        }                                                                                                          // 410
      }                                                                                                            // 411
    }                                                                                                              // 412
  }                                                                                                                // 413
  // Diff took too long and hit the deadline or                                                                    // 414
  // number of diffs equals number of characters, no commonality at all.                                           // 415
  return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];                                                             // 416
};                                                                                                                 // 417
                                                                                                                   // 418
                                                                                                                   // 419
/**                                                                                                                // 420
 * Given the location of the 'middle snake', split the diff in two parts                                           // 421
 * and recurse.                                                                                                    // 422
 * @param {string} text1 Old string to be diffed.                                                                  // 423
 * @param {string} text2 New string to be diffed.                                                                  // 424
 * @param {number} x Index of split point in text1.                                                                // 425
 * @param {number} y Index of split point in text2.                                                                // 426
 * @param {number} deadline Time at which to bail if not yet complete.                                             // 427
 * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.                                                 // 428
 * @private                                                                                                        // 429
 */                                                                                                                // 430
diff_match_patch.prototype.diff_bisectSplit_ = function(text1, text2, x, y,                                        // 431
    deadline) {                                                                                                    // 432
  var text1a = text1.substring(0, x);                                                                              // 433
  var text2a = text2.substring(0, y);                                                                              // 434
  var text1b = text1.substring(x);                                                                                 // 435
  var text2b = text2.substring(y);                                                                                 // 436
                                                                                                                   // 437
  // Compute both diffs serially.                                                                                  // 438
  var diffs = this.diff_main(text1a, text2a, false, deadline);                                                     // 439
  var diffsb = this.diff_main(text1b, text2b, false, deadline);                                                    // 440
                                                                                                                   // 441
  return diffs.concat(diffsb);                                                                                     // 442
};                                                                                                                 // 443
                                                                                                                   // 444
                                                                                                                   // 445
/**                                                                                                                // 446
 * Split two texts into an array of strings.  Reduce the texts to a string of                                      // 447
 * hashes where each Unicode character represents one line.                                                        // 448
 * @param {string} text1 First string.                                                                             // 449
 * @param {string} text2 Second string.                                                                            // 450
 * @return {!Array.<string|!Array.<string>>} Three element Array, containing the                                   // 451
 *     encoded text1, the encoded text2 and the array of unique strings.  The                                      // 452
 *     zeroth element of the array of unique strings is intentionally blank.                                       // 453
 * @private                                                                                                        // 454
 */                                                                                                                // 455
diff_match_patch.prototype.diff_linesToChars_ = function(text1, text2) {                                           // 456
  var lineArray = [];  // e.g. lineArray[4] == 'Hello\n'                                                           // 457
  var lineHash = {};   // e.g. lineHash['Hello\n'] == 4                                                            // 458
                                                                                                                   // 459
  // '\x00' is a valid character, but various debuggers don't like it.                                             // 460
  // So we'll insert a junk entry to avoid generating a null character.                                            // 461
  lineArray[0] = '';                                                                                               // 462
                                                                                                                   // 463
  /**                                                                                                              // 464
   * Split a text into an array of strings.  Reduce the texts to a string of                                       // 465
   * hashes where each Unicode character represents one line.                                                      // 466
   * Modifies linearray and linehash through being a closure.                                                      // 467
   * @param {string} text String to encode.                                                                        // 468
   * @return {string} Encoded string.                                                                              // 469
   * @private                                                                                                      // 470
   */                                                                                                              // 471
  function diff_linesToCharsMunge_(text) {                                                                         // 472
    var chars = '';                                                                                                // 473
    // Walk the text, pulling out a substring for each line.                                                       // 474
    // text.split('\n') would would temporarily double our memory footprint.                                       // 475
    // Modifying text would create many large strings to garbage collect.                                          // 476
    var lineStart = 0;                                                                                             // 477
    var lineEnd = -1;                                                                                              // 478
    // Keeping our own length variable is faster than looking it up.                                               // 479
    var lineArrayLength = lineArray.length;                                                                        // 480
    while (lineEnd < text.length - 1) {                                                                            // 481
      lineEnd = text.indexOf('\n', lineStart);                                                                     // 482
      if (lineEnd == -1) {                                                                                         // 483
        lineEnd = text.length - 1;                                                                                 // 484
      }                                                                                                            // 485
      var line = text.substring(lineStart, lineEnd + 1);                                                           // 486
      lineStart = lineEnd + 1;                                                                                     // 487
                                                                                                                   // 488
      if (lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line) :                                                // 489
          (lineHash[line] !== undefined)) {                                                                        // 490
        chars += String.fromCharCode(lineHash[line]);                                                              // 491
      } else {                                                                                                     // 492
        chars += String.fromCharCode(lineArrayLength);                                                             // 493
        lineHash[line] = lineArrayLength;                                                                          // 494
        lineArray[lineArrayLength++] = line;                                                                       // 495
      }                                                                                                            // 496
    }                                                                                                              // 497
    return chars;                                                                                                  // 498
  }                                                                                                                // 499
                                                                                                                   // 500
  var chars1 = diff_linesToCharsMunge_(text1);                                                                     // 501
  var chars2 = diff_linesToCharsMunge_(text2);                                                                     // 502
  return [chars1, chars2, lineArray];                                                                              // 503
};                                                                                                                 // 504
                                                                                                                   // 505
                                                                                                                   // 506
/**                                                                                                                // 507
 * Rehydrate the text in a diff from a string of line hashes to real lines of                                      // 508
 * text.                                                                                                           // 509
 * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.                                            // 510
 * @param {!Array.<string>} lineArray Array of unique strings.                                                     // 511
 * @private                                                                                                        // 512
 */                                                                                                                // 513
diff_match_patch.prototype.diff_charsToLines_ = function(diffs, lineArray) {                                       // 514
  for (var x = 0; x < diffs.length; x++) {                                                                         // 515
    var chars = diffs[x][1];                                                                                       // 516
    var text = [];                                                                                                 // 517
    for (var y = 0; y < chars.length; y++) {                                                                       // 518
      text[y] = lineArray[chars.charCodeAt(y)];                                                                    // 519
    }                                                                                                              // 520
    diffs[x][1] = text.join('');                                                                                   // 521
  }                                                                                                                // 522
};                                                                                                                 // 523
                                                                                                                   // 524
                                                                                                                   // 525
/**                                                                                                                // 526
 * Determine the common prefix of two strings.                                                                     // 527
 * @param {string} text1 First string.                                                                             // 528
 * @param {string} text2 Second string.                                                                            // 529
 * @return {number} The number of characters common to the start of each                                           // 530
 *     string.                                                                                                     // 531
 */                                                                                                                // 532
diff_match_patch.prototype.diff_commonPrefix = function(text1, text2) {                                            // 533
  // Quick check for common null cases.                                                                            // 534
  if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) {                                                    // 535
    return 0;                                                                                                      // 536
  }                                                                                                                // 537
  // Binary search.                                                                                                // 538
  // Performance analysis: http://neil.fraser.name/news/2007/10/09/                                                // 539
  var pointermin = 0;                                                                                              // 540
  var pointermax = Math.min(text1.length, text2.length);                                                           // 541
  var pointermid = pointermax;                                                                                     // 542
  var pointerstart = 0;                                                                                            // 543
  while (pointermin < pointermid) {                                                                                // 544
    if (text1.substring(pointerstart, pointermid) ==                                                               // 545
        text2.substring(pointerstart, pointermid)) {                                                               // 546
      pointermin = pointermid;                                                                                     // 547
      pointerstart = pointermin;                                                                                   // 548
    } else {                                                                                                       // 549
      pointermax = pointermid;                                                                                     // 550
    }                                                                                                              // 551
    pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);                                           // 552
  }                                                                                                                // 553
  return pointermid;                                                                                               // 554
};                                                                                                                 // 555
                                                                                                                   // 556
                                                                                                                   // 557
/**                                                                                                                // 558
 * Determine the common suffix of two strings.                                                                     // 559
 * @param {string} text1 First string.                                                                             // 560
 * @param {string} text2 Second string.                                                                            // 561
 * @return {number} The number of characters common to the end of each string.                                     // 562
 */                                                                                                                // 563
diff_match_patch.prototype.diff_commonSuffix = function(text1, text2) {                                            // 564
  // Quick check for common null cases.                                                                            // 565
  if (!text1 || !text2 ||                                                                                          // 566
      text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) {                                          // 567
    return 0;                                                                                                      // 568
  }                                                                                                                // 569
  // Binary search.                                                                                                // 570
  // Performance analysis: http://neil.fraser.name/news/2007/10/09/                                                // 571
  var pointermin = 0;                                                                                              // 572
  var pointermax = Math.min(text1.length, text2.length);                                                           // 573
  var pointermid = pointermax;                                                                                     // 574
  var pointerend = 0;                                                                                              // 575
  while (pointermin < pointermid) {                                                                                // 576
    if (text1.substring(text1.length - pointermid, text1.length - pointerend) ==                                   // 577
        text2.substring(text2.length - pointermid, text2.length - pointerend)) {                                   // 578
      pointermin = pointermid;                                                                                     // 579
      pointerend = pointermin;                                                                                     // 580
    } else {                                                                                                       // 581
      pointermax = pointermid;                                                                                     // 582
    }                                                                                                              // 583
    pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);                                           // 584
  }                                                                                                                // 585
  return pointermid;                                                                                               // 586
};                                                                                                                 // 587
                                                                                                                   // 588
                                                                                                                   // 589
/**                                                                                                                // 590
 * Determine if the suffix of one string is the prefix of another.                                                 // 591
 * @param {string} text1 First string.                                                                             // 592
 * @param {string} text2 Second string.                                                                            // 593
 * @return {number} The number of characters common to the end of the first                                        // 594
 *     string and the start of the second string.                                                                  // 595
 * @private                                                                                                        // 596
 */                                                                                                                // 597
diff_match_patch.prototype.diff_commonOverlap_ = function(text1, text2) {                                          // 598
  // Cache the text lengths to prevent multiple calls.                                                             // 599
  var text1_length = text1.length;                                                                                 // 600
  var text2_length = text2.length;                                                                                 // 601
  // Eliminate the null case.                                                                                      // 602
  if (text1_length == 0 || text2_length == 0) {                                                                    // 603
    return 0;                                                                                                      // 604
  }                                                                                                                // 605
  // Truncate the longer string.                                                                                   // 606
  if (text1_length > text2_length) {                                                                               // 607
    text1 = text1.substring(text1_length - text2_length);                                                          // 608
  } else if (text1_length < text2_length) {                                                                        // 609
    text2 = text2.substring(0, text1_length);                                                                      // 610
  }                                                                                                                // 611
  var text_length = Math.min(text1_length, text2_length);                                                          // 612
  // Quick check for the worst case.                                                                               // 613
  if (text1 == text2) {                                                                                            // 614
    return text_length;                                                                                            // 615
  }                                                                                                                // 616
                                                                                                                   // 617
  // Start by looking for a single character match                                                                 // 618
  // and increase length until no match is found.                                                                  // 619
  // Performance analysis: http://neil.fraser.name/news/2010/11/04/                                                // 620
  var best = 0;                                                                                                    // 621
  var length = 1;                                                                                                  // 622
  while (true) {                                                                                                   // 623
    var pattern = text1.substring(text_length - length);                                                           // 624
    var found = text2.indexOf(pattern);                                                                            // 625
    if (found == -1) {                                                                                             // 626
      return best;                                                                                                 // 627
    }                                                                                                              // 628
    length += found;                                                                                               // 629
    if (found == 0 || text1.substring(text_length - length) ==                                                     // 630
        text2.substring(0, length)) {                                                                              // 631
      best = length;                                                                                               // 632
      length++;                                                                                                    // 633
    }                                                                                                              // 634
  }                                                                                                                // 635
};                                                                                                                 // 636
                                                                                                                   // 637
                                                                                                                   // 638
/**                                                                                                                // 639
 * Do the two texts share a substring which is at least half the length of the                                     // 640
 * longer text?                                                                                                    // 641
 * This speedup can produce non-minimal diffs.                                                                     // 642
 * @param {string} text1 First string.                                                                             // 643
 * @param {string} text2 Second string.                                                                            // 644
 * @return {Array.<string>} Five element Array, containing the prefix of                                           // 645
 *     text1, the suffix of text1, the prefix of text2, the suffix of                                              // 646
 *     text2 and the common middle.  Or null if there was no match.                                                // 647
 * @private                                                                                                        // 648
 */                                                                                                                // 649
diff_match_patch.prototype.diff_halfMatch_ = function(text1, text2) {                                              // 650
  if (this.Diff_Timeout <= 0) {                                                                                    // 651
    // Don't risk returning a non-optimal diff if we have unlimited time.                                          // 652
    return null;                                                                                                   // 653
  }                                                                                                                // 654
  var longtext = text1.length > text2.length ? text1 : text2;                                                      // 655
  var shorttext = text1.length > text2.length ? text2 : text1;                                                     // 656
  if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {                                             // 657
    return null;  // Pointless.                                                                                    // 658
  }                                                                                                                // 659
  var dmp = this;  // 'this' becomes 'window' in a closure.                                                        // 660
                                                                                                                   // 661
  /**                                                                                                              // 662
   * Does a substring of shorttext exist within longtext such that the substring                                   // 663
   * is at least half the length of longtext?                                                                      // 664
   * Closure, but does not reference any external variables.                                                       // 665
   * @param {string} longtext Longer string.                                                                       // 666
   * @param {string} shorttext Shorter string.                                                                     // 667
   * @param {number} i Start index of quarter length substring within longtext.                                    // 668
   * @return {Array.<string>} Five element Array, containing the prefix of                                         // 669
   *     longtext, the suffix of longtext, the prefix of shorttext, the suffix                                     // 670
   *     of shorttext and the common middle.  Or null if there was no match.                                       // 671
   * @private                                                                                                      // 672
   */                                                                                                              // 673
  function diff_halfMatchI_(longtext, shorttext, i) {                                                              // 674
    // Start with a 1/4 length substring at position i as a seed.                                                  // 675
    var seed = longtext.substring(i, i + Math.floor(longtext.length / 4));                                         // 676
    var j = -1;                                                                                                    // 677
    var best_common = '';                                                                                          // 678
    var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;                                      // 679
    while ((j = shorttext.indexOf(seed, j + 1)) != -1) {                                                           // 680
      var prefixLength = dmp.diff_commonPrefix(longtext.substring(i),                                              // 681
                                               shorttext.substring(j));                                            // 682
      var suffixLength = dmp.diff_commonSuffix(longtext.substring(0, i),                                           // 683
                                               shorttext.substring(0, j));                                         // 684
      if (best_common.length < suffixLength + prefixLength) {                                                      // 685
        best_common = shorttext.substring(j - suffixLength, j) +                                                   // 686
            shorttext.substring(j, j + prefixLength);                                                              // 687
        best_longtext_a = longtext.substring(0, i - suffixLength);                                                 // 688
        best_longtext_b = longtext.substring(i + prefixLength);                                                    // 689
        best_shorttext_a = shorttext.substring(0, j - suffixLength);                                               // 690
        best_shorttext_b = shorttext.substring(j + prefixLength);                                                  // 691
      }                                                                                                            // 692
    }                                                                                                              // 693
    if (best_common.length * 2 >= longtext.length) {                                                               // 694
      return [best_longtext_a, best_longtext_b,                                                                    // 695
              best_shorttext_a, best_shorttext_b, best_common];                                                    // 696
    } else {                                                                                                       // 697
      return null;                                                                                                 // 698
    }                                                                                                              // 699
  }                                                                                                                // 700
                                                                                                                   // 701
  // First check if the second quarter is the seed for a half-match.                                               // 702
  var hm1 = diff_halfMatchI_(longtext, shorttext,                                                                  // 703
                             Math.ceil(longtext.length / 4));                                                      // 704
  // Check again based on the third quarter.                                                                       // 705
  var hm2 = diff_halfMatchI_(longtext, shorttext,                                                                  // 706
                             Math.ceil(longtext.length / 2));                                                      // 707
  var hm;                                                                                                          // 708
  if (!hm1 && !hm2) {                                                                                              // 709
    return null;                                                                                                   // 710
  } else if (!hm2) {                                                                                               // 711
    hm = hm1;                                                                                                      // 712
  } else if (!hm1) {                                                                                               // 713
    hm = hm2;                                                                                                      // 714
  } else {                                                                                                         // 715
    // Both matched.  Select the longest.                                                                          // 716
    hm = hm1[4].length > hm2[4].length ? hm1 : hm2;                                                                // 717
  }                                                                                                                // 718
                                                                                                                   // 719
  // A half-match was found, sort out the return data.                                                             // 720
  var text1_a, text1_b, text2_a, text2_b;                                                                          // 721
  if (text1.length > text2.length) {                                                                               // 722
    text1_a = hm[0];                                                                                               // 723
    text1_b = hm[1];                                                                                               // 724
    text2_a = hm[2];                                                                                               // 725
    text2_b = hm[3];                                                                                               // 726
  } else {                                                                                                         // 727
    text2_a = hm[0];                                                                                               // 728
    text2_b = hm[1];                                                                                               // 729
    text1_a = hm[2];                                                                                               // 730
    text1_b = hm[3];                                                                                               // 731
  }                                                                                                                // 732
  var mid_common = hm[4];                                                                                          // 733
  return [text1_a, text1_b, text2_a, text2_b, mid_common];                                                         // 734
};                                                                                                                 // 735
                                                                                                                   // 736
                                                                                                                   // 737
/**                                                                                                                // 738
 * Reduce the number of edits by eliminating semantically trivial equalities.                                      // 739
 * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.                                            // 740
 */                                                                                                                // 741
diff_match_patch.prototype.diff_cleanupSemantic = function(diffs) {                                                // 742
  var changes = false;                                                                                             // 743
  var equalities = [];  // Stack of indices where equalities are found.                                            // 744
  var equalitiesLength = 0;  // Keeping our own length var is faster in JS.                                        // 745
  /** @type {?string} */                                                                                           // 746
  var lastequality = null;  // Always equal to equalities[equalitiesLength-1][1]                                   // 747
  var pointer = 0;  // Index of current position.                                                                  // 748
  // Number of characters that changed prior to the equality.                                                      // 749
  var length_insertions1 = 0;                                                                                      // 750
  var length_deletions1 = 0;                                                                                       // 751
  // Number of characters that changed after the equality.                                                         // 752
  var length_insertions2 = 0;                                                                                      // 753
  var length_deletions2 = 0;                                                                                       // 754
  while (pointer < diffs.length) {                                                                                 // 755
    if (diffs[pointer][0] == DIFF_EQUAL) {  // Equality found.                                                     // 756
      equalities[equalitiesLength++] = pointer;                                                                    // 757
      length_insertions1 = length_insertions2;                                                                     // 758
      length_deletions1 = length_deletions2;                                                                       // 759
      length_insertions2 = 0;                                                                                      // 760
      length_deletions2 = 0;                                                                                       // 761
      lastequality = /** @type {string} */(diffs[pointer][1]);                                                     // 762
    } else {  // An insertion or deletion.                                                                         // 763
      if (diffs[pointer][0] == DIFF_INSERT) {                                                                      // 764
        length_insertions2 += diffs[pointer][1].length;                                                            // 765
      } else {                                                                                                     // 766
        length_deletions2 += diffs[pointer][1].length;                                                             // 767
      }                                                                                                            // 768
      // Eliminate an equality that is smaller or equal to the edits on both                                       // 769
      // sides of it.                                                                                              // 770
      if (lastequality !== null && (lastequality.length <=                                                         // 771
          Math.max(length_insertions1, length_deletions1)) &&                                                      // 772
          (lastequality.length <= Math.max(length_insertions2,                                                     // 773
                                           length_deletions2))) {                                                  // 774
        // Duplicate record.                                                                                       // 775
        diffs.splice(equalities[equalitiesLength - 1], 0,                                                          // 776
                     [DIFF_DELETE, lastequality]);                                                                 // 777
        // Change second copy to insert.                                                                           // 778
        diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;                                              // 779
        // Throw away the equality we just deleted.                                                                // 780
        equalitiesLength--;                                                                                        // 781
        // Throw away the previous equality (it needs to be reevaluated).                                          // 782
        equalitiesLength--;                                                                                        // 783
        pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;                                    // 784
        length_insertions1 = 0;  // Reset the counters.                                                            // 785
        length_deletions1 = 0;                                                                                     // 786
        length_insertions2 = 0;                                                                                    // 787
        length_deletions2 = 0;                                                                                     // 788
        lastequality = null;                                                                                       // 789
        changes = true;                                                                                            // 790
      }                                                                                                            // 791
    }                                                                                                              // 792
    pointer++;                                                                                                     // 793
  }                                                                                                                // 794
                                                                                                                   // 795
  // Normalize the diff.                                                                                           // 796
  if (changes) {                                                                                                   // 797
    this.diff_cleanupMerge(diffs);                                                                                 // 798
  }                                                                                                                // 799
  this.diff_cleanupSemanticLossless(diffs);                                                                        // 800
                                                                                                                   // 801
  // Find any overlaps between deletions and insertions.                                                           // 802
  // e.g: <del>abcxxx</del><ins>xxxdef</ins>                                                                       // 803
  //   -> <del>abc</del>xxx<ins>def</ins>                                                                          // 804
  // Only extract an overlap if it is as big as the edit ahead or behind it.                                       // 805
  pointer = 1;                                                                                                     // 806
  while (pointer < diffs.length) {                                                                                 // 807
    if (diffs[pointer - 1][0] == DIFF_DELETE &&                                                                    // 808
        diffs[pointer][0] == DIFF_INSERT) {                                                                        // 809
      var deletion = /** @type {string} */(diffs[pointer - 1][1]);                                                 // 810
      var insertion = /** @type {string} */(diffs[pointer][1]);                                                    // 811
      var overlap_length = this.diff_commonOverlap_(deletion, insertion);                                          // 812
      if (overlap_length >= deletion.length / 2 ||                                                                 // 813
          overlap_length >= insertion.length / 2) {                                                                // 814
        // Overlap found.  Insert an equality and trim the surrounding edits.                                      // 815
        diffs.splice(pointer, 0,                                                                                   // 816
            [DIFF_EQUAL, insertion.substring(0, overlap_length)]);                                                 // 817
        diffs[pointer - 1][1] =                                                                                    // 818
            deletion.substring(0, deletion.length - overlap_length);                                               // 819
        diffs[pointer + 1][1] = insertion.substring(overlap_length);                                               // 820
        pointer++;                                                                                                 // 821
      }                                                                                                            // 822
      pointer++;                                                                                                   // 823
    }                                                                                                              // 824
    pointer++;                                                                                                     // 825
  }                                                                                                                // 826
};                                                                                                                 // 827
                                                                                                                   // 828
                                                                                                                   // 829
/**                                                                                                                // 830
 * Look for single edits surrounded on both sides by equalities                                                    // 831
 * which can be shifted sideways to align the edit to a word boundary.                                             // 832
 * e.g: The c<ins>at c</ins>ame. -> The <ins>cat </ins>came.                                                       // 833
 * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.                                            // 834
 */                                                                                                                // 835
diff_match_patch.prototype.diff_cleanupSemanticLossless = function(diffs) {                                        // 836
  // Define some regex patterns for matching boundaries.                                                           // 837
  var punctuation = /[^a-zA-Z0-9]/;                                                                                // 838
  var whitespace = /\s/;                                                                                           // 839
  var linebreak = /[\r\n]/;                                                                                        // 840
  var blanklineEnd = /\n\r?\n$/;                                                                                   // 841
  var blanklineStart = /^\r?\n\r?\n/;                                                                              // 842
                                                                                                                   // 843
  /**                                                                                                              // 844
   * Given two strings, compute a score representing whether the internal                                          // 845
   * boundary falls on logical boundaries.                                                                         // 846
   * Scores range from 5 (best) to 0 (worst).                                                                      // 847
   * Closure, makes reference to regex patterns defined above.                                                     // 848
   * @param {string} one First string.                                                                             // 849
   * @param {string} two Second string.                                                                            // 850
   * @return {number} The score.                                                                                   // 851
   * @private                                                                                                      // 852
   */                                                                                                              // 853
  function diff_cleanupSemanticScore_(one, two) {                                                                  // 854
    if (!one || !two) {                                                                                            // 855
      // Edges are the best.                                                                                       // 856
      return 5;                                                                                                    // 857
    }                                                                                                              // 858
                                                                                                                   // 859
    // Each port of this function behaves slightly differently due to                                              // 860
    // subtle differences in each language's definition of things like                                             // 861
    // 'whitespace'.  Since this function's purpose is largely cosmetic,                                           // 862
    // the choice has been made to use each language's native features                                             // 863
    // rather than force total conformity.                                                                         // 864
    var score = 0;                                                                                                 // 865
    // One point for non-alphanumeric.                                                                             // 866
    if (one.charAt(one.length - 1).match(punctuation) ||                                                           // 867
        two.charAt(0).match(punctuation)) {                                                                        // 868
      score++;                                                                                                     // 869
      // Two points for whitespace.                                                                                // 870
      if (one.charAt(one.length - 1).match(whitespace) ||                                                          // 871
          two.charAt(0).match(whitespace)) {                                                                       // 872
        score++;                                                                                                   // 873
        // Three points for line breaks.                                                                           // 874
        if (one.charAt(one.length - 1).match(linebreak) ||                                                         // 875
            two.charAt(0).match(linebreak)) {                                                                      // 876
          score++;                                                                                                 // 877
          // Four points for blank lines.                                                                          // 878
          if (one.match(blanklineEnd) || two.match(blanklineStart)) {                                              // 879
            score++;                                                                                               // 880
          }                                                                                                        // 881
        }                                                                                                          // 882
      }                                                                                                            // 883
    }                                                                                                              // 884
    return score;                                                                                                  // 885
  }                                                                                                                // 886
                                                                                                                   // 887
  var pointer = 1;                                                                                                 // 888
  // Intentionally ignore the first and last element (don't need checking).                                        // 889
  while (pointer < diffs.length - 1) {                                                                             // 890
    if (diffs[pointer - 1][0] == DIFF_EQUAL &&                                                                     // 891
        diffs[pointer + 1][0] == DIFF_EQUAL) {                                                                     // 892
      // This is a single edit surrounded by equalities.                                                           // 893
      var equality1 = /** @type {string} */(diffs[pointer - 1][1]);                                                // 894
      var edit = /** @type {string} */(diffs[pointer][1]);                                                         // 895
      var equality2 = /** @type {string} */(diffs[pointer + 1][1]);                                                // 896
                                                                                                                   // 897
      // First, shift the edit as far left as possible.                                                            // 898
      var commonOffset = this.diff_commonSuffix(equality1, edit);                                                  // 899
      if (commonOffset) {                                                                                          // 900
        var commonString = edit.substring(edit.length - commonOffset);                                             // 901
        equality1 = equality1.substring(0, equality1.length - commonOffset);                                       // 902
        edit = commonString + edit.substring(0, edit.length - commonOffset);                                       // 903
        equality2 = commonString + equality2;                                                                      // 904
      }                                                                                                            // 905
                                                                                                                   // 906
      // Second, step character by character right, looking for the best fit.                                      // 907
      var bestEquality1 = equality1;                                                                               // 908
      var bestEdit = edit;                                                                                         // 909
      var bestEquality2 = equality2;                                                                               // 910
      var bestScore = diff_cleanupSemanticScore_(equality1, edit) +                                                // 911
          diff_cleanupSemanticScore_(edit, equality2);                                                             // 912
      while (edit.charAt(0) === equality2.charAt(0)) {                                                             // 913
        equality1 += edit.charAt(0);                                                                               // 914
        edit = edit.substring(1) + equality2.charAt(0);                                                            // 915
        equality2 = equality2.substring(1);                                                                        // 916
        var score = diff_cleanupSemanticScore_(equality1, edit) +                                                  // 917
            diff_cleanupSemanticScore_(edit, equality2);                                                           // 918
        // The >= encourages trailing rather than leading whitespace on edits.                                     // 919
        if (score >= bestScore) {                                                                                  // 920
          bestScore = score;                                                                                       // 921
          bestEquality1 = equality1;                                                                               // 922
          bestEdit = edit;                                                                                         // 923
          bestEquality2 = equality2;                                                                               // 924
        }                                                                                                          // 925
      }                                                                                                            // 926
                                                                                                                   // 927
      if (diffs[pointer - 1][1] != bestEquality1) {                                                                // 928
        // We have an improvement, save it back to the diff.                                                       // 929
        if (bestEquality1) {                                                                                       // 930
          diffs[pointer - 1][1] = bestEquality1;                                                                   // 931
        } else {                                                                                                   // 932
          diffs.splice(pointer - 1, 1);                                                                            // 933
          pointer--;                                                                                               // 934
        }                                                                                                          // 935
        diffs[pointer][1] = bestEdit;                                                                              // 936
        if (bestEquality2) {                                                                                       // 937
          diffs[pointer + 1][1] = bestEquality2;                                                                   // 938
        } else {                                                                                                   // 939
          diffs.splice(pointer + 1, 1);                                                                            // 940
          pointer--;                                                                                               // 941
        }                                                                                                          // 942
      }                                                                                                            // 943
    }                                                                                                              // 944
    pointer++;                                                                                                     // 945
  }                                                                                                                // 946
};                                                                                                                 // 947
                                                                                                                   // 948
                                                                                                                   // 949
/**                                                                                                                // 950
 * Reduce the number of edits by eliminating operationally trivial equalities.                                     // 951
 * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.                                            // 952
 */                                                                                                                // 953
diff_match_patch.prototype.diff_cleanupEfficiency = function(diffs) {                                              // 954
  var changes = false;                                                                                             // 955
  var equalities = [];  // Stack of indices where equalities are found.                                            // 956
  var equalitiesLength = 0;  // Keeping our own length var is faster in JS.                                        // 957
  var lastequality = '';  // Always equal to equalities[equalitiesLength-1][1]                                     // 958
  var pointer = 0;  // Index of current position.                                                                  // 959
  // Is there an insertion operation before the last equality.                                                     // 960
  var pre_ins = false;                                                                                             // 961
  // Is there a deletion operation before the last equality.                                                       // 962
  var pre_del = false;                                                                                             // 963
  // Is there an insertion operation after the last equality.                                                      // 964
  var post_ins = false;                                                                                            // 965
  // Is there a deletion operation after the last equality.                                                        // 966
  var post_del = false;                                                                                            // 967
  while (pointer < diffs.length) {                                                                                 // 968
    if (diffs[pointer][0] == DIFF_EQUAL) {  // Equality found.                                                     // 969
      if (diffs[pointer][1].length < this.Diff_EditCost &&                                                         // 970
          (post_ins || post_del)) {                                                                                // 971
        // Candidate found.                                                                                        // 972
        equalities[equalitiesLength++] = pointer;                                                                  // 973
        pre_ins = post_ins;                                                                                        // 974
        pre_del = post_del;                                                                                        // 975
        lastequality = diffs[pointer][1];                                                                          // 976
      } else {                                                                                                     // 977
        // Not a candidate, and can never become one.                                                              // 978
        equalitiesLength = 0;                                                                                      // 979
        lastequality = '';                                                                                         // 980
      }                                                                                                            // 981
      post_ins = post_del = false;                                                                                 // 982
    } else {  // An insertion or deletion.                                                                         // 983
      if (diffs[pointer][0] == DIFF_DELETE) {                                                                      // 984
        post_del = true;                                                                                           // 985
      } else {                                                                                                     // 986
        post_ins = true;                                                                                           // 987
      }                                                                                                            // 988
      /*                                                                                                           // 989
       * Five types to be split:                                                                                   // 990
       * <ins>A</ins><del>B</del>XY<ins>C</ins><del>D</del>                                                        // 991
       * <ins>A</ins>X<ins>C</ins><del>D</del>                                                                     // 992
       * <ins>A</ins><del>B</del>X<ins>C</ins>                                                                     // 993
       * <ins>A</del>X<ins>C</ins><del>D</del>                                                                     // 994
       * <ins>A</ins><del>B</del>X<del>C</del>                                                                     // 995
       */                                                                                                          // 996
      if (lastequality && ((pre_ins && pre_del && post_ins && post_del) ||                                         // 997
                           ((lastequality.length < this.Diff_EditCost / 2) &&                                      // 998
                            (pre_ins + pre_del + post_ins + post_del) == 3))) {                                    // 999
        // Duplicate record.                                                                                       // 1000
        diffs.splice(equalities[equalitiesLength - 1], 0,                                                          // 1001
                     [DIFF_DELETE, lastequality]);                                                                 // 1002
        // Change second copy to insert.                                                                           // 1003
        diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;                                              // 1004
        equalitiesLength--;  // Throw away the equality we just deleted;                                           // 1005
        lastequality = '';                                                                                         // 1006
        if (pre_ins && pre_del) {                                                                                  // 1007
          // No changes made which could affect previous entry, keep going.                                        // 1008
          post_ins = post_del = true;                                                                              // 1009
          equalitiesLength = 0;                                                                                    // 1010
        } else {                                                                                                   // 1011
          equalitiesLength--;  // Throw away the previous equality.                                                // 1012
          pointer = equalitiesLength > 0 ?                                                                         // 1013
              equalities[equalitiesLength - 1] : -1;                                                               // 1014
          post_ins = post_del = false;                                                                             // 1015
        }                                                                                                          // 1016
        changes = true;                                                                                            // 1017
      }                                                                                                            // 1018
    }                                                                                                              // 1019
    pointer++;                                                                                                     // 1020
  }                                                                                                                // 1021
                                                                                                                   // 1022
  if (changes) {                                                                                                   // 1023
    this.diff_cleanupMerge(diffs);                                                                                 // 1024
  }                                                                                                                // 1025
};                                                                                                                 // 1026
                                                                                                                   // 1027
                                                                                                                   // 1028
/**                                                                                                                // 1029
 * Reorder and merge like edit sections.  Merge equalities.                                                        // 1030
 * Any edit section can move as long as it doesn't cross an equality.                                              // 1031
 * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.                                            // 1032
 */                                                                                                                // 1033
diff_match_patch.prototype.diff_cleanupMerge = function(diffs) {                                                   // 1034
  diffs.push([DIFF_EQUAL, '']);  // Add a dummy entry at the end.                                                  // 1035
  var pointer = 0;                                                                                                 // 1036
  var count_delete = 0;                                                                                            // 1037
  var count_insert = 0;                                                                                            // 1038
  var text_delete = '';                                                                                            // 1039
  var text_insert = '';                                                                                            // 1040
  var commonlength;                                                                                                // 1041
  while (pointer < diffs.length) {                                                                                 // 1042
    switch (diffs[pointer][0]) {                                                                                   // 1043
      case DIFF_INSERT:                                                                                            // 1044
        count_insert++;                                                                                            // 1045
        text_insert += diffs[pointer][1];                                                                          // 1046
        pointer++;                                                                                                 // 1047
        break;                                                                                                     // 1048
      case DIFF_DELETE:                                                                                            // 1049
        count_delete++;                                                                                            // 1050
        text_delete += diffs[pointer][1];                                                                          // 1051
        pointer++;                                                                                                 // 1052
        break;                                                                                                     // 1053
      case DIFF_EQUAL:                                                                                             // 1054
        // Upon reaching an equality, check for prior redundancies.                                                // 1055
        if (count_delete + count_insert > 1) {                                                                     // 1056
          if (count_delete !== 0 && count_insert !== 0) {                                                          // 1057
            // Factor out any common prefixies.                                                                    // 1058
            commonlength = this.diff_commonPrefix(text_insert, text_delete);                                       // 1059
            if (commonlength !== 0) {                                                                              // 1060
              if ((pointer - count_delete - count_insert) > 0 &&                                                   // 1061
                  diffs[pointer - count_delete - count_insert - 1][0] ==                                           // 1062
                  DIFF_EQUAL) {                                                                                    // 1063
                diffs[pointer - count_delete - count_insert - 1][1] +=                                             // 1064
                    text_insert.substring(0, commonlength);                                                        // 1065
              } else {                                                                                             // 1066
                diffs.splice(0, 0, [DIFF_EQUAL,                                                                    // 1067
                                    text_insert.substring(0, commonlength)]);                                      // 1068
                pointer++;                                                                                         // 1069
              }                                                                                                    // 1070
              text_insert = text_insert.substring(commonlength);                                                   // 1071
              text_delete = text_delete.substring(commonlength);                                                   // 1072
            }                                                                                                      // 1073
            // Factor out any common suffixies.                                                                    // 1074
            commonlength = this.diff_commonSuffix(text_insert, text_delete);                                       // 1075
            if (commonlength !== 0) {                                                                              // 1076
              diffs[pointer][1] = text_insert.substring(text_insert.length -                                       // 1077
                  commonlength) + diffs[pointer][1];                                                               // 1078
              text_insert = text_insert.substring(0, text_insert.length -                                          // 1079
                  commonlength);                                                                                   // 1080
              text_delete = text_delete.substring(0, text_delete.length -                                          // 1081
                  commonlength);                                                                                   // 1082
            }                                                                                                      // 1083
          }                                                                                                        // 1084
          // Delete the offending records and add the merged ones.                                                 // 1085
          if (count_delete === 0) {                                                                                // 1086
            diffs.splice(pointer - count_delete - count_insert,                                                    // 1087
                count_delete + count_insert, [DIFF_INSERT, text_insert]);                                          // 1088
          } else if (count_insert === 0) {                                                                         // 1089
            diffs.splice(pointer - count_delete - count_insert,                                                    // 1090
                count_delete + count_insert, [DIFF_DELETE, text_delete]);                                          // 1091
          } else {                                                                                                 // 1092
            diffs.splice(pointer - count_delete - count_insert,                                                    // 1093
                count_delete + count_insert, [DIFF_DELETE, text_delete],                                           // 1094
                [DIFF_INSERT, text_insert]);                                                                       // 1095
          }                                                                                                        // 1096
          pointer = pointer - count_delete - count_insert +                                                        // 1097
                    (count_delete ? 1 : 0) + (count_insert ? 1 : 0) + 1;                                           // 1098
        } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) {                                         // 1099
          // Merge this equality with the previous one.                                                            // 1100
          diffs[pointer - 1][1] += diffs[pointer][1];                                                              // 1101
          diffs.splice(pointer, 1);                                                                                // 1102
        } else {                                                                                                   // 1103
          pointer++;                                                                                               // 1104
        }                                                                                                          // 1105
        count_insert = 0;                                                                                          // 1106
        count_delete = 0;                                                                                          // 1107
        text_delete = '';                                                                                          // 1108
        text_insert = '';                                                                                          // 1109
        break;                                                                                                     // 1110
    }                                                                                                              // 1111
  }                                                                                                                // 1112
  if (diffs[diffs.length - 1][1] === '') {                                                                         // 1113
    diffs.pop();  // Remove the dummy entry at the end.                                                            // 1114
  }                                                                                                                // 1115
                                                                                                                   // 1116
  // Second pass: look for single edits surrounded on both sides by equalities                                     // 1117
  // which can be shifted sideways to eliminate an equality.                                                       // 1118
  // e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC                                                                       // 1119
  var changes = false;                                                                                             // 1120
  pointer = 1;                                                                                                     // 1121
  // Intentionally ignore the first and last element (don't need checking).                                        // 1122
  while (pointer < diffs.length - 1) {                                                                             // 1123
    if (diffs[pointer - 1][0] == DIFF_EQUAL &&                                                                     // 1124
        diffs[pointer + 1][0] == DIFF_EQUAL) {                                                                     // 1125
      // This is a single edit surrounded by equalities.                                                           // 1126
      if (diffs[pointer][1].substring(diffs[pointer][1].length -                                                   // 1127
          diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) {                                                // 1128
        // Shift the edit over the previous equality.                                                              // 1129
        diffs[pointer][1] = diffs[pointer - 1][1] +                                                                // 1130
            diffs[pointer][1].substring(0, diffs[pointer][1].length -                                              // 1131
                                        diffs[pointer - 1][1].length);                                             // 1132
        diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];                                     // 1133
        diffs.splice(pointer - 1, 1);                                                                              // 1134
        changes = true;                                                                                            // 1135
      } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) ==                                   // 1136
          diffs[pointer + 1][1]) {                                                                                 // 1137
        // Shift the edit over the next equality.                                                                  // 1138
        diffs[pointer - 1][1] += diffs[pointer + 1][1];                                                            // 1139
        diffs[pointer][1] =                                                                                        // 1140
            diffs[pointer][1].substring(diffs[pointer + 1][1].length) +                                            // 1141
            diffs[pointer + 1][1];                                                                                 // 1142
        diffs.splice(pointer + 1, 1);                                                                              // 1143
        changes = true;                                                                                            // 1144
      }                                                                                                            // 1145
    }                                                                                                              // 1146
    pointer++;                                                                                                     // 1147
  }                                                                                                                // 1148
  // If shifts were made, the diff needs reordering and another shift sweep.                                       // 1149
  if (changes) {                                                                                                   // 1150
    this.diff_cleanupMerge(diffs);                                                                                 // 1151
  }                                                                                                                // 1152
};                                                                                                                 // 1153
                                                                                                                   // 1154
                                                                                                                   // 1155
/**                                                                                                                // 1156
 * loc is a location in text1, compute and return the equivalent location in                                       // 1157
 * text2.                                                                                                          // 1158
 * e.g. 'The cat' vs 'The big cat', 1->1, 5->8                                                                     // 1159
 * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.                                            // 1160
 * @param {number} loc Location within text1.                                                                      // 1161
 * @return {number} Location within text2.                                                                         // 1162
 */                                                                                                                // 1163
diff_match_patch.prototype.diff_xIndex = function(diffs, loc) {                                                    // 1164
  var chars1 = 0;                                                                                                  // 1165
  var chars2 = 0;                                                                                                  // 1166
  var last_chars1 = 0;                                                                                             // 1167
  var last_chars2 = 0;                                                                                             // 1168
  var x;                                                                                                           // 1169
  for (x = 0; x < diffs.length; x++) {                                                                             // 1170
    if (diffs[x][0] !== DIFF_INSERT) {  // Equality or deletion.                                                   // 1171
      chars1 += diffs[x][1].length;                                                                                // 1172
    }                                                                                                              // 1173
    if (diffs[x][0] !== DIFF_DELETE) {  // Equality or insertion.                                                  // 1174
      chars2 += diffs[x][1].length;                                                                                // 1175
    }                                                                                                              // 1176
    if (chars1 > loc) {  // Overshot the location.                                                                 // 1177
      break;                                                                                                       // 1178
    }                                                                                                              // 1179
    last_chars1 = chars1;                                                                                          // 1180
    last_chars2 = chars2;                                                                                          // 1181
  }                                                                                                                // 1182
  // Was the location was deleted?                                                                                 // 1183
  if (diffs.length != x && diffs[x][0] === DIFF_DELETE) {                                                          // 1184
    return last_chars2;                                                                                            // 1185
  }                                                                                                                // 1186
  // Add the remaining character length.                                                                           // 1187
  return last_chars2 + (loc - last_chars1);                                                                        // 1188
};                                                                                                                 // 1189
                                                                                                                   // 1190
                                                                                                                   // 1191
/**                                                                                                                // 1192
 * Convert a diff array into a pretty HTML report.                                                                 // 1193
 * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.                                            // 1194
 * @return {string} HTML representation.                                                                           // 1195
 */                                                                                                                // 1196
diff_match_patch.prototype.diff_prettyHtml = function(diffs) {                                                     // 1197
  var html = [];                                                                                                   // 1198
  var i = 0;                                                                                                       // 1199
  var pattern_amp = /&/g;                                                                                          // 1200
  var pattern_lt = /</g;                                                                                           // 1201
  var pattern_gt = />/g;                                                                                           // 1202
  var pattern_para = /\n/g;                                                                                        // 1203
  for (var x = 0; x < diffs.length; x++) {                                                                         // 1204
    var op = diffs[x][0];    // Operation (insert, delete, equal)                                                  // 1205
    var data = diffs[x][1];  // Text of change.                                                                    // 1206
    var text = data.replace(pattern_amp, '&amp;').replace(pattern_lt, '&lt;')                                      // 1207
        .replace(pattern_gt, '&gt;').replace(pattern_para, '&para;<br>');                                          // 1208
    switch (op) {                                                                                                  // 1209
      case DIFF_INSERT:                                                                                            // 1210
        html[x] = '<ins style="background:#e6ffe6;">' + text + '</ins>';                                           // 1211
        break;                                                                                                     // 1212
      case DIFF_DELETE:                                                                                            // 1213
        html[x] = '<del style="background:#ffe6e6;">' + text + '</del>';                                           // 1214
        break;                                                                                                     // 1215
      case DIFF_EQUAL:                                                                                             // 1216
        html[x] = '<span>' + text + '</span>';                                                                     // 1217
        break;                                                                                                     // 1218
    }                                                                                                              // 1219
    if (op !== DIFF_DELETE) {                                                                                      // 1220
      i += data.length;                                                                                            // 1221
    }                                                                                                              // 1222
  }                                                                                                                // 1223
  return html.join('');                                                                                            // 1224
};                                                                                                                 // 1225
                                                                                                                   // 1226
                                                                                                                   // 1227
/**                                                                                                                // 1228
 * Compute and return the source text (all equalities and deletions).                                              // 1229
 * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.                                            // 1230
 * @return {string} Source text.                                                                                   // 1231
 */                                                                                                                // 1232
diff_match_patch.prototype.diff_text1 = function(diffs) {                                                          // 1233
  var text = [];                                                                                                   // 1234
  for (var x = 0; x < diffs.length; x++) {                                                                         // 1235
    if (diffs[x][0] !== DIFF_INSERT) {                                                                             // 1236
      text[x] = diffs[x][1];                                                                                       // 1237
    }                                                                                                              // 1238
  }                                                                                                                // 1239
  return text.join('');                                                                                            // 1240
};                                                                                                                 // 1241
                                                                                                                   // 1242
                                                                                                                   // 1243
/**                                                                                                                // 1244
 * Compute and return the destination text (all equalities and insertions).                                        // 1245
 * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.                                            // 1246
 * @return {string} Destination text.                                                                              // 1247
 */                                                                                                                // 1248
diff_match_patch.prototype.diff_text2 = function(diffs) {                                                          // 1249
  var text = [];                                                                                                   // 1250
  for (var x = 0; x < diffs.length; x++) {                                                                         // 1251
    if (diffs[x][0] !== DIFF_DELETE) {                                                                             // 1252
      text[x] = diffs[x][1];                                                                                       // 1253
    }                                                                                                              // 1254
  }                                                                                                                // 1255
  return text.join('');                                                                                            // 1256
};                                                                                                                 // 1257
                                                                                                                   // 1258
                                                                                                                   // 1259
/**                                                                                                                // 1260
 * Compute the Levenshtein distance; the number of inserted, deleted or                                            // 1261
 * substituted characters.                                                                                         // 1262
 * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.                                            // 1263
 * @return {number} Number of changes.                                                                             // 1264
 */                                                                                                                // 1265
diff_match_patch.prototype.diff_levenshtein = function(diffs) {                                                    // 1266
  var levenshtein = 0;                                                                                             // 1267
  var insertions = 0;                                                                                              // 1268
  var deletions = 0;                                                                                               // 1269
  for (var x = 0; x < diffs.length; x++) {                                                                         // 1270
    var op = diffs[x][0];                                                                                          // 1271
    var data = diffs[x][1];                                                                                        // 1272
    switch (op) {                                                                                                  // 1273
      case DIFF_INSERT:                                                                                            // 1274
        insertions += data.length;                                                                                 // 1275
        break;                                                                                                     // 1276
      case DIFF_DELETE:                                                                                            // 1277
        deletions += data.length;                                                                                  // 1278
        break;                                                                                                     // 1279
      case DIFF_EQUAL:                                                                                             // 1280
        // A deletion and an insertion is one substitution.                                                        // 1281
        levenshtein += Math.max(insertions, deletions);                                                            // 1282
        insertions = 0;                                                                                            // 1283
        deletions = 0;                                                                                             // 1284
        break;                                                                                                     // 1285
    }                                                                                                              // 1286
  }                                                                                                                // 1287
  levenshtein += Math.max(insertions, deletions);                                                                  // 1288
  return levenshtein;                                                                                              // 1289
};                                                                                                                 // 1290
                                                                                                                   // 1291
                                                                                                                   // 1292
/**                                                                                                                // 1293
 * Crush the diff into an encoded string which describes the operations                                            // 1294
 * required to transform text1 into text2.                                                                         // 1295
 * E.g. =3\t-2\t+ing  -> Keep 3 chars, delete 2 chars, insert 'ing'.                                               // 1296
 * Operations are tab-separated.  Inserted text is escaped using %xx notation.                                     // 1297
 * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.                                            // 1298
 * @return {string} Delta text.                                                                                    // 1299
 */                                                                                                                // 1300
diff_match_patch.prototype.diff_toDelta = function(diffs) {                                                        // 1301
  var text = [];                                                                                                   // 1302
  for (var x = 0; x < diffs.length; x++) {                                                                         // 1303
    switch (diffs[x][0]) {                                                                                         // 1304
      case DIFF_INSERT:                                                                                            // 1305
        text[x] = '+' + encodeURI(diffs[x][1]);                                                                    // 1306
        break;                                                                                                     // 1307
      case DIFF_DELETE:                                                                                            // 1308
        text[x] = '-' + diffs[x][1].length;                                                                        // 1309
        break;                                                                                                     // 1310
      case DIFF_EQUAL:                                                                                             // 1311
        text[x] = '=' + diffs[x][1].length;                                                                        // 1312
        break;                                                                                                     // 1313
    }                                                                                                              // 1314
  }                                                                                                                // 1315
  return text.join('\t').replace(/%20/g, ' ');                                                                     // 1316
};                                                                                                                 // 1317
                                                                                                                   // 1318
                                                                                                                   // 1319
/**                                                                                                                // 1320
 * Given the original text1, and an encoded string which describes the                                             // 1321
 * operations required to transform text1 into text2, compute the full diff.                                       // 1322
 * @param {string} text1 Source string for the diff.                                                               // 1323
 * @param {string} delta Delta text.                                                                               // 1324
 * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.                                                 // 1325
 * @throws {!Error} If invalid input.                                                                              // 1326
 */                                                                                                                // 1327
diff_match_patch.prototype.diff_fromDelta = function(text1, delta) {                                               // 1328
  var diffs = [];                                                                                                  // 1329
  var diffsLength = 0;  // Keeping our own length var is faster in JS.                                             // 1330
  var pointer = 0;  // Cursor in text1                                                                             // 1331
  var tokens = delta.split(/\t/g);                                                                                 // 1332
  for (var x = 0; x < tokens.length; x++) {                                                                        // 1333
    // Each token begins with a one character parameter which specifies the                                        // 1334
    // operation of this token (delete, insert, equality).                                                         // 1335
    var param = tokens[x].substring(1);                                                                            // 1336
    switch (tokens[x].charAt(0)) {                                                                                 // 1337
      case '+':                                                                                                    // 1338
        try {                                                                                                      // 1339
          diffs[diffsLength++] = [DIFF_INSERT, decodeURI(param)];                                                  // 1340
        } catch (ex) {                                                                                             // 1341
          // Malformed URI sequence.                                                                               // 1342
          throw new Error('Illegal escape in diff_fromDelta: ' + param);                                           // 1343
        }                                                                                                          // 1344
        break;                                                                                                     // 1345
      case '-':                                                                                                    // 1346
        // Fall through.                                                                                           // 1347
      case '=':                                                                                                    // 1348
        var n = parseInt(param, 10);                                                                               // 1349
        if (isNaN(n) || n < 0) {                                                                                   // 1350
          throw new Error('Invalid number in diff_fromDelta: ' + param);                                           // 1351
        }                                                                                                          // 1352
        var text = text1.substring(pointer, pointer += n);                                                         // 1353
        if (tokens[x].charAt(0) == '=') {                                                                          // 1354
          diffs[diffsLength++] = [DIFF_EQUAL, text];                                                               // 1355
        } else {                                                                                                   // 1356
          diffs[diffsLength++] = [DIFF_DELETE, text];                                                              // 1357
        }                                                                                                          // 1358
        break;                                                                                                     // 1359
      default:                                                                                                     // 1360
        // Blank tokens are ok (from a trailing \t).                                                               // 1361
        // Anything else is an error.                                                                              // 1362
        if (tokens[x]) {                                                                                           // 1363
          throw new Error('Invalid diff operation in diff_fromDelta: ' +                                           // 1364
                          tokens[x]);                                                                              // 1365
        }                                                                                                          // 1366
    }                                                                                                              // 1367
  }                                                                                                                // 1368
  if (pointer != text1.length) {                                                                                   // 1369
    throw new Error('Delta length (' + pointer +                                                                   // 1370
        ') does not equal source text length (' + text1.length + ').');                                            // 1371
  }                                                                                                                // 1372
  return diffs;                                                                                                    // 1373
};                                                                                                                 // 1374
                                                                                                                   // 1375
                                                                                                                   // 1376
//  MATCH FUNCTIONS                                                                                                // 1377
                                                                                                                   // 1378
                                                                                                                   // 1379
/**                                                                                                                // 1380
 * Locate the best instance of 'pattern' in 'text' near 'loc'.                                                     // 1381
 * @param {string} text The text to search.                                                                        // 1382
 * @param {string} pattern The pattern to search for.                                                              // 1383
 * @param {number} loc The location to search around.                                                              // 1384
 * @return {number} Best match index or -1.                                                                        // 1385
 */                                                                                                                // 1386
diff_match_patch.prototype.match_main = function(text, pattern, loc) {                                             // 1387
  // Check for null inputs.                                                                                        // 1388
  if (text == null || pattern == null || loc == null) {                                                            // 1389
    throw new Error('Null input. (match_main)');                                                                   // 1390
  }                                                                                                                // 1391
                                                                                                                   // 1392
  loc = Math.max(0, Math.min(loc, text.length));                                                                   // 1393
  if (text == pattern) {                                                                                           // 1394
    // Shortcut (potentially not guaranteed by the algorithm)                                                      // 1395
    return 0;                                                                                                      // 1396
  } else if (!text.length) {                                                                                       // 1397
    // Nothing to match.                                                                                           // 1398
    return -1;                                                                                                     // 1399
  } else if (text.substring(loc, loc + pattern.length) == pattern) {                                               // 1400
    // Perfect match at the perfect spot!  (Includes case of null pattern)                                         // 1401
    return loc;                                                                                                    // 1402
  } else {                                                                                                         // 1403
    // Do a fuzzy compare.                                                                                         // 1404
    return this.match_bitap_(text, pattern, loc);                                                                  // 1405
  }                                                                                                                // 1406
};                                                                                                                 // 1407
                                                                                                                   // 1408
                                                                                                                   // 1409
/**                                                                                                                // 1410
 * Locate the best instance of 'pattern' in 'text' near 'loc' using the                                            // 1411
 * Bitap algorithm.                                                                                                // 1412
 * @param {string} text The text to search.                                                                        // 1413
 * @param {string} pattern The pattern to search for.                                                              // 1414
 * @param {number} loc The location to search around.                                                              // 1415
 * @return {number} Best match index or -1.                                                                        // 1416
 * @private                                                                                                        // 1417
 */                                                                                                                // 1418
diff_match_patch.prototype.match_bitap_ = function(text, pattern, loc) {                                           // 1419
  if (pattern.length > this.Match_MaxBits) {                                                                       // 1420
    throw new Error('Pattern too long for this browser.');                                                         // 1421
  }                                                                                                                // 1422
                                                                                                                   // 1423
  // Initialise the alphabet.                                                                                      // 1424
  var s = this.match_alphabet_(pattern);                                                                           // 1425
                                                                                                                   // 1426
  var dmp = this;  // 'this' becomes 'window' in a closure.                                                        // 1427
                                                                                                                   // 1428
  /**                                                                                                              // 1429
   * Compute and return the score for a match with e errors and x location.                                        // 1430
   * Accesses loc and pattern through being a closure.                                                             // 1431
   * @param {number} e Number of errors in match.                                                                  // 1432
   * @param {number} x Location of match.                                                                          // 1433
   * @return {number} Overall score for match (0.0 = good, 1.0 = bad).                                             // 1434
   * @private                                                                                                      // 1435
   */                                                                                                              // 1436
  function match_bitapScore_(e, x) {                                                                               // 1437
    var accuracy = e / pattern.length;                                                                             // 1438
    var proximity = Math.abs(loc - x);                                                                             // 1439
    if (!dmp.Match_Distance) {                                                                                     // 1440
      // Dodge divide by zero error.                                                                               // 1441
      return proximity ? 1.0 : accuracy;                                                                           // 1442
    }                                                                                                              // 1443
    return accuracy + (proximity / dmp.Match_Distance);                                                            // 1444
  }                                                                                                                // 1445
                                                                                                                   // 1446
  // Highest score beyond which we give up.                                                                        // 1447
  var score_threshold = this.Match_Threshold;                                                                      // 1448
  // Is there a nearby exact match? (speedup)                                                                      // 1449
  var best_loc = text.indexOf(pattern, loc);                                                                       // 1450
  if (best_loc != -1) {                                                                                            // 1451
    score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold);                                   // 1452
    // What about in the other direction? (speedup)                                                                // 1453
    best_loc = text.lastIndexOf(pattern, loc + pattern.length);                                                    // 1454
    if (best_loc != -1) {                                                                                          // 1455
      score_threshold =                                                                                            // 1456
          Math.min(match_bitapScore_(0, best_loc), score_threshold);                                               // 1457
    }                                                                                                              // 1458
  }                                                                                                                // 1459
                                                                                                                   // 1460
  // Initialise the bit arrays.                                                                                    // 1461
  var matchmask = 1 << (pattern.length - 1);                                                                       // 1462
  best_loc = -1;                                                                                                   // 1463
                                                                                                                   // 1464
  var bin_min, bin_mid;                                                                                            // 1465
  var bin_max = pattern.length + text.length;                                                                      // 1466
  var last_rd;                                                                                                     // 1467
  for (var d = 0; d < pattern.length; d++) {                                                                       // 1468
    // Scan for the best match; each iteration allows for one more error.                                          // 1469
    // Run a binary search to determine how far from 'loc' we can stray at this                                    // 1470
    // error level.                                                                                                // 1471
    bin_min = 0;                                                                                                   // 1472
    bin_mid = bin_max;                                                                                             // 1473
    while (bin_min < bin_mid) {                                                                                    // 1474
      if (match_bitapScore_(d, loc + bin_mid) <= score_threshold) {                                                // 1475
        bin_min = bin_mid;                                                                                         // 1476
      } else {                                                                                                     // 1477
        bin_max = bin_mid;                                                                                         // 1478
      }                                                                                                            // 1479
      bin_mid = Math.floor((bin_max - bin_min) / 2 + bin_min);                                                     // 1480
    }                                                                                                              // 1481
    // Use the result from this iteration as the maximum for the next.                                             // 1482
    bin_max = bin_mid;                                                                                             // 1483
    var start = Math.max(1, loc - bin_mid + 1);                                                                    // 1484
    var finish = Math.min(loc + bin_mid, text.length) + pattern.length;                                            // 1485
                                                                                                                   // 1486
    var rd = Array(finish + 2);                                                                                    // 1487
    rd[finish + 1] = (1 << d) - 1;                                                                                 // 1488
    for (var j = finish; j >= start; j--) {                                                                        // 1489
      // The alphabet (s) is a sparse hash, so the following line generates                                        // 1490
      // warnings.                                                                                                 // 1491
      var charMatch = s[text.charAt(j - 1)];                                                                       // 1492
      if (d === 0) {  // First pass: exact match.                                                                  // 1493
        rd[j] = ((rd[j + 1] << 1) | 1) & charMatch;                                                                // 1494
      } else {  // Subsequent passes: fuzzy match.                                                                 // 1495
        rd[j] = ((rd[j + 1] << 1) | 1) & charMatch |                                                               // 1496
                (((last_rd[j + 1] | last_rd[j]) << 1) | 1) |                                                       // 1497
                last_rd[j + 1];                                                                                    // 1498
      }                                                                                                            // 1499
      if (rd[j] & matchmask) {                                                                                     // 1500
        var score = match_bitapScore_(d, j - 1);                                                                   // 1501
        // This match will almost certainly be better than any existing match.                                     // 1502
        // But check anyway.                                                                                       // 1503
        if (score <= score_threshold) {                                                                            // 1504
          // Told you so.                                                                                          // 1505
          score_threshold = score;                                                                                 // 1506
          best_loc = j - 1;                                                                                        // 1507
          if (best_loc > loc) {                                                                                    // 1508
            // When passing loc, don't exceed our current distance from loc.                                       // 1509
            start = Math.max(1, 2 * loc - best_loc);                                                               // 1510
          } else {                                                                                                 // 1511
            // Already passed loc, downhill from here on in.                                                       // 1512
            break;                                                                                                 // 1513
          }                                                                                                        // 1514
        }                                                                                                          // 1515
      }                                                                                                            // 1516
    }                                                                                                              // 1517
    // No hope for a (better) match at greater error levels.                                                       // 1518
    if (match_bitapScore_(d + 1, loc) > score_threshold) {                                                         // 1519
      break;                                                                                                       // 1520
    }                                                                                                              // 1521
    last_rd = rd;                                                                                                  // 1522
  }                                                                                                                // 1523
  return best_loc;                                                                                                 // 1524
};                                                                                                                 // 1525
                                                                                                                   // 1526
                                                                                                                   // 1527
/**                                                                                                                // 1528
 * Initialise the alphabet for the Bitap algorithm.                                                                // 1529
 * @param {string} pattern The text to encode.                                                                     // 1530
 * @return {!Object} Hash of character locations.                                                                  // 1531
 * @private                                                                                                        // 1532
 */                                                                                                                // 1533
diff_match_patch.prototype.match_alphabet_ = function(pattern) {                                                   // 1534
  var s = {};                                                                                                      // 1535
  for (var i = 0; i < pattern.length; i++) {                                                                       // 1536
    s[pattern.charAt(i)] = 0;                                                                                      // 1537
  }                                                                                                                // 1538
  for (var i = 0; i < pattern.length; i++) {                                                                       // 1539
    s[pattern.charAt(i)] |= 1 << (pattern.length - i - 1);                                                         // 1540
  }                                                                                                                // 1541
  return s;                                                                                                        // 1542
};                                                                                                                 // 1543
                                                                                                                   // 1544
                                                                                                                   // 1545
//  PATCH FUNCTIONS                                                                                                // 1546
                                                                                                                   // 1547
                                                                                                                   // 1548
/**                                                                                                                // 1549
 * Increase the context until it is unique,                                                                        // 1550
 * but don't let the pattern expand beyond Match_MaxBits.                                                          // 1551
 * @param {!diff_match_patch.patch_obj} patch The patch to grow.                                                   // 1552
 * @param {string} text Source text.                                                                               // 1553
 * @private                                                                                                        // 1554
 */                                                                                                                // 1555
diff_match_patch.prototype.patch_addContext_ = function(patch, text) {                                             // 1556
  if (text.length == 0) {                                                                                          // 1557
    return;                                                                                                        // 1558
  }                                                                                                                // 1559
  var pattern = text.substring(patch.start2, patch.start2 + patch.length1);                                        // 1560
  var padding = 0;                                                                                                 // 1561
                                                                                                                   // 1562
  // Look for the first and last matches of pattern in text.  If two different                                     // 1563
  // matches are found, increase the pattern length.                                                               // 1564
  while (text.indexOf(pattern) != text.lastIndexOf(pattern) &&                                                     // 1565
         pattern.length < this.Match_MaxBits - this.Patch_Margin -                                                 // 1566
         this.Patch_Margin) {                                                                                      // 1567
    padding += this.Patch_Margin;                                                                                  // 1568
    pattern = text.substring(patch.start2 - padding,                                                               // 1569
                             patch.start2 + patch.length1 + padding);                                              // 1570
  }                                                                                                                // 1571
  // Add one chunk for good luck.                                                                                  // 1572
  padding += this.Patch_Margin;                                                                                    // 1573
                                                                                                                   // 1574
  // Add the prefix.                                                                                               // 1575
  var prefix = text.substring(patch.start2 - padding, patch.start2);                                               // 1576
  if (prefix) {                                                                                                    // 1577
    patch.diffs.unshift([DIFF_EQUAL, prefix]);                                                                     // 1578
  }                                                                                                                // 1579
  // Add the suffix.                                                                                               // 1580
  var suffix = text.substring(patch.start2 + patch.length1,                                                        // 1581
                              patch.start2 + patch.length1 + padding);                                             // 1582
  if (suffix) {                                                                                                    // 1583
    patch.diffs.push([DIFF_EQUAL, suffix]);                                                                        // 1584
  }                                                                                                                // 1585
                                                                                                                   // 1586
  // Roll back the start points.                                                                                   // 1587
  patch.start1 -= prefix.length;                                                                                   // 1588
  patch.start2 -= prefix.length;                                                                                   // 1589
  // Extend the lengths.                                                                                           // 1590
  patch.length1 += prefix.length + suffix.length;                                                                  // 1591
  patch.length2 += prefix.length + suffix.length;                                                                  // 1592
};                                                                                                                 // 1593
                                                                                                                   // 1594
                                                                                                                   // 1595
/**                                                                                                                // 1596
 * Compute a list of patches to turn text1 into text2.                                                             // 1597
 * Use diffs if provided, otherwise compute it ourselves.                                                          // 1598
 * There are four ways to call this function, depending on what data is                                            // 1599
 * available to the caller:                                                                                        // 1600
 * Method 1:                                                                                                       // 1601
 * a = text1, b = text2                                                                                            // 1602
 * Method 2:                                                                                                       // 1603
 * a = diffs                                                                                                       // 1604
 * Method 3 (optimal):                                                                                             // 1605
 * a = text1, b = diffs                                                                                            // 1606
 * Method 4 (deprecated, use method 3):                                                                            // 1607
 * a = text1, b = text2, c = diffs                                                                                 // 1608
 *                                                                                                                 // 1609
 * @param {string|!Array.<!diff_match_patch.Diff>} a text1 (methods 1,3,4) or                                      // 1610
 * Array of diff tuples for text1 to text2 (method 2).                                                             // 1611
 * @param {string|!Array.<!diff_match_patch.Diff>} opt_b text2 (methods 1,4) or                                    // 1612
 * Array of diff tuples for text1 to text2 (method 3) or undefined (method 2).                                     // 1613
 * @param {string|!Array.<!diff_match_patch.Diff>} opt_c Array of diff tuples                                      // 1614
 * for text1 to text2 (method 4) or undefined (methods 1,2,3).                                                     // 1615
 * @return {!Array.<!diff_match_patch.patch_obj>} Array of patch objects.                                          // 1616
 */                                                                                                                // 1617
diff_match_patch.prototype.patch_make = function(a, opt_b, opt_c) {                                                // 1618
  var text1, diffs;                                                                                                // 1619
  if (typeof a == 'string' && typeof opt_b == 'string' &&                                                          // 1620
      typeof opt_c == 'undefined') {                                                                               // 1621
    // Method 1: text1, text2                                                                                      // 1622
    // Compute diffs from text1 and text2.                                                                         // 1623
    text1 = /** @type {string} */(a);                                                                              // 1624
    diffs = this.diff_main(text1, /** @type {string} */(opt_b), true);                                             // 1625
    if (diffs.length > 2) {                                                                                        // 1626
      this.diff_cleanupSemantic(diffs);                                                                            // 1627
      this.diff_cleanupEfficiency(diffs);                                                                          // 1628
    }                                                                                                              // 1629
  } else if (a && typeof a == 'object' && typeof opt_b == 'undefined' &&                                           // 1630
      typeof opt_c == 'undefined') {                                                                               // 1631
    // Method 2: diffs                                                                                             // 1632
    // Compute text1 from diffs.                                                                                   // 1633
    diffs = /** @type {!Array.<!diff_match_patch.Diff>} */(a);                                                     // 1634
    text1 = this.diff_text1(diffs);                                                                                // 1635
  } else if (typeof a == 'string' && opt_b && typeof opt_b == 'object' &&                                          // 1636
      typeof opt_c == 'undefined') {                                                                               // 1637
    // Method 3: text1, diffs                                                                                      // 1638
    text1 = /** @type {string} */(a);                                                                              // 1639
    diffs = /** @type {!Array.<!diff_match_patch.Diff>} */(opt_b);                                                 // 1640
  } else if (typeof a == 'string' && typeof opt_b == 'string' &&                                                   // 1641
      opt_c && typeof opt_c == 'object') {                                                                         // 1642
    // Method 4: text1, text2, diffs                                                                               // 1643
    // text2 is not used.                                                                                          // 1644
    text1 = /** @type {string} */(a);                                                                              // 1645
    diffs = /** @type {!Array.<!diff_match_patch.Diff>} */(opt_c);                                                 // 1646
  } else {                                                                                                         // 1647
    throw new Error('Unknown call format to patch_make.');                                                         // 1648
  }                                                                                                                // 1649
                                                                                                                   // 1650
  if (diffs.length === 0) {                                                                                        // 1651
    return [];  // Get rid of the null case.                                                                       // 1652
  }                                                                                                                // 1653
  var patches = [];                                                                                                // 1654
  var patch = new diff_match_patch.patch_obj();                                                                    // 1655
  var patchDiffLength = 0;  // Keeping our own length var is faster in JS.                                         // 1656
  var char_count1 = 0;  // Number of characters into the text1 string.                                             // 1657
  var char_count2 = 0;  // Number of characters into the text2 string.                                             // 1658
  // Start with text1 (prepatch_text) and apply the diffs until we arrive at                                       // 1659
  // text2 (postpatch_text).  We recreate the patches one by one to determine                                      // 1660
  // context info.                                                                                                 // 1661
  var prepatch_text = text1;                                                                                       // 1662
  var postpatch_text = text1;                                                                                      // 1663
  for (var x = 0; x < diffs.length; x++) {                                                                         // 1664
    var diff_type = diffs[x][0];                                                                                   // 1665
    var diff_text = diffs[x][1];                                                                                   // 1666
                                                                                                                   // 1667
    if (!patchDiffLength && diff_type !== DIFF_EQUAL) {                                                            // 1668
      // A new patch starts here.                                                                                  // 1669
      patch.start1 = char_count1;                                                                                  // 1670
      patch.start2 = char_count2;                                                                                  // 1671
    }                                                                                                              // 1672
                                                                                                                   // 1673
    switch (diff_type) {                                                                                           // 1674
      case DIFF_INSERT:                                                                                            // 1675
        patch.diffs[patchDiffLength++] = diffs[x];                                                                 // 1676
        patch.length2 += diff_text.length;                                                                         // 1677
        postpatch_text = postpatch_text.substring(0, char_count2) + diff_text +                                    // 1678
                         postpatch_text.substring(char_count2);                                                    // 1679
        break;                                                                                                     // 1680
      case DIFF_DELETE:                                                                                            // 1681
        patch.length1 += diff_text.length;                                                                         // 1682
        patch.diffs[patchDiffLength++] = diffs[x];                                                                 // 1683
        postpatch_text = postpatch_text.substring(0, char_count2) +                                                // 1684
                         postpatch_text.substring(char_count2 +                                                    // 1685
                             diff_text.length);                                                                    // 1686
        break;                                                                                                     // 1687
      case DIFF_EQUAL:                                                                                             // 1688
        if (diff_text.length <= 2 * this.Patch_Margin &&                                                           // 1689
            patchDiffLength && diffs.length != x + 1) {                                                            // 1690
          // Small equality inside a patch.                                                                        // 1691
          patch.diffs[patchDiffLength++] = diffs[x];                                                               // 1692
          patch.length1 += diff_text.length;                                                                       // 1693
          patch.length2 += diff_text.length;                                                                       // 1694
        } else if (diff_text.length >= 2 * this.Patch_Margin) {                                                    // 1695
          // Time for a new patch.                                                                                 // 1696
          if (patchDiffLength) {                                                                                   // 1697
            this.patch_addContext_(patch, prepatch_text);                                                          // 1698
            patches.push(patch);                                                                                   // 1699
            patch = new diff_match_patch.patch_obj();                                                              // 1700
            patchDiffLength = 0;                                                                                   // 1701
            // Unlike Unidiff, our patch lists have a rolling context.                                             // 1702
            // http://code.google.com/p/google-diff-match-patch/wiki/Unidiff                                       // 1703
            // Update prepatch text & pos to reflect the application of the                                        // 1704
            // just completed patch.                                                                               // 1705
            prepatch_text = postpatch_text;                                                                        // 1706
            char_count1 = char_count2;                                                                             // 1707
          }                                                                                                        // 1708
        }                                                                                                          // 1709
        break;                                                                                                     // 1710
    }                                                                                                              // 1711
                                                                                                                   // 1712
    // Update the current character count.                                                                         // 1713
    if (diff_type !== DIFF_INSERT) {                                                                               // 1714
      char_count1 += diff_text.length;                                                                             // 1715
    }                                                                                                              // 1716
    if (diff_type !== DIFF_DELETE) {                                                                               // 1717
      char_count2 += diff_text.length;                                                                             // 1718
    }                                                                                                              // 1719
  }                                                                                                                // 1720
  // Pick up the leftover patch if not empty.                                                                      // 1721
  if (patchDiffLength) {                                                                                           // 1722
    this.patch_addContext_(patch, prepatch_text);                                                                  // 1723
    patches.push(patch);                                                                                           // 1724
  }                                                                                                                // 1725
                                                                                                                   // 1726
  return patches;                                                                                                  // 1727
};                                                                                                                 // 1728
                                                                                                                   // 1729
                                                                                                                   // 1730
/**                                                                                                                // 1731
 * Given an array of patches, return another array that is identical.                                              // 1732
 * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of patch objects.                                   // 1733
 * @return {!Array.<!diff_match_patch.patch_obj>} Array of patch objects.                                          // 1734
 */                                                                                                                // 1735
diff_match_patch.prototype.patch_deepCopy = function(patches) {                                                    // 1736
  // Making deep copies is hard in JavaScript.                                                                     // 1737
  var patchesCopy = [];                                                                                            // 1738
  for (var x = 0; x < patches.length; x++) {                                                                       // 1739
    var patch = patches[x];                                                                                        // 1740
    var patchCopy = new diff_match_patch.patch_obj();                                                              // 1741
    patchCopy.diffs = [];                                                                                          // 1742
    for (var y = 0; y < patch.diffs.length; y++) {                                                                 // 1743
      patchCopy.diffs[y] = patch.diffs[y].slice();                                                                 // 1744
    }                                                                                                              // 1745
    patchCopy.start1 = patch.start1;                                                                               // 1746
    patchCopy.start2 = patch.start2;                                                                               // 1747
    patchCopy.length1 = patch.length1;                                                                             // 1748
    patchCopy.length2 = patch.length2;                                                                             // 1749
    patchesCopy[x] = patchCopy;                                                                                    // 1750
  }                                                                                                                // 1751
  return patchesCopy;                                                                                              // 1752
};                                                                                                                 // 1753
                                                                                                                   // 1754
                                                                                                                   // 1755
/**                                                                                                                // 1756
 * Merge a set of patches onto the text.  Return a patched text, as well                                           // 1757
 * as a list of true/false values indicating which patches were applied.                                           // 1758
 * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of patch objects.                                   // 1759
 * @param {string} text Old text.                                                                                  // 1760
 * @return {!Array.<string|!Array.<boolean>>} Two element Array, containing the                                    // 1761
 *      new text and an array of boolean values.                                                                   // 1762
 */                                                                                                                // 1763
diff_match_patch.prototype.patch_apply = function(patches, text) {                                                 // 1764
  if (patches.length == 0) {                                                                                       // 1765
    return [text, []];                                                                                             // 1766
  }                                                                                                                // 1767
                                                                                                                   // 1768
  // Deep copy the patches so that no changes are made to originals.                                               // 1769
  patches = this.patch_deepCopy(patches);                                                                          // 1770
                                                                                                                   // 1771
  var nullPadding = this.patch_addPadding(patches);                                                                // 1772
  text = nullPadding + text + nullPadding;                                                                         // 1773
                                                                                                                   // 1774
  this.patch_splitMax(patches);                                                                                    // 1775
  // delta keeps track of the offset between the expected and actual location                                      // 1776
  // of the previous patch.  If there are patches expected at positions 10 and                                     // 1777
  // 20, but the first patch was found at 12, delta is 2 and the second patch                                      // 1778
  // has an effective expected position of 22.                                                                     // 1779
  var delta = 0;                                                                                                   // 1780
  var results = [];                                                                                                // 1781
  for (var x = 0; x < patches.length; x++) {                                                                       // 1782
    var expected_loc = patches[x].start2 + delta;                                                                  // 1783
    var text1 = this.diff_text1(patches[x].diffs);                                                                 // 1784
    var start_loc;                                                                                                 // 1785
    var end_loc = -1;                                                                                              // 1786
    if (text1.length > this.Match_MaxBits) {                                                                       // 1787
      // patch_splitMax will only provide an oversized pattern in the case of                                      // 1788
      // a monster delete.                                                                                         // 1789
      start_loc = this.match_main(text, text1.substring(0, this.Match_MaxBits),                                    // 1790
                                  expected_loc);                                                                   // 1791
      if (start_loc != -1) {                                                                                       // 1792
        end_loc = this.match_main(text,                                                                            // 1793
            text1.substring(text1.length - this.Match_MaxBits),                                                    // 1794
            expected_loc + text1.length - this.Match_MaxBits);                                                     // 1795
        if (end_loc == -1 || start_loc >= end_loc) {                                                               // 1796
          // Can't find valid trailing context.  Drop this patch.                                                  // 1797
          start_loc = -1;                                                                                          // 1798
        }                                                                                                          // 1799
      }                                                                                                            // 1800
    } else {                                                                                                       // 1801
      start_loc = this.match_main(text, text1, expected_loc);                                                      // 1802
    }                                                                                                              // 1803
    if (start_loc == -1) {                                                                                         // 1804
      // No match found.  :(                                                                                       // 1805
      results[x] = false;                                                                                          // 1806
      // Subtract the delta for this failed patch from subsequent patches.                                         // 1807
      delta -= patches[x].length2 - patches[x].length1;                                                            // 1808
    } else {                                                                                                       // 1809
      // Found a match.  :)                                                                                        // 1810
      results[x] = true;                                                                                           // 1811
      delta = start_loc - expected_loc;                                                                            // 1812
      var text2;                                                                                                   // 1813
      if (end_loc == -1) {                                                                                         // 1814
        text2 = text.substring(start_loc, start_loc + text1.length);                                               // 1815
      } else {                                                                                                     // 1816
        text2 = text.substring(start_loc, end_loc + this.Match_MaxBits);                                           // 1817
      }                                                                                                            // 1818
      if (text1 == text2) {                                                                                        // 1819
        // Perfect match, just shove the replacement text in.                                                      // 1820
        text = text.substring(0, start_loc) +                                                                      // 1821
               this.diff_text2(patches[x].diffs) +                                                                 // 1822
               text.substring(start_loc + text1.length);                                                           // 1823
      } else {                                                                                                     // 1824
        // Imperfect match.  Run a diff to get a framework of equivalent                                           // 1825
        // indices.                                                                                                // 1826
        var diffs = this.diff_main(text1, text2, false);                                                           // 1827
        if (text1.length > this.Match_MaxBits &&                                                                   // 1828
            this.diff_levenshtein(diffs) / text1.length >                                                          // 1829
            this.Patch_DeleteThreshold) {                                                                          // 1830
          // The end points match, but the content is unacceptably bad.                                            // 1831
          results[x] = false;                                                                                      // 1832
        } else {                                                                                                   // 1833
          this.diff_cleanupSemanticLossless(diffs);                                                                // 1834
          var index1 = 0;                                                                                          // 1835
          var index2;                                                                                              // 1836
          for (var y = 0; y < patches[x].diffs.length; y++) {                                                      // 1837
            var mod = patches[x].diffs[y];                                                                         // 1838
            if (mod[0] !== DIFF_EQUAL) {                                                                           // 1839
              index2 = this.diff_xIndex(diffs, index1);                                                            // 1840
            }                                                                                                      // 1841
            if (mod[0] === DIFF_INSERT) {  // Insertion                                                            // 1842
              text = text.substring(0, start_loc + index2) + mod[1] +                                              // 1843
                     text.substring(start_loc + index2);                                                           // 1844
            } else if (mod[0] === DIFF_DELETE) {  // Deletion                                                      // 1845
              text = text.substring(0, start_loc + index2) +                                                       // 1846
                     text.substring(start_loc + this.diff_xIndex(diffs,                                            // 1847
                         index1 + mod[1].length));                                                                 // 1848
            }                                                                                                      // 1849
            if (mod[0] !== DIFF_DELETE) {                                                                          // 1850
              index1 += mod[1].length;                                                                             // 1851
            }                                                                                                      // 1852
          }                                                                                                        // 1853
        }                                                                                                          // 1854
      }                                                                                                            // 1855
    }                                                                                                              // 1856
  }                                                                                                                // 1857
  // Strip the padding off.                                                                                        // 1858
  text = text.substring(nullPadding.length, text.length - nullPadding.length);                                     // 1859
  return [text, results];                                                                                          // 1860
};                                                                                                                 // 1861
                                                                                                                   // 1862
                                                                                                                   // 1863
/**                                                                                                                // 1864
 * Add some padding on text start and end so that edges can match something.                                       // 1865
 * Intended to be called only from within patch_apply.                                                             // 1866
 * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of patch objects.                                   // 1867
 * @return {string} The padding string added to each side.                                                         // 1868
 */                                                                                                                // 1869
diff_match_patch.prototype.patch_addPadding = function(patches) {                                                  // 1870
  var paddingLength = this.Patch_Margin;                                                                           // 1871
  var nullPadding = '';                                                                                            // 1872
  for (var x = 1; x <= paddingLength; x++) {                                                                       // 1873
    nullPadding += String.fromCharCode(x);                                                                         // 1874
  }                                                                                                                // 1875
                                                                                                                   // 1876
  // Bump all the patches forward.                                                                                 // 1877
  for (var x = 0; x < patches.length; x++) {                                                                       // 1878
    patches[x].start1 += paddingLength;                                                                            // 1879
    patches[x].start2 += paddingLength;                                                                            // 1880
  }                                                                                                                // 1881
                                                                                                                   // 1882
  // Add some padding on start of first diff.                                                                      // 1883
  var patch = patches[0];                                                                                          // 1884
  var diffs = patch.diffs;                                                                                         // 1885
  if (diffs.length == 0 || diffs[0][0] != DIFF_EQUAL) {                                                            // 1886
    // Add nullPadding equality.                                                                                   // 1887
    diffs.unshift([DIFF_EQUAL, nullPadding]);                                                                      // 1888
    patch.start1 -= paddingLength;  // Should be 0.                                                                // 1889
    patch.start2 -= paddingLength;  // Should be 0.                                                                // 1890
    patch.length1 += paddingLength;                                                                                // 1891
    patch.length2 += paddingLength;                                                                                // 1892
  } else if (paddingLength > diffs[0][1].length) {                                                                 // 1893
    // Grow first equality.                                                                                        // 1894
    var extraLength = paddingLength - diffs[0][1].length;                                                          // 1895
    diffs[0][1] = nullPadding.substring(diffs[0][1].length) + diffs[0][1];                                         // 1896
    patch.start1 -= extraLength;                                                                                   // 1897
    patch.start2 -= extraLength;                                                                                   // 1898
    patch.length1 += extraLength;                                                                                  // 1899
    patch.length2 += extraLength;                                                                                  // 1900
  }                                                                                                                // 1901
                                                                                                                   // 1902
  // Add some padding on end of last diff.                                                                         // 1903
  patch = patches[patches.length - 1];                                                                             // 1904
  diffs = patch.diffs;                                                                                             // 1905
  if (diffs.length == 0 || diffs[diffs.length - 1][0] != DIFF_EQUAL) {                                             // 1906
    // Add nullPadding equality.                                                                                   // 1907
    diffs.push([DIFF_EQUAL, nullPadding]);                                                                         // 1908
    patch.length1 += paddingLength;                                                                                // 1909
    patch.length2 += paddingLength;                                                                                // 1910
  } else if (paddingLength > diffs[diffs.length - 1][1].length) {                                                  // 1911
    // Grow last equality.                                                                                         // 1912
    var extraLength = paddingLength - diffs[diffs.length - 1][1].length;                                           // 1913
    diffs[diffs.length - 1][1] += nullPadding.substring(0, extraLength);                                           // 1914
    patch.length1 += extraLength;                                                                                  // 1915
    patch.length2 += extraLength;                                                                                  // 1916
  }                                                                                                                // 1917
                                                                                                                   // 1918
  return nullPadding;                                                                                              // 1919
};                                                                                                                 // 1920
                                                                                                                   // 1921
                                                                                                                   // 1922
/**                                                                                                                // 1923
 * Look through the patches and break up any which are longer than the maximum                                     // 1924
 * limit of the match algorithm.                                                                                   // 1925
 * Intended to be called only from within patch_apply.                                                             // 1926
 * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of patch objects.                                   // 1927
 */                                                                                                                // 1928
diff_match_patch.prototype.patch_splitMax = function(patches) {                                                    // 1929
  var patch_size = this.Match_MaxBits;                                                                             // 1930
  for (var x = 0; x < patches.length; x++) {                                                                       // 1931
    if (patches[x].length1 > patch_size) {                                                                         // 1932
      var bigpatch = patches[x];                                                                                   // 1933
      // Remove the big old patch.                                                                                 // 1934
      patches.splice(x--, 1);                                                                                      // 1935
      var start1 = bigpatch.start1;                                                                                // 1936
      var start2 = bigpatch.start2;                                                                                // 1937
      var precontext = '';                                                                                         // 1938
      while (bigpatch.diffs.length !== 0) {                                                                        // 1939
        // Create one of several smaller patches.                                                                  // 1940
        var patch = new diff_match_patch.patch_obj();                                                              // 1941
        var empty = true;                                                                                          // 1942
        patch.start1 = start1 - precontext.length;                                                                 // 1943
        patch.start2 = start2 - precontext.length;                                                                 // 1944
        if (precontext !== '') {                                                                                   // 1945
          patch.length1 = patch.length2 = precontext.length;                                                       // 1946
          patch.diffs.push([DIFF_EQUAL, precontext]);                                                              // 1947
        }                                                                                                          // 1948
        while (bigpatch.diffs.length !== 0 &&                                                                      // 1949
               patch.length1 < patch_size - this.Patch_Margin) {                                                   // 1950
          var diff_type = bigpatch.diffs[0][0];                                                                    // 1951
          var diff_text = bigpatch.diffs[0][1];                                                                    // 1952
          if (diff_type === DIFF_INSERT) {                                                                         // 1953
            // Insertions are harmless.                                                                            // 1954
            patch.length2 += diff_text.length;                                                                     // 1955
            start2 += diff_text.length;                                                                            // 1956
            patch.diffs.push(bigpatch.diffs.shift());                                                              // 1957
            empty = false;                                                                                         // 1958
          } else if (diff_type === DIFF_DELETE && patch.diffs.length == 1 &&                                       // 1959
                     patch.diffs[0][0] == DIFF_EQUAL &&                                                            // 1960
                     diff_text.length > 2 * patch_size) {                                                          // 1961
            // This is a large deletion.  Let it pass in one chunk.                                                // 1962
            patch.length1 += diff_text.length;                                                                     // 1963
            start1 += diff_text.length;                                                                            // 1964
            empty = false;                                                                                         // 1965
            patch.diffs.push([diff_type, diff_text]);                                                              // 1966
            bigpatch.diffs.shift();                                                                                // 1967
          } else {                                                                                                 // 1968
            // Deletion or equality.  Only take as much as we can stomach.                                         // 1969
            diff_text = diff_text.substring(0,                                                                     // 1970
                patch_size - patch.length1 - this.Patch_Margin);                                                   // 1971
            patch.length1 += diff_text.length;                                                                     // 1972
            start1 += diff_text.length;                                                                            // 1973
            if (diff_type === DIFF_EQUAL) {                                                                        // 1974
              patch.length2 += diff_text.length;                                                                   // 1975
              start2 += diff_text.length;                                                                          // 1976
            } else {                                                                                               // 1977
              empty = false;                                                                                       // 1978
            }                                                                                                      // 1979
            patch.diffs.push([diff_type, diff_text]);                                                              // 1980
            if (diff_text == bigpatch.diffs[0][1]) {                                                               // 1981
              bigpatch.diffs.shift();                                                                              // 1982
            } else {                                                                                               // 1983
              bigpatch.diffs[0][1] =                                                                               // 1984
                  bigpatch.diffs[0][1].substring(diff_text.length);                                                // 1985
            }                                                                                                      // 1986
          }                                                                                                        // 1987
        }                                                                                                          // 1988
        // Compute the head context for the next patch.                                                            // 1989
        precontext = this.diff_text2(patch.diffs);                                                                 // 1990
        precontext =                                                                                               // 1991
            precontext.substring(precontext.length - this.Patch_Margin);                                           // 1992
        // Append the end context for this patch.                                                                  // 1993
        var postcontext = this.diff_text1(bigpatch.diffs)                                                          // 1994
                              .substring(0, this.Patch_Margin);                                                    // 1995
        if (postcontext !== '') {                                                                                  // 1996
          patch.length1 += postcontext.length;                                                                     // 1997
          patch.length2 += postcontext.length;                                                                     // 1998
          if (patch.diffs.length !== 0 &&                                                                          // 1999
              patch.diffs[patch.diffs.length - 1][0] === DIFF_EQUAL) {                                             // 2000
            patch.diffs[patch.diffs.length - 1][1] += postcontext;                                                 // 2001
          } else {                                                                                                 // 2002
            patch.diffs.push([DIFF_EQUAL, postcontext]);                                                           // 2003
          }                                                                                                        // 2004
        }                                                                                                          // 2005
        if (!empty) {                                                                                              // 2006
          patches.splice(++x, 0, patch);                                                                           // 2007
        }                                                                                                          // 2008
      }                                                                                                            // 2009
    }                                                                                                              // 2010
  }                                                                                                                // 2011
};                                                                                                                 // 2012
                                                                                                                   // 2013
                                                                                                                   // 2014
/**                                                                                                                // 2015
 * Take a list of patches and return a textual representation.                                                     // 2016
 * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of patch objects.                                   // 2017
 * @return {string} Text representation of patches.                                                                // 2018
 */                                                                                                                // 2019
diff_match_patch.prototype.patch_toText = function(patches) {                                                      // 2020
  var text = [];                                                                                                   // 2021
  for (var x = 0; x < patches.length; x++) {                                                                       // 2022
    text[x] = patches[x];                                                                                          // 2023
  }                                                                                                                // 2024
  return text.join('');                                                                                            // 2025
};                                                                                                                 // 2026
                                                                                                                   // 2027
                                                                                                                   // 2028
/**                                                                                                                // 2029
 * Parse a textual representation of patches and return a list of patch objects.                                   // 2030
 * @param {string} textline Text representation of patches.                                                        // 2031
 * @return {!Array.<!diff_match_patch.patch_obj>} Array of patch objects.                                          // 2032
 * @throws {!Error} If invalid input.                                                                              // 2033
 */                                                                                                                // 2034
diff_match_patch.prototype.patch_fromText = function(textline) {                                                   // 2035
  var patches = [];                                                                                                // 2036
  if (!textline) {                                                                                                 // 2037
    return patches;                                                                                                // 2038
  }                                                                                                                // 2039
  var text = textline.split('\n');                                                                                 // 2040
  var textPointer = 0;                                                                                             // 2041
  var patchHeader = /^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;                                                        // 2042
  while (textPointer < text.length) {                                                                              // 2043
    var m = text[textPointer].match(patchHeader);                                                                  // 2044
    if (!m) {                                                                                                      // 2045
      throw new Error('Invalid patch string: ' + text[textPointer]);                                               // 2046
    }                                                                                                              // 2047
    var patch = new diff_match_patch.patch_obj();                                                                  // 2048
    patches.push(patch);                                                                                           // 2049
    patch.start1 = parseInt(m[1], 10);                                                                             // 2050
    if (m[2] === '') {                                                                                             // 2051
      patch.start1--;                                                                                              // 2052
      patch.length1 = 1;                                                                                           // 2053
    } else if (m[2] == '0') {                                                                                      // 2054
      patch.length1 = 0;                                                                                           // 2055
    } else {                                                                                                       // 2056
      patch.start1--;                                                                                              // 2057
      patch.length1 = parseInt(m[2], 10);                                                                          // 2058
    }                                                                                                              // 2059
                                                                                                                   // 2060
    patch.start2 = parseInt(m[3], 10);                                                                             // 2061
    if (m[4] === '') {                                                                                             // 2062
      patch.start2--;                                                                                              // 2063
      patch.length2 = 1;                                                                                           // 2064
    } else if (m[4] == '0') {                                                                                      // 2065
      patch.length2 = 0;                                                                                           // 2066
    } else {                                                                                                       // 2067
      patch.start2--;                                                                                              // 2068
      patch.length2 = parseInt(m[4], 10);                                                                          // 2069
    }                                                                                                              // 2070
    textPointer++;                                                                                                 // 2071
                                                                                                                   // 2072
    while (textPointer < text.length) {                                                                            // 2073
      var sign = text[textPointer].charAt(0);                                                                      // 2074
      try {                                                                                                        // 2075
        var line = decodeURI(text[textPointer].substring(1));                                                      // 2076
      } catch (ex) {                                                                                               // 2077
        // Malformed URI sequence.                                                                                 // 2078
        throw new Error('Illegal escape in patch_fromText: ' + line);                                              // 2079
      }                                                                                                            // 2080
      if (sign == '-') {                                                                                           // 2081
        // Deletion.                                                                                               // 2082
        patch.diffs.push([DIFF_DELETE, line]);                                                                     // 2083
      } else if (sign == '+') {                                                                                    // 2084
        // Insertion.                                                                                              // 2085
        patch.diffs.push([DIFF_INSERT, line]);                                                                     // 2086
      } else if (sign == ' ') {                                                                                    // 2087
        // Minor equality.                                                                                         // 2088
        patch.diffs.push([DIFF_EQUAL, line]);                                                                      // 2089
      } else if (sign == '@') {                                                                                    // 2090
        // Start of next patch.                                                                                    // 2091
        break;                                                                                                     // 2092
      } else if (sign === '') {                                                                                    // 2093
        // Blank line?  Whatever.                                                                                  // 2094
      } else {                                                                                                     // 2095
        // WTF?                                                                                                    // 2096
        throw new Error('Invalid patch mode "' + sign + '" in: ' + line);                                          // 2097
      }                                                                                                            // 2098
      textPointer++;                                                                                               // 2099
    }                                                                                                              // 2100
  }                                                                                                                // 2101
  return patches;                                                                                                  // 2102
};                                                                                                                 // 2103
                                                                                                                   // 2104
                                                                                                                   // 2105
/**                                                                                                                // 2106
 * Class representing one patch operation.                                                                         // 2107
 * @constructor                                                                                                    // 2108
 */                                                                                                                // 2109
diff_match_patch.patch_obj = function() {                                                                          // 2110
  /** @type {!Array.<!diff_match_patch.Diff>} */                                                                   // 2111
  this.diffs = [];                                                                                                 // 2112
  /** @type {?number} */                                                                                           // 2113
  this.start1 = null;                                                                                              // 2114
  /** @type {?number} */                                                                                           // 2115
  this.start2 = null;                                                                                              // 2116
  /** @type {number} */                                                                                            // 2117
  this.length1 = 0;                                                                                                // 2118
  /** @type {number} */                                                                                            // 2119
  this.length2 = 0;                                                                                                // 2120
};                                                                                                                 // 2121
                                                                                                                   // 2122
                                                                                                                   // 2123
/**                                                                                                                // 2124
 * Emmulate GNU diff's format.                                                                                     // 2125
 * Header: @@ -382,8 +481,9 @@                                                                                     // 2126
 * Indicies are printed as 1-based, not 0-based.                                                                   // 2127
 * @return {string} The GNU diff string.                                                                           // 2128
 */                                                                                                                // 2129
diff_match_patch.patch_obj.prototype.toString = function() {                                                       // 2130
  var coords1, coords2;                                                                                            // 2131
  if (this.length1 === 0) {                                                                                        // 2132
    coords1 = this.start1 + ',0';                                                                                  // 2133
  } else if (this.length1 == 1) {                                                                                  // 2134
    coords1 = this.start1 + 1;                                                                                     // 2135
  } else {                                                                                                         // 2136
    coords1 = (this.start1 + 1) + ',' + this.length1;                                                              // 2137
  }                                                                                                                // 2138
  if (this.length2 === 0) {                                                                                        // 2139
    coords2 = this.start2 + ',0';                                                                                  // 2140
  } else if (this.length2 == 1) {                                                                                  // 2141
    coords2 = this.start2 + 1;                                                                                     // 2142
  } else {                                                                                                         // 2143
    coords2 = (this.start2 + 1) + ',' + this.length2;                                                              // 2144
  }                                                                                                                // 2145
  var text = ['@@ -' + coords1 + ' +' + coords2 + ' @@\n'];                                                        // 2146
  var op;                                                                                                          // 2147
  // Escape the body of the patch with %xx notation.                                                               // 2148
  for (var x = 0; x < this.diffs.length; x++) {                                                                    // 2149
    switch (this.diffs[x][0]) {                                                                                    // 2150
      case DIFF_INSERT:                                                                                            // 2151
        op = '+';                                                                                                  // 2152
        break;                                                                                                     // 2153
      case DIFF_DELETE:                                                                                            // 2154
        op = '-';                                                                                                  // 2155
        break;                                                                                                     // 2156
      case DIFF_EQUAL:                                                                                             // 2157
        op = ' ';                                                                                                  // 2158
        break;                                                                                                     // 2159
    }                                                                                                              // 2160
    text[x + 1] = op + encodeURI(this.diffs[x][1]) + '\n';                                                         // 2161
  }                                                                                                                // 2162
  return text.join('').replace(/%20/g, ' ');                                                                       // 2163
};                                                                                                                 // 2164
                                                                                                                   // 2165
                                                                                                                   // 2166
// Export these global variables so that they survive Google's JS compiler.                                        // 2167
// In a browser, 'this' will be 'window'.                                                                          // 2168
// In node.js 'this' will be a global object.                                                                      // 2169
this['diff_match_patch'] = diff_match_patch;                                                                       // 2170
this['DIFF_DELETE'] = DIFF_DELETE;                                                                                 // 2171
this['DIFF_INSERT'] = DIFF_INSERT;                                                                                 // 2172
this['DIFF_EQUAL'] = DIFF_EQUAL;                                                                                   // 2173
                                                                                                                   // 2174
                                                                                                                   // 2175
},{}],3:[function(require,module,exports){                                                                         // 2176
                                                                                                                   // 2177
var Pipe = require('../pipe').Pipe;                                                                                // 2178
                                                                                                                   // 2179
var Context = function Context(){                                                                                  // 2180
};                                                                                                                 // 2181
                                                                                                                   // 2182
Context.prototype.setResult = function(result) {                                                                   // 2183
	this.result = result;                                                                                             // 2184
	this.hasResult = true;                                                                                            // 2185
	return this;                                                                                                      // 2186
};                                                                                                                 // 2187
                                                                                                                   // 2188
Context.prototype.exit = function() {                                                                              // 2189
	this.exiting = true;                                                                                              // 2190
	return this;                                                                                                      // 2191
};                                                                                                                 // 2192
                                                                                                                   // 2193
Context.prototype.switchTo = function(next, pipe) {                                                                // 2194
	if (typeof next === 'string' || next instanceof Pipe) {                                                           // 2195
		this.nextPipe = next;                                                                                            // 2196
	} else {                                                                                                          // 2197
		this.next = next;                                                                                                // 2198
		if (pipe) {                                                                                                      // 2199
			this.nextPipe = pipe;                                                                                           // 2200
		}                                                                                                                // 2201
	}                                                                                                                 // 2202
	return this;                                                                                                      // 2203
};                                                                                                                 // 2204
                                                                                                                   // 2205
Context.prototype.push = function(child, name) {                                                                   // 2206
	child.parent = this;                                                                                              // 2207
	if (typeof name !== 'undefined') {                                                                                // 2208
		child.childName = name;                                                                                          // 2209
	}                                                                                                                 // 2210
	child.root = this.root || this;                                                                                   // 2211
	child.options = child.options || this.options;                                                                    // 2212
	if (!this.children) {                                                                                             // 2213
		this.children = [child];                                                                                         // 2214
		this.nextAfterChildren = this.next || null;                                                                      // 2215
		this.next = child;                                                                                               // 2216
	} else {                                                                                                          // 2217
		this.children[this.children.length - 1].next = child;                                                            // 2218
		this.children.push(child);                                                                                       // 2219
	}                                                                                                                 // 2220
	child.next = this;                                                                                                // 2221
	return this;                                                                                                      // 2222
};                                                                                                                 // 2223
                                                                                                                   // 2224
exports.Context = Context;                                                                                         // 2225
                                                                                                                   // 2226
},{"../pipe":17}],4:[function(require,module,exports){                                                             // 2227
var Context = require('./context').Context;                                                                        // 2228
                                                                                                                   // 2229
var DiffContext = function DiffContext(left, right) {                                                              // 2230
  this.left = left;                                                                                                // 2231
  this.right = right;                                                                                              // 2232
  this.pipe = 'diff';                                                                                              // 2233
};                                                                                                                 // 2234
                                                                                                                   // 2235
DiffContext.prototype = new Context();                                                                             // 2236
                                                                                                                   // 2237
exports.DiffContext = DiffContext;                                                                                 // 2238
                                                                                                                   // 2239
},{"./context":3}],5:[function(require,module,exports){                                                            // 2240
var Context = require('./context').Context;                                                                        // 2241
                                                                                                                   // 2242
var PatchContext = function PatchContext(left, delta) {                                                            // 2243
  this.left = left;                                                                                                // 2244
  this.delta = delta;                                                                                              // 2245
  this.pipe = 'patch';                                                                                             // 2246
};                                                                                                                 // 2247
                                                                                                                   // 2248
PatchContext.prototype = new Context();                                                                            // 2249
                                                                                                                   // 2250
exports.PatchContext = PatchContext;                                                                               // 2251
                                                                                                                   // 2252
},{"./context":3}],6:[function(require,module,exports){                                                            // 2253
var Context = require('./context').Context;                                                                        // 2254
                                                                                                                   // 2255
var ReverseContext = function ReverseContext(delta) {                                                              // 2256
  this.delta = delta;                                                                                              // 2257
  this.pipe = 'reverse';                                                                                           // 2258
};                                                                                                                 // 2259
                                                                                                                   // 2260
ReverseContext.prototype = new Context();                                                                          // 2261
                                                                                                                   // 2262
exports.ReverseContext = ReverseContext;                                                                           // 2263
                                                                                                                   // 2264
},{"./context":3}],7:[function(require,module,exports){                                                            // 2265
// use as 2nd parameter for JSON.parse to revive Date instances                                                    // 2266
module.exports = function dateReviver(key, value) {                                                                // 2267
  var parts;                                                                                                       // 2268
  if (typeof value === 'string') {                                                                                 // 2269
    parts = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d*))?(Z|([+\-])(\d{2}):(\d{2}))$/.exec(value);
    if (parts) {                                                                                                   // 2271
      return new Date(Date.UTC(+parts[1], +parts[2] - 1, +parts[3], +parts[4], +parts[5], +parts[6], +(parts[7] || 0)));
    }                                                                                                              // 2273
  }                                                                                                                // 2274
  return value;                                                                                                    // 2275
};                                                                                                                 // 2276
                                                                                                                   // 2277
},{}],8:[function(require,module,exports){                                                                         // 2278
var Processor = require('./processor').Processor;                                                                  // 2279
var Pipe = require('./pipe').Pipe;                                                                                 // 2280
var DiffContext = require('./contexts/diff').DiffContext;                                                          // 2281
var PatchContext = require('./contexts/patch').PatchContext;                                                       // 2282
var ReverseContext = require('./contexts/reverse').ReverseContext;                                                 // 2283
                                                                                                                   // 2284
var trivial = require('./filters/trivial');                                                                        // 2285
var nested = require('./filters/nested');                                                                          // 2286
var arrays = require('./filters/arrays');                                                                          // 2287
var dates = require('./filters/dates');                                                                            // 2288
var texts = require('./filters/texts');                                                                            // 2289
                                                                                                                   // 2290
var DiffPatcher = function DiffPatcher(options) {                                                                  // 2291
  this.processor = new Processor(options);                                                                         // 2292
  this.processor.pipe(new Pipe('diff').append(                                                                     // 2293
    nested.collectChildrenDiffFilter,                                                                              // 2294
    trivial.diffFilter,                                                                                            // 2295
    dates.diffFilter,                                                                                              // 2296
    texts.diffFilter,                                                                                              // 2297
    nested.objectsDiffFilter,                                                                                      // 2298
    arrays.diffFilter                                                                                              // 2299
  ).shouldHaveResult());                                                                                           // 2300
  this.processor.pipe(new Pipe('patch').append(                                                                    // 2301
    nested.collectChildrenPatchFilter,                                                                             // 2302
    arrays.collectChildrenPatchFilter,                                                                             // 2303
    trivial.patchFilter,                                                                                           // 2304
    texts.patchFilter,                                                                                             // 2305
    nested.patchFilter,                                                                                            // 2306
    arrays.patchFilter                                                                                             // 2307
  ).shouldHaveResult());                                                                                           // 2308
  this.processor.pipe(new Pipe('reverse').append(                                                                  // 2309
    nested.collectChildrenReverseFilter,                                                                           // 2310
    arrays.collectChildrenReverseFilter,                                                                           // 2311
    trivial.reverseFilter,                                                                                         // 2312
    texts.reverseFilter,                                                                                           // 2313
    nested.reverseFilter,                                                                                          // 2314
    arrays.reverseFilter                                                                                           // 2315
  ).shouldHaveResult());                                                                                           // 2316
};                                                                                                                 // 2317
                                                                                                                   // 2318
DiffPatcher.prototype.options = function() {                                                                       // 2319
  return this.processor.options.apply(this.processor, arguments);                                                  // 2320
};                                                                                                                 // 2321
                                                                                                                   // 2322
DiffPatcher.prototype.diff = function(left, right) {                                                               // 2323
  return this.processor.process(new DiffContext(left, right));                                                     // 2324
};                                                                                                                 // 2325
                                                                                                                   // 2326
DiffPatcher.prototype.patch = function(left, delta) {                                                              // 2327
  return this.processor.process(new PatchContext(left, delta));                                                    // 2328
};                                                                                                                 // 2329
                                                                                                                   // 2330
DiffPatcher.prototype.reverse = function(delta) {                                                                  // 2331
  return this.processor.process(new ReverseContext(delta));                                                        // 2332
};                                                                                                                 // 2333
                                                                                                                   // 2334
DiffPatcher.prototype.unpatch = function(right, delta) {                                                           // 2335
  return this.patch(right, this.reverse(delta));                                                                   // 2336
};                                                                                                                 // 2337
                                                                                                                   // 2338
exports.DiffPatcher = DiffPatcher;                                                                                 // 2339
                                                                                                                   // 2340
},{"./contexts/diff":4,"./contexts/patch":5,"./contexts/reverse":6,"./filters/arrays":10,"./filters/dates":11,"./filters/nested":13,"./filters/texts":14,"./filters/trivial":15,"./pipe":17,"./processor":18}],9:[function(require,module,exports){
                                                                                                                   // 2342
exports.isBrowser = typeof window !== 'undefined';                                                                 // 2343
                                                                                                                   // 2344
},{}],10:[function(require,module,exports){                                                                        // 2345
var DiffContext = require('../contexts/diff').DiffContext;                                                         // 2346
var PatchContext = require('../contexts/patch').PatchContext;                                                      // 2347
var ReverseContext = require('../contexts/reverse').ReverseContext;                                                // 2348
                                                                                                                   // 2349
var lcs = require('./lcs');                                                                                        // 2350
                                                                                                                   // 2351
var ARRAY_MOVE = 3;                                                                                                // 2352
                                                                                                                   // 2353
var isArray = (typeof Array.isArray === 'function') ?                                                              // 2354
  // use native function                                                                                           // 2355
  Array.isArray :                                                                                                  // 2356
  // use instanceof operator                                                                                       // 2357
  function(a) {                                                                                                    // 2358
    return a instanceof Array;                                                                                     // 2359
  };                                                                                                               // 2360
                                                                                                                   // 2361
var arrayIndexOf = typeof Array.prototype.indexOf === 'function' ?                                                 // 2362
  function(array, item) {                                                                                          // 2363
    return array.indexOf(item);                                                                                    // 2364
  } : function(array, item) {                                                                                      // 2365
    var length = array.length;                                                                                     // 2366
    for (var i = 0; i < length; i++) {                                                                             // 2367
      if (array[i] === item) {                                                                                     // 2368
        return i;                                                                                                  // 2369
      }                                                                                                            // 2370
    }                                                                                                              // 2371
    return -1;                                                                                                     // 2372
  };                                                                                                               // 2373
                                                                                                                   // 2374
function arraysHaveMatchByRef(array1, array2, len1, len2) {                                                        // 2375
  for (var index1 = 0; index1 < len1; index1++) {                                                                  // 2376
    var val1 = array1[index1];                                                                                     // 2377
    for (var index2 = 0; index2 < len2; index2++) {                                                                // 2378
      var val2 = array2[index2];                                                                                   // 2379
      if (val1 === val2) {                                                                                         // 2380
        return true;                                                                                               // 2381
      }                                                                                                            // 2382
    }                                                                                                              // 2383
  }                                                                                                                // 2384
}                                                                                                                  // 2385
                                                                                                                   // 2386
function matchItems(array1, array2, index1, index2, context) {                                                     // 2387
  var value1 = array1[index1];                                                                                     // 2388
  var value2 = array2[index2];                                                                                     // 2389
  if (value1 === value2) {                                                                                         // 2390
    return true;                                                                                                   // 2391
  }                                                                                                                // 2392
  if (typeof value1 !== 'object' || typeof value2 !== 'object') {                                                  // 2393
    return false;                                                                                                  // 2394
  }                                                                                                                // 2395
  var objectHash = context.objectHash;                                                                             // 2396
  if (!objectHash) {                                                                                               // 2397
    // no way to match objects was provided, try match by position                                                 // 2398
    return context.matchByPosition && index1 === index2;                                                           // 2399
  }                                                                                                                // 2400
  var hash1;                                                                                                       // 2401
  var hash2;                                                                                                       // 2402
  if (typeof index1 === 'number') {                                                                                // 2403
    context.hashCache1 = context.hashCache1 || [];                                                                 // 2404
    hash1 = context.hashCache1[index1];                                                                            // 2405
    if (typeof hash1 === 'undefined') {                                                                            // 2406
      context.hashCache1[index1] = hash1 = objectHash(value1, index1);                                             // 2407
    }                                                                                                              // 2408
  } else {                                                                                                         // 2409
    hash1 = objectHash(value1);                                                                                    // 2410
  }                                                                                                                // 2411
  if (typeof hash1 === 'undefined') {                                                                              // 2412
    return false;                                                                                                  // 2413
  }                                                                                                                // 2414
  if (typeof index2 === 'number') {                                                                                // 2415
    context.hashCache2 = context.hashCache2 || [];                                                                 // 2416
    hash2 = context.hashCache2[index2];                                                                            // 2417
    if (typeof hash2 === 'undefined') {                                                                            // 2418
      context.hashCache2[index2] = hash2 = objectHash(value2, index2);                                             // 2419
    }                                                                                                              // 2420
  } else {                                                                                                         // 2421
    hash2 = objectHash(value2);                                                                                    // 2422
  }                                                                                                                // 2423
  if (typeof hash2 === 'undefined') {                                                                              // 2424
    return false;                                                                                                  // 2425
  }                                                                                                                // 2426
  return hash1 === hash2;                                                                                          // 2427
}                                                                                                                  // 2428
                                                                                                                   // 2429
var diffFilter = function arraysDiffFilter(context) {                                                              // 2430
  if (!context.leftIsArray) {                                                                                      // 2431
    return;                                                                                                        // 2432
  }                                                                                                                // 2433
                                                                                                                   // 2434
  var matchContext = {                                                                                             // 2435
    objectHash: context.options && context.options.objectHash,                                                     // 2436
    matchByPosition: context.options && context.options.matchByPosition                                            // 2437
  };                                                                                                               // 2438
  var commonHead = 0;                                                                                              // 2439
  var commonTail = 0;                                                                                              // 2440
  var index;                                                                                                       // 2441
  var index1;                                                                                                      // 2442
  var index2;                                                                                                      // 2443
  var array1 = context.left;                                                                                       // 2444
  var array2 = context.right;                                                                                      // 2445
  var len1 = array1.length;                                                                                        // 2446
  var len2 = array2.length;                                                                                        // 2447
                                                                                                                   // 2448
  var child;                                                                                                       // 2449
                                                                                                                   // 2450
  if (len1 > 0 && len2 > 0 && !matchContext.objectHash &&                                                          // 2451
    typeof matchContext.matchByPosition !== 'boolean') {                                                           // 2452
    matchContext.matchByPosition = !arraysHaveMatchByRef(array1, array2, len1, len2);                              // 2453
  }                                                                                                                // 2454
                                                                                                                   // 2455
  // separate common head                                                                                          // 2456
  while (commonHead < len1 && commonHead < len2 &&                                                                 // 2457
    matchItems(array1, array2, commonHead, commonHead, matchContext)) {                                            // 2458
    index = commonHead;                                                                                            // 2459
    child = new DiffContext(context.left[index], context.right[index]);                                            // 2460
    context.push(child, index);                                                                                    // 2461
    commonHead++;                                                                                                  // 2462
  }                                                                                                                // 2463
  // separate common tail                                                                                          // 2464
  while (commonTail + commonHead < len1 && commonTail + commonHead < len2 &&                                       // 2465
    matchItems(array1, array2, len1 - 1 - commonTail, len2 - 1 - commonTail, matchContext)) {                      // 2466
    index1 = len1 - 1 - commonTail;                                                                                // 2467
    index2 = len2 - 1 - commonTail;                                                                                // 2468
    child = new DiffContext(context.left[index1], context.right[index2]);                                          // 2469
    context.push(child, index2);                                                                                   // 2470
    commonTail++;                                                                                                  // 2471
  }                                                                                                                // 2472
  var result;                                                                                                      // 2473
  if (commonHead + commonTail === len1) {                                                                          // 2474
    if (len1 === len2) {                                                                                           // 2475
      // arrays are identical                                                                                      // 2476
      context.setResult(undefined).exit();                                                                         // 2477
      return;                                                                                                      // 2478
    }                                                                                                              // 2479
    // trivial case, a block (1 or more consecutive items) was added                                               // 2480
    result = result || {                                                                                           // 2481
      _t: 'a'                                                                                                      // 2482
    };                                                                                                             // 2483
    for (index = commonHead; index < len2 - commonTail; index++) {                                                 // 2484
      result[index] = [array2[index]];                                                                             // 2485
    }                                                                                                              // 2486
    context.setResult(result).exit();                                                                              // 2487
    return;                                                                                                        // 2488
  }                                                                                                                // 2489
  if (commonHead + commonTail === len2) {                                                                          // 2490
    // trivial case, a block (1 or more consecutive items) was removed                                             // 2491
    result = result || {                                                                                           // 2492
      _t: 'a'                                                                                                      // 2493
    };                                                                                                             // 2494
    for (index = commonHead; index < len1 - commonTail; index++) {                                                 // 2495
      result['_' + index] = [array1[index], 0, 0];                                                                 // 2496
    }                                                                                                              // 2497
    context.setResult(result).exit();                                                                              // 2498
    return;                                                                                                        // 2499
  }                                                                                                                // 2500
  // reset hash cache                                                                                              // 2501
  delete matchContext.hashCache1;                                                                                  // 2502
  delete matchContext.hashCache2;                                                                                  // 2503
                                                                                                                   // 2504
  // diff is not trivial, find the LCS (Longest Common Subsequence)                                                // 2505
  var trimmed1 = array1.slice(commonHead, len1 - commonTail);                                                      // 2506
  var trimmed2 = array2.slice(commonHead, len2 - commonTail);                                                      // 2507
  var seq = lcs.get(                                                                                               // 2508
    trimmed1, trimmed2,                                                                                            // 2509
    matchItems,                                                                                                    // 2510
    matchContext                                                                                                   // 2511
  );                                                                                                               // 2512
  var removedItems = [];                                                                                           // 2513
  result = result || {                                                                                             // 2514
    _t: 'a'                                                                                                        // 2515
  };                                                                                                               // 2516
  for (index = commonHead; index < len1 - commonTail; index++) {                                                   // 2517
    if (arrayIndexOf(seq.indices1, index - commonHead) < 0) {                                                      // 2518
      // removed                                                                                                   // 2519
      result['_' + index] = [array1[index], 0, 0];                                                                 // 2520
      removedItems.push(index);                                                                                    // 2521
    }                                                                                                              // 2522
  }                                                                                                                // 2523
                                                                                                                   // 2524
  var detectMove = true;                                                                                           // 2525
  if (context.options && context.options.arrays && context.options.arrays.detectMove === false) {                  // 2526
    detectMove = false;                                                                                            // 2527
  }                                                                                                                // 2528
  var includeValueOnMove = false;                                                                                  // 2529
  if (context.options && context.options.arrays && context.options.arrays.includeValueOnMove) {                    // 2530
    includeValueOnMove = true;                                                                                     // 2531
  }                                                                                                                // 2532
                                                                                                                   // 2533
  var removedItemsLength = removedItems.length;                                                                    // 2534
  for (index = commonHead; index < len2 - commonTail; index++) {                                                   // 2535
    var indexOnArray2 = arrayIndexOf(seq.indices2, index - commonHead);                                            // 2536
    if (indexOnArray2 < 0) {                                                                                       // 2537
      // added, try to match with a removed item and register as position move                                     // 2538
      var isMove = false;                                                                                          // 2539
      if (detectMove && removedItemsLength > 0) {                                                                  // 2540
        for (var removeItemIndex1 = 0; removeItemIndex1 < removedItemsLength; removeItemIndex1++) {                // 2541
          index1 = removedItems[removeItemIndex1];                                                                 // 2542
          if (matchItems(trimmed1, trimmed2, index1 - commonHead,                                                  // 2543
            index - commonHead, matchContext)) {                                                                   // 2544
            // store position move as: [originalValue, newPosition, ARRAY_MOVE]                                    // 2545
            result['_' + index1].splice(1, 2, index, ARRAY_MOVE);                                                  // 2546
            if (!includeValueOnMove) {                                                                             // 2547
              // don't include moved value on diff, to save bytes                                                  // 2548
              result['_' + index1][0] = '';                                                                        // 2549
            }                                                                                                      // 2550
                                                                                                                   // 2551
            index2 = index;                                                                                        // 2552
            child = new DiffContext(context.left[index1], context.right[index2]);                                  // 2553
            context.push(child, index2);                                                                           // 2554
            removedItems.splice(removeItemIndex1, 1);                                                              // 2555
            isMove = true;                                                                                         // 2556
            break;                                                                                                 // 2557
          }                                                                                                        // 2558
        }                                                                                                          // 2559
      }                                                                                                            // 2560
      if (!isMove) {                                                                                               // 2561
        // added                                                                                                   // 2562
        result[index] = [array2[index]];                                                                           // 2563
      }                                                                                                            // 2564
    } else {                                                                                                       // 2565
      // match, do inner diff                                                                                      // 2566
      index1 = seq.indices1[indexOnArray2] + commonHead;                                                           // 2567
      index2 = seq.indices2[indexOnArray2] + commonHead;                                                           // 2568
      child = new DiffContext(context.left[index1], context.right[index2]);                                        // 2569
      context.push(child, index2);                                                                                 // 2570
    }                                                                                                              // 2571
  }                                                                                                                // 2572
                                                                                                                   // 2573
  context.setResult(result).exit();                                                                                // 2574
                                                                                                                   // 2575
};                                                                                                                 // 2576
diffFilter.filterName = 'arrays';                                                                                  // 2577
                                                                                                                   // 2578
var compare = {                                                                                                    // 2579
  numerically: function(a, b) {                                                                                    // 2580
    return a - b;                                                                                                  // 2581
  },                                                                                                               // 2582
  numericallyBy: function(name) {                                                                                  // 2583
    return function(a, b) {                                                                                        // 2584
      return a[name] - b[name];                                                                                    // 2585
    };                                                                                                             // 2586
  }                                                                                                                // 2587
};                                                                                                                 // 2588
                                                                                                                   // 2589
var patchFilter = function nestedPatchFilter(context) {                                                            // 2590
  if (!context.nested) {                                                                                           // 2591
    return;                                                                                                        // 2592
  }                                                                                                                // 2593
  if (context.delta._t !== 'a') {                                                                                  // 2594
    return;                                                                                                        // 2595
  }                                                                                                                // 2596
  var index, index1;                                                                                               // 2597
                                                                                                                   // 2598
  var delta = context.delta;                                                                                       // 2599
  var array = context.left;                                                                                        // 2600
                                                                                                                   // 2601
  // first, separate removals, insertions and modifications                                                        // 2602
  var toRemove = [];                                                                                               // 2603
  var toInsert = [];                                                                                               // 2604
  var toModify = [];                                                                                               // 2605
  for (index in delta) {                                                                                           // 2606
    if (index !== '_t') {                                                                                          // 2607
      if (index[0] === '_') {                                                                                      // 2608
        // removed item from original array                                                                        // 2609
        if (delta[index][2] === 0 || delta[index][2] === ARRAY_MOVE) {                                             // 2610
          toRemove.push(parseInt(index.slice(1), 10));                                                             // 2611
        } else {                                                                                                   // 2612
          throw new Error('only removal or move can be applied at original array indices' +                        // 2613
            ', invalid diff type: ' + delta[index][2]);                                                            // 2614
        }                                                                                                          // 2615
      } else {                                                                                                     // 2616
        if (delta[index].length === 1) {                                                                           // 2617
          // added item at new array                                                                               // 2618
          toInsert.push({                                                                                          // 2619
            index: parseInt(index, 10),                                                                            // 2620
            value: delta[index][0]                                                                                 // 2621
          });                                                                                                      // 2622
        } else {                                                                                                   // 2623
          // modified item at new array                                                                            // 2624
          toModify.push({                                                                                          // 2625
            index: parseInt(index, 10),                                                                            // 2626
            delta: delta[index]                                                                                    // 2627
          });                                                                                                      // 2628
        }                                                                                                          // 2629
      }                                                                                                            // 2630
    }                                                                                                              // 2631
  }                                                                                                                // 2632
                                                                                                                   // 2633
  // remove items, in reverse order to avoid sawing our own floor                                                  // 2634
  toRemove = toRemove.sort(compare.numerically);                                                                   // 2635
  for (index = toRemove.length - 1; index >= 0; index--) {                                                         // 2636
    index1 = toRemove[index];                                                                                      // 2637
    var indexDiff = delta['_' + index1];                                                                           // 2638
    var removedValue = array.splice(index1, 1)[0];                                                                 // 2639
    if (indexDiff[2] === ARRAY_MOVE) {                                                                             // 2640
      // reinsert later                                                                                            // 2641
      toInsert.push({                                                                                              // 2642
        index: indexDiff[1],                                                                                       // 2643
        value: removedValue                                                                                        // 2644
      });                                                                                                          // 2645
    }                                                                                                              // 2646
  }                                                                                                                // 2647
                                                                                                                   // 2648
  // insert items, in reverse order to avoid moving our own floor                                                  // 2649
  toInsert = toInsert.sort(compare.numericallyBy('index'));                                                        // 2650
  var toInsertLength = toInsert.length;                                                                            // 2651
  for (index = 0; index < toInsertLength; index++) {                                                               // 2652
    var insertion = toInsert[index];                                                                               // 2653
    array.splice(insertion.index, 0, insertion.value);                                                             // 2654
  }                                                                                                                // 2655
                                                                                                                   // 2656
  // apply modifications                                                                                           // 2657
  var toModifyLength = toModify.length;                                                                            // 2658
  var child;                                                                                                       // 2659
  if (toModifyLength > 0) {                                                                                        // 2660
    for (index = 0; index < toModifyLength; index++) {                                                             // 2661
      var modification = toModify[index];                                                                          // 2662
      child = new PatchContext(context.left[modification.index], modification.delta);                              // 2663
      context.push(child, modification.index);                                                                     // 2664
    }                                                                                                              // 2665
  }                                                                                                                // 2666
                                                                                                                   // 2667
  if (!context.children) {                                                                                         // 2668
    context.setResult(context.left).exit();                                                                        // 2669
    return;                                                                                                        // 2670
  }                                                                                                                // 2671
  context.exit();                                                                                                  // 2672
};                                                                                                                 // 2673
patchFilter.filterName = 'arrays';                                                                                 // 2674
                                                                                                                   // 2675
var collectChildrenPatchFilter = function collectChildrenPatchFilter(context) {                                    // 2676
  if (!context || !context.children) {                                                                             // 2677
    return;                                                                                                        // 2678
  }                                                                                                                // 2679
  if (context.delta._t !== 'a') {                                                                                  // 2680
    return;                                                                                                        // 2681
  }                                                                                                                // 2682
  var length = context.children.length;                                                                            // 2683
  var child;                                                                                                       // 2684
  for (var index = 0; index < length; index++) {                                                                   // 2685
    child = context.children[index];                                                                               // 2686
    context.left[child.childName] = child.result;                                                                  // 2687
  }                                                                                                                // 2688
  context.setResult(context.left).exit();                                                                          // 2689
};                                                                                                                 // 2690
collectChildrenPatchFilter.filterName = 'arraysCollectChildren';                                                   // 2691
                                                                                                                   // 2692
var reverseFilter = function arraysReverseFilter(context) {                                                        // 2693
  if (!context.nested) {                                                                                           // 2694
    if (context.delta[2] === ARRAY_MOVE) {                                                                         // 2695
      context.newName = '_' + context.delta[1];                                                                    // 2696
      context.setResult([context.delta[0], parseInt(context.childName.substr(1), 10), ARRAY_MOVE]).exit();         // 2697
    }                                                                                                              // 2698
    return;                                                                                                        // 2699
  }                                                                                                                // 2700
  if (context.delta._t !== 'a') {                                                                                  // 2701
    return;                                                                                                        // 2702
  }                                                                                                                // 2703
  var name, child;                                                                                                 // 2704
  for (name in context.delta) {                                                                                    // 2705
    if (name === '_t') {                                                                                           // 2706
      continue;                                                                                                    // 2707
    }                                                                                                              // 2708
    child = new ReverseContext(context.delta[name]);                                                               // 2709
    context.push(child, name);                                                                                     // 2710
  }                                                                                                                // 2711
  context.exit();                                                                                                  // 2712
};                                                                                                                 // 2713
reverseFilter.filterName = 'arrays';                                                                               // 2714
                                                                                                                   // 2715
var reverseArrayDeltaIndex = function(delta, index, itemDelta) {                                                   // 2716
  if (typeof index === 'string' && index[0] === '_') {                                                             // 2717
    return parseInt(index.substr(1), 10);                                                                          // 2718
  } else if (isArray(itemDelta) && itemDelta[2] === 0) {                                                           // 2719
    return '_' + index;                                                                                            // 2720
  }                                                                                                                // 2721
                                                                                                                   // 2722
  var reverseIndex = +index;                                                                                       // 2723
  for (var deltaIndex in delta) {                                                                                  // 2724
    var deltaItem = delta[deltaIndex];                                                                             // 2725
    if (isArray(deltaItem)) {                                                                                      // 2726
      if (deltaItem[2] === ARRAY_MOVE) {                                                                           // 2727
        var moveFromIndex = parseInt(deltaIndex.substr(1), 10);                                                    // 2728
        var moveToIndex = deltaItem[1];                                                                            // 2729
        if (moveToIndex === +index) {                                                                              // 2730
          return moveFromIndex;                                                                                    // 2731
        }                                                                                                          // 2732
        if (moveFromIndex <= reverseIndex && moveToIndex > reverseIndex) {                                         // 2733
          reverseIndex++;                                                                                          // 2734
        } else if (moveFromIndex >= reverseIndex && moveToIndex < reverseIndex) {                                  // 2735
          reverseIndex--;                                                                                          // 2736
        }                                                                                                          // 2737
      } else if (deltaItem[2] === 0) {                                                                             // 2738
        var deleteIndex = parseInt(deltaIndex.substr(1), 10);                                                      // 2739
        if (deleteIndex <= reverseIndex) {                                                                         // 2740
          reverseIndex++;                                                                                          // 2741
        }                                                                                                          // 2742
      } else if (deltaItem.length === 1 && deltaIndex <= reverseIndex) {                                           // 2743
        reverseIndex--;                                                                                            // 2744
      }                                                                                                            // 2745
    }                                                                                                              // 2746
  }                                                                                                                // 2747
                                                                                                                   // 2748
  return reverseIndex;                                                                                             // 2749
};                                                                                                                 // 2750
                                                                                                                   // 2751
var collectChildrenReverseFilter = function collectChildrenReverseFilter(context) {                                // 2752
  if (!context || !context.children) {                                                                             // 2753
    return;                                                                                                        // 2754
  }                                                                                                                // 2755
  if (context.delta._t !== 'a') {                                                                                  // 2756
    return;                                                                                                        // 2757
  }                                                                                                                // 2758
  var length = context.children.length;                                                                            // 2759
  var child;                                                                                                       // 2760
  var delta = {                                                                                                    // 2761
    _t: 'a'                                                                                                        // 2762
  };                                                                                                               // 2763
                                                                                                                   // 2764
  for (var index = 0; index < length; index++) {                                                                   // 2765
    child = context.children[index];                                                                               // 2766
    var name = child.newName;                                                                                      // 2767
    if (typeof name === 'undefined') {                                                                             // 2768
      name = reverseArrayDeltaIndex(context.delta, child.childName, child.result);                                 // 2769
    }                                                                                                              // 2770
    if (delta[name] !== child.result) {                                                                            // 2771
      delta[name] = child.result;                                                                                  // 2772
    }                                                                                                              // 2773
  }                                                                                                                // 2774
  context.setResult(delta).exit();                                                                                 // 2775
};                                                                                                                 // 2776
collectChildrenReverseFilter.filterName = 'arraysCollectChildren';                                                 // 2777
                                                                                                                   // 2778
exports.diffFilter = diffFilter;                                                                                   // 2779
exports.patchFilter = patchFilter;                                                                                 // 2780
exports.collectChildrenPatchFilter = collectChildrenPatchFilter;                                                   // 2781
exports.reverseFilter = reverseFilter;                                                                             // 2782
exports.collectChildrenReverseFilter = collectChildrenReverseFilter;                                               // 2783
                                                                                                                   // 2784
},{"../contexts/diff":4,"../contexts/patch":5,"../contexts/reverse":6,"./lcs":12}],11:[function(require,module,exports){
var diffFilter = function datesDiffFilter(context) {                                                               // 2786
  if (context.left instanceof Date) {                                                                              // 2787
    if (context.right instanceof Date) {                                                                           // 2788
      if (context.left.getTime() !== context.right.getTime()) {                                                    // 2789
        context.setResult([context.left, context.right]);                                                          // 2790
      } else {                                                                                                     // 2791
        context.setResult(undefined);                                                                              // 2792
      }                                                                                                            // 2793
    } else {                                                                                                       // 2794
      context.setResult([context.left, context.right]);                                                            // 2795
    }                                                                                                              // 2796
    context.exit();                                                                                                // 2797
  } else if (context.right instanceof Date) {                                                                      // 2798
    context.setResult([context.left, context.right]).exit();                                                       // 2799
  }                                                                                                                // 2800
};                                                                                                                 // 2801
diffFilter.filterName = 'dates';                                                                                   // 2802
                                                                                                                   // 2803
exports.diffFilter = diffFilter;                                                                                   // 2804
                                                                                                                   // 2805
},{}],12:[function(require,module,exports){                                                                        // 2806
/*                                                                                                                 // 2807
                                                                                                                   // 2808
LCS implementation that supports arrays or strings                                                                 // 2809
                                                                                                                   // 2810
reference: http://en.wikipedia.org/wiki/Longest_common_subsequence_problem                                         // 2811
                                                                                                                   // 2812
*/                                                                                                                 // 2813
                                                                                                                   // 2814
var defaultMatch = function(array1, array2, index1, index2) {                                                      // 2815
  return array1[index1] === array2[index2];                                                                        // 2816
};                                                                                                                 // 2817
                                                                                                                   // 2818
var lengthMatrix = function(array1, array2, match, context) {                                                      // 2819
  var len1 = array1.length;                                                                                        // 2820
  var len2 = array2.length;                                                                                        // 2821
  var x, y;                                                                                                        // 2822
                                                                                                                   // 2823
  // initialize empty matrix of len1+1 x len2+1                                                                    // 2824
  var matrix = [len1 + 1];                                                                                         // 2825
  for (x = 0; x < len1 + 1; x++) {                                                                                 // 2826
    matrix[x] = [len2 + 1];                                                                                        // 2827
    for (y = 0; y < len2 + 1; y++) {                                                                               // 2828
      matrix[x][y] = 0;                                                                                            // 2829
    }                                                                                                              // 2830
  }                                                                                                                // 2831
  matrix.match = match;                                                                                            // 2832
  // save sequence lengths for each coordinate                                                                     // 2833
  for (x = 1; x < len1 + 1; x++) {                                                                                 // 2834
    for (y = 1; y < len2 + 1; y++) {                                                                               // 2835
      if (match(array1, array2, x - 1, y - 1, context)) {                                                          // 2836
        matrix[x][y] = matrix[x - 1][y - 1] + 1;                                                                   // 2837
      } else {                                                                                                     // 2838
        matrix[x][y] = Math.max(matrix[x - 1][y], matrix[x][y - 1]);                                               // 2839
      }                                                                                                            // 2840
    }                                                                                                              // 2841
  }                                                                                                                // 2842
  return matrix;                                                                                                   // 2843
};                                                                                                                 // 2844
                                                                                                                   // 2845
var backtrack = function(matrix, array1, array2, index1, index2, context) {                                        // 2846
  if (index1 === 0 || index2 === 0) {                                                                              // 2847
    return {                                                                                                       // 2848
      sequence: [],                                                                                                // 2849
      indices1: [],                                                                                                // 2850
      indices2: []                                                                                                 // 2851
    };                                                                                                             // 2852
  }                                                                                                                // 2853
                                                                                                                   // 2854
  if (matrix.match(array1, array2, index1 - 1, index2 - 1, context)) {                                             // 2855
    var subsequence = backtrack(matrix, array1, array2, index1 - 1, index2 - 1, context);                          // 2856
    subsequence.sequence.push(array1[index1 - 1]);                                                                 // 2857
    subsequence.indices1.push(index1 - 1);                                                                         // 2858
    subsequence.indices2.push(index2 - 1);                                                                         // 2859
    return subsequence;                                                                                            // 2860
  }                                                                                                                // 2861
                                                                                                                   // 2862
  if (matrix[index1][index2 - 1] > matrix[index1 - 1][index2]) {                                                   // 2863
    return backtrack(matrix, array1, array2, index1, index2 - 1, context);                                         // 2864
  } else {                                                                                                         // 2865
    return backtrack(matrix, array1, array2, index1 - 1, index2, context);                                         // 2866
  }                                                                                                                // 2867
};                                                                                                                 // 2868
                                                                                                                   // 2869
var get = function(array1, array2, match, context) {                                                               // 2870
  context = context || {};                                                                                         // 2871
  var matrix = lengthMatrix(array1, array2, match || defaultMatch, context);                                       // 2872
  var result = backtrack(matrix, array1, array2, array1.length, array2.length, context);                           // 2873
  if (typeof array1 === 'string' && typeof array2 === 'string') {                                                  // 2874
    result.sequence = result.sequence.join('');                                                                    // 2875
  }                                                                                                                // 2876
  return result;                                                                                                   // 2877
};                                                                                                                 // 2878
                                                                                                                   // 2879
exports.get = get;                                                                                                 // 2880
                                                                                                                   // 2881
},{}],13:[function(require,module,exports){                                                                        // 2882
var DiffContext = require('../contexts/diff').DiffContext;                                                         // 2883
var PatchContext = require('../contexts/patch').PatchContext;                                                      // 2884
var ReverseContext = require('../contexts/reverse').ReverseContext;                                                // 2885
                                                                                                                   // 2886
var collectChildrenDiffFilter = function collectChildrenDiffFilter(context) {                                      // 2887
  if (!context || !context.children) {                                                                             // 2888
    return;                                                                                                        // 2889
  }                                                                                                                // 2890
  var length = context.children.length;                                                                            // 2891
  var child;                                                                                                       // 2892
  var result = context.result;                                                                                     // 2893
  for (var index = 0; index < length; index++) {                                                                   // 2894
    child = context.children[index];                                                                               // 2895
    if (typeof child.result === 'undefined') {                                                                     // 2896
      continue;                                                                                                    // 2897
    }                                                                                                              // 2898
    result = result || {};                                                                                         // 2899
    result[child.childName] = child.result;                                                                        // 2900
  }                                                                                                                // 2901
  if (result && context.leftIsArray) {                                                                             // 2902
    result._t = 'a';                                                                                               // 2903
  }                                                                                                                // 2904
  context.setResult(result).exit();                                                                                // 2905
};                                                                                                                 // 2906
collectChildrenDiffFilter.filterName = 'collectChildren';                                                          // 2907
                                                                                                                   // 2908
var objectsDiffFilter = function objectsDiffFilter(context) {                                                      // 2909
  if (context.leftIsArray || context.leftType !== 'object') {                                                      // 2910
    return;                                                                                                        // 2911
  }                                                                                                                // 2912
                                                                                                                   // 2913
  var name, child;                                                                                                 // 2914
  for (name in context.left) {                                                                                     // 2915
    child = new DiffContext(context.left[name], context.right[name]);                                              // 2916
    context.push(child, name);                                                                                     // 2917
  }                                                                                                                // 2918
  for (name in context.right) {                                                                                    // 2919
    if (typeof context.left[name] === 'undefined') {                                                               // 2920
      child = new DiffContext(undefined, context.right[name]);                                                     // 2921
      context.push(child, name);                                                                                   // 2922
    }                                                                                                              // 2923
  }                                                                                                                // 2924
                                                                                                                   // 2925
  if (!context.children || context.children.length === 0) {                                                        // 2926
    context.setResult(undefined).exit();                                                                           // 2927
    return;                                                                                                        // 2928
  }                                                                                                                // 2929
  context.exit();                                                                                                  // 2930
};                                                                                                                 // 2931
objectsDiffFilter.filterName = 'objects';                                                                          // 2932
                                                                                                                   // 2933
var patchFilter = function nestedPatchFilter(context) {                                                            // 2934
  if (!context.nested) {                                                                                           // 2935
    return;                                                                                                        // 2936
  }                                                                                                                // 2937
  if (context.delta._t) {                                                                                          // 2938
    return;                                                                                                        // 2939
  }                                                                                                                // 2940
  var name, child;                                                                                                 // 2941
  for (name in context.delta) {                                                                                    // 2942
    child = new PatchContext(context.left[name], context.delta[name]);                                             // 2943
    context.push(child, name);                                                                                     // 2944
  }                                                                                                                // 2945
  context.exit();                                                                                                  // 2946
};                                                                                                                 // 2947
patchFilter.filterName = 'objects';                                                                                // 2948
                                                                                                                   // 2949
var collectChildrenPatchFilter = function collectChildrenPatchFilter(context) {                                    // 2950
  if (!context || !context.children) {                                                                             // 2951
    return;                                                                                                        // 2952
  }                                                                                                                // 2953
  if (context.delta._t) {                                                                                          // 2954
    return;                                                                                                        // 2955
  }                                                                                                                // 2956
  var length = context.children.length;                                                                            // 2957
  var child;                                                                                                       // 2958
  for (var index = 0; index < length; index++) {                                                                   // 2959
    child = context.children[index];                                                                               // 2960
    if (context.left.hasOwnProperty(child.childName) && child.result === undefined) {                              // 2961
      delete context.left[child.childName];                                                                        // 2962
    } else if (context.left[child.childName] !== child.result) {                                                   // 2963
      context.left[child.childName] = child.result;                                                                // 2964
    }                                                                                                              // 2965
  }                                                                                                                // 2966
  context.setResult(context.left).exit();                                                                          // 2967
};                                                                                                                 // 2968
collectChildrenPatchFilter.filterName = 'collectChildren';                                                         // 2969
                                                                                                                   // 2970
var reverseFilter = function nestedReverseFilter(context) {                                                        // 2971
  if (!context.nested) {                                                                                           // 2972
    return;                                                                                                        // 2973
  }                                                                                                                // 2974
  if (context.delta._t) {                                                                                          // 2975
    return;                                                                                                        // 2976
  }                                                                                                                // 2977
  var name, child;                                                                                                 // 2978
  for (name in context.delta) {                                                                                    // 2979
    child = new ReverseContext(context.delta[name]);                                                               // 2980
    context.push(child, name);                                                                                     // 2981
  }                                                                                                                // 2982
  context.exit();                                                                                                  // 2983
};                                                                                                                 // 2984
reverseFilter.filterName = 'objects';                                                                              // 2985
                                                                                                                   // 2986
var collectChildrenReverseFilter = function collectChildrenReverseFilter(context) {                                // 2987
  if (!context || !context.children) {                                                                             // 2988
    return;                                                                                                        // 2989
  }                                                                                                                // 2990
  if (context.delta._t) {                                                                                          // 2991
    return;                                                                                                        // 2992
  }                                                                                                                // 2993
  var length = context.children.length;                                                                            // 2994
  var child;                                                                                                       // 2995
  var delta = {};                                                                                                  // 2996
  for (var index = 0; index < length; index++) {                                                                   // 2997
    child = context.children[index];                                                                               // 2998
    if (delta[child.childName] !== child.result) {                                                                 // 2999
      delta[child.childName] = child.result;                                                                       // 3000
    }                                                                                                              // 3001
  }                                                                                                                // 3002
  context.setResult(delta).exit();                                                                                 // 3003
};                                                                                                                 // 3004
collectChildrenReverseFilter.filterName = 'collectChildren';                                                       // 3005
                                                                                                                   // 3006
exports.collectChildrenDiffFilter = collectChildrenDiffFilter;                                                     // 3007
exports.objectsDiffFilter = objectsDiffFilter;                                                                     // 3008
exports.patchFilter = patchFilter;                                                                                 // 3009
exports.collectChildrenPatchFilter = collectChildrenPatchFilter;                                                   // 3010
exports.reverseFilter = reverseFilter;                                                                             // 3011
exports.collectChildrenReverseFilter = collectChildrenReverseFilter;                                               // 3012
                                                                                                                   // 3013
},{"../contexts/diff":4,"../contexts/patch":5,"../contexts/reverse":6}],14:[function(require,module,exports){      // 3014
/* global diff_match_patch */                                                                                      // 3015
var TEXT_DIFF = 2;                                                                                                 // 3016
var DEFAULT_MIN_LENGTH = 60;                                                                                       // 3017
var cachedDiffPatch = null;                                                                                        // 3018
                                                                                                                   // 3019
var getDiffMatchPatch = function(required) {                                                                       // 3020
  /*jshint camelcase: false */                                                                                     // 3021
                                                                                                                   // 3022
  if (!cachedDiffPatch) {                                                                                          // 3023
    var instance;                                                                                                  // 3024
    if (typeof diff_match_patch !== 'undefined') {                                                                 // 3025
      // already loaded, probably a browser                                                                        // 3026
      instance = typeof diff_match_patch === 'function' ?                                                          // 3027
        new diff_match_patch() : new diff_match_patch.diff_match_patch();                                          // 3028
    } else if (typeof require === 'function') {                                                                    // 3029
      try {                                                                                                        // 3030
        var dmpModuleName = 'diff_match_patch_uncompressed';                                                       // 3031
        var dmp = require('../../public/external/' + dmpModuleName);                                               // 3032
        instance = new dmp.diff_match_patch();                                                                     // 3033
      } catch (err) {                                                                                              // 3034
        instance = null;                                                                                           // 3035
      }                                                                                                            // 3036
    }                                                                                                              // 3037
    if (!instance) {                                                                                               // 3038
      if (!required) {                                                                                             // 3039
        return null;                                                                                               // 3040
      }                                                                                                            // 3041
      var error = new Error('text diff_match_patch library not found');                                            // 3042
      error.diff_match_patch_not_found = true;                                                                     // 3043
      throw error;                                                                                                 // 3044
    }                                                                                                              // 3045
    cachedDiffPatch = {                                                                                            // 3046
      diff: function(txt1, txt2) {                                                                                 // 3047
        return instance.patch_toText(instance.patch_make(txt1, txt2));                                             // 3048
      },                                                                                                           // 3049
      patch: function(txt1, patch) {                                                                               // 3050
        var results = instance.patch_apply(instance.patch_fromText(patch), txt1);                                  // 3051
        for (var i = 0; i < results[1].length; i++) {                                                              // 3052
          if (!results[1][i]) {                                                                                    // 3053
            var error = new Error('text patch failed');                                                            // 3054
            error.textPatchFailed = true;                                                                          // 3055
          }                                                                                                        // 3056
        }                                                                                                          // 3057
        return results[0];                                                                                         // 3058
      }                                                                                                            // 3059
    };                                                                                                             // 3060
  }                                                                                                                // 3061
  return cachedDiffPatch;                                                                                          // 3062
};                                                                                                                 // 3063
                                                                                                                   // 3064
var diffFilter = function textsDiffFilter(context) {                                                               // 3065
  if (context.leftType !== 'string') {                                                                             // 3066
    return;                                                                                                        // 3067
  }                                                                                                                // 3068
  var minLength = (context.options && context.options.textDiff &&                                                  // 3069
    context.options.textDiff.minLength) || DEFAULT_MIN_LENGTH;                                                     // 3070
  if (context.left.length < minLength ||                                                                           // 3071
    context.right.length < minLength) {                                                                            // 3072
    context.setResult([context.left, context.right]).exit();                                                       // 3073
    return;                                                                                                        // 3074
  }                                                                                                                // 3075
  // large text, try to use a text-diff algorithm                                                                  // 3076
  var diffMatchPatch = getDiffMatchPatch();                                                                        // 3077
  if (!diffMatchPatch) {                                                                                           // 3078
    // diff-match-patch library not available, fallback to regular string replace                                  // 3079
    context.setResult([context.left, context.right]).exit();                                                       // 3080
    return;                                                                                                        // 3081
  }                                                                                                                // 3082
  var diff = diffMatchPatch.diff;                                                                                  // 3083
  context.setResult([diff(context.left, context.right), 0, TEXT_DIFF]).exit();                                     // 3084
};                                                                                                                 // 3085
diffFilter.filterName = 'texts';                                                                                   // 3086
                                                                                                                   // 3087
var patchFilter = function textsPatchFilter(context) {                                                             // 3088
  if (context.nested) {                                                                                            // 3089
    return;                                                                                                        // 3090
  }                                                                                                                // 3091
  if (context.delta[2] !== TEXT_DIFF) {                                                                            // 3092
    return;                                                                                                        // 3093
  }                                                                                                                // 3094
                                                                                                                   // 3095
  // text-diff, use a text-patch algorithm                                                                         // 3096
  var patch = getDiffMatchPatch(true).patch;                                                                       // 3097
  context.setResult(patch(context.left, context.delta[0])).exit();                                                 // 3098
};                                                                                                                 // 3099
patchFilter.filterName = 'texts';                                                                                  // 3100
                                                                                                                   // 3101
var textDeltaReverse = function(delta) {                                                                           // 3102
  var i, l, lines, line, lineTmp, header = null,                                                                   // 3103
    headerRegex = /^@@ +\-(\d+),(\d+) +\+(\d+),(\d+) +@@$/,                                                        // 3104
    lineHeader, lineAdd, lineRemove;                                                                               // 3105
  lines = delta.split('\n');                                                                                       // 3106
  for (i = 0, l = lines.length; i < l; i++) {                                                                      // 3107
    line = lines[i];                                                                                               // 3108
    var lineStart = line.slice(0, 1);                                                                              // 3109
    if (lineStart === '@') {                                                                                       // 3110
      header = headerRegex.exec(line);                                                                             // 3111
      lineHeader = i;                                                                                              // 3112
      lineAdd = null;                                                                                              // 3113
      lineRemove = null;                                                                                           // 3114
                                                                                                                   // 3115
      // fix header                                                                                                // 3116
      lines[lineHeader] = '@@ -' + header[3] + ',' + header[4] + ' +' + header[1] + ',' + header[2] + ' @@';       // 3117
    } else if (lineStart === '+') {                                                                                // 3118
      lineAdd = i;                                                                                                 // 3119
      lines[i] = '-' + lines[i].slice(1);                                                                          // 3120
      if (lines[i - 1].slice(0, 1) === '+') {                                                                      // 3121
        // swap lines to keep default order (-+)                                                                   // 3122
        lineTmp = lines[i];                                                                                        // 3123
        lines[i] = lines[i - 1];                                                                                   // 3124
        lines[i - 1] = lineTmp;                                                                                    // 3125
      }                                                                                                            // 3126
    } else if (lineStart === '-') {                                                                                // 3127
      lineRemove = i;                                                                                              // 3128
      lines[i] = '+' + lines[i].slice(1);                                                                          // 3129
    }                                                                                                              // 3130
  }                                                                                                                // 3131
  return lines.join('\n');                                                                                         // 3132
};                                                                                                                 // 3133
                                                                                                                   // 3134
var reverseFilter = function textsReverseFilter(context) {                                                         // 3135
  if (context.nested) {                                                                                            // 3136
    return;                                                                                                        // 3137
  }                                                                                                                // 3138
  if (context.delta[2] !== TEXT_DIFF) {                                                                            // 3139
    return;                                                                                                        // 3140
  }                                                                                                                // 3141
                                                                                                                   // 3142
  // text-diff, use a text-diff algorithm                                                                          // 3143
  context.setResult([textDeltaReverse(context.delta[0]), 0, TEXT_DIFF]).exit();                                    // 3144
};                                                                                                                 // 3145
reverseFilter.filterName = 'texts';                                                                                // 3146
                                                                                                                   // 3147
exports.diffFilter = diffFilter;                                                                                   // 3148
exports.patchFilter = patchFilter;                                                                                 // 3149
exports.reverseFilter = reverseFilter;                                                                             // 3150
                                                                                                                   // 3151
},{}],15:[function(require,module,exports){                                                                        // 3152
var isArray = (typeof Array.isArray === 'function') ?                                                              // 3153
  // use native function                                                                                           // 3154
  Array.isArray :                                                                                                  // 3155
  // use instanceof operator                                                                                       // 3156
  function(a) {                                                                                                    // 3157
    return a instanceof Array;                                                                                     // 3158
  };                                                                                                               // 3159
                                                                                                                   // 3160
var diffFilter = function trivialMatchesDiffFilter(context) {                                                      // 3161
  if (context.left === context.right) {                                                                            // 3162
    context.setResult(undefined).exit();                                                                           // 3163
    return;                                                                                                        // 3164
  }                                                                                                                // 3165
  if (typeof context.left === 'undefined') {                                                                       // 3166
    if (typeof context.right === 'function') {                                                                     // 3167
      throw new Error('functions are not supported');                                                              // 3168
    }                                                                                                              // 3169
    context.setResult([context.right]).exit();                                                                     // 3170
    return;                                                                                                        // 3171
  }                                                                                                                // 3172
  if (typeof context.right === 'undefined') {                                                                      // 3173
    context.setResult([context.left, 0, 0]).exit();                                                                // 3174
    return;                                                                                                        // 3175
  }                                                                                                                // 3176
  if (typeof context.left === 'function' || typeof context.right === 'function') {                                 // 3177
    throw new Error('functions are not supported');                                                                // 3178
  }                                                                                                                // 3179
  context.leftType = context.left === null ? 'null' : typeof context.left;                                         // 3180
  context.rightType = context.right === null ? 'null' : typeof context.right;                                      // 3181
  if (context.leftType !== context.rightType) {                                                                    // 3182
    context.setResult([context.left, context.right]).exit();                                                       // 3183
    return;                                                                                                        // 3184
  }                                                                                                                // 3185
  if (context.leftType === 'boolean' || context.leftType === 'number') {                                           // 3186
    context.setResult([context.left, context.right]).exit();                                                       // 3187
    return;                                                                                                        // 3188
  }                                                                                                                // 3189
  if (context.leftType === 'object') {                                                                             // 3190
    context.leftIsArray = isArray(context.left);                                                                   // 3191
  }                                                                                                                // 3192
  if (context.rightType === 'object') {                                                                            // 3193
    context.rightIsArray = isArray(context.right);                                                                 // 3194
  }                                                                                                                // 3195
  if (context.leftIsArray !== context.rightIsArray) {                                                              // 3196
    context.setResult([context.left, context.right]).exit();                                                       // 3197
    return;                                                                                                        // 3198
  }                                                                                                                // 3199
};                                                                                                                 // 3200
diffFilter.filterName = 'trivial';                                                                                 // 3201
                                                                                                                   // 3202
var patchFilter = function trivialMatchesPatchFilter(context) {                                                    // 3203
  if (typeof context.delta === 'undefined') {                                                                      // 3204
    context.setResult(context.left).exit();                                                                        // 3205
    return;                                                                                                        // 3206
  }                                                                                                                // 3207
  context.nested = !isArray(context.delta);                                                                        // 3208
  if (context.nested) {                                                                                            // 3209
    return;                                                                                                        // 3210
  }                                                                                                                // 3211
  if (context.delta.length === 1) {                                                                                // 3212
    context.setResult(context.delta[0]).exit();                                                                    // 3213
    return;                                                                                                        // 3214
  }                                                                                                                // 3215
  if (context.delta.length === 2) {                                                                                // 3216
    context.setResult(context.delta[1]).exit();                                                                    // 3217
    return;                                                                                                        // 3218
  }                                                                                                                // 3219
  if (context.delta.length === 3 && context.delta[2] === 0) {                                                      // 3220
    context.setResult(undefined).exit();                                                                           // 3221
    return;                                                                                                        // 3222
  }                                                                                                                // 3223
};                                                                                                                 // 3224
patchFilter.filterName = 'trivial';                                                                                // 3225
                                                                                                                   // 3226
var reverseFilter = function trivialReferseFilter(context) {                                                       // 3227
  if (typeof context.delta === 'undefined') {                                                                      // 3228
    context.setResult(context.delta).exit();                                                                       // 3229
    return;                                                                                                        // 3230
  }                                                                                                                // 3231
  context.nested = !isArray(context.delta);                                                                        // 3232
  if (context.nested) {                                                                                            // 3233
    return;                                                                                                        // 3234
  }                                                                                                                // 3235
  if (context.delta.length === 1) {                                                                                // 3236
    context.setResult([context.delta[0], 0, 0]).exit();                                                            // 3237
    return;                                                                                                        // 3238
  }                                                                                                                // 3239
  if (context.delta.length === 2) {                                                                                // 3240
    context.setResult([context.delta[1], context.delta[0]]).exit();                                                // 3241
    return;                                                                                                        // 3242
  }                                                                                                                // 3243
  if (context.delta.length === 3 && context.delta[2] === 0) {                                                      // 3244
    context.setResult([context.delta[0]]).exit();                                                                  // 3245
    return;                                                                                                        // 3246
  }                                                                                                                // 3247
};                                                                                                                 // 3248
reverseFilter.filterName = 'trivial';                                                                              // 3249
                                                                                                                   // 3250
exports.diffFilter = diffFilter;                                                                                   // 3251
exports.patchFilter = patchFilter;                                                                                 // 3252
exports.reverseFilter = reverseFilter;                                                                             // 3253
                                                                                                                   // 3254
},{}],16:[function(require,module,exports){                                                                        // 3255
                                                                                                                   // 3256
var environment = require('./environment');                                                                        // 3257
                                                                                                                   // 3258
var DiffPatcher = require('./diffpatcher').DiffPatcher;                                                            // 3259
exports.DiffPatcher = DiffPatcher;                                                                                 // 3260
                                                                                                                   // 3261
exports.create = function(options){                                                                                // 3262
	return new DiffPatcher(options);                                                                                  // 3263
};                                                                                                                 // 3264
                                                                                                                   // 3265
exports.dateReviver = require('./date-reviver');                                                                   // 3266
                                                                                                                   // 3267
var defaultInstance;                                                                                               // 3268
                                                                                                                   // 3269
exports.diff = function() {                                                                                        // 3270
	if (!defaultInstance) {                                                                                           // 3271
		defaultInstance = new DiffPatcher();                                                                             // 3272
	}                                                                                                                 // 3273
	return defaultInstance.diff.apply(defaultInstance, arguments);                                                    // 3274
};                                                                                                                 // 3275
                                                                                                                   // 3276
exports.patch = function() {                                                                                       // 3277
	if (!defaultInstance) {                                                                                           // 3278
		defaultInstance = new DiffPatcher();                                                                             // 3279
	}                                                                                                                 // 3280
	return defaultInstance.patch.apply(defaultInstance, arguments);                                                   // 3281
};                                                                                                                 // 3282
                                                                                                                   // 3283
exports.unpatch = function() {                                                                                     // 3284
	if (!defaultInstance) {                                                                                           // 3285
		defaultInstance = new DiffPatcher();                                                                             // 3286
	}                                                                                                                 // 3287
	return defaultInstance.unpatch.apply(defaultInstance, arguments);                                                 // 3288
};                                                                                                                 // 3289
                                                                                                                   // 3290
exports.reverse = function() {                                                                                     // 3291
	if (!defaultInstance) {                                                                                           // 3292
		defaultInstance = new DiffPatcher();                                                                             // 3293
	}                                                                                                                 // 3294
	return defaultInstance.reverse.apply(defaultInstance, arguments);                                                 // 3295
};                                                                                                                 // 3296
                                                                                                                   // 3297
if (environment.isBrowser) {                                                                                       // 3298
	exports.homepage = 'https://github.com/benjamine/jsondiffpatch';                                                  // 3299
	exports.version = '0.1.37';                                                                                       // 3300
} else {                                                                                                           // 3301
	var packageInfoModuleName = '../package.json';                                                                    // 3302
	var packageInfo = require(packageInfoModuleName);                                                                 // 3303
	exports.homepage = packageInfo.homepage;                                                                          // 3304
	exports.version = packageInfo.version;                                                                            // 3305
                                                                                                                   // 3306
	var formatterModuleName = './formatters';                                                                         // 3307
	var formatters = require(formatterModuleName);                                                                    // 3308
	exports.formatters = formatters;                                                                                  // 3309
	// shortcut for console                                                                                           // 3310
	exports.console = formatters.console;                                                                             // 3311
}                                                                                                                  // 3312
                                                                                                                   // 3313
},{"./date-reviver":7,"./diffpatcher":8,"./environment":9}],17:[function(require,module,exports){                  // 3314
var Pipe = function Pipe(name) {                                                                                   // 3315
  this.name = name;                                                                                                // 3316
  this.filters = [];                                                                                               // 3317
};                                                                                                                 // 3318
                                                                                                                   // 3319
Pipe.prototype.process = function(input) {                                                                         // 3320
  if (!this.processor) {                                                                                           // 3321
    throw new Error('add this pipe to a processor before using it');                                               // 3322
  }                                                                                                                // 3323
  var debug = this.debug;                                                                                          // 3324
  var length = this.filters.length;                                                                                // 3325
  var context = input;                                                                                             // 3326
  for (var index = 0; index < length; index++) {                                                                   // 3327
    var filter = this.filters[index];                                                                              // 3328
    if (debug) {                                                                                                   // 3329
      this.log('filter: ' + filter.filterName);                                                                    // 3330
    }                                                                                                              // 3331
    filter(context);                                                                                               // 3332
    if (typeof context === 'object' && context.exiting) {                                                          // 3333
      context.exiting = false;                                                                                     // 3334
      break;                                                                                                       // 3335
    }                                                                                                              // 3336
  }                                                                                                                // 3337
  if (!context.next && this.resultCheck) {                                                                         // 3338
    this.resultCheck(context);                                                                                     // 3339
  }                                                                                                                // 3340
};                                                                                                                 // 3341
                                                                                                                   // 3342
Pipe.prototype.log = function(msg) {                                                                               // 3343
  console.log('[jsondiffpatch] ' + this.name + ' pipe, ' + msg);                                                   // 3344
};                                                                                                                 // 3345
                                                                                                                   // 3346
Pipe.prototype.append = function() {                                                                               // 3347
  this.filters.push.apply(this.filters, arguments);                                                                // 3348
  return this;                                                                                                     // 3349
};                                                                                                                 // 3350
                                                                                                                   // 3351
Pipe.prototype.prepend = function() {                                                                              // 3352
  this.filters.unshift.apply(this.filters, arguments);                                                             // 3353
  return this;                                                                                                     // 3354
};                                                                                                                 // 3355
                                                                                                                   // 3356
Pipe.prototype.indexOf = function(filterName) {                                                                    // 3357
  if (!filterName) {                                                                                               // 3358
    throw new Error('a filter name is required');                                                                  // 3359
  }                                                                                                                // 3360
  for (var index = 0; index < this.filters.length; index++) {                                                      // 3361
    var filter = this.filters[index];                                                                              // 3362
    if (filter.filterName === filterName) {                                                                        // 3363
      return index;                                                                                                // 3364
    }                                                                                                              // 3365
  }                                                                                                                // 3366
  throw new Error('filter not found: ' + filterName);                                                              // 3367
};                                                                                                                 // 3368
                                                                                                                   // 3369
Pipe.prototype.list = function() {                                                                                 // 3370
  var names = [];                                                                                                  // 3371
  for (var index = 0; index < this.filters.length; index++) {                                                      // 3372
    var filter = this.filters[index];                                                                              // 3373
    names.push(filter.filterName);                                                                                 // 3374
  }                                                                                                                // 3375
  return names;                                                                                                    // 3376
};                                                                                                                 // 3377
                                                                                                                   // 3378
Pipe.prototype.after = function(filterName) {                                                                      // 3379
  var index = this.indexOf(filterName);                                                                            // 3380
  var params = Array.prototype.slice.call(arguments, 1);                                                           // 3381
  if (!params.length) {                                                                                            // 3382
    throw new Error('a filter is required');                                                                       // 3383
  }                                                                                                                // 3384
  params.unshift(index + 1, 0);                                                                                    // 3385
  Array.prototype.splice.apply(this.filters, params);                                                              // 3386
  return this;                                                                                                     // 3387
};                                                                                                                 // 3388
                                                                                                                   // 3389
Pipe.prototype.before = function(filterName) {                                                                     // 3390
  var index = this.indexOf(filterName);                                                                            // 3391
  var params = Array.prototype.slice.call(arguments, 1);                                                           // 3392
  if (!params.length) {                                                                                            // 3393
    throw new Error('a filter is required');                                                                       // 3394
  }                                                                                                                // 3395
  params.unshift(index, 0);                                                                                        // 3396
  Array.prototype.splice.apply(this.filters, params);                                                              // 3397
  return this;                                                                                                     // 3398
};                                                                                                                 // 3399
                                                                                                                   // 3400
Pipe.prototype.clear = function() {                                                                                // 3401
  this.filters.length = 0;                                                                                         // 3402
  return this;                                                                                                     // 3403
};                                                                                                                 // 3404
                                                                                                                   // 3405
Pipe.prototype.shouldHaveResult = function(should) {                                                               // 3406
  if (should === false) {                                                                                          // 3407
    this.resultCheck = null;                                                                                       // 3408
    return;                                                                                                        // 3409
  }                                                                                                                // 3410
  if (this.resultCheck) {                                                                                          // 3411
    return;                                                                                                        // 3412
  }                                                                                                                // 3413
  var pipe = this;                                                                                                 // 3414
  this.resultCheck = function(context) {                                                                           // 3415
    if (!context.hasResult) {                                                                                      // 3416
      console.log(context);                                                                                        // 3417
      var error = new Error(pipe.name + ' failed');                                                                // 3418
      error.noResult = true;                                                                                       // 3419
      throw error;                                                                                                 // 3420
    }                                                                                                              // 3421
  };                                                                                                               // 3422
  return this;                                                                                                     // 3423
};                                                                                                                 // 3424
                                                                                                                   // 3425
exports.Pipe = Pipe;                                                                                               // 3426
                                                                                                                   // 3427
},{}],18:[function(require,module,exports){                                                                        // 3428
                                                                                                                   // 3429
var Processor = function Processor(options){                                                                       // 3430
	this.selfOptions = options;                                                                                       // 3431
	this.pipes = {};                                                                                                  // 3432
};                                                                                                                 // 3433
                                                                                                                   // 3434
Processor.prototype.options = function(options) {                                                                  // 3435
	if (options) {                                                                                                    // 3436
		this.selfOptions = options;                                                                                      // 3437
	}                                                                                                                 // 3438
	return this.selfOptions;                                                                                          // 3439
};                                                                                                                 // 3440
                                                                                                                   // 3441
Processor.prototype.pipe = function(name, pipe) {                                                                  // 3442
	if (typeof name === 'string') {                                                                                   // 3443
		if (typeof pipe === 'undefined') {                                                                               // 3444
			return this.pipes[name];                                                                                        // 3445
		} else {                                                                                                         // 3446
			this.pipes[name] = pipe;                                                                                        // 3447
		}                                                                                                                // 3448
	}                                                                                                                 // 3449
	if (name && name.name) {                                                                                          // 3450
		pipe = name;                                                                                                     // 3451
		if (pipe.processor === this) { return pipe; }                                                                    // 3452
		this.pipes[pipe.name] = pipe;                                                                                    // 3453
	}                                                                                                                 // 3454
	pipe.processor = this;                                                                                            // 3455
	return pipe;                                                                                                      // 3456
};                                                                                                                 // 3457
                                                                                                                   // 3458
Processor.prototype.process = function(input, pipe) {                                                              // 3459
	var context = input;                                                                                              // 3460
	context.options = this.options();                                                                                 // 3461
	var nextPipe = pipe || input.pipe || 'default';                                                                   // 3462
	var lastPipe, lastContext;                                                                                        // 3463
	while (nextPipe) {                                                                                                // 3464
		if (typeof context.nextAfterChildren !== 'undefined') {                                                          // 3465
			// children processed and coming back to parent                                                                 // 3466
			context.next = context.nextAfterChildren;                                                                       // 3467
			context.nextAfterChildren = null;                                                                               // 3468
		}                                                                                                                // 3469
                                                                                                                   // 3470
		if (typeof nextPipe === 'string') {                                                                              // 3471
			nextPipe = this.pipe(nextPipe);                                                                                 // 3472
		}                                                                                                                // 3473
		nextPipe.process(context);                                                                                       // 3474
		lastContext = context;                                                                                           // 3475
		lastPipe = nextPipe;                                                                                             // 3476
		nextPipe = null;                                                                                                 // 3477
		if (context) {                                                                                                   // 3478
			if (context.next) {                                                                                             // 3479
				context = context.next;                                                                                        // 3480
				nextPipe = lastContext.nextPipe || context.pipe || lastPipe;                                                   // 3481
			}                                                                                                               // 3482
		}                                                                                                                // 3483
	}                                                                                                                 // 3484
	return context.hasResult ? context.result : undefined;                                                            // 3485
};                                                                                                                 // 3486
                                                                                                                   // 3487
exports.Processor = Processor;                                                                                     // 3488
                                                                                                                   // 3489
},{}]},{},[1])(1)                                                                                                  // 3490
});                                                                                                                // 3491
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9maWJlcmdsYXNzL25vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJzcmMvbWFpbi1mdWxsLmpzIiwicHVibGljL2V4dGVybmFsL2RpZmZfbWF0Y2hfcGF0Y2hfdW5jb21wcmVzc2VkLmpzIiwic3JjL2NvbnRleHRzL2NvbnRleHQuanMiLCJzcmMvY29udGV4dHMvZGlmZi5qcyIsInNyYy9jb250ZXh0cy9wYXRjaC5qcyIsInNyYy9jb250ZXh0cy9yZXZlcnNlLmpzIiwic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kZfSU5TRVJUOlxuICAgICAgICBjb3VudF9pbnNlcnQrKztcbiAgICAgICAgdGV4dF9pbnNlcnQgKz0gZGlmZnNbcG9pbnRlcl1bMV07XG4gICAgICAgIGJyZWFrO1xuICAgICAgY2FzZSBESUZGX0RFTEVURTpcbiAgICAgICAgY291bnRfZGVsZXRlKys7XG4gICAgICAgIHRleHRfZGVsZXRlICs9IGRpZmZzW3BvaW50ZXJdWzFdO1xuICAgICAgICBicmVhaztcbiAgICAgIGNhc2UgRElGRl9FUVVBTDpcbiAgICAgICAgLy8gVXBvbiByZWFjaGluZyBhbiBlcXVhbGl0eSwgY2hlY2sgZm9yIHByaW9yIHJlZHVuZGFuY2llcy5cbiAgICAgICAgaWYgKGNvdW50X2RlbGV0ZSA+PSAxICYmIGNvdW50X2luc2VydCA+PSAxKSB7XG4gICAgICAgICAgLy8gRGVsZXRlIHRoZSBvZmZlbmRpbmcgcmVjb3JkcyBhbmQgYWRkIHRoZSBtZXJnZWQgb25lcy5cbiAgICAgICAgICB2YXIgYSA9IHRoaXMuZGlmZl9tYWluKHRleHRfZGVsZXRlLCB0ZXh0X2luc2VydCwgZmFsc2UsIGRlYWRsaW5lKTtcbiAgICAgICAgICBkaWZmcy5zcGxpY2UocG9pbnRlciAtIGNvdW50X2RlbGV0ZSAtIGNvdW50X2luc2VydCxcbiAgICAgICAgICAgICAgICAgICAgICAgY291bnRfZGVsZXRlICsgY291bnRfaW5zZXJ0KTtcbiAgICAgICAgICBwb2ludGVyID0gcG9pbnRlciAtIGNvdW50X2RlbGV0ZSAtIGNvdW50X2luc2VydDtcbiAgICAgICAgICBmb3IgKHZhciBqID0gYS5sZW5ndGggLSAxOyBqID49IDA7IGotLSkge1xuICAgICAgICAgICAgZGlmZnMuc3BsaWNlKHBvaW50ZXIsIDAsIGFbal0pO1xuICAgICAgICAgIH1cbiAgICAgICAgICBwb2ludGVyID0gcG9pbnRlciArIGEubGVuZ3RoO1xuICAgICAgICB9XG4gICAgICAgIGNvdW50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xuICAgICAgICAgICAgaWYgKGNvbW1vbmxlbmd0aCAhPT0gMCkge1xuICAgICAgICAgICAgICBpZiAoKHBvaW50ZXIgLSBjb3VudF9kZWxldGUgLSBjb3VudF9pbnNlcnQpID4gMCAmJlxuICAgICAgICAgICAgICAgICAgZGlmZnNbcG9pbnRlciAtIGNvdW50X2RlbGV0ZSAtIGNvdW50X2luc2VydCAtIDFdWzBdID09XG4gICAgICAgICAgICAgICAgICBESUZGX0VRVUFMKSB7XG4gICAgICAgICAgICAgICAgZGlmZnNbcG9pbnRlciAtIGNvdW50X2RlbGV0ZSAtIGNvdW50X2luc2VydCAtIDFdWzFdICs9XG4gICAgICAgICAgICAgICAgICAgIHRleHRfaW5zZXJ0LnN1YnN0cmluZygwLCBjb21tb25sZW5ndGgpO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGRpZmZzLnNwbGljZSgwLCAwLCBbRElGRl9FUVVBTCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRleHRfaW5zZXJ0LnN1YnN0cmluZygwLCBjb21tb25sZW5ndGgpXSk7XG4gICAgICAgICAgICAgICAgcG9pbnRlcisrO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIHRleHRfaW5zZXJ0ID0gdGV4dF9pbnNlcnQuc3Vic3RyaW5nKGNvbW1vbmxlbmd0aCk7XG4gICAgICAgICAgICAgIHRleHRfZGVsZXRlID0gdGV4dF9kZWxldGUuc3Vic3RyaW5nKGNvbW1vbmxlbmd0aCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvLyBGYWN0b3Igb3V0IGFueSBjb21tb24gc3VmZml4aWVzLlxuICAgICAgICAgICAgY29tbW9ubGVuZ3RoID0gdGhpcy5kaWZmX2NvbW1vblN1ZmZpeCh0ZXh0X2luc2VydCwgdGV4dF9kZWxldGUpO1xuICAgICAgICAgICAgaWYgKGNvbW1vbmxlbmd0aCAhPT0gMCkge1xuICAgICAgICA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ocG9pbnRlciAtIGNvdW50X2RlbGV0ZSAtIGNvdW50X2luc2VydCxcbiAgICAgICAgICAgICAgICBjb3VudF9kZWxldGUgKyBjb3VudF9pbnNlcnQsIFtESUZGX0RFTEVURSwgdGV4dF9kZWxldGVdLFxuICAgICAgICAgICAgICAgIFtESUZGX0lOU0VSVCwgdGV4dF9pbnNlcnRdKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgcG9pbnRlciA9IHBvaW50ZXIgLSBjb3VudF9kZWxldGUgLSBjb3VudF9pbnNlcnQgK1xuICAgICAgICAgICAgICAgICAgICAoY291bnRfZGVsZXRlID8gMSA6IDApICsgKGNvdW50X2luc2VydCA/IDEgOiAwKSArIDE7XG4gICAgICAgIH0gZWxzZSBpZiAocG9pbnRlciAhPT0gMCAmJiBkaWZmc1twb2ludGVyIC0gMV1bMF0gPT0gRElGRl9FUVVBTCkge1xuICAgICAgICAgIC8vIE1lcmdlIHRoaXMgZXF1YWxpdHkgd2l0aCB0aGUgcHJldmlvdXMgb25lLlxuICAgICAgICAgIGRpZmZzW3BvaW50ZXIgLSAxXVsxXSArPSBkaWZmc1twb2ludGVyXVsxXTtcbiAgICAgICAgICBkaWZmcy5zcGxpY2UocG9pbnRlciwgMSk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgcG9pbnRlcisrO1xuICAgICAgICB9XG4gICAgICAgIGNvdW50X2luc2VydCA9IDA7XG4gICAgICAgIGNvdW50X2RlbGV0ZSA9IDA7XG4gICAgICAgIHRleHRfZGVsZXRlID0gJyc7XG4gICAgICAgIHRleHRfaW5zZXJ0ID0gJyc7XG4gICAgICAgIGJyZWFrO1xuICAgIH1cbiAgfVxuICBpZiAoZGlmZnNbZGlmZnMubGVuZ3RoIC0gMV1bMV0gPT09ICcnKSB7XG4gICAgZGlmZnMucG9wKCk7ICAvLyBSZW1vdmUgdGhlIGR1bW15IGVudHJ5IGF0IHRoZSBlbmQuXG4gIH1cblxuICAvLyBTZWNvbmQgcGFzczogb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bmFjY2VwdGFibHkgYmFkLlxuICAgICAgICAgIHJlc3VsdHNbeF0gPSBmYWxzZTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICB0aGlzLmRpZmZfY2xlYW51cFNlbWFudGljTG9zc2xlc3MoZGlmZnMpO1xuICAgICAgICAgIHZhciBpbmRleDEgPSAwO1xuICAgICAgICAgIHZhciBpbmRleDI7XG4gICAgICAgICAgZm9yICh2YXIgeSA9IDA7IHkgPCBwYXRjaGVzW3hdLmRpZmZzLmxlbmd0aDsgeSsrKSB7XG4gICAgICAgICAgICB2YXIgbW9kID0gcGF0Y2hlc1t4XS5kaWZmc1t5XTtcbiAgICAgICAgICAgIGlmIChtb2RbMF0gIT09IERJRkZfRVFVQUwpIHtcbiAgICAgICAgICAgICAgaW5kZXgyID0gdGhpcy5kaWZmX3hJbmRleChkaWZmcywgaW5kZXgxKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChtb2RbMF0gPT09IERJRkZfSU5TRVJUKSB7ICAvLyBJbnNlcnRpb25cbiAgICAgICAgICAgICAgdGV4dCA9IHRleHQuc3Vic3RyaW5nKDAsIHN0YXJ0X2xvYyArIGluZGV4MikgKyBtb2RbMV0gK1xuICAgICAgICAgICAgICAgICAgICAgdGV4dC5zdWJzdHJpbmcoc3RhcnRfbG9jICsgaW5kZXgyKTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAobW9kWzBdID09PSBESUZGX0RFTEVURSkgeyAgLy8gRGVsZXRpb25cbiAgICAgICAgICAgICAgdGV4dCA9IHRleHQuc3Vic3RyaW5nKDAsIHN0YXJ0X2xvYyArIGluZGV4MikgK1xuICAgICAgICAgICAgICAgICAgICAgdGV4dC5zdWJzdHJpbmcoc3RhcnRfbG9jICsgdGhpcy5kaWZmX3hJbmRleChkaWZmcyxcbiAgICAgICAgICAgICAgICAgICAgICAgICBpbmRleDEgKyBtb2RbMV0ubGVuZ3RoKSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIC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ICAgICAgICAgc3RhcnQyICs9IGRpZmZfdGV4dC5sZW5ndGg7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBlbXB0eSA9IGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcGF0Y2guZGlmZnMucHVzaChbZGlmZl90eXBlLCBkaWZmX3RleHRdKTtcbiAgICAgICAgICAgIGlmIChkaWZmX3RleHQgPT0gYmlncGF0Y2guZGlmZnNbMF1bMV0pIHtcbiAgICAgICAgICAgICAgYmlncGF0Y2guZGlmZnMuc2hpZnQoKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIGJpZ3BhdGNoLmRpZmZzWzBdWzFdID1cbiAgICAgICAgICAgICAgICAgIGJpZ3BhdGNoLmRpZmZzWzBdWzFdLnN1YnN0cmluZyhkaWZmX3RleHQubGVuZ3RoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgLy8gQ29tcHV0ZSB0aGUgaGVhZCBjb250ZXh0IGZvciB0aGUgbmV4dCBwYXRjaC5cbiAgICAgICAgcHJlY29udGV4dCA9IHRoaXMuZGlmZl90ZXh0MihwYXRjaC5kaWZmcyk7XG4gICAgICAgIHByZWNvbnRleHQgPVxuICAgICAgICAgICAgcHJlY29udGV4dC5zdWJzdHJpbmcocHJlY29udGV4dC5sZW5ndGggLSB0aGlzLlBhdGNoX01hcmdpbik7XG4gICAgICAgIC8vIEFwcGVuZCB0aGUgZW5kIGNvbnRleHQgZm9yIHRoaXMgcGF0Y2guXG4gICAgICAgIHZhciBwb3N0Y29udGV4dCA9IHRoaXMuZGlmZl90ZXh0MShiaWdwYXRjaC5kaWZmcylcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5zdWJzdHJpbmcoMCwgdGhpcy5QYXRjaF9NYXJnaW4pO1xuICAgICAgICBpZiAocG9zdGNvbnRleHQgIT09ICcnKSB7XG4gICAgICAgICAgcGF0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lIHx8IGxhc3RQaXBlO1xuXHRcdFx0fVxuXHRcdH1cblx0fVxuXHRyZXR1cm4gY29udGV4dC5oYXNSZXN1bHQgPyBjb250ZXh0LnJlc3VsdCA6IHVuZGVmaW5lZDtcbn07XG5cbmV4cG9ydHMuUHJvY2Vzc29yID0gUHJvY2Vzc29yO1xuIl19
                                                                                                                   // 3493
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}).call(this);


/* Exports */
if (typeof Package === 'undefined') Package = {};
Package['benjamine:jsondiffpatch'] = {};

})();
(function () {

/* Imports */
var Meteor = Package.meteor.Meteor;
var global = Package.meteor.global;
var meteorEnv = Package.meteor.meteorEnv;
var Session = Package.session.Session;
var EJSON = Package.ejson.EJSON;
var check = Package.check.check;
var Match = Package.check.Match;
var DiffSequence = Package['diff-sequence'].DiffSequence;
var MongoID = Package['mongo-id'].MongoID;
var _ = Package.underscore._;
var Tracker = Package.tracker.Tracker;
var Deps = Package.tracker.Deps;
var Mongo = Package.mongo.Mongo;
var LocalCollection = Package.minimongo.LocalCollection;
var Minimongo = Package.minimongo.Minimongo;
var ObserveSequence = Package['observe-sequence'].ObserveSequence;
var ReactiveVar = Package['reactive-var'].ReactiveVar;

(function(){

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                    //
// packages/angular-meteor-data/.npm/package/node_modules/angular-meteor/dist/angular-meteor.js                       //
//                                                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                      //
/*! angular-meteor v1.3.10 */                                                                                         // 1
(function webpackUniversalModuleDefinition(root, factory) {                                                           // 2
	if(typeof exports === 'object' && typeof module === 'object')                                                        // 3
		module.exports = factory(require("underscore"), require("jsondiffpatch"));                                          // 4
	else if(typeof define === 'function' && define.amd)                                                                  // 5
		define(["underscore", "jsondiffpatch"], factory);                                                                   // 6
	else if(typeof exports === 'object')                                                                                 // 7
		exports["angularMeteor"] = factory(require("underscore"), require("jsondiffpatch"));                                // 8
	else                                                                                                                 // 9
		root["angularMeteor"] = factory(root["_"], root["jsondiffpatch"]);                                                  // 10
})(this, function(__WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_22__) {                                    // 11
return /******/ (function(modules) { // webpackBootstrap                                                              // 12
/******/ 	// The module cache                                                                                         // 13
/******/ 	var installedModules = {};                                                                                  // 14
                                                                                                                      // 15
/******/ 	// The require function                                                                                     // 16
/******/ 	function __webpack_require__(moduleId) {                                                                    // 17
                                                                                                                      // 18
/******/ 		// Check if module is in cache                                                                             // 19
/******/ 		if(installedModules[moduleId])                                                                             // 20
/******/ 			return installedModules[moduleId].exports;                                                                // 21
                                                                                                                      // 22
/******/ 		// Create a new module (and put it into the cache)                                                         // 23
/******/ 		var module = installedModules[moduleId] = {                                                                // 24
/******/ 			exports: {},                                                                                              // 25
/******/ 			id: moduleId,                                                                                             // 26
/******/ 			loaded: false                                                                                             // 27
/******/ 		};                                                                                                         // 28
                                                                                                                      // 29
/******/ 		// Execute the module function                                                                             // 30
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);                       // 31
                                                                                                                      // 32
/******/ 		// Flag the module as loaded                                                                               // 33
/******/ 		module.loaded = true;                                                                                      // 34
                                                                                                                      // 35
/******/ 		// Return the exports of the module                                                                        // 36
/******/ 		return module.exports;                                                                                     // 37
/******/ 	}                                                                                                           // 38
                                                                                                                      // 39
                                                                                                                      // 40
/******/ 	// expose the modules object (__webpack_modules__)                                                          // 41
/******/ 	__webpack_require__.m = modules;                                                                            // 42
                                                                                                                      // 43
/******/ 	// expose the module cache                                                                                  // 44
/******/ 	__webpack_require__.c = installedModules;                                                                   // 45
                                                                                                                      // 46
/******/ 	// __webpack_public_path__                                                                                  // 47
/******/ 	__webpack_require__.p = "";                                                                                 // 48
                                                                                                                      // 49
/******/ 	// Load entry module and return exports                                                                     // 50
/******/ 	return __webpack_require__(0);                                                                              // 51
/******/ })                                                                                                           // 52
/************************************************************************/                                            // 53
/******/ ([                                                                                                           // 54
/* 0 */                                                                                                               // 55
/***/ function(module, exports, __webpack_require__) {                                                                // 56
                                                                                                                      // 57
	'use strict';                                                                                                        // 58
                                                                                                                      // 59
	Object.defineProperty(exports, "__esModule", {                                                                       // 60
	  value: true                                                                                                        // 61
	});                                                                                                                  // 62
                                                                                                                      // 63
	__webpack_require__(1);                                                                                              // 64
                                                                                                                      // 65
	__webpack_require__(4);                                                                                              // 66
                                                                                                                      // 67
	__webpack_require__(5);                                                                                              // 68
                                                                                                                      // 69
	__webpack_require__(6);                                                                                              // 70
                                                                                                                      // 71
	__webpack_require__(7);                                                                                              // 72
                                                                                                                      // 73
	__webpack_require__(8);                                                                                              // 74
                                                                                                                      // 75
	__webpack_require__(9);                                                                                              // 76
                                                                                                                      // 77
	__webpack_require__(10);                                                                                             // 78
                                                                                                                      // 79
	__webpack_require__(11);                                                                                             // 80
                                                                                                                      // 81
	__webpack_require__(12);                                                                                             // 82
                                                                                                                      // 83
	__webpack_require__(13);                                                                                             // 84
                                                                                                                      // 85
	__webpack_require__(14);                                                                                             // 86
                                                                                                                      // 87
	__webpack_require__(15);                                                                                             // 88
                                                                                                                      // 89
	var _utils = __webpack_require__(16);                                                                                // 90
                                                                                                                      // 91
	var _mixer = __webpack_require__(17);                                                                                // 92
                                                                                                                      // 93
	var _scope = __webpack_require__(18);                                                                                // 94
                                                                                                                      // 95
	var _core = __webpack_require__(19);                                                                                 // 96
                                                                                                                      // 97
	var _viewModel = __webpack_require__(20);                                                                            // 98
                                                                                                                      // 99
	var _reactive = __webpack_require__(21);                                                                             // 100
                                                                                                                      // 101
	var _templates = __webpack_require__(23);                                                                            // 102
                                                                                                                      // 103
	// legacy                                                                                                            // 104
	// lib                                                                                                               // 105
                                                                                                                      // 106
                                                                                                                      // 107
	var name = 'angular-meteor';                                                                                         // 108
                                                                                                                      // 109
	// new                                                                                                               // 110
                                                                                                                      // 111
	exports.default = name;                                                                                              // 112
                                                                                                                      // 113
                                                                                                                      // 114
	angular.module(name, [                                                                                               // 115
	// new                                                                                                               // 116
	_utils.name, _mixer.name, _scope.name, _core.name, _viewModel.name, _reactive.name, _templates.name,                 // 117
                                                                                                                      // 118
	// legacy                                                                                                            // 119
	'angular-meteor.ironrouter', 'angular-meteor.utils', 'angular-meteor.subscribe', 'angular-meteor.collection', 'angular-meteor.object', 'angular-meteor.user', 'angular-meteor.methods', 'angular-meteor.session', 'angular-meteor.camera']).run([_mixer.Mixer, _core.Core, _viewModel.ViewModel, _reactive.Reactive, function ($Mixer, $$Core, $$ViewModel, $$Reactive) {
	  // Load all mixins                                                                                                 // 121
	  $Mixer.mixin($$Core).mixin($$ViewModel).mixin($$Reactive);                                                         // 122
	}])                                                                                                                  // 123
                                                                                                                      // 124
	// legacy                                                                                                            // 125
	// Putting all services under $meteor service for syntactic sugar                                                    // 126
	.service('$meteor', ['$meteorCollection', '$meteorCollectionFS', '$meteorObject', '$meteorMethods', '$meteorSession', '$meteorSubscribe', '$meteorUtils', '$meteorCamera', '$meteorUser', function ($meteorCollection, $meteorCollectionFS, $meteorObject, $meteorMethods, $meteorSession, $meteorSubscribe, $meteorUtils, $meteorCamera, $meteorUser) {
	  var _this = this;                                                                                                  // 128
                                                                                                                      // 129
	  this.collection = $meteorCollection;                                                                               // 130
	  this.collectionFS = $meteorCollectionFS;                                                                           // 131
	  this.object = $meteorObject;                                                                                       // 132
	  this.subscribe = $meteorSubscribe.subscribe;                                                                       // 133
	  this.call = $meteorMethods.call;                                                                                   // 134
	  this.session = $meteorSession;                                                                                     // 135
	  this.autorun = $meteorUtils.autorun;                                                                               // 136
	  this.getCollectionByName = $meteorUtils.getCollectionByName;                                                       // 137
	  this.getPicture = $meteorCamera.getPicture;                                                                        // 138
                                                                                                                      // 139
	  // $meteorUser                                                                                                     // 140
	  ['loginWithPassword', 'requireUser', 'requireValidUser', 'waitForUser', 'createUser', 'changePassword', 'forgotPassword', 'resetPassword', 'verifyEmail', 'loginWithMeteorDeveloperAccount', 'loginWithFacebook', 'loginWithGithub', 'loginWithGoogle', 'loginWithMeetup', 'loginWithTwitter', 'loginWithWeibo', 'logout', 'logoutOtherClients'].forEach(function (method) {
	    _this[method] = $meteorUser[method];                                                                             // 142
	  });                                                                                                                // 143
	}]);                                                                                                                 // 144
	module.exports = exports['default'];                                                                                 // 145
                                                                                                                      // 146
/***/ },                                                                                                              // 147
/* 1 */                                                                                                               // 148
/***/ function(module, exports, __webpack_require__) {                                                                // 149
                                                                                                                      // 150
	'use strict';                                                                                                        // 151
                                                                                                                      // 152
	var _underscore = __webpack_require__(2);                                                                            // 153
                                                                                                                      // 154
	var _underscore2 = _interopRequireDefault(_underscore);                                                              // 155
                                                                                                                      // 156
	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }                      // 157
                                                                                                                      // 158
	'use strict';                                                                                                        // 159
                                                                                                                      // 160
	// https://github.com/DAB0mB/get-updates                                                                             // 161
	/*global                                                                                                             // 162
	 angular, _                                                                                                          // 163
	 */                                                                                                                  // 164
                                                                                                                      // 165
	(function () {                                                                                                       // 166
	  var module = angular.module('getUpdates', []);                                                                     // 167
                                                                                                                      // 168
	  var utils = function () {                                                                                          // 169
	    var rip = function rip(obj, level) {                                                                             // 170
	      if (level < 1) return {};                                                                                      // 171
                                                                                                                      // 172
	      return _underscore2.default.reduce(obj, function (clone, v, k) {                                               // 173
	        v = _underscore2.default.isObject(v) ? rip(v, --level) : v;                                                  // 174
	        clone[k] = v;                                                                                                // 175
	        return clone;                                                                                                // 176
	      }, {});                                                                                                        // 177
	    };                                                                                                               // 178
                                                                                                                      // 179
	    var toPaths = function toPaths(obj) {                                                                            // 180
	      var keys = getKeyPaths(obj);                                                                                   // 181
	      var values = getDeepValues(obj);                                                                               // 182
	      return _underscore2.default.object(keys, values);                                                              // 183
	    };                                                                                                               // 184
                                                                                                                      // 185
	    var getKeyPaths = function getKeyPaths(obj) {                                                                    // 186
	      var keys = _underscore2.default.keys(obj).map(function (k) {                                                   // 187
	        var v = obj[k];                                                                                              // 188
	        if (!_underscore2.default.isObject(v) || _underscore2.default.isEmpty(v) || _underscore2.default.isArray(v)) return k;
                                                                                                                      // 190
	        return getKeyPaths(v).map(function (subKey) {                                                                // 191
	          return k + '.' + subKey;                                                                                   // 192
	        });                                                                                                          // 193
	      });                                                                                                            // 194
                                                                                                                      // 195
	      return _underscore2.default.flatten(keys);                                                                     // 196
	    };                                                                                                               // 197
                                                                                                                      // 198
	    var getDeepValues = function getDeepValues(obj, arr) {                                                           // 199
	      arr = arr || [];                                                                                               // 200
                                                                                                                      // 201
	      _underscore2.default.values(obj).forEach(function (v) {                                                        // 202
	        if (!_underscore2.default.isObject(v) || _underscore2.default.isEmpty(v) || _underscore2.default.isArray(v)) arr.push(v);else getDeepValues(v, arr);
	      });                                                                                                            // 204
                                                                                                                      // 205
	      return arr;                                                                                                    // 206
	    };                                                                                                               // 207
                                                                                                                      // 208
	    var flatten = function flatten(arr) {                                                                            // 209
	      return arr.reduce(function (flattened, v, i) {                                                                 // 210
	        if (_underscore2.default.isArray(v) && !_underscore2.default.isEmpty(v)) flattened.push.apply(flattened, flatten(v));else flattened.push(v);
                                                                                                                      // 212
	        return flattened;                                                                                            // 213
	      }, []);                                                                                                        // 214
	    };                                                                                                               // 215
                                                                                                                      // 216
	    var setFilled = function setFilled(obj, k, v) {                                                                  // 217
	      if (!_underscore2.default.isEmpty(v)) obj[k] = v;                                                              // 218
	    };                                                                                                               // 219
                                                                                                                      // 220
	    var assert = function assert(result, msg) {                                                                      // 221
	      if (!result) throwErr(msg);                                                                                    // 222
	    };                                                                                                               // 223
                                                                                                                      // 224
	    var throwErr = function throwErr(msg) {                                                                          // 225
	      throw Error('get-updates error - ' + msg);                                                                     // 226
	    };                                                                                                               // 227
                                                                                                                      // 228
	    return {                                                                                                         // 229
	      rip: rip,                                                                                                      // 230
	      toPaths: toPaths,                                                                                              // 231
	      getKeyPaths: getKeyPaths,                                                                                      // 232
	      getDeepValues: getDeepValues,                                                                                  // 233
	      setFilled: setFilled,                                                                                          // 234
	      assert: assert,                                                                                                // 235
	      throwErr: throwErr                                                                                             // 236
	    };                                                                                                               // 237
	  }();                                                                                                               // 238
                                                                                                                      // 239
	  var getDifference = function () {                                                                                  // 240
	    var getDifference = function getDifference(src, dst, isShallow) {                                                // 241
	      var level;                                                                                                     // 242
                                                                                                                      // 243
	      if (isShallow > 1) level = isShallow;else if (isShallow) level = 1;                                            // 244
                                                                                                                      // 245
	      if (level) {                                                                                                   // 246
	        src = utils.rip(src, level);                                                                                 // 247
	        dst = utils.rip(dst, level);                                                                                 // 248
	      }                                                                                                              // 249
                                                                                                                      // 250
	      return compare(src, dst);                                                                                      // 251
	    };                                                                                                               // 252
                                                                                                                      // 253
	    var compare = function compare(src, dst) {                                                                       // 254
	      var srcKeys = _underscore2.default.keys(src);                                                                  // 255
	      var dstKeys = _underscore2.default.keys(dst);                                                                  // 256
                                                                                                                      // 257
	      var keys = _underscore2.default.chain([]).concat(srcKeys).concat(dstKeys).uniq().without('$$hashKey').value();
                                                                                                                      // 259
	      return keys.reduce(function (diff, k) {                                                                        // 260
	        var srcValue = src[k];                                                                                       // 261
	        var dstValue = dst[k];                                                                                       // 262
                                                                                                                      // 263
	        if (_underscore2.default.isDate(srcValue) && _underscore2.default.isDate(dstValue)) {                        // 264
	          if (srcValue.getTime() != dstValue.getTime()) diff[k] = dstValue;                                          // 265
	        }                                                                                                            // 266
                                                                                                                      // 267
	        if (_underscore2.default.isObject(srcValue) && _underscore2.default.isObject(dstValue)) {                    // 268
	          var valueDiff = getDifference(srcValue, dstValue);                                                         // 269
	          utils.setFilled(diff, k, valueDiff);                                                                       // 270
	        } else if (srcValue !== dstValue) {                                                                          // 271
	          diff[k] = dstValue;                                                                                        // 272
	        }                                                                                                            // 273
                                                                                                                      // 274
	        return diff;                                                                                                 // 275
	      }, {});                                                                                                        // 276
	    };                                                                                                               // 277
                                                                                                                      // 278
	    return getDifference;                                                                                            // 279
	  }();                                                                                                               // 280
                                                                                                                      // 281
	  var getUpdates = function () {                                                                                     // 282
	    var getUpdates = function getUpdates(src, dst, isShallow) {                                                      // 283
	      utils.assert(_underscore2.default.isObject(src), 'first argument must be an object');                          // 284
	      utils.assert(_underscore2.default.isObject(dst), 'second argument must be an object');                         // 285
                                                                                                                      // 286
	      var diff = getDifference(src, dst, isShallow);                                                                 // 287
	      var paths = utils.toPaths(diff);                                                                               // 288
                                                                                                                      // 289
	      var set = createSet(paths);                                                                                    // 290
	      var unset = createUnset(paths);                                                                                // 291
	      var pull = createPull(unset);                                                                                  // 292
                                                                                                                      // 293
	      var updates = {};                                                                                              // 294
	      utils.setFilled(updates, '$set', set);                                                                         // 295
	      utils.setFilled(updates, '$unset', unset);                                                                     // 296
	      utils.setFilled(updates, '$pull', pull);                                                                       // 297
                                                                                                                      // 298
	      return updates;                                                                                                // 299
	    };                                                                                                               // 300
                                                                                                                      // 301
	    var createSet = function createSet(paths) {                                                                      // 302
	      var undefinedKeys = getUndefinedKeys(paths);                                                                   // 303
	      return _underscore2.default.omit(paths, undefinedKeys);                                                        // 304
	    };                                                                                                               // 305
                                                                                                                      // 306
	    var createUnset = function createUnset(paths) {                                                                  // 307
	      var undefinedKeys = getUndefinedKeys(paths);                                                                   // 308
	      var unset = _underscore2.default.pick(paths, undefinedKeys);                                                   // 309
                                                                                                                      // 310
	      return _underscore2.default.reduce(unset, function (result, v, k) {                                            // 311
	        result[k] = true;                                                                                            // 312
	        return result;                                                                                               // 313
	      }, {});                                                                                                        // 314
	    };                                                                                                               // 315
                                                                                                                      // 316
	    var createPull = function createPull(unset) {                                                                    // 317
	      var arrKeyPaths = _underscore2.default.keys(unset).map(function (k) {                                          // 318
	        var split = k.match(/(.*)\.\d+$/);                                                                           // 319
	        return split && split[1];                                                                                    // 320
	      });                                                                                                            // 321
                                                                                                                      // 322
	      return _underscore2.default.compact(arrKeyPaths).reduce(function (pull, k) {                                   // 323
	        pull[k] = null;                                                                                              // 324
	        return pull;                                                                                                 // 325
	      }, {});                                                                                                        // 326
	    };                                                                                                               // 327
                                                                                                                      // 328
	    var getUndefinedKeys = function getUndefinedKeys(obj) {                                                          // 329
	      return _underscore2.default.keys(obj).filter(function (k) {                                                    // 330
	        var v = obj[k];                                                                                              // 331
	        return _underscore2.default.isUndefined(v);                                                                  // 332
	      });                                                                                                            // 333
	    };                                                                                                               // 334
                                                                                                                      // 335
	    return getUpdates;                                                                                               // 336
	  }();                                                                                                               // 337
                                                                                                                      // 338
	  module.value('getUpdates', getUpdates);                                                                            // 339
	})();                                                                                                                // 340
                                                                                                                      // 341
/***/ },                                                                                                              // 342
/* 2 */                                                                                                               // 343
/***/ function(module, exports, __webpack_require__) {                                                                // 344
                                                                                                                      // 345
	'use strict';                                                                                                        // 346
                                                                                                                      // 347
	Object.defineProperty(exports, "__esModule", {                                                                       // 348
	  value: true                                                                                                        // 349
	});                                                                                                                  // 350
                                                                                                                      // 351
	var _underscore = __webpack_require__(3);                                                                            // 352
                                                                                                                      // 353
	var _underscore2 = _interopRequireDefault(_underscore);                                                              // 354
                                                                                                                      // 355
	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }                      // 356
                                                                                                                      // 357
	if (typeof _underscore2.default === 'undefined') {                                                                   // 358
	  if (typeof Package.underscore === 'undefined') {                                                                   // 359
	    throw new Error('underscore is missing');                                                                        // 360
	  }                                                                                                                  // 361
	}                                                                                                                    // 362
                                                                                                                      // 363
	exports.default = _underscore2.default || Package.underscore._;                                                      // 364
	module.exports = exports['default'];                                                                                 // 365
                                                                                                                      // 366
/***/ },                                                                                                              // 367
/* 3 */                                                                                                               // 368
/***/ function(module, exports) {                                                                                     // 369
                                                                                                                      // 370
	module.exports = __WEBPACK_EXTERNAL_MODULE_3__;                                                                      // 371
                                                                                                                      // 372
/***/ },                                                                                                              // 373
/* 4 */                                                                                                               // 374
/***/ function(module, exports, __webpack_require__) {                                                                // 375
                                                                                                                      // 376
	'use strict';                                                                                                        // 377
                                                                                                                      // 378
	var _underscore = __webpack_require__(2);                                                                            // 379
                                                                                                                      // 380
	var _underscore2 = _interopRequireDefault(_underscore);                                                              // 381
                                                                                                                      // 382
	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }                      // 383
                                                                                                                      // 384
	'use strict'; /*global                                                                                               // 385
	               angular, _, Package                                                                                   // 386
	               */                                                                                                    // 387
                                                                                                                      // 388
	var _module = angular.module('diffArray', ['getUpdates']);                                                           // 389
                                                                                                                      // 390
	_module.factory('diffArray', ['getUpdates', function (getUpdates) {                                                  // 391
	  var LocalCollection = Package.minimongo.LocalCollection;                                                           // 392
	  var idStringify = LocalCollection._idStringify || Package['mongo-id'].MongoID.idStringify;                         // 393
	  var idParse = LocalCollection._idParse || Package['mongo-id'].MongoID.idParse;                                     // 394
                                                                                                                      // 395
	  // Calculates the differences between `lastSeqArray` and                                                           // 396
	  // `seqArray` and calls appropriate functions from `callbacks`.                                                    // 397
	  // Reuses Minimongo's diff algorithm implementation.                                                               // 398
	  // XXX Should be replaced with the original diffArray function here:                                               // 399
	  // https://github.com/meteor/meteor/blob/devel/packages/observe-sequence/observe_sequence.js#L152                  // 400
	  // When it will become nested as well, tracking here: https://github.com/meteor/meteor/issues/3764                 // 401
	  function diffArray(lastSeqArray, seqArray, callbacks, preventNestedDiff) {                                         // 402
	    preventNestedDiff = !!preventNestedDiff;                                                                         // 403
                                                                                                                      // 404
	    var diffFn = Package.minimongo.LocalCollection._diffQueryOrderedChanges || Package['diff-sequence'].DiffSequence.diffQueryOrderedChanges;
                                                                                                                      // 406
	    var oldObjIds = [];                                                                                              // 407
	    var newObjIds = [];                                                                                              // 408
	    var posOld = {}; // maps from idStringify'd ids                                                                  // 409
	    var posNew = {}; // ditto                                                                                        // 410
	    var posCur = {};                                                                                                 // 411
	    var lengthCur = lastSeqArray.length;                                                                             // 412
                                                                                                                      // 413
	    _underscore2.default.each(seqArray, function (doc, i) {                                                          // 414
	      newObjIds.push({ _id: doc._id });                                                                              // 415
	      posNew[idStringify(doc._id)] = i;                                                                              // 416
	    });                                                                                                              // 417
                                                                                                                      // 418
	    _underscore2.default.each(lastSeqArray, function (doc, i) {                                                      // 419
	      oldObjIds.push({ _id: doc._id });                                                                              // 420
	      posOld[idStringify(doc._id)] = i;                                                                              // 421
	      posCur[idStringify(doc._id)] = i;                                                                              // 422
	    });                                                                                                              // 423
                                                                                                                      // 424
	    // Arrays can contain arbitrary objects. We don't diff the                                                       // 425
	    // objects. Instead we always fire 'changedAt' callback on every                                                 // 426
	    // object. The consumer of `observe-sequence` should deal with                                                   // 427
	    // it appropriately.                                                                                             // 428
	    diffFn(oldObjIds, newObjIds, {                                                                                   // 429
	      addedBefore: function addedBefore(id, doc, before) {                                                           // 430
	        var position = before ? posCur[idStringify(before)] : lengthCur;                                             // 431
                                                                                                                      // 432
	        _underscore2.default.each(posCur, function (pos, id) {                                                       // 433
	          if (pos >= position) posCur[id]++;                                                                         // 434
	        });                                                                                                          // 435
                                                                                                                      // 436
	        lengthCur++;                                                                                                 // 437
	        posCur[idStringify(id)] = position;                                                                          // 438
                                                                                                                      // 439
	        callbacks.addedAt(id, seqArray[posNew[idStringify(id)]], position, before);                                  // 440
	      },                                                                                                             // 441
                                                                                                                      // 442
	      movedBefore: function movedBefore(id, before) {                                                                // 443
	        var prevPosition = posCur[idStringify(id)];                                                                  // 444
	        var position = before ? posCur[idStringify(before)] : lengthCur - 1;                                         // 445
                                                                                                                      // 446
	        _underscore2.default.each(posCur, function (pos, id) {                                                       // 447
	          if (pos >= prevPosition && pos <= position) posCur[id]--;else if (pos <= prevPosition && pos >= position) posCur[id]++;
	        });                                                                                                          // 449
                                                                                                                      // 450
	        posCur[idStringify(id)] = position;                                                                          // 451
                                                                                                                      // 452
	        callbacks.movedTo(id, seqArray[posNew[idStringify(id)]], prevPosition, position, before);                    // 453
	      },                                                                                                             // 454
	      removed: function removed(id) {                                                                                // 455
	        var prevPosition = posCur[idStringify(id)];                                                                  // 456
                                                                                                                      // 457
	        _underscore2.default.each(posCur, function (pos, id) {                                                       // 458
	          if (pos >= prevPosition) posCur[id]--;                                                                     // 459
	        });                                                                                                          // 460
                                                                                                                      // 461
	        delete posCur[idStringify(id)];                                                                              // 462
	        lengthCur--;                                                                                                 // 463
                                                                                                                      // 464
	        callbacks.removedAt(id, lastSeqArray[posOld[idStringify(id)]], prevPosition);                                // 465
	      }                                                                                                              // 466
	    });                                                                                                              // 467
                                                                                                                      // 468
	    _underscore2.default.each(posNew, function (pos, idString) {                                                     // 469
	      if (!_underscore2.default.has(posOld, idString)) return;                                                       // 470
                                                                                                                      // 471
	      var id = idParse(idString);                                                                                    // 472
	      var newItem = seqArray[pos] || {};                                                                             // 473
	      var oldItem = lastSeqArray[posOld[idString]];                                                                  // 474
	      var updates = getUpdates(oldItem, newItem, preventNestedDiff);                                                 // 475
                                                                                                                      // 476
	      if (!_underscore2.default.isEmpty(updates)) callbacks.changedAt(id, updates, pos, oldItem);                    // 477
	    });                                                                                                              // 478
	  }                                                                                                                  // 479
                                                                                                                      // 480
	  diffArray.shallow = function (lastSeqArray, seqArray, callbacks) {                                                 // 481
	    return diffArray(lastSeqArray, seqArray, callbacks, true);                                                       // 482
	  };                                                                                                                 // 483
                                                                                                                      // 484
	  diffArray.deepCopyChanges = function (oldItem, newItem) {                                                          // 485
	    var setDiff = getUpdates(oldItem, newItem).$set;                                                                 // 486
                                                                                                                      // 487
	    _underscore2.default.each(setDiff, function (v, deepKey) {                                                       // 488
	      setDeep(oldItem, deepKey, v);                                                                                  // 489
	    });                                                                                                              // 490
	  };                                                                                                                 // 491
                                                                                                                      // 492
	  diffArray.deepCopyRemovals = function (oldItem, newItem) {                                                         // 493
	    var unsetDiff = getUpdates(oldItem, newItem).$unset;                                                             // 494
                                                                                                                      // 495
	    _underscore2.default.each(unsetDiff, function (v, deepKey) {                                                     // 496
	      unsetDeep(oldItem, deepKey);                                                                                   // 497
	    });                                                                                                              // 498
	  };                                                                                                                 // 499
                                                                                                                      // 500
	  // Finds changes between two collections                                                                           // 501
	  diffArray.getChanges = function (newCollection, oldCollection, diffMethod) {                                       // 502
	    var changes = { added: [], removed: [], changed: [] };                                                           // 503
                                                                                                                      // 504
	    diffMethod(oldCollection, newCollection, {                                                                       // 505
	      addedAt: function addedAt(id, item, index) {                                                                   // 506
	        changes.added.push({ item: item, index: index });                                                            // 507
	      },                                                                                                             // 508
                                                                                                                      // 509
	      removedAt: function removedAt(id, item, index) {                                                               // 510
	        changes.removed.push({ item: item, index: index });                                                          // 511
	      },                                                                                                             // 512
                                                                                                                      // 513
	      changedAt: function changedAt(id, updates, index, oldItem) {                                                   // 514
	        changes.changed.push({ selector: id, modifier: updates });                                                   // 515
	      },                                                                                                             // 516
                                                                                                                      // 517
	      movedTo: function movedTo(id, item, fromIndex, toIndex) {                                                      // 518
	        // XXX do we need this?                                                                                      // 519
	      }                                                                                                              // 520
	    });                                                                                                              // 521
                                                                                                                      // 522
	    return changes;                                                                                                  // 523
	  };                                                                                                                 // 524
                                                                                                                      // 525
	  var setDeep = function setDeep(obj, deepKey, v) {                                                                  // 526
	    var split = deepKey.split('.');                                                                                  // 527
	    var initialKeys = _underscore2.default.initial(split);                                                           // 528
	    var lastKey = _underscore2.default.last(split);                                                                  // 529
                                                                                                                      // 530
	    initialKeys.reduce(function (subObj, k, i) {                                                                     // 531
	      var nextKey = split[i + 1];                                                                                    // 532
                                                                                                                      // 533
	      if (isNumStr(nextKey)) {                                                                                       // 534
	        if (subObj[k] === null) subObj[k] = [];                                                                      // 535
	        if (subObj[k].length == parseInt(nextKey)) subObj[k].push(null);                                             // 536
	      } else if (subObj[k] === null || !isHash(subObj[k])) {                                                         // 537
	        subObj[k] = {};                                                                                              // 538
	      }                                                                                                              // 539
                                                                                                                      // 540
	      return subObj[k];                                                                                              // 541
	    }, obj);                                                                                                         // 542
                                                                                                                      // 543
	    var deepObj = getDeep(obj, initialKeys);                                                                         // 544
	    deepObj[lastKey] = v;                                                                                            // 545
	    return v;                                                                                                        // 546
	  };                                                                                                                 // 547
                                                                                                                      // 548
	  var unsetDeep = function unsetDeep(obj, deepKey) {                                                                 // 549
	    var split = deepKey.split('.');                                                                                  // 550
	    var initialKeys = _underscore2.default.initial(split);                                                           // 551
	    var lastKey = _underscore2.default.last(split);                                                                  // 552
	    var deepObj = getDeep(obj, initialKeys);                                                                         // 553
                                                                                                                      // 554
	    if (_underscore2.default.isArray(deepObj) && isNumStr(lastKey)) return !!deepObj.splice(lastKey, 1);else return delete deepObj[lastKey];
	  };                                                                                                                 // 556
                                                                                                                      // 557
	  var getDeep = function getDeep(obj, keys) {                                                                        // 558
	    return keys.reduce(function (subObj, k) {                                                                        // 559
	      return subObj[k];                                                                                              // 560
	    }, obj);                                                                                                         // 561
	  };                                                                                                                 // 562
                                                                                                                      // 563
	  var isHash = function isHash(obj) {                                                                                // 564
	    return _underscore2.default.isObject(obj) && Object.getPrototypeOf(obj) === Object.prototype;                    // 565
	  };                                                                                                                 // 566
                                                                                                                      // 567
	  var isNumStr = function isNumStr(str) {                                                                            // 568
	    return str.match(/^\d+$/);                                                                                       // 569
	  };                                                                                                                 // 570
                                                                                                                      // 571
	  return diffArray;                                                                                                  // 572
	}]);                                                                                                                 // 573
                                                                                                                      // 574
/***/ },                                                                                                              // 575
/* 5 */                                                                                                               // 576
/***/ function(module, exports) {                                                                                     // 577
                                                                                                                      // 578
	'use strict';                                                                                                        // 579
                                                                                                                      // 580
	angular.module('angular-meteor.settings', []).constant('$angularMeteorSettings', {                                   // 581
	  suppressWarnings: true                                                                                             // 582
	});                                                                                                                  // 583
                                                                                                                      // 584
/***/ },                                                                                                              // 585
/* 6 */                                                                                                               // 586
/***/ function(module, exports) {                                                                                     // 587
                                                                                                                      // 588
	'use strict';                                                                                                        // 589
                                                                                                                      // 590
	angular.module('angular-meteor.ironrouter', []).run(['$compile', '$document', '$rootScope', function ($compile, $document, $rootScope) {
	  var Router = (Package['iron:router'] || {}).Router;                                                                // 592
	  if (!Router) return;                                                                                               // 593
                                                                                                                      // 594
	  var isLoaded = false;                                                                                              // 595
                                                                                                                      // 596
	  // Recompile after iron:router builds page                                                                         // 597
	  Router.onAfterAction(function (req, res, next) {                                                                   // 598
	    Tracker.afterFlush(function () {                                                                                 // 599
	      if (isLoaded) return;                                                                                          // 600
	      $compile($document)($rootScope);                                                                               // 601
	      if (!$rootScope.$$phase) $rootScope.$apply();                                                                  // 602
	      isLoaded = true;                                                                                               // 603
	    });                                                                                                              // 604
	  });                                                                                                                // 605
	}]);                                                                                                                 // 606
                                                                                                                      // 607
/***/ },                                                                                                              // 608
/* 7 */                                                                                                               // 609
/***/ function(module, exports, __webpack_require__) {                                                                // 610
                                                                                                                      // 611
	'use strict';                                                                                                        // 612
                                                                                                                      // 613
	var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; /*global
	                                                                                                                                                                                                                                                   angular, _, Tracker, EJSON, FS, Mongo
	                                                                                                                                                                                                                                                   */
                                                                                                                      // 617
	var _underscore = __webpack_require__(2);                                                                            // 618
                                                                                                                      // 619
	var _underscore2 = _interopRequireDefault(_underscore);                                                              // 620
                                                                                                                      // 621
	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }                      // 622
                                                                                                                      // 623
	'use strict';                                                                                                        // 624
                                                                                                                      // 625
	var angularMeteorUtils = angular.module('angular-meteor.utils', ['angular-meteor.settings']);                        // 626
                                                                                                                      // 627
	angularMeteorUtils.service('$meteorUtils', ['$q', '$timeout', '$angularMeteorSettings', function ($q, $timeout, $angularMeteorSettings) {
                                                                                                                      // 629
	  var self = this;                                                                                                   // 630
                                                                                                                      // 631
	  this.autorun = function (scope, fn) {                                                                              // 632
	    if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.utils.autorun] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.6/autorun. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');
                                                                                                                      // 634
	    // wrapping around Deps.autorun                                                                                  // 635
	    var comp = Tracker.autorun(function (c) {                                                                        // 636
	      fn(c);                                                                                                         // 637
	      // this is run immediately for the first call                                                                  // 638
	      // but after that, we need to $apply to start Angular digest                                                   // 639
	      if (!c.firstRun) $timeout(angular.noop, 0);                                                                    // 640
	    });                                                                                                              // 641
                                                                                                                      // 642
	    // stop autorun when scope is destroyed                                                                          // 643
	    scope.$on('$destroy', function () {                                                                              // 644
	      comp.stop();                                                                                                   // 645
	    });                                                                                                              // 646
                                                                                                                      // 647
	    // return autorun object so that it can be stopped manually                                                      // 648
	    return comp;                                                                                                     // 649
	  };                                                                                                                 // 650
                                                                                                                      // 651
	  // Borrowed from angularFire                                                                                       // 652
	  // https://github.com/firebase/angularfire/blob/master/src/utils.js#L445-L454                                      // 653
	  this.stripDollarPrefixedKeys = function (data) {                                                                   // 654
	    if (!_underscore2.default.isObject(data) || data instanceof Date || data instanceof File || EJSON.toJSONValue(data).$type === 'oid' || (typeof FS === 'undefined' ? 'undefined' : _typeof(FS)) === 'object' && data instanceof FS.File) return data;
                                                                                                                      // 656
	    var out = _underscore2.default.isArray(data) ? [] : {};                                                          // 657
                                                                                                                      // 658
	    _underscore2.default.each(data, function (v, k) {                                                                // 659
	      if (typeof k !== 'string' || k.charAt(0) !== '$') out[k] = self.stripDollarPrefixedKeys(v);                    // 660
	    });                                                                                                              // 661
                                                                                                                      // 662
	    return out;                                                                                                      // 663
	  };                                                                                                                 // 664
                                                                                                                      // 665
	  // Returns a callback which fulfills promise                                                                       // 666
	  this.fulfill = function (deferred, boundError, boundResult) {                                                      // 667
	    return function (err, result) {                                                                                  // 668
	      if (err) deferred.reject(boundError == null ? err : boundError);else if (typeof boundResult == "function") deferred.resolve(boundResult == null ? result : boundResult(result));else deferred.resolve(boundResult == null ? result : boundResult);
	    };                                                                                                               // 670
	  };                                                                                                                 // 671
                                                                                                                      // 672
	  // creates a function which invokes method with the given arguments and returns a promise                          // 673
	  this.promissor = function (obj, method) {                                                                          // 674
	    return function () {                                                                                             // 675
	      var deferred = $q.defer();                                                                                     // 676
	      var fulfill = self.fulfill(deferred);                                                                          // 677
	      var args = _underscore2.default.toArray(arguments).concat(fulfill);                                            // 678
	      obj[method].apply(obj, args);                                                                                  // 679
	      return deferred.promise;                                                                                       // 680
	    };                                                                                                               // 681
	  };                                                                                                                 // 682
                                                                                                                      // 683
	  // creates a $q.all() promise and call digestion loop on fulfillment                                               // 684
	  this.promiseAll = function (promises) {                                                                            // 685
	    var allPromise = $q.all(promises);                                                                               // 686
                                                                                                                      // 687
	    allPromise.finally(function () {                                                                                 // 688
	      // calls digestion loop with no conflicts                                                                      // 689
	      $timeout(angular.noop);                                                                                        // 690
	    });                                                                                                              // 691
                                                                                                                      // 692
	    return allPromise;                                                                                               // 693
	  };                                                                                                                 // 694
                                                                                                                      // 695
	  this.getCollectionByName = function (string) {                                                                     // 696
	    return Mongo.Collection.get(string);                                                                             // 697
	  };                                                                                                                 // 698
                                                                                                                      // 699
	  this.findIndexById = function (collection, doc) {                                                                  // 700
	    var foundDoc = _underscore2.default.find(collection, function (colDoc) {                                         // 701
	      // EJSON.equals used to compare Mongo.ObjectIDs and Strings.                                                   // 702
	      return EJSON.equals(colDoc._id, doc._id);                                                                      // 703
	    });                                                                                                              // 704
                                                                                                                      // 705
	    return _underscore2.default.indexOf(collection, foundDoc);                                                       // 706
	  };                                                                                                                 // 707
	}]);                                                                                                                 // 708
                                                                                                                      // 709
	angularMeteorUtils.run(['$rootScope', '$meteorUtils', function ($rootScope, $meteorUtils) {                          // 710
	  Object.getPrototypeOf($rootScope).$meteorAutorun = function (fn) {                                                 // 711
	    return $meteorUtils.autorun(this, fn);                                                                           // 712
	  };                                                                                                                 // 713
	}]);                                                                                                                 // 714
                                                                                                                      // 715
/***/ },                                                                                                              // 716
/* 8 */                                                                                                               // 717
/***/ function(module, exports) {                                                                                     // 718
                                                                                                                      // 719
	/*global                                                                                                             // 720
	 angular, Meteor                                                                                                     // 721
	 */                                                                                                                  // 722
                                                                                                                      // 723
	'use strict';                                                                                                        // 724
                                                                                                                      // 725
	var angularMeteorSubscribe = angular.module('angular-meteor.subscribe', ['angular-meteor.settings']);                // 726
                                                                                                                      // 727
	angularMeteorSubscribe.service('$meteorSubscribe', ['$q', '$angularMeteorSettings', function ($q, $angularMeteorSettings) {
                                                                                                                      // 729
	  var self = this;                                                                                                   // 730
                                                                                                                      // 731
	  this._subscribe = function (scope, deferred, args) {                                                               // 732
	    if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.subscribe] Please note that this module is deprecated since 1.3.0 and will be removed in 1.4.0! Replace it with the new syntax described here: http://www.angular-meteor.com/api/1.3.6/subscribe. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');
                                                                                                                      // 734
	    var subscription = null;                                                                                         // 735
	    var lastArg = args[args.length - 1];                                                                             // 736
                                                                                                                      // 737
	    // User supplied onStop callback                                                                                 // 738
	    // save it for later use and remove                                                                              // 739
	    // from subscription arguments                                                                                   // 740
	    if (angular.isObject(lastArg) && angular.isFunction(lastArg.onStop)) {                                           // 741
	      var _onStop = lastArg.onStop;                                                                                  // 742
                                                                                                                      // 743
	      args.pop();                                                                                                    // 744
	    }                                                                                                                // 745
                                                                                                                      // 746
	    args.push({                                                                                                      // 747
	      onReady: function onReady() {                                                                                  // 748
	        deferred.resolve(subscription);                                                                              // 749
	      },                                                                                                             // 750
	      onStop: function onStop(err) {                                                                                 // 751
	        if (!deferred.promise.$$state.status) {                                                                      // 752
	          if (err) deferred.reject(err);else deferred.reject(new Meteor.Error("Subscription Stopped", "Subscription stopped by a call to stop method. Either by the client or by the server."));
	        } else if (_onStop)                                                                                          // 754
	          // After promise was resolved or rejected                                                                  // 755
	          // call user supplied onStop callback.                                                                     // 756
	          _onStop.apply(this, Array.prototype.slice.call(arguments));                                                // 757
	      }                                                                                                              // 758
	    });                                                                                                              // 759
                                                                                                                      // 760
	    subscription = Meteor.subscribe.apply(scope, args);                                                              // 761
                                                                                                                      // 762
	    return subscription;                                                                                             // 763
	  };                                                                                                                 // 764
                                                                                                                      // 765
	  this.subscribe = function () {                                                                                     // 766
	    var deferred = $q.defer();                                                                                       // 767
	    var args = Array.prototype.slice.call(arguments);                                                                // 768
	    var subscription = null;                                                                                         // 769
                                                                                                                      // 770
	    self._subscribe(this, deferred, args);                                                                           // 771
                                                                                                                      // 772
	    return deferred.promise;                                                                                         // 773
	  };                                                                                                                 // 774
	}]);                                                                                                                 // 775
                                                                                                                      // 776
	angularMeteorSubscribe.run(['$rootScope', '$q', '$meteorSubscribe', function ($rootScope, $q, $meteorSubscribe) {    // 777
	  Object.getPrototypeOf($rootScope).$meteorSubscribe = function () {                                                 // 778
	    var deferred = $q.defer();                                                                                       // 779
	    var args = Array.prototype.slice.call(arguments);                                                                // 780
                                                                                                                      // 781
	    var subscription = $meteorSubscribe._subscribe(this, deferred, args);                                            // 782
                                                                                                                      // 783
	    this.$on('$destroy', function () {                                                                               // 784
	      subscription.stop();                                                                                           // 785
	    });                                                                                                              // 786
                                                                                                                      // 787
	    return deferred.promise;                                                                                         // 788
	  };                                                                                                                 // 789
	}]);                                                                                                                 // 790
                                                                                                                      // 791
/***/ },                                                                                                              // 792
/* 9 */                                                                                                               // 793
/***/ function(module, exports, __webpack_require__) {                                                                // 794
                                                                                                                      // 795
	'use strict';                                                                                                        // 796
                                                                                                                      // 797
	var _underscore = __webpack_require__(2);                                                                            // 798
                                                                                                                      // 799
	var _underscore2 = _interopRequireDefault(_underscore);                                                              // 800
                                                                                                                      // 801
	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }                      // 802
                                                                                                                      // 803
	'use strict'; /*global                                                                                               // 804
	               angular, _, Tracker, check, Match, Mongo                                                              // 805
	               */                                                                                                    // 806
                                                                                                                      // 807
	var angularMeteorCollection = angular.module('angular-meteor.collection', ['angular-meteor.stopper', 'angular-meteor.subscribe', 'angular-meteor.utils', 'diffArray', 'angular-meteor.settings']);
                                                                                                                      // 809
	// The reason angular meteor collection is a factory function and not something                                      // 810
	// that inherit from array comes from here:                                                                          // 811
	// http://perfectionkills.com/how-ecmascript-5-still-does-not-allow-to-subclass-an-array/                            // 812
	// We went with the direct extensions approach.                                                                      // 813
	angularMeteorCollection.factory('AngularMeteorCollection', ['$q', '$meteorSubscribe', '$meteorUtils', '$rootScope', '$timeout', 'diffArray', '$angularMeteorSettings', function ($q, $meteorSubscribe, $meteorUtils, $rootScope, $timeout, diffArray, $angularMeteorSettings) {
                                                                                                                      // 815
	  function AngularMeteorCollection(curDefFunc, collection, diffArrayFunc, autoClientSave) {                          // 816
	    if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.$meteorCollection] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/meteorCollection. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');
                                                                                                                      // 818
	    var data = [];                                                                                                   // 819
	    // Server backup data to evaluate what changes come from client                                                  // 820
	    // after each server update.                                                                                     // 821
	    data._serverBackup = [];                                                                                         // 822
	    // Array differ function.                                                                                        // 823
	    data._diffArrayFunc = diffArrayFunc;                                                                             // 824
	    // Handler of the cursor observer.                                                                               // 825
	    data._hObserve = null;                                                                                           // 826
	    // On new cursor autorun handler                                                                                 // 827
	    // (autorun for reactive variables).                                                                             // 828
	    data._hNewCurAutorun = null;                                                                                     // 829
	    // On new data autorun handler                                                                                   // 830
	    // (autorun for cursor.fetch).                                                                                   // 831
	    data._hDataAutorun = null;                                                                                       // 832
                                                                                                                      // 833
	    if (angular.isDefined(collection)) {                                                                             // 834
	      data.$$collection = collection;                                                                                // 835
	    } else {                                                                                                         // 836
	      var cursor = curDefFunc();                                                                                     // 837
	      data.$$collection = $meteorUtils.getCollectionByName(cursor.collection.name);                                  // 838
	    }                                                                                                                // 839
                                                                                                                      // 840
	    _underscore2.default.extend(data, AngularMeteorCollection);                                                      // 841
	    data._startCurAutorun(curDefFunc, autoClientSave);                                                               // 842
                                                                                                                      // 843
	    return data;                                                                                                     // 844
	  }                                                                                                                  // 845
                                                                                                                      // 846
	  AngularMeteorCollection._startCurAutorun = function (curDefFunc, autoClientSave) {                                 // 847
	    var self = this;                                                                                                 // 848
                                                                                                                      // 849
	    self._hNewCurAutorun = Tracker.autorun(function () {                                                             // 850
	      // When the reactive func gets recomputated we need to stop any previous                                       // 851
	      // observeChanges.                                                                                             // 852
	      Tracker.onInvalidate(function () {                                                                             // 853
	        self._stopCursor();                                                                                          // 854
	      });                                                                                                            // 855
                                                                                                                      // 856
	      if (autoClientSave) self._setAutoClientSave();                                                                 // 857
	      self._updateCursor(curDefFunc(), autoClientSave);                                                              // 858
	    });                                                                                                              // 859
	  };                                                                                                                 // 860
                                                                                                                      // 861
	  AngularMeteorCollection.subscribe = function () {                                                                  // 862
	    $meteorSubscribe.subscribe.apply(this, arguments);                                                               // 863
	    return this;                                                                                                     // 864
	  };                                                                                                                 // 865
                                                                                                                      // 866
	  AngularMeteorCollection.save = function (docs, useUnsetModifier) {                                                 // 867
	    // save whole collection                                                                                         // 868
	    if (!docs) docs = this;                                                                                          // 869
	    // save single doc                                                                                               // 870
	    docs = [].concat(docs);                                                                                          // 871
                                                                                                                      // 872
	    var promises = docs.map(function (doc) {                                                                         // 873
	      return this._upsertDoc(doc, useUnsetModifier);                                                                 // 874
	    }, this);                                                                                                        // 875
                                                                                                                      // 876
	    return $meteorUtils.promiseAll(promises);                                                                        // 877
	  };                                                                                                                 // 878
                                                                                                                      // 879
	  AngularMeteorCollection._upsertDoc = function (doc, useUnsetModifier) {                                            // 880
	    var deferred = $q.defer();                                                                                       // 881
	    var collection = this.$$collection;                                                                              // 882
	    var createFulfill = _underscore2.default.partial($meteorUtils.fulfill, deferred, null);                          // 883
                                                                                                                      // 884
	    // delete $$hashkey                                                                                              // 885
	    doc = $meteorUtils.stripDollarPrefixedKeys(doc);                                                                 // 886
	    var docId = doc._id;                                                                                             // 887
	    var isExist = collection.findOne(docId);                                                                         // 888
                                                                                                                      // 889
	    // update                                                                                                        // 890
	    if (isExist) {                                                                                                   // 891
	      // Deletes _id property (from the copy) so that                                                                // 892
	      // it can be $set using update.                                                                                // 893
	      delete doc._id;                                                                                                // 894
	      var modifier = useUnsetModifier ? { $unset: doc } : { $set: doc };                                             // 895
	      // NOTE: do not use #upsert() method, since it does not exist in some collections                              // 896
	      collection.update(docId, modifier, createFulfill(function () {                                                 // 897
	        return { _id: docId, action: 'updated' };                                                                    // 898
	      }));                                                                                                           // 899
	    }                                                                                                                // 900
	    // insert                                                                                                        // 901
	    else {                                                                                                           // 902
	        collection.insert(doc, createFulfill(function (id) {                                                         // 903
	          return { _id: id, action: 'inserted' };                                                                    // 904
	        }));                                                                                                         // 905
	      }                                                                                                              // 906
                                                                                                                      // 907
	    return deferred.promise;                                                                                         // 908
	  };                                                                                                                 // 909
                                                                                                                      // 910
	  // performs $pull operations parallely.                                                                            // 911
	  // used for handling splice operations returned from getUpdates() to prevent conflicts.                            // 912
	  // see issue: https://github.com/Urigo/angular-meteor/issues/793                                                   // 913
	  AngularMeteorCollection._updateDiff = function (selector, update, callback) {                                      // 914
	    callback = callback || angular.noop;                                                                             // 915
	    var setters = _underscore2.default.omit(update, '$pull');                                                        // 916
	    var updates = [setters];                                                                                         // 917
                                                                                                                      // 918
	    _underscore2.default.each(update.$pull, function (pull, prop) {                                                  // 919
	      var puller = {};                                                                                               // 920
	      puller[prop] = pull;                                                                                           // 921
	      updates.push({ $pull: puller });                                                                               // 922
	    });                                                                                                              // 923
                                                                                                                      // 924
	    this._updateParallel(selector, updates, callback);                                                               // 925
	  };                                                                                                                 // 926
                                                                                                                      // 927
	  // performs each update operation parallely                                                                        // 928
	  AngularMeteorCollection._updateParallel = function (selector, updates, callback) {                                 // 929
	    var self = this;                                                                                                 // 930
	    var done = _underscore2.default.after(updates.length, callback);                                                 // 931
                                                                                                                      // 932
	    var next = function next(err, affectedDocsNum) {                                                                 // 933
	      if (err) return callback(err);                                                                                 // 934
	      done(null, affectedDocsNum);                                                                                   // 935
	    };                                                                                                               // 936
                                                                                                                      // 937
	    _underscore2.default.each(updates, function (update) {                                                           // 938
	      self.$$collection.update(selector, update, next);                                                              // 939
	    });                                                                                                              // 940
	  };                                                                                                                 // 941
                                                                                                                      // 942
	  AngularMeteorCollection.remove = function (keyOrDocs) {                                                            // 943
	    var keys;                                                                                                        // 944
                                                                                                                      // 945
	    // remove whole collection                                                                                       // 946
	    if (!keyOrDocs) {                                                                                                // 947
	      keys = _underscore2.default.pluck(this, '_id');                                                                // 948
	    }                                                                                                                // 949
	    // remove docs                                                                                                   // 950
	    else {                                                                                                           // 951
	        keyOrDocs = [].concat(keyOrDocs);                                                                            // 952
                                                                                                                      // 953
	        keys = _underscore2.default.map(keyOrDocs, function (keyOrDoc) {                                             // 954
	          return keyOrDoc._id || keyOrDoc;                                                                           // 955
	        });                                                                                                          // 956
	      }                                                                                                              // 957
                                                                                                                      // 958
	    // Checks if all keys are correct.                                                                               // 959
	    check(keys, [Match.OneOf(String, Mongo.ObjectID)]);                                                              // 960
                                                                                                                      // 961
	    var promises = keys.map(function (key) {                                                                         // 962
	      return this._removeDoc(key);                                                                                   // 963
	    }, this);                                                                                                        // 964
                                                                                                                      // 965
	    return $meteorUtils.promiseAll(promises);                                                                        // 966
	  };                                                                                                                 // 967
                                                                                                                      // 968
	  AngularMeteorCollection._removeDoc = function (id) {                                                               // 969
	    var deferred = $q.defer();                                                                                       // 970
	    var collection = this.$$collection;                                                                              // 971
	    var fulfill = $meteorUtils.fulfill(deferred, null, { _id: id, action: 'removed' });                              // 972
	    collection.remove(id, fulfill);                                                                                  // 973
	    return deferred.promise;                                                                                         // 974
	  };                                                                                                                 // 975
                                                                                                                      // 976
	  AngularMeteorCollection._updateCursor = function (cursor, autoClientSave) {                                        // 977
	    var self = this;                                                                                                 // 978
	    // XXX - consider adding an option for a non-orderd result for faster performance                                // 979
	    if (self._hObserve) self._stopObserving();                                                                       // 980
                                                                                                                      // 981
	    self._hObserve = cursor.observe({                                                                                // 982
	      addedAt: function addedAt(doc, atIndex) {                                                                      // 983
	        self.splice(atIndex, 0, doc);                                                                                // 984
	        self._serverBackup.splice(atIndex, 0, doc);                                                                  // 985
	        self._setServerUpdateMode();                                                                                 // 986
	      },                                                                                                             // 987
                                                                                                                      // 988
	      changedAt: function changedAt(doc, oldDoc, atIndex) {                                                          // 989
	        diffArray.deepCopyChanges(self[atIndex], doc);                                                               // 990
	        diffArray.deepCopyRemovals(self[atIndex], doc);                                                              // 991
	        self._serverBackup[atIndex] = self[atIndex];                                                                 // 992
	        self._setServerUpdateMode();                                                                                 // 993
	      },                                                                                                             // 994
                                                                                                                      // 995
	      movedTo: function movedTo(doc, fromIndex, toIndex) {                                                           // 996
	        self.splice(fromIndex, 1);                                                                                   // 997
	        self.splice(toIndex, 0, doc);                                                                                // 998
	        self._serverBackup.splice(fromIndex, 1);                                                                     // 999
	        self._serverBackup.splice(toIndex, 0, doc);                                                                  // 1000
	        self._setServerUpdateMode();                                                                                 // 1001
	      },                                                                                                             // 1002
                                                                                                                      // 1003
	      removedAt: function removedAt(oldDoc) {                                                                        // 1004
	        var removedIndex = $meteorUtils.findIndexById(self, oldDoc);                                                 // 1005
                                                                                                                      // 1006
	        if (removedIndex != -1) {                                                                                    // 1007
	          self.splice(removedIndex, 1);                                                                              // 1008
	          self._serverBackup.splice(removedIndex, 1);                                                                // 1009
	          self._setServerUpdateMode();                                                                               // 1010
	        } else {                                                                                                     // 1011
	          // If it's been removed on client then it's already not in collection                                      // 1012
	          // itself but still is in the _serverBackup.                                                               // 1013
	          removedIndex = $meteorUtils.findIndexById(self._serverBackup, oldDoc);                                     // 1014
                                                                                                                      // 1015
	          if (removedIndex != -1) {                                                                                  // 1016
	            self._serverBackup.splice(removedIndex, 1);                                                              // 1017
	          }                                                                                                          // 1018
	        }                                                                                                            // 1019
	      }                                                                                                              // 1020
	    });                                                                                                              // 1021
                                                                                                                      // 1022
	    self._hDataAutorun = Tracker.autorun(function () {                                                               // 1023
	      cursor.fetch();                                                                                                // 1024
	      if (self._serverMode) self._unsetServerUpdateMode(autoClientSave);                                             // 1025
	    });                                                                                                              // 1026
	  };                                                                                                                 // 1027
                                                                                                                      // 1028
	  AngularMeteorCollection._stopObserving = function () {                                                             // 1029
	    this._hObserve.stop();                                                                                           // 1030
	    this._hDataAutorun.stop();                                                                                       // 1031
	    delete this._serverMode;                                                                                         // 1032
	    delete this._hUnsetTimeout;                                                                                      // 1033
	  };                                                                                                                 // 1034
                                                                                                                      // 1035
	  AngularMeteorCollection._setServerUpdateMode = function (name) {                                                   // 1036
	    this._serverMode = true;                                                                                         // 1037
	    // To simplify server update logic, we don't follow                                                              // 1038
	    // updates from the client at the same time.                                                                     // 1039
	    this._unsetAutoClientSave();                                                                                     // 1040
	  };                                                                                                                 // 1041
                                                                                                                      // 1042
	  // Here we use $timeout to combine multiple updates that go                                                        // 1043
	  // each one after another.                                                                                         // 1044
	  AngularMeteorCollection._unsetServerUpdateMode = function (autoClientSave) {                                       // 1045
	    var self = this;                                                                                                 // 1046
                                                                                                                      // 1047
	    if (self._hUnsetTimeout) {                                                                                       // 1048
	      $timeout.cancel(self._hUnsetTimeout);                                                                          // 1049
	      self._hUnsetTimeout = null;                                                                                    // 1050
	    }                                                                                                                // 1051
                                                                                                                      // 1052
	    self._hUnsetTimeout = $timeout(function () {                                                                     // 1053
	      self._serverMode = false;                                                                                      // 1054
	      // Finds updates that was potentially done from the client side                                                // 1055
	      // and saves them.                                                                                             // 1056
	      var changes = diffArray.getChanges(self, self._serverBackup, self._diffArrayFunc);                             // 1057
	      self._saveChanges(changes);                                                                                    // 1058
	      // After, continues following client updates.                                                                  // 1059
	      if (autoClientSave) self._setAutoClientSave();                                                                 // 1060
	    }, 0);                                                                                                           // 1061
	  };                                                                                                                 // 1062
                                                                                                                      // 1063
	  AngularMeteorCollection.stop = function () {                                                                       // 1064
	    this._stopCursor();                                                                                              // 1065
	    this._hNewCurAutorun.stop();                                                                                     // 1066
	  };                                                                                                                 // 1067
                                                                                                                      // 1068
	  AngularMeteorCollection._stopCursor = function () {                                                                // 1069
	    this._unsetAutoClientSave();                                                                                     // 1070
                                                                                                                      // 1071
	    if (this._hObserve) {                                                                                            // 1072
	      this._hObserve.stop();                                                                                         // 1073
	      this._hDataAutorun.stop();                                                                                     // 1074
	    }                                                                                                                // 1075
                                                                                                                      // 1076
	    this.splice(0);                                                                                                  // 1077
	    this._serverBackup.splice(0);                                                                                    // 1078
	  };                                                                                                                 // 1079
                                                                                                                      // 1080
	  AngularMeteorCollection._unsetAutoClientSave = function (name) {                                                   // 1081
	    if (this._hRegAutoBind) {                                                                                        // 1082
	      this._hRegAutoBind();                                                                                          // 1083
	      this._hRegAutoBind = null;                                                                                     // 1084
	    }                                                                                                                // 1085
	  };                                                                                                                 // 1086
                                                                                                                      // 1087
	  AngularMeteorCollection._setAutoClientSave = function () {                                                         // 1088
	    var self = this;                                                                                                 // 1089
                                                                                                                      // 1090
	    // Always unsets auto save to keep only one $watch handler.                                                      // 1091
	    self._unsetAutoClientSave();                                                                                     // 1092
                                                                                                                      // 1093
	    self._hRegAutoBind = $rootScope.$watch(function () {                                                             // 1094
	      return self;                                                                                                   // 1095
	    }, function (nItems, oItems) {                                                                                   // 1096
	      if (nItems === oItems) return;                                                                                 // 1097
                                                                                                                      // 1098
	      var changes = diffArray.getChanges(self, oItems, self._diffArrayFunc);                                         // 1099
	      self._unsetAutoClientSave();                                                                                   // 1100
	      self._saveChanges(changes);                                                                                    // 1101
	      self._setAutoClientSave();                                                                                     // 1102
	    }, true);                                                                                                        // 1103
	  };                                                                                                                 // 1104
                                                                                                                      // 1105
	  AngularMeteorCollection._saveChanges = function (changes) {                                                        // 1106
	    var self = this;                                                                                                 // 1107
                                                                                                                      // 1108
	    // Saves added documents                                                                                         // 1109
	    // Using reversed iteration to prevent indexes from changing during splice                                       // 1110
	    var addedDocs = changes.added.reverse().map(function (descriptor) {                                              // 1111
	      self.splice(descriptor.index, 1);                                                                              // 1112
	      return descriptor.item;                                                                                        // 1113
	    });                                                                                                              // 1114
                                                                                                                      // 1115
	    if (addedDocs.length) self.save(addedDocs);                                                                      // 1116
                                                                                                                      // 1117
	    // Removes deleted documents                                                                                     // 1118
	    var removedDocs = changes.removed.map(function (descriptor) {                                                    // 1119
	      return descriptor.item;                                                                                        // 1120
	    });                                                                                                              // 1121
                                                                                                                      // 1122
	    if (removedDocs.length) self.remove(removedDocs);                                                                // 1123
                                                                                                                      // 1124
	    // Updates changed documents                                                                                     // 1125
	    changes.changed.forEach(function (descriptor) {                                                                  // 1126
	      self._updateDiff(descriptor.selector, descriptor.modifier);                                                    // 1127
	    });                                                                                                              // 1128
	  };                                                                                                                 // 1129
                                                                                                                      // 1130
	  return AngularMeteorCollection;                                                                                    // 1131
	}]);                                                                                                                 // 1132
                                                                                                                      // 1133
	angularMeteorCollection.factory('$meteorCollectionFS', ['$meteorCollection', 'diffArray', '$angularMeteorSettings', function ($meteorCollection, diffArray, $angularMeteorSettings) {
	  function $meteorCollectionFS(reactiveFunc, autoClientSave, collection) {                                           // 1135
                                                                                                                      // 1136
	    if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.$meteorCollectionFS] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/files. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');
	    return new $meteorCollection(reactiveFunc, autoClientSave, collection, diffArray.shallow);                       // 1138
	  }                                                                                                                  // 1139
                                                                                                                      // 1140
	  return $meteorCollectionFS;                                                                                        // 1141
	}]);                                                                                                                 // 1142
                                                                                                                      // 1143
	angularMeteorCollection.factory('$meteorCollection', ['AngularMeteorCollection', '$rootScope', 'diffArray', function (AngularMeteorCollection, $rootScope, diffArray) {
	  function $meteorCollection(reactiveFunc, autoClientSave, collection, diffFn) {                                     // 1145
	    // Validate parameters                                                                                           // 1146
	    if (!reactiveFunc) {                                                                                             // 1147
	      throw new TypeError('The first argument of $meteorCollection is undefined.');                                  // 1148
	    }                                                                                                                // 1149
                                                                                                                      // 1150
	    if (!(angular.isFunction(reactiveFunc) || angular.isFunction(reactiveFunc.find))) {                              // 1151
	      throw new TypeError('The first argument of $meteorCollection must be a function or ' + 'a have a find function property.');
	    }                                                                                                                // 1153
                                                                                                                      // 1154
	    if (!angular.isFunction(reactiveFunc)) {                                                                         // 1155
	      collection = angular.isDefined(collection) ? collection : reactiveFunc;                                        // 1156
	      reactiveFunc = _underscore2.default.bind(reactiveFunc.find, reactiveFunc);                                     // 1157
	    }                                                                                                                // 1158
                                                                                                                      // 1159
	    // By default auto save - true.                                                                                  // 1160
	    autoClientSave = angular.isDefined(autoClientSave) ? autoClientSave : true;                                      // 1161
	    diffFn = diffFn || diffArray;                                                                                    // 1162
	    return new AngularMeteorCollection(reactiveFunc, collection, diffFn, autoClientSave);                            // 1163
	  }                                                                                                                  // 1164
                                                                                                                      // 1165
	  return $meteorCollection;                                                                                          // 1166
	}]);                                                                                                                 // 1167
                                                                                                                      // 1168
	angularMeteorCollection.run(['$rootScope', '$meteorCollection', '$meteorCollectionFS', '$meteorStopper', function ($rootScope, $meteorCollection, $meteorCollectionFS, $meteorStopper) {
	  var scopeProto = Object.getPrototypeOf($rootScope);                                                                // 1170
	  scopeProto.$meteorCollection = $meteorStopper($meteorCollection);                                                  // 1171
	  scopeProto.$meteorCollectionFS = $meteorStopper($meteorCollectionFS);                                              // 1172
	}]);                                                                                                                 // 1173
                                                                                                                      // 1174
/***/ },                                                                                                              // 1175
/* 10 */                                                                                                              // 1176
/***/ function(module, exports, __webpack_require__) {                                                                // 1177
                                                                                                                      // 1178
	'use strict';                                                                                                        // 1179
                                                                                                                      // 1180
	var _underscore = __webpack_require__(2);                                                                            // 1181
                                                                                                                      // 1182
	var _underscore2 = _interopRequireDefault(_underscore);                                                              // 1183
                                                                                                                      // 1184
	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }                      // 1185
                                                                                                                      // 1186
	'use strict'; /*global                                                                                               // 1187
	                angular, _, Mongo                                                                                    // 1188
	              */                                                                                                     // 1189
                                                                                                                      // 1190
	var angularMeteorObject = angular.module('angular-meteor.object', ['angular-meteor.utils', 'angular-meteor.subscribe', 'angular-meteor.collection', 'getUpdates', 'diffArray', 'angular-meteor.settings']);
                                                                                                                      // 1192
	angularMeteorObject.factory('AngularMeteorObject', ['$q', '$meteorSubscribe', '$meteorUtils', 'diffArray', 'getUpdates', 'AngularMeteorCollection', '$angularMeteorSettings', function ($q, $meteorSubscribe, $meteorUtils, diffArray, getUpdates, AngularMeteorCollection, $angularMeteorSettings) {
                                                                                                                      // 1194
	  // A list of internals properties to not watch for, nor pass to the Document on update and etc.                    // 1195
	  AngularMeteorObject.$$internalProps = ['$$collection', '$$options', '$$id', '$$hashkey', '$$internalProps', '$$scope', 'bind', 'save', 'reset', 'subscribe', 'stop', 'autorunComputation', 'unregisterAutoBind', 'unregisterAutoDestroy', 'getRawObject', '_auto', '_setAutos', '_eventEmitter', '_serverBackup', '_updateDiff', '_updateParallel', '_getId'];
                                                                                                                      // 1197
	  function AngularMeteorObject(collection, selector, options) {                                                      // 1198
	    if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.$meteorObject] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/meteorObject. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');
	    // Make data not be an object so we can extend it to preserve                                                    // 1200
	    // Collection Helpers and the like                                                                               // 1201
	    var helpers = collection._helpers;                                                                               // 1202
	    var data = _underscore2.default.isFunction(helpers) ? Object.create(helpers.prototype) : {};                     // 1203
	    var doc = collection.findOne(selector, options);                                                                 // 1204
	    var collectionExtension = _underscore2.default.pick(AngularMeteorCollection, '_updateParallel');                 // 1205
	    _underscore2.default.extend(data, doc);                                                                          // 1206
	    _underscore2.default.extend(data, AngularMeteorObject);                                                          // 1207
	    _underscore2.default.extend(data, collectionExtension);                                                          // 1208
                                                                                                                      // 1209
	    // Omit options that may spoil document finding                                                                  // 1210
	    data.$$options = _underscore2.default.omit(options, 'skip', 'limit');                                            // 1211
	    data.$$collection = collection;                                                                                  // 1212
	    data.$$id = data._getId(selector);                                                                               // 1213
	    data._serverBackup = doc || {};                                                                                  // 1214
                                                                                                                      // 1215
	    return data;                                                                                                     // 1216
	  }                                                                                                                  // 1217
                                                                                                                      // 1218
	  AngularMeteorObject.getRawObject = function () {                                                                   // 1219
	    return angular.copy(_underscore2.default.omit(this, this.$$internalProps));                                      // 1220
	  };                                                                                                                 // 1221
                                                                                                                      // 1222
	  AngularMeteorObject.subscribe = function () {                                                                      // 1223
	    $meteorSubscribe.subscribe.apply(this, arguments);                                                               // 1224
	    return this;                                                                                                     // 1225
	  };                                                                                                                 // 1226
                                                                                                                      // 1227
	  AngularMeteorObject.save = function (custom) {                                                                     // 1228
	    var deferred = $q.defer();                                                                                       // 1229
	    var collection = this.$$collection;                                                                              // 1230
	    var createFulfill = _underscore2.default.partial($meteorUtils.fulfill, deferred, null);                          // 1231
	    var oldDoc = collection.findOne(this.$$id);                                                                      // 1232
	    var mods;                                                                                                        // 1233
                                                                                                                      // 1234
	    // update                                                                                                        // 1235
	    if (oldDoc) {                                                                                                    // 1236
	      if (custom) mods = { $set: custom };else {                                                                     // 1237
	        mods = getUpdates(oldDoc, this.getRawObject());                                                              // 1238
	        // If there are no updates, there is nothing to do here, returning                                           // 1239
	        if (_underscore2.default.isEmpty(mods)) {                                                                    // 1240
	          return $q.when({ action: 'updated' });                                                                     // 1241
	        }                                                                                                            // 1242
	      }                                                                                                              // 1243
                                                                                                                      // 1244
	      // NOTE: do not use #upsert() method, since it does not exist in some collections                              // 1245
	      this._updateDiff(mods, createFulfill({ action: 'updated' }));                                                  // 1246
	    }                                                                                                                // 1247
	    // insert                                                                                                        // 1248
	    else {                                                                                                           // 1249
	        if (custom) mods = _underscore2.default.clone(custom);else mods = this.getRawObject();                       // 1250
                                                                                                                      // 1251
	        mods._id = mods._id || this.$$id;                                                                            // 1252
	        collection.insert(mods, createFulfill({ action: 'inserted' }));                                              // 1253
	      }                                                                                                              // 1254
                                                                                                                      // 1255
	    return deferred.promise;                                                                                         // 1256
	  };                                                                                                                 // 1257
                                                                                                                      // 1258
	  AngularMeteorObject._updateDiff = function (update, callback) {                                                    // 1259
	    var selector = this.$$id;                                                                                        // 1260
	    AngularMeteorCollection._updateDiff.call(this, selector, update, callback);                                      // 1261
	  };                                                                                                                 // 1262
                                                                                                                      // 1263
	  AngularMeteorObject.reset = function (keepClientProps) {                                                           // 1264
	    var self = this;                                                                                                 // 1265
	    var options = this.$$options;                                                                                    // 1266
	    var id = this.$$id;                                                                                              // 1267
	    var doc = this.$$collection.findOne(id, options);                                                                // 1268
                                                                                                                      // 1269
	    if (doc) {                                                                                                       // 1270
	      // extend SubObject                                                                                            // 1271
	      var docKeys = _underscore2.default.keys(doc);                                                                  // 1272
	      var docExtension = _underscore2.default.pick(doc, docKeys);                                                    // 1273
	      var clientProps;                                                                                               // 1274
                                                                                                                      // 1275
	      _underscore2.default.extend(self, docExtension);                                                               // 1276
	      _underscore2.default.extend(self._serverBackup, docExtension);                                                 // 1277
                                                                                                                      // 1278
	      if (keepClientProps) {                                                                                         // 1279
	        clientProps = _underscore2.default.intersection(_underscore2.default.keys(self), _underscore2.default.keys(self._serverBackup));
	      } else {                                                                                                       // 1281
	        clientProps = _underscore2.default.keys(self);                                                               // 1282
	      }                                                                                                              // 1283
                                                                                                                      // 1284
	      var serverProps = _underscore2.default.keys(doc);                                                              // 1285
	      var removedKeys = _underscore2.default.difference(clientProps, serverProps, self.$$internalProps);             // 1286
                                                                                                                      // 1287
	      removedKeys.forEach(function (prop) {                                                                          // 1288
	        delete self[prop];                                                                                           // 1289
	        delete self._serverBackup[prop];                                                                             // 1290
	      });                                                                                                            // 1291
	    } else {                                                                                                         // 1292
	      _underscore2.default.keys(this.getRawObject()).forEach(function (prop) {                                       // 1293
	        delete self[prop];                                                                                           // 1294
	      });                                                                                                            // 1295
                                                                                                                      // 1296
	      self._serverBackup = {};                                                                                       // 1297
	    }                                                                                                                // 1298
	  };                                                                                                                 // 1299
                                                                                                                      // 1300
	  AngularMeteorObject.stop = function () {                                                                           // 1301
	    if (this.unregisterAutoDestroy) this.unregisterAutoDestroy();                                                    // 1302
                                                                                                                      // 1303
	    if (this.unregisterAutoBind) this.unregisterAutoBind();                                                          // 1304
                                                                                                                      // 1305
	    if (this.autorunComputation && this.autorunComputation.stop) this.autorunComputation.stop();                     // 1306
	  };                                                                                                                 // 1307
                                                                                                                      // 1308
	  AngularMeteorObject._getId = function (selector) {                                                                 // 1309
	    var options = _underscore2.default.extend({}, this.$$options, {                                                  // 1310
	      fields: { _id: 1 },                                                                                            // 1311
	      reactive: false,                                                                                               // 1312
	      transform: null                                                                                                // 1313
	    });                                                                                                              // 1314
                                                                                                                      // 1315
	    var doc = this.$$collection.findOne(selector, options);                                                          // 1316
                                                                                                                      // 1317
	    if (doc) return doc._id;                                                                                         // 1318
	    if (selector instanceof Mongo.ObjectID) return selector;                                                         // 1319
	    if (_underscore2.default.isString(selector)) return selector;                                                    // 1320
	    return new Mongo.ObjectID();                                                                                     // 1321
	  };                                                                                                                 // 1322
                                                                                                                      // 1323
	  return AngularMeteorObject;                                                                                        // 1324
	}]);                                                                                                                 // 1325
                                                                                                                      // 1326
	angularMeteorObject.factory('$meteorObject', ['$rootScope', '$meteorUtils', 'getUpdates', 'AngularMeteorObject', function ($rootScope, $meteorUtils, getUpdates, AngularMeteorObject) {
	  function $meteorObject(collection, id, auto, options) {                                                            // 1328
	    // Validate parameters                                                                                           // 1329
	    if (!collection) {                                                                                               // 1330
	      throw new TypeError("The first argument of $meteorObject is undefined.");                                      // 1331
	    }                                                                                                                // 1332
                                                                                                                      // 1333
	    if (!angular.isFunction(collection.findOne)) {                                                                   // 1334
	      throw new TypeError("The first argument of $meteorObject must be a function or a have a findOne function property.");
	    }                                                                                                                // 1336
                                                                                                                      // 1337
	    var data = new AngularMeteorObject(collection, id, options);                                                     // 1338
	    // Making auto default true - http://stackoverflow.com/a/15464208/1426570                                        // 1339
	    data._auto = auto !== false;                                                                                     // 1340
	    _underscore2.default.extend(data, $meteorObject);                                                                // 1341
	    data._setAutos();                                                                                                // 1342
	    return data;                                                                                                     // 1343
	  }                                                                                                                  // 1344
                                                                                                                      // 1345
	  $meteorObject._setAutos = function () {                                                                            // 1346
	    var self = this;                                                                                                 // 1347
                                                                                                                      // 1348
	    this.autorunComputation = $meteorUtils.autorun($rootScope, function () {                                         // 1349
	      self.reset(true);                                                                                              // 1350
	    });                                                                                                              // 1351
                                                                                                                      // 1352
	    // Deep watches the model and performs autobind                                                                  // 1353
	    this.unregisterAutoBind = this._auto && $rootScope.$watch(function () {                                          // 1354
	      return self.getRawObject();                                                                                    // 1355
	    }, function (item, oldItem) {                                                                                    // 1356
	      if (item !== oldItem) self.save();                                                                             // 1357
	    }, true);                                                                                                        // 1358
                                                                                                                      // 1359
	    this.unregisterAutoDestroy = $rootScope.$on('$destroy', function () {                                            // 1360
	      if (self && self.stop) self.pop();                                                                             // 1361
	    });                                                                                                              // 1362
	  };                                                                                                                 // 1363
                                                                                                                      // 1364
	  return $meteorObject;                                                                                              // 1365
	}]);                                                                                                                 // 1366
                                                                                                                      // 1367
	angularMeteorObject.run(['$rootScope', '$meteorObject', '$meteorStopper', function ($rootScope, $meteorObject, $meteorStopper) {
	  var scopeProto = Object.getPrototypeOf($rootScope);                                                                // 1369
	  scopeProto.$meteorObject = $meteorStopper($meteorObject);                                                          // 1370
	}]);                                                                                                                 // 1371
                                                                                                                      // 1372
/***/ },                                                                                                              // 1373
/* 11 */                                                                                                              // 1374
/***/ function(module, exports, __webpack_require__) {                                                                // 1375
                                                                                                                      // 1376
	'use strict';                                                                                                        // 1377
                                                                                                                      // 1378
	var _underscore = __webpack_require__(2);                                                                            // 1379
                                                                                                                      // 1380
	var _underscore2 = _interopRequireDefault(_underscore);                                                              // 1381
                                                                                                                      // 1382
	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }                      // 1383
                                                                                                                      // 1384
	'use strict'; /*global                                                                                               // 1385
	               angular, _, Package, Meteor                                                                           // 1386
	               */                                                                                                    // 1387
                                                                                                                      // 1388
	var angularMeteorUser = angular.module('angular-meteor.user', ['angular-meteor.utils', 'angular-meteor.core', 'angular-meteor.settings']);
                                                                                                                      // 1390
	// requires package 'accounts-password'                                                                              // 1391
	angularMeteorUser.service('$meteorUser', ['$rootScope', '$meteorUtils', '$q', '$angularMeteorSettings', function ($rootScope, $meteorUtils, $q, $angularMeteorSettings) {
                                                                                                                      // 1393
	  var pack = Package['accounts-base'];                                                                               // 1394
	  if (!pack) return;                                                                                                 // 1395
                                                                                                                      // 1396
	  var self = this;                                                                                                   // 1397
	  var Accounts = pack.Accounts;                                                                                      // 1398
                                                                                                                      // 1399
	  this.waitForUser = function () {                                                                                   // 1400
	    if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.waitForUser] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://info.meteor.com/blog/angular-meteor-1.3. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');
                                                                                                                      // 1402
	    var deferred = $q.defer();                                                                                       // 1403
                                                                                                                      // 1404
	    $meteorUtils.autorun($rootScope, function () {                                                                   // 1405
	      if (!Meteor.loggingIn()) deferred.resolve(Meteor.user());                                                      // 1406
	    }, true);                                                                                                        // 1407
                                                                                                                      // 1408
	    return deferred.promise;                                                                                         // 1409
	  };                                                                                                                 // 1410
                                                                                                                      // 1411
	  this.requireUser = function () {                                                                                   // 1412
	    if (!$angularMeteorSettings.suppressWarnings) {                                                                  // 1413
	      console.warn('[angular-meteor.requireUser] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://info.meteor.com/blog/angular-meteor-1.3. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');
	    }                                                                                                                // 1415
                                                                                                                      // 1416
	    var deferred = $q.defer();                                                                                       // 1417
                                                                                                                      // 1418
	    $meteorUtils.autorun($rootScope, function () {                                                                   // 1419
	      if (!Meteor.loggingIn()) {                                                                                     // 1420
	        if (Meteor.user() === null) deferred.reject("AUTH_REQUIRED");else deferred.resolve(Meteor.user());           // 1421
	      }                                                                                                              // 1422
	    }, true);                                                                                                        // 1423
                                                                                                                      // 1424
	    return deferred.promise;                                                                                         // 1425
	  };                                                                                                                 // 1426
                                                                                                                      // 1427
	  this.requireValidUser = function (validatorFn) {                                                                   // 1428
	    if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.requireValidUser] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://info.meteor.com/blog/angular-meteor-1.3. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');
                                                                                                                      // 1430
	    return self.requireUser(true).then(function (user) {                                                             // 1431
	      var valid = validatorFn(user);                                                                                 // 1432
                                                                                                                      // 1433
	      if (valid === true) return user;else if (typeof valid === "string") return $q.reject(valid);else return $q.reject("FORBIDDEN");
	    });                                                                                                              // 1435
	  };                                                                                                                 // 1436
                                                                                                                      // 1437
	  this.loginWithPassword = $meteorUtils.promissor(Meteor, 'loginWithPassword');                                      // 1438
	  this.createUser = $meteorUtils.promissor(Accounts, 'createUser');                                                  // 1439
	  this.changePassword = $meteorUtils.promissor(Accounts, 'changePassword');                                          // 1440
	  this.forgotPassword = $meteorUtils.promissor(Accounts, 'forgotPassword');                                          // 1441
	  this.resetPassword = $meteorUtils.promissor(Accounts, 'resetPassword');                                            // 1442
	  this.verifyEmail = $meteorUtils.promissor(Accounts, 'verifyEmail');                                                // 1443
	  this.logout = $meteorUtils.promissor(Meteor, 'logout');                                                            // 1444
	  this.logoutOtherClients = $meteorUtils.promissor(Meteor, 'logoutOtherClients');                                    // 1445
	  this.loginWithFacebook = $meteorUtils.promissor(Meteor, 'loginWithFacebook');                                      // 1446
	  this.loginWithTwitter = $meteorUtils.promissor(Meteor, 'loginWithTwitter');                                        // 1447
	  this.loginWithGoogle = $meteorUtils.promissor(Meteor, 'loginWithGoogle');                                          // 1448
	  this.loginWithGithub = $meteorUtils.promissor(Meteor, 'loginWithGithub');                                          // 1449
	  this.loginWithMeteorDeveloperAccount = $meteorUtils.promissor(Meteor, 'loginWithMeteorDeveloperAccount');          // 1450
	  this.loginWithMeetup = $meteorUtils.promissor(Meteor, 'loginWithMeetup');                                          // 1451
	  this.loginWithWeibo = $meteorUtils.promissor(Meteor, 'loginWithWeibo');                                            // 1452
	}]);                                                                                                                 // 1453
                                                                                                                      // 1454
	angularMeteorUser.run(['$rootScope', '$angularMeteorSettings', '$$Core', function ($rootScope, $angularMeteorSettings, $$Core) {
                                                                                                                      // 1456
	  var ScopeProto = Object.getPrototypeOf($rootScope);                                                                // 1457
	  _underscore2.default.extend(ScopeProto, $$Core);                                                                   // 1458
                                                                                                                      // 1459
	  $rootScope.autorun(function () {                                                                                   // 1460
	    if (!Meteor.user) return;                                                                                        // 1461
	    $rootScope.currentUser = Meteor.user();                                                                          // 1462
	    $rootScope.loggingIn = Meteor.loggingIn();                                                                       // 1463
	  });                                                                                                                // 1464
	}]);                                                                                                                 // 1465
                                                                                                                      // 1466
/***/ },                                                                                                              // 1467
/* 12 */                                                                                                              // 1468
/***/ function(module, exports, __webpack_require__) {                                                                // 1469
                                                                                                                      // 1470
	'use strict';                                                                                                        // 1471
                                                                                                                      // 1472
	var _underscore = __webpack_require__(2);                                                                            // 1473
                                                                                                                      // 1474
	var _underscore2 = _interopRequireDefault(_underscore);                                                              // 1475
                                                                                                                      // 1476
	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }                      // 1477
                                                                                                                      // 1478
	'use strict'; /*global                                                                                               // 1479
	               angular, _, Meteor                                                                                    // 1480
	               */                                                                                                    // 1481
                                                                                                                      // 1482
	var angularMeteorMethods = angular.module('angular-meteor.methods', ['angular-meteor.utils', 'angular-meteor.settings']);
                                                                                                                      // 1484
	angularMeteorMethods.service('$meteorMethods', ['$q', '$meteorUtils', '$angularMeteorSettings', function ($q, $meteorUtils, $angularMeteorSettings) {
	  this.call = function () {                                                                                          // 1486
	    if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.$meteor.call] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/methods. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');
                                                                                                                      // 1488
	    var deferred = $q.defer();                                                                                       // 1489
	    var fulfill = $meteorUtils.fulfill(deferred);                                                                    // 1490
	    var args = _underscore2.default.toArray(arguments).concat(fulfill);                                              // 1491
	    Meteor.call.apply(this, args);                                                                                   // 1492
	    return deferred.promise;                                                                                         // 1493
	  };                                                                                                                 // 1494
	}]);                                                                                                                 // 1495
                                                                                                                      // 1496
/***/ },                                                                                                              // 1497
/* 13 */                                                                                                              // 1498
/***/ function(module, exports) {                                                                                     // 1499
                                                                                                                      // 1500
	/*global                                                                                                             // 1501
	 angular, Session                                                                                                    // 1502
	 */                                                                                                                  // 1503
                                                                                                                      // 1504
	'use strict';                                                                                                        // 1505
                                                                                                                      // 1506
	var angularMeteorSession = angular.module('angular-meteor.session', ['angular-meteor.utils', 'angular-meteor.settings']);
                                                                                                                      // 1508
	angularMeteorSession.factory('$meteorSession', ['$meteorUtils', '$parse', '$angularMeteorSettings', function ($meteorUtils, $parse, $angularMeteorSettings) {
	  return function (session) {                                                                                        // 1510
                                                                                                                      // 1511
	    return {                                                                                                         // 1512
                                                                                                                      // 1513
	      bind: function bind(scope, model) {                                                                            // 1514
	        if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.session.bind] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://www.angular-meteor.com/api/1.3.0/session. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');
                                                                                                                      // 1516
	        var getter = $parse(model);                                                                                  // 1517
	        var setter = getter.assign;                                                                                  // 1518
	        $meteorUtils.autorun(scope, function () {                                                                    // 1519
	          setter(scope, Session.get(session));                                                                       // 1520
	        });                                                                                                          // 1521
                                                                                                                      // 1522
	        scope.$watch(model, function (newItem, oldItem) {                                                            // 1523
	          Session.set(session, getter(scope));                                                                       // 1524
	        }, true);                                                                                                    // 1525
	      }                                                                                                              // 1526
	    };                                                                                                               // 1527
	  };                                                                                                                 // 1528
	}]);                                                                                                                 // 1529
                                                                                                                      // 1530
/***/ },                                                                                                              // 1531
/* 14 */                                                                                                              // 1532
/***/ function(module, exports) {                                                                                     // 1533
                                                                                                                      // 1534
	/*global                                                                                                             // 1535
	 angular, Package                                                                                                    // 1536
	 */                                                                                                                  // 1537
                                                                                                                      // 1538
	'use strict';                                                                                                        // 1539
                                                                                                                      // 1540
	var angularMeteorCamera = angular.module('angular-meteor.camera', ['angular-meteor.utils', 'angular-meteor.settings']);
                                                                                                                      // 1542
	// requires package 'mdg:camera'                                                                                     // 1543
	angularMeteorCamera.service('$meteorCamera', ['$q', '$meteorUtils', '$angularMeteorSettings', function ($q, $meteorUtils, $angularMeteorSettings) {
	  if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.camera] Please note that this module has moved to a separate package and is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/camera. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');
	  var pack = Package['mdg:camera'];                                                                                  // 1546
	  if (!pack) return;                                                                                                 // 1547
                                                                                                                      // 1548
	  var MeteorCamera = pack.MeteorCamera;                                                                              // 1549
                                                                                                                      // 1550
	  this.getPicture = function (options) {                                                                             // 1551
	    if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.camera] Please note that this module has moved to a separate package and is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/camera. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');
                                                                                                                      // 1553
	    options = options || {};                                                                                         // 1554
	    var deferred = $q.defer();                                                                                       // 1555
	    MeteorCamera.getPicture(options, $meteorUtils.fulfill(deferred));                                                // 1556
	    return deferred.promise;                                                                                         // 1557
	  };                                                                                                                 // 1558
	}]);                                                                                                                 // 1559
                                                                                                                      // 1560
/***/ },                                                                                                              // 1561
/* 15 */                                                                                                              // 1562
/***/ function(module, exports) {                                                                                     // 1563
                                                                                                                      // 1564
	/*global                                                                                                             // 1565
	 angular                                                                                                             // 1566
	 */                                                                                                                  // 1567
                                                                                                                      // 1568
	'use strict';                                                                                                        // 1569
                                                                                                                      // 1570
	var angularMeteorStopper = angular.module('angular-meteor.stopper', ['angular-meteor.subscribe']);                   // 1571
                                                                                                                      // 1572
	angularMeteorStopper.factory('$meteorStopper', ['$q', '$meteorSubscribe', function ($q, $meteorSubscribe) {          // 1573
	  function $meteorStopper($meteorEntity) {                                                                           // 1574
	    return function () {                                                                                             // 1575
	      var args = Array.prototype.slice.call(arguments);                                                              // 1576
	      var meteorEntity = $meteorEntity.apply(this, args);                                                            // 1577
                                                                                                                      // 1578
	      angular.extend(meteorEntity, $meteorStopper);                                                                  // 1579
	      meteorEntity.$$scope = this;                                                                                   // 1580
                                                                                                                      // 1581
	      this.$on('$destroy', function () {                                                                             // 1582
	        meteorEntity.stop();                                                                                         // 1583
	        if (meteorEntity.subscription) meteorEntity.subscription.stop();                                             // 1584
	      });                                                                                                            // 1585
                                                                                                                      // 1586
	      return meteorEntity;                                                                                           // 1587
	    };                                                                                                               // 1588
	  }                                                                                                                  // 1589
                                                                                                                      // 1590
	  $meteorStopper.subscribe = function () {                                                                           // 1591
	    var args = Array.prototype.slice.call(arguments);                                                                // 1592
	    this.subscription = $meteorSubscribe._subscribe(this.$$scope, $q.defer(), args);                                 // 1593
	    return this;                                                                                                     // 1594
	  };                                                                                                                 // 1595
                                                                                                                      // 1596
	  return $meteorStopper;                                                                                             // 1597
	}]);                                                                                                                 // 1598
                                                                                                                      // 1599
/***/ },                                                                                                              // 1600
/* 16 */                                                                                                              // 1601
/***/ function(module, exports, __webpack_require__) {                                                                // 1602
                                                                                                                      // 1603
	'use strict';                                                                                                        // 1604
                                                                                                                      // 1605
	Object.defineProperty(exports, "__esModule", {                                                                       // 1606
	  value: true                                                                                                        // 1607
	});                                                                                                                  // 1608
	exports.utils = exports.name = undefined;                                                                            // 1609
                                                                                                                      // 1610
	var _underscore = __webpack_require__(2);                                                                            // 1611
                                                                                                                      // 1612
	var _underscore2 = _interopRequireDefault(_underscore);                                                              // 1613
                                                                                                                      // 1614
	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }                      // 1615
                                                                                                                      // 1616
	var name = exports.name = 'angular-meteor.utilities';                                                                // 1617
	var utils = exports.utils = '$$utils';                                                                               // 1618
                                                                                                                      // 1619
	angular.module(name, [])                                                                                             // 1620
                                                                                                                      // 1621
	/*                                                                                                                   // 1622
	  A utility service which is provided with general utility functions                                                 // 1623
	 */                                                                                                                  // 1624
	.service(utils, ['$rootScope', function ($rootScope) {                                                               // 1625
	  var self = this;                                                                                                   // 1626
                                                                                                                      // 1627
	  // Checks if an object is a cursor                                                                                 // 1628
	  this.isCursor = function (obj) {                                                                                   // 1629
	    return obj instanceof Meteor.Collection.Cursor;                                                                  // 1630
	  };                                                                                                                 // 1631
                                                                                                                      // 1632
	  // Cheecks if an object is a scope                                                                                 // 1633
	  this.isScope = function (obj) {                                                                                    // 1634
	    return obj instanceof $rootScope.constructor;                                                                    // 1635
	  };                                                                                                                 // 1636
                                                                                                                      // 1637
	  // Checks if an object is a view model                                                                             // 1638
	  this.isViewModel = function (obj) {                                                                                // 1639
	    return _underscore2.default.isObject(obj) && obj.$$dependencies;                                                 // 1640
	  };                                                                                                                 // 1641
                                                                                                                      // 1642
	  // Checks if two objects are siblings                                                                              // 1643
	  this.areSiblings = function (obj1, obj2) {                                                                         // 1644
	    return _underscore2.default.isObject(obj1) && _underscore2.default.isObject(obj2) && Object.getPrototypeOf(obj1) === Object.getPrototypeOf(obj2);
	  };                                                                                                                 // 1646
                                                                                                                      // 1647
	  // Binds function into a scpecified context. If an object is provided, will bind every                             // 1648
	  // value in the object which is a function. If a tap function is provided, it will be                              // 1649
	  // called right after the function has been invoked.                                                               // 1650
	  this.bind = function (fn, context, tap) {                                                                          // 1651
	    tap = _underscore2.default.isFunction(tap) ? tap : angular.noop;                                                 // 1652
	    if (_underscore2.default.isFunction(fn)) return bindFn(fn, context, tap);                                        // 1653
	    if (_underscore2.default.isObject(fn)) return bindObj(fn, context, tap);                                         // 1654
	    return fn;                                                                                                       // 1655
	  };                                                                                                                 // 1656
                                                                                                                      // 1657
	  function bindFn(fn, context, tap) {                                                                                // 1658
	    return function () {                                                                                             // 1659
	      for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {                         // 1660
	        args[_key] = arguments[_key];                                                                                // 1661
	      }                                                                                                              // 1662
                                                                                                                      // 1663
	      var result = fn.apply(context, args);                                                                          // 1664
	      tap.call(context, {                                                                                            // 1665
	        result: result,                                                                                              // 1666
	        args: args                                                                                                   // 1667
	      });                                                                                                            // 1668
	      return result;                                                                                                 // 1669
	    };                                                                                                               // 1670
	  }                                                                                                                  // 1671
                                                                                                                      // 1672
	  function bindObj(obj, context, tap) {                                                                              // 1673
	    return _underscore2.default.keys(obj).reduce(function (bound, k) {                                               // 1674
	      bound[k] = self.bind(obj[k], context, tap);                                                                    // 1675
	      return bound;                                                                                                  // 1676
	    }, {});                                                                                                          // 1677
	  }                                                                                                                  // 1678
	}]);                                                                                                                 // 1679
                                                                                                                      // 1680
/***/ },                                                                                                              // 1681
/* 17 */                                                                                                              // 1682
/***/ function(module, exports, __webpack_require__) {                                                                // 1683
                                                                                                                      // 1684
	'use strict';                                                                                                        // 1685
                                                                                                                      // 1686
	Object.defineProperty(exports, "__esModule", {                                                                       // 1687
	  value: true                                                                                                        // 1688
	});                                                                                                                  // 1689
	exports.Mixer = exports.name = undefined;                                                                            // 1690
                                                                                                                      // 1691
	var _underscore = __webpack_require__(2);                                                                            // 1692
                                                                                                                      // 1693
	var _underscore2 = _interopRequireDefault(_underscore);                                                              // 1694
                                                                                                                      // 1695
	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }                      // 1696
                                                                                                                      // 1697
	function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
                                                                                                                      // 1699
	var name = exports.name = 'angular-meteor.mixer';                                                                    // 1700
	var Mixer = exports.Mixer = '$Mixer';                                                                                // 1701
                                                                                                                      // 1702
	angular.module(name, [])                                                                                             // 1703
                                                                                                                      // 1704
	/*                                                                                                                   // 1705
	  A service which lets us apply mixins into Scope.prototype.                                                         // 1706
	  The flow is simple. Once we define a mixin, it will be stored in the `$Mixer`,                                     // 1707
	  and any time a `ChildScope` prototype is created                                                                   // 1708
	  it will be extended by the `$Mixer`.                                                                               // 1709
	  This concept is good because it keeps our code                                                                     // 1710
	  clean and simple, and easy to extend.                                                                              // 1711
	  So any time we would like to define a new behaviour to our scope,                                                  // 1712
	  we will just use the `$Mixer` service.                                                                             // 1713
	 */                                                                                                                  // 1714
	.service(Mixer, function () {                                                                                        // 1715
	  var _this = this;                                                                                                  // 1716
                                                                                                                      // 1717
	  // Used to store method's caller                                                                                   // 1718
	  var caller = undefined;                                                                                            // 1719
                                                                                                                      // 1720
	  this._mixins = [];                                                                                                 // 1721
	  // Apply mixins automatically on specified contexts                                                                // 1722
	  this._autoExtend = [];                                                                                             // 1723
	  this._autoConstruct = [];                                                                                          // 1724
                                                                                                                      // 1725
	  // Adds a new mixin                                                                                                // 1726
	  this.mixin = function (mixin) {                                                                                    // 1727
	    if (!_underscore2.default.isObject(mixin)) {                                                                     // 1728
	      throw Error('argument 1 must be an object');                                                                   // 1729
	    }                                                                                                                // 1730
                                                                                                                      // 1731
	    _this._mixins = _underscore2.default.union(_this._mixins, [mixin]);                                              // 1732
	    // Apply mixins to stored contexts                                                                               // 1733
	    _this._autoExtend.forEach(function (context) {                                                                   // 1734
	      return _this._extend(context);                                                                                 // 1735
	    });                                                                                                              // 1736
	    _this._autoConstruct.forEach(function (context) {                                                                // 1737
	      return _this._construct(context);                                                                              // 1738
	    });                                                                                                              // 1739
	    return _this;                                                                                                    // 1740
	  };                                                                                                                 // 1741
                                                                                                                      // 1742
	  // Removes a mixin. Useful mainly for test purposes                                                                // 1743
	  this._mixout = function (mixin) {                                                                                  // 1744
	    _this._mixins = _underscore2.default.without(_this._mixins, mixin);                                              // 1745
	    return _this;                                                                                                    // 1746
	  };                                                                                                                 // 1747
                                                                                                                      // 1748
	  // Invoke function mixins with the provided context and arguments                                                  // 1749
	  this._construct = function (context) {                                                                             // 1750
	    for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {        // 1751
	      args[_key - 1] = arguments[_key];                                                                              // 1752
	    }                                                                                                                // 1753
                                                                                                                      // 1754
	    _this._mixins.filter(_underscore2.default.isFunction).forEach(function (mixin) {                                 // 1755
	      mixin.call.apply(mixin, [context].concat(args));                                                               // 1756
	    });                                                                                                              // 1757
                                                                                                                      // 1758
	    return context;                                                                                                  // 1759
	  };                                                                                                                 // 1760
                                                                                                                      // 1761
	  // Extend prototype with the defined mixins                                                                        // 1762
	  this._extend = function (obj, options) {                                                                           // 1763
	    var _$defaults = _underscore2.default.defaults({}, options, {                                                    // 1764
	      pattern: /.*/ });                                                                                              // 1765
                                                                                                                      // 1766
	    var pattern = _$defaults.pattern;                                                                                // 1767
	    var context = _$defaults.context;                                                                                // 1768
	    // The patterns of the keys which will be filtered                                                               // 1769
                                                                                                                      // 1770
                                                                                                                      // 1771
	    var mixins = _this._mixins.map(function (mixin) {                                                                // 1772
	      // Filtering the keys by the specified pattern                                                                 // 1773
	      var keys = _underscore2.default.keys(mixin).filter(function (k) {                                              // 1774
	        return k.match(pattern);                                                                                     // 1775
	      }).filter(function (k) {                                                                                       // 1776
	        return _underscore2.default.isFunction(mixin[k]);                                                            // 1777
	      });                                                                                                            // 1778
                                                                                                                      // 1779
	      return keys.reduce(function (boundMixin, methodName) {                                                         // 1780
	        var methodHandler = mixin[methodName];                                                                       // 1781
                                                                                                                      // 1782
	        // Note that this is not an arrow function so we can conserve the conetxt                                    // 1783
	        boundMixin[methodName] = function () {                                                                       // 1784
	          // Storing original caller so we will know who actually called the                                         // 1785
	          // method event though it is bound to another context                                                      // 1786
	          var methodContext = context || this;                                                                       // 1787
	          var recentCaller = caller;                                                                                 // 1788
	          caller = this;                                                                                             // 1789
                                                                                                                      // 1790
	          try {                                                                                                      // 1791
	            for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {             // 1792
	              args[_key2] = arguments[_key2];                                                                        // 1793
	            }                                                                                                        // 1794
                                                                                                                      // 1795
	            return methodHandler.apply(methodContext, args);                                                         // 1796
	          } finally {                                                                                                // 1797
	            // No matter what happens, restore variable to the previous one                                          // 1798
	            caller = recentCaller;                                                                                   // 1799
	          }                                                                                                          // 1800
	        };                                                                                                           // 1801
                                                                                                                      // 1802
	        return boundMixin;                                                                                           // 1803
	      }, {});                                                                                                        // 1804
	    });                                                                                                              // 1805
                                                                                                                      // 1806
	    return _underscore2.default.extend.apply(_underscore2.default, [obj].concat(_toConsumableArray(mixins)));        // 1807
	  };                                                                                                                 // 1808
                                                                                                                      // 1809
	  // Caller property can not be set                                                                                  // 1810
	  Object.defineProperty(this, 'caller', {                                                                            // 1811
	    configurable: true,                                                                                              // 1812
	    enumerable: true,                                                                                                // 1813
                                                                                                                      // 1814
	    get: function get() {                                                                                            // 1815
	      return caller;                                                                                                 // 1816
	    }                                                                                                                // 1817
	  });                                                                                                                // 1818
	});                                                                                                                  // 1819
                                                                                                                      // 1820
/***/ },                                                                                                              // 1821
/* 18 */                                                                                                              // 1822
/***/ function(module, exports, __webpack_require__) {                                                                // 1823
                                                                                                                      // 1824
	'use strict';                                                                                                        // 1825
                                                                                                                      // 1826
	Object.defineProperty(exports, "__esModule", {                                                                       // 1827
	  value: true                                                                                                        // 1828
	});                                                                                                                  // 1829
	exports.name = undefined;                                                                                            // 1830
                                                                                                                      // 1831
	var _mixer = __webpack_require__(17);                                                                                // 1832
                                                                                                                      // 1833
	var name = exports.name = 'angular-meteor.scope';                                                                    // 1834
                                                                                                                      // 1835
	angular.module(name, [_mixer.name]).run(['$rootScope', _mixer.Mixer, function ($rootScope, $Mixer) {                 // 1836
	  var Scope = $rootScope.constructor;                                                                                // 1837
	  var $new = $rootScope.$new;                                                                                        // 1838
                                                                                                                      // 1839
	  // Apply extensions whether a mixin in defined.                                                                    // 1840
	  // Note that this way mixins which are initialized later                                                           // 1841
	  // can be applied on rootScope.                                                                                    // 1842
	  $Mixer._autoExtend.push(Scope.prototype);                                                                          // 1843
	  $Mixer._autoConstruct.push($rootScope);                                                                            // 1844
                                                                                                                      // 1845
	  Scope.prototype.$new = function () {                                                                               // 1846
	    var scope = $new.apply(this, arguments);                                                                         // 1847
	    // Apply constructors to newly created scopes                                                                    // 1848
	    return $Mixer._construct(scope);                                                                                 // 1849
	  };                                                                                                                 // 1850
	}]);                                                                                                                 // 1851
                                                                                                                      // 1852
/***/ },                                                                                                              // 1853
/* 19 */                                                                                                              // 1854
/***/ function(module, exports, __webpack_require__) {                                                                // 1855
                                                                                                                      // 1856
	'use strict';                                                                                                        // 1857
                                                                                                                      // 1858
	Object.defineProperty(exports, "__esModule", {                                                                       // 1859
	  value: true                                                                                                        // 1860
	});                                                                                                                  // 1861
	exports.Core = exports.name = undefined;                                                                             // 1862
                                                                                                                      // 1863
	var _underscore = __webpack_require__(2);                                                                            // 1864
                                                                                                                      // 1865
	var _underscore2 = _interopRequireDefault(_underscore);                                                              // 1866
                                                                                                                      // 1867
	var _utils = __webpack_require__(16);                                                                                // 1868
                                                                                                                      // 1869
	var _mixer = __webpack_require__(17);                                                                                // 1870
                                                                                                                      // 1871
	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }                      // 1872
                                                                                                                      // 1873
	function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
                                                                                                                      // 1875
	var name = exports.name = 'angular-meteor.core';                                                                     // 1876
	var Core = exports.Core = '$$Core';                                                                                  // 1877
                                                                                                                      // 1878
	angular.module(name, [_utils.name, _mixer.name])                                                                     // 1879
                                                                                                                      // 1880
	/*                                                                                                                   // 1881
	  A mixin which provides us with core Meteor functions.                                                              // 1882
	 */                                                                                                                  // 1883
	.factory(Core, ['$q', _utils.utils, _mixer.Mixer, function ($q, $$utils, $Mixer) {                                   // 1884
	  function $$Core() {}                                                                                               // 1885
                                                                                                                      // 1886
	  // Calls Meteor.autorun() which will be digested after each run and automatically destroyed                        // 1887
	  $$Core.autorun = function (fn) {                                                                                   // 1888
	    var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];                           // 1889
                                                                                                                      // 1890
	    fn = this.$bindToContext($Mixer.caller, fn);                                                                     // 1891
                                                                                                                      // 1892
	    if (!_underscore2.default.isFunction(fn)) {                                                                      // 1893
	      throw Error('argument 1 must be a function');                                                                  // 1894
	    }                                                                                                                // 1895
	    if (!_underscore2.default.isObject(options)) {                                                                   // 1896
	      throw Error('argument 2 must be an object');                                                                   // 1897
	    }                                                                                                                // 1898
                                                                                                                      // 1899
	    var computation = Tracker.autorun(fn, options);                                                                  // 1900
	    // Reset to a function that will also stop the listener we just added                                            // 1901
	    computation.stop = this.$$autoStop(computation);                                                                 // 1902
	    return computation;                                                                                              // 1903
	  };                                                                                                                 // 1904
                                                                                                                      // 1905
	  // Calls Meteor.subscribe() which will be digested after each invokation                                           // 1906
	  // and automatically destroyed                                                                                     // 1907
	  $$Core.subscribe = function (subName, fn, cb) {                                                                    // 1908
	    fn = this.$bindToContext($Mixer.caller, fn || angular.noop);                                                     // 1909
	    cb = cb ? this.$bindToContext($Mixer.caller, cb) : angular.noop;                                                 // 1910
                                                                                                                      // 1911
	    if (!_underscore2.default.isString(subName)) {                                                                   // 1912
	      throw Error('argument 1 must be a string');                                                                    // 1913
	    }                                                                                                                // 1914
	    if (!_underscore2.default.isFunction(fn)) {                                                                      // 1915
	      throw Error('argument 2 must be a function');                                                                  // 1916
	    }                                                                                                                // 1917
	    if (!_underscore2.default.isFunction(cb) && !_underscore2.default.isObject(cb)) {                                // 1918
	      throw Error('argument 3 must be a function or an object');                                                     // 1919
	    }                                                                                                                // 1920
                                                                                                                      // 1921
	    var result = {};                                                                                                 // 1922
                                                                                                                      // 1923
	    var computation = this.autorun(function () {                                                                     // 1924
	      var _Meteor;                                                                                                   // 1925
                                                                                                                      // 1926
	      var args = fn();                                                                                               // 1927
	      if (angular.isUndefined(args)) args = [];                                                                      // 1928
                                                                                                                      // 1929
	      if (!_underscore2.default.isArray(args)) {                                                                     // 1930
	        throw Error('reactive function\'s return value must be an array');                                           // 1931
	      }                                                                                                              // 1932
                                                                                                                      // 1933
	      var subscription = (_Meteor = Meteor).subscribe.apply(_Meteor, [subName].concat(_toConsumableArray(args), [cb]));
	      result.ready = subscription.ready.bind(subscription);                                                          // 1935
	      result.subscriptionId = subscription.subscriptionId;                                                           // 1936
	    });                                                                                                              // 1937
                                                                                                                      // 1938
	    // Once the computation has been stopped,                                                                        // 1939
	    // any subscriptions made inside will be stopped as well                                                         // 1940
	    result.stop = computation.stop.bind(computation);                                                                // 1941
	    return result;                                                                                                   // 1942
	  };                                                                                                                 // 1943
                                                                                                                      // 1944
	  // Calls Meteor.call() wrapped by a digestion cycle                                                                // 1945
	  $$Core.callMethod = function () {                                                                                  // 1946
	    var _Meteor2;                                                                                                    // 1947
                                                                                                                      // 1948
	    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {                           // 1949
	      args[_key] = arguments[_key];                                                                                  // 1950
	    }                                                                                                                // 1951
                                                                                                                      // 1952
	    var fn = args.pop();                                                                                             // 1953
	    if (_underscore2.default.isFunction(fn)) fn = this.$bindToContext($Mixer.caller, fn);                            // 1954
	    return (_Meteor2 = Meteor).call.apply(_Meteor2, args.concat([fn]));                                              // 1955
	  };                                                                                                                 // 1956
                                                                                                                      // 1957
	  // Calls Meteor.apply() wrapped by a digestion cycle                                                               // 1958
	  $$Core.applyMethod = function () {                                                                                 // 1959
	    var _Meteor3;                                                                                                    // 1960
                                                                                                                      // 1961
	    for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {                     // 1962
	      args[_key2] = arguments[_key2];                                                                                // 1963
	    }                                                                                                                // 1964
                                                                                                                      // 1965
	    var fn = args.pop();                                                                                             // 1966
	    if (_underscore2.default.isFunction(fn)) fn = this.$bindToContext($Mixer.caller, fn);                            // 1967
	    return (_Meteor3 = Meteor).apply.apply(_Meteor3, args.concat([fn]));                                             // 1968
	  };                                                                                                                 // 1969
                                                                                                                      // 1970
	  // Stops a process once the scope has been destroyed                                                               // 1971
	  $$Core.$$autoStop = function (stoppable) {                                                                         // 1972
	    var removeListener = undefined;                                                                                  // 1973
	    var baseStop = stoppable.stop.bind(stoppable);                                                                   // 1974
                                                                                                                      // 1975
	    // Once the process has been stopped the destroy event listener will be removed                                  // 1976
	    // to avoid memory leaks and unexpected behaviours                                                               // 1977
	    var stop = function stop() {                                                                                     // 1978
	      removeListener();                                                                                              // 1979
	      return baseStop.apply(undefined, arguments);                                                                   // 1980
	    };                                                                                                               // 1981
                                                                                                                      // 1982
	    removeListener = this.$on('$destroy', stop);                                                                     // 1983
	    return stop;                                                                                                     // 1984
	  };                                                                                                                 // 1985
                                                                                                                      // 1986
	  // Digests scope only if there is no phase at the moment                                                           // 1987
	  $$Core.$$throttledDigest = function () {                                                                           // 1988
	    var isDigestable = !this.$$destroyed && !this.$$phase && !this.$root.$$phase;                                    // 1989
                                                                                                                      // 1990
	    if (isDigestable) this.$digest();                                                                                // 1991
	  };                                                                                                                 // 1992
                                                                                                                      // 1993
	  // Creates a promise only that the digestion cycle will be called at its fulfillment                               // 1994
	  $$Core.$$defer = function () {                                                                                     // 1995
	    var deferred = $q.defer();                                                                                       // 1996
	    // Once promise has been fulfilled, digest                                                                       // 1997
	    deferred.promise = deferred.promise.finally(this.$$throttledDigest.bind(this));                                  // 1998
	    return deferred;                                                                                                 // 1999
	  };                                                                                                                 // 2000
                                                                                                                      // 2001
	  // Binds an object or a function to the provided context and digest it once it is invoked                          // 2002
	  $$Core.$bindToContext = function (context, fn) {                                                                   // 2003
	    if (_underscore2.default.isFunction(context)) {                                                                  // 2004
	      fn = context;                                                                                                  // 2005
	      context = this;                                                                                                // 2006
	    }                                                                                                                // 2007
                                                                                                                      // 2008
	    return $$utils.bind(fn, context, this.$$throttledDigest.bind(this));                                             // 2009
	  };                                                                                                                 // 2010
                                                                                                                      // 2011
	  return $$Core;                                                                                                     // 2012
	}]);                                                                                                                 // 2013
                                                                                                                      // 2014
/***/ },                                                                                                              // 2015
/* 20 */                                                                                                              // 2016
/***/ function(module, exports, __webpack_require__) {                                                                // 2017
                                                                                                                      // 2018
	'use strict';                                                                                                        // 2019
                                                                                                                      // 2020
	Object.defineProperty(exports, "__esModule", {                                                                       // 2021
	  value: true                                                                                                        // 2022
	});                                                                                                                  // 2023
	exports.reactive = exports.ViewModel = exports.name = undefined;                                                     // 2024
                                                                                                                      // 2025
	var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
                                                                                                                      // 2027
	var _underscore = __webpack_require__(2);                                                                            // 2028
                                                                                                                      // 2029
	var _underscore2 = _interopRequireDefault(_underscore);                                                              // 2030
                                                                                                                      // 2031
	var _utils = __webpack_require__(16);                                                                                // 2032
                                                                                                                      // 2033
	var _mixer = __webpack_require__(17);                                                                                // 2034
                                                                                                                      // 2035
	var _core = __webpack_require__(19);                                                                                 // 2036
                                                                                                                      // 2037
	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }                      // 2038
                                                                                                                      // 2039
	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
                                                                                                                      // 2041
	var name = exports.name = 'angular-meteor.view-model';                                                               // 2042
	var ViewModel = exports.ViewModel = '$$ViewModel';                                                                   // 2043
	var reactive = exports.reactive = '$reactive';                                                                       // 2044
                                                                                                                      // 2045
	angular.module(name, [_utils.name, _mixer.name, _core.name])                                                         // 2046
                                                                                                                      // 2047
	/*                                                                                                                   // 2048
	  A mixin which lets us bind a view model into a scope.                                                              // 2049
	  Note that only a single view model can be bound,                                                                   // 2050
	  otherwise the scope might behave unexpectedly.                                                                     // 2051
	  Mainly used to define the controller as the view model,                                                            // 2052
	  and very useful when wanting to use Angular's `controllerAs` syntax.                                               // 2053
	 */                                                                                                                  // 2054
	.factory(ViewModel, [_utils.utils, _mixer.Mixer, function ($$utils, $Mixer) {                                        // 2055
	  function $$ViewModel() {}                                                                                          // 2056
                                                                                                                      // 2057
	  // Gets an object, wraps it with scope functions and returns it                                                    // 2058
	  $$ViewModel.viewModel = function (vm) {                                                                            // 2059
	    if (!_underscore2.default.isObject(vm)) {                                                                        // 2060
	      throw Error('argument 1 must be an object');                                                                   // 2061
	    }                                                                                                                // 2062
                                                                                                                      // 2063
	    // Extend view model with mixin functions                                                                        // 2064
	    $Mixer._extend(vm, {                                                                                             // 2065
	      pattern: /^(?!\$\$).*$/, // Omitting methods which start with a $$ notation                                    // 2066
	      context: this // Binding methods to scope                                                                      // 2067
	    });                                                                                                              // 2068
                                                                                                                      // 2069
	    // Apply mixin constructors on scope with view model                                                             // 2070
	    $Mixer._construct(this, vm);                                                                                     // 2071
	    return vm;                                                                                                       // 2072
	  };                                                                                                                 // 2073
                                                                                                                      // 2074
	  return $$ViewModel;                                                                                                // 2075
	}])                                                                                                                  // 2076
                                                                                                                      // 2077
	/*                                                                                                                   // 2078
	  Illustrates the old API where a view model is created using $reactive service                                      // 2079
	 */                                                                                                                  // 2080
	.service(reactive, [_utils.utils, function ($$utils) {                                                               // 2081
	  var Reactive = function () {                                                                                       // 2082
	    function Reactive(vm) {                                                                                          // 2083
	      var _this = this;                                                                                              // 2084
                                                                                                                      // 2085
	      _classCallCheck(this, Reactive);                                                                               // 2086
                                                                                                                      // 2087
	      if (!_underscore2.default.isObject(vm)) {                                                                      // 2088
	        throw Error('argument 1 must be an object');                                                                 // 2089
	      }                                                                                                              // 2090
                                                                                                                      // 2091
	      _underscore2.default.defer(function () {                                                                       // 2092
	        if (!_this._attached) {                                                                                      // 2093
	          console.warn('view model was not attached to any scope');                                                  // 2094
	        }                                                                                                            // 2095
	      });                                                                                                            // 2096
                                                                                                                      // 2097
	      this._vm = vm;                                                                                                 // 2098
	    }                                                                                                                // 2099
                                                                                                                      // 2100
	    _createClass(Reactive, [{                                                                                        // 2101
	      key: 'attach',                                                                                                 // 2102
	      value: function attach(scope) {                                                                                // 2103
	        this._attached = true;                                                                                       // 2104
                                                                                                                      // 2105
	        if (!$$utils.isScope(scope)) {                                                                               // 2106
	          throw Error('argument 1 must be a scope');                                                                 // 2107
	        }                                                                                                            // 2108
                                                                                                                      // 2109
	        var viewModel = scope.viewModel(this._vm);                                                                   // 2110
                                                                                                                      // 2111
	        // Similar to the old/Meteor API                                                                             // 2112
	        viewModel.call = viewModel.callMethod;                                                                       // 2113
	        viewModel.apply = viewModel.applyMethod;                                                                     // 2114
                                                                                                                      // 2115
	        return viewModel;                                                                                            // 2116
	      }                                                                                                              // 2117
	    }]);                                                                                                             // 2118
                                                                                                                      // 2119
	    return Reactive;                                                                                                 // 2120
	  }();                                                                                                               // 2121
                                                                                                                      // 2122
	  return function (vm) {                                                                                             // 2123
	    return new Reactive(vm);                                                                                         // 2124
	  };                                                                                                                 // 2125
	}]);                                                                                                                 // 2126
                                                                                                                      // 2127
/***/ },                                                                                                              // 2128
/* 21 */                                                                                                              // 2129
/***/ function(module, exports, __webpack_require__) {                                                                // 2130
                                                                                                                      // 2131
	'use strict';                                                                                                        // 2132
                                                                                                                      // 2133
	Object.defineProperty(exports, "__esModule", {                                                                       // 2134
	  value: true                                                                                                        // 2135
	});                                                                                                                  // 2136
	exports.Reactive = exports.name = undefined;                                                                         // 2137
                                                                                                                      // 2138
	var _jsondiffpatch = __webpack_require__(22);                                                                        // 2139
                                                                                                                      // 2140
	var _jsondiffpatch2 = _interopRequireDefault(_jsondiffpatch);                                                        // 2141
                                                                                                                      // 2142
	var _underscore = __webpack_require__(2);                                                                            // 2143
                                                                                                                      // 2144
	var _underscore2 = _interopRequireDefault(_underscore);                                                              // 2145
                                                                                                                      // 2146
	var _utils = __webpack_require__(16);                                                                                // 2147
                                                                                                                      // 2148
	var _mixer = __webpack_require__(17);                                                                                // 2149
                                                                                                                      // 2150
	var _core = __webpack_require__(19);                                                                                 // 2151
                                                                                                                      // 2152
	var _viewModel = __webpack_require__(20);                                                                            // 2153
                                                                                                                      // 2154
	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }                      // 2155
                                                                                                                      // 2156
	var name = exports.name = 'angular-meteor.reactive';                                                                 // 2157
	var Reactive = exports.Reactive = '$$Reactive';                                                                      // 2158
                                                                                                                      // 2159
	angular.module(name, [_utils.name, _mixer.name, _core.name, _viewModel.name])                                        // 2160
                                                                                                                      // 2161
	/*                                                                                                                   // 2162
	  A mixin which enhance our reactive abilities by providing methods                                                  // 2163
	  that are capable of updating our scope reactively.                                                                 // 2164
	 */                                                                                                                  // 2165
	.factory(Reactive, ['$parse', _utils.utils, _mixer.Mixer, function ($parse, $$utils, $Mixer) {                       // 2166
	  function $$Reactive() {                                                                                            // 2167
	    var vm = arguments.length <= 0 || arguments[0] === undefined ? this : arguments[0];                              // 2168
                                                                                                                      // 2169
	    // Helps us track changes made in the view model                                                                 // 2170
	    vm.$$dependencies = {};                                                                                          // 2171
	  }                                                                                                                  // 2172
                                                                                                                      // 2173
	  // Gets an object containing functions and define their results as reactive properties.                            // 2174
	  // Once a return value has been changed the property will be reset.                                                // 2175
	  $$Reactive.helpers = function (vm, props) {                                                                        // 2176
	    var _this = this;                                                                                                // 2177
                                                                                                                      // 2178
	    if ($$utils.isViewModel(vm)) {                                                                                   // 2179
	      if (!_underscore2.default.isObject(props)) {                                                                   // 2180
	        throw Error('argument 2 must be an object');                                                                 // 2181
	      }                                                                                                              // 2182
	    } else {                                                                                                         // 2183
	      props = vm;                                                                                                    // 2184
	      vm = $Mixer.caller;                                                                                            // 2185
                                                                                                                      // 2186
	      if (!_underscore2.default.isObject(props)) {                                                                   // 2187
	        throw Error('argument 1 must be an object');                                                                 // 2188
	      }                                                                                                              // 2189
	    }                                                                                                                // 2190
                                                                                                                      // 2191
	    _underscore2.default.each(props, function (v, k) {                                                               // 2192
	      if (!_underscore2.default.isFunction(v)) {                                                                     // 2193
	        throw Error('helper \'' + k + '\' must be a function');                                                      // 2194
	      }                                                                                                              // 2195
	    });                                                                                                              // 2196
                                                                                                                      // 2197
	    _underscore2.default.each(props, function (v, k) {                                                               // 2198
	      if (!vm.$$dependencies[k]) {                                                                                   // 2199
	        // Registers a new dependency to the specified helper                                                        // 2200
	        vm.$$dependencies[k] = new Tracker.Dependency();                                                             // 2201
	      }                                                                                                              // 2202
                                                                                                                      // 2203
	      _this.$$setFnHelper(vm, k, v);                                                                                 // 2204
	    });                                                                                                              // 2205
	  };                                                                                                                 // 2206
                                                                                                                      // 2207
	  // Gets a model reactively                                                                                         // 2208
	  $$Reactive.getReactively = function (vm, k, isDeep) {                                                              // 2209
	    if ($$utils.isViewModel(vm)) {                                                                                   // 2210
	      if (angular.isUndefined(isDeep)) isDeep = false;                                                               // 2211
                                                                                                                      // 2212
	      if (!_underscore2.default.isString(k)) {                                                                       // 2213
	        throw Error('argument 2 must be a string');                                                                  // 2214
	      }                                                                                                              // 2215
	      if (!_underscore2.default.isBoolean(isDeep)) {                                                                 // 2216
	        throw Error('argument 3 must be a boolean');                                                                 // 2217
	      }                                                                                                              // 2218
	    } else {                                                                                                         // 2219
	      isDeep = angular.isDefined(k) ? k : false;                                                                     // 2220
	      k = vm;                                                                                                        // 2221
	      vm = $Mixer.caller;                                                                                            // 2222
                                                                                                                      // 2223
	      if (!_underscore2.default.isString(k)) {                                                                       // 2224
	        throw Error('argument 1 must be a string');                                                                  // 2225
	      }                                                                                                              // 2226
	      if (!_underscore2.default.isBoolean(isDeep)) {                                                                 // 2227
	        throw Error('argument 2 must be a boolean');                                                                 // 2228
	      }                                                                                                              // 2229
	    }                                                                                                                // 2230
                                                                                                                      // 2231
	    return this.$$reactivateEntity(vm, k, this.$watch, isDeep);                                                      // 2232
	  };                                                                                                                 // 2233
                                                                                                                      // 2234
	  // Gets a collection reactively                                                                                    // 2235
	  $$Reactive.getCollectionReactively = function (vm, k) {                                                            // 2236
	    if ($$utils.isViewModel(vm)) {                                                                                   // 2237
	      if (!_underscore2.default.isString(k)) {                                                                       // 2238
	        throw Error('argument 2 must be a string');                                                                  // 2239
	      }                                                                                                              // 2240
	    } else {                                                                                                         // 2241
	      k = vm;                                                                                                        // 2242
	      vm = $Mixer.caller;                                                                                            // 2243
                                                                                                                      // 2244
	      if (!_underscore2.default.isString(k)) {                                                                       // 2245
	        throw Error('argument 1 must be a string');                                                                  // 2246
	      }                                                                                                              // 2247
	    }                                                                                                                // 2248
                                                                                                                      // 2249
	    return this.$$reactivateEntity(vm, k, this.$watchCollection);                                                    // 2250
	  };                                                                                                                 // 2251
                                                                                                                      // 2252
	  // Gets an entity reactively, and once it has been changed the computation will be recomputed                      // 2253
	  $$Reactive.$$reactivateEntity = function (vm, k, watcher) {                                                        // 2254
	    if (!vm.$$dependencies[k]) {                                                                                     // 2255
	      vm.$$dependencies[k] = new Tracker.Dependency();                                                               // 2256
                                                                                                                      // 2257
	      for (var _len = arguments.length, watcherArgs = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
	        watcherArgs[_key - 3] = arguments[_key];                                                                     // 2259
	      }                                                                                                              // 2260
                                                                                                                      // 2261
	      this.$$watchEntity.apply(this, [vm, k, watcher].concat(watcherArgs));                                          // 2262
	    }                                                                                                                // 2263
                                                                                                                      // 2264
	    vm.$$dependencies[k].depend();                                                                                   // 2265
	    return $parse(k)(vm);                                                                                            // 2266
	  };                                                                                                                 // 2267
                                                                                                                      // 2268
	  // Watches for changes in the view model, and if so will notify a change                                           // 2269
	  $$Reactive.$$watchEntity = function (vm, k, watcher) {                                                             // 2270
	    var _this2 = this;                                                                                               // 2271
                                                                                                                      // 2272
	    // Gets a deep property from the caller                                                                          // 2273
	    var getVal = _underscore2.default.partial($parse(k), vm);                                                        // 2274
	    var initialVal = getVal();                                                                                       // 2275
                                                                                                                      // 2276
	    // Watches for changes in the view model                                                                         // 2277
                                                                                                                      // 2278
	    for (var _len2 = arguments.length, watcherArgs = Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
	      watcherArgs[_key2 - 3] = arguments[_key2];                                                                     // 2280
	    }                                                                                                                // 2281
                                                                                                                      // 2282
	    watcher.call.apply(watcher, [this, getVal, function (val, oldVal) {                                              // 2283
	      var hasChanged = val !== initialVal || val !== oldVal;                                                         // 2284
                                                                                                                      // 2285
	      // Notify if a change has been detected                                                                        // 2286
	      if (hasChanged) _this2.$$changed(vm, k);                                                                       // 2287
	    }].concat(watcherArgs));                                                                                         // 2288
	  };                                                                                                                 // 2289
                                                                                                                      // 2290
	  // Invokes a function and sets the return value as a property                                                      // 2291
	  $$Reactive.$$setFnHelper = function (vm, k, fn) {                                                                  // 2292
	    var _this3 = this;                                                                                               // 2293
                                                                                                                      // 2294
	    var activeObservation = null;                                                                                    // 2295
	    var lastModel = null;                                                                                            // 2296
	    var lastModelData = [];                                                                                          // 2297
                                                                                                                      // 2298
	    this.autorun(function () /* computation */{                                                                      // 2299
	      // Invokes the reactive functon                                                                                // 2300
	      var model = fn.apply(vm);                                                                                      // 2301
                                                                                                                      // 2302
	      // Ignore notifications made by the following handler                                                          // 2303
	      Tracker.nonreactive(function () {                                                                              // 2304
	        // If a cursor, observe its changes and update acoordingly                                                   // 2305
	        if ($$utils.isCursor(model)) {                                                                               // 2306
	          var modelData = undefined;                                                                                 // 2307
                                                                                                                      // 2308
	          if (angular.isUndefined(vm[k])) {                                                                          // 2309
	            _this3.$$setValHelper(vm, k, [], false);                                                                 // 2310
	          }                                                                                                          // 2311
                                                                                                                      // 2312
	          if (activeObservation) {                                                                                   // 2313
	            lastModelData = lastModel.fetch();                                                                       // 2314
	            activeObservation.stop();                                                                                // 2315
	            activeObservation = null;                                                                                // 2316
	          }                                                                                                          // 2317
                                                                                                                      // 2318
	          var handle = _this3.$$handleCursor(vm, k, model);                                                          // 2319
                                                                                                                      // 2320
	          activeObservation = handle.observation;                                                                    // 2321
	          modelData = handle.data;                                                                                   // 2322
                                                                                                                      // 2323
	          if (lastModelData.length !== 0) {                                                                          // 2324
	            var diff = _jsondiffpatch2.default.diff(lastModelData, modelData);                                       // 2325
	            vm[k] = _jsondiffpatch2.default.patch(lastModelData, diff);                                              // 2326
	          } else {                                                                                                   // 2327
	            vm[k] = modelData;                                                                                       // 2328
	          }                                                                                                          // 2329
                                                                                                                      // 2330
	          lastModel = model;                                                                                         // 2331
	          lastModelData = modelData;                                                                                 // 2332
                                                                                                                      // 2333
	          /* computation.onInvalidate(() => {                                                                        // 2334
	            activeObservation.stop();                                                                                // 2335
	          });*/                                                                                                      // 2336
	        } else {                                                                                                     // 2337
	            _this3.$$handleNonCursor(vm, k, model);                                                                  // 2338
	          }                                                                                                          // 2339
                                                                                                                      // 2340
	        // Notify change and update the view model                                                                   // 2341
	        _this3.$$changed(vm, k);                                                                                     // 2342
	      });                                                                                                            // 2343
	    });                                                                                                              // 2344
	  };                                                                                                                 // 2345
                                                                                                                      // 2346
	  // Sets a value helper as a setter and a getter which will notify computations once used                           // 2347
	  $$Reactive.$$setValHelper = function (vm, k, v) {                                                                  // 2348
	    var _this4 = this;                                                                                               // 2349
                                                                                                                      // 2350
	    var watch = arguments.length <= 3 || arguments[3] === undefined ? true : arguments[3];                           // 2351
                                                                                                                      // 2352
	    // If set, reactives property                                                                                    // 2353
	    if (watch) {                                                                                                     // 2354
	      var isDeep = _underscore2.default.isObject(v);                                                                 // 2355
	      this.getReactively(vm, k, isDeep);                                                                             // 2356
	    }                                                                                                                // 2357
                                                                                                                      // 2358
	    Object.defineProperty(vm, k, {                                                                                   // 2359
	      configurable: true,                                                                                            // 2360
	      enumerable: true,                                                                                              // 2361
                                                                                                                      // 2362
	      get: function get() {                                                                                          // 2363
	        return v;                                                                                                    // 2364
	      },                                                                                                             // 2365
	      set: function set(newVal) {                                                                                    // 2366
	        v = newVal;                                                                                                  // 2367
	        _this4.$$changed(vm, k);                                                                                     // 2368
	      }                                                                                                              // 2369
	    });                                                                                                              // 2370
	  };                                                                                                                 // 2371
                                                                                                                      // 2372
	  // Fetching a cursor and updates properties once the result set has been changed                                   // 2373
	  $$Reactive.$$handleCursor = function (vm, k, cursor) {                                                             // 2374
	    var _this5 = this;                                                                                               // 2375
                                                                                                                      // 2376
	    var data = [];                                                                                                   // 2377
	    // Observe changes made in the result set                                                                        // 2378
	    var observation = cursor.observe({                                                                               // 2379
	      addedAt: function addedAt(doc, atIndex) {                                                                      // 2380
	        if (!observation) {                                                                                          // 2381
	          data.push(doc);                                                                                            // 2382
	          return;                                                                                                    // 2383
	        }                                                                                                            // 2384
	        vm[k].splice(atIndex, 0, doc);                                                                               // 2385
	        _this5.$$changed(vm, k);                                                                                     // 2386
	      },                                                                                                             // 2387
	      changedAt: function changedAt(doc, oldDoc, atIndex) {                                                          // 2388
	        var diff = _jsondiffpatch2.default.diff(vm[k][atIndex], doc);                                                // 2389
	        _jsondiffpatch2.default.patch(vm[k][atIndex], diff);                                                         // 2390
	        _this5.$$changed(vm, k);                                                                                     // 2391
	      },                                                                                                             // 2392
	      movedTo: function movedTo(doc, fromIndex, toIndex) {                                                           // 2393
	        vm[k].splice(fromIndex, 1);                                                                                  // 2394
	        vm[k].splice(toIndex, 0, doc);                                                                               // 2395
	        _this5.$$changed(vm, k);                                                                                     // 2396
	      },                                                                                                             // 2397
	      removedAt: function removedAt(oldDoc, atIndex) {                                                               // 2398
	        vm[k].splice(atIndex, 1);                                                                                    // 2399
	        _this5.$$changed(vm, k);                                                                                     // 2400
	      }                                                                                                              // 2401
	    });                                                                                                              // 2402
                                                                                                                      // 2403
	    return {                                                                                                         // 2404
	      observation: observation,                                                                                      // 2405
	      data: data                                                                                                     // 2406
	    };                                                                                                               // 2407
	  };                                                                                                                 // 2408
                                                                                                                      // 2409
	  $$Reactive.$$handleNonCursor = function (vm, k, data) {                                                            // 2410
	    var v = vm[k];                                                                                                   // 2411
                                                                                                                      // 2412
	    if (angular.isDefined(v)) {                                                                                      // 2413
	      delete vm[k];                                                                                                  // 2414
	      v = null;                                                                                                      // 2415
	    }                                                                                                                // 2416
                                                                                                                      // 2417
	    if (angular.isUndefined(v)) {                                                                                    // 2418
	      this.$$setValHelper(vm, k, data);                                                                              // 2419
	    }                                                                                                                // 2420
	    // Update property if the new value is from the same type                                                        // 2421
	    else if ($$utils.areSiblings(v, data)) {                                                                         // 2422
	        var diff = _jsondiffpatch2.default.diff(v, data);                                                            // 2423
	        _jsondiffpatch2.default.patch(v, diff);                                                                      // 2424
	        this.$$changed(vm, k);                                                                                       // 2425
	      } else {                                                                                                       // 2426
	        vm[k] = data;                                                                                                // 2427
	      }                                                                                                              // 2428
	  };                                                                                                                 // 2429
                                                                                                                      // 2430
	  // Notifies dependency in view model                                                                               // 2431
	  $$Reactive.$$depend = function (vm, k) {                                                                           // 2432
	    vm.$$dependencies[k].depend();                                                                                   // 2433
	  };                                                                                                                 // 2434
                                                                                                                      // 2435
	  // Notifies change in view model                                                                                   // 2436
	  $$Reactive.$$changed = function (vm, k) {                                                                          // 2437
	    this.$$throttledDigest();                                                                                        // 2438
	    vm.$$dependencies[k].changed();                                                                                  // 2439
	  };                                                                                                                 // 2440
                                                                                                                      // 2441
	  return $$Reactive;                                                                                                 // 2442
	}]);                                                                                                                 // 2443
                                                                                                                      // 2444
/***/ },                                                                                                              // 2445
/* 22 */                                                                                                              // 2446
/***/ function(module, exports) {                                                                                     // 2447
                                                                                                                      // 2448
	module.exports = __WEBPACK_EXTERNAL_MODULE_22__;                                                                     // 2449
                                                                                                                      // 2450
/***/ },                                                                                                              // 2451
/* 23 */                                                                                                              // 2452
/***/ function(module, exports) {                                                                                     // 2453
                                                                                                                      // 2454
	'use strict';                                                                                                        // 2455
                                                                                                                      // 2456
	Object.defineProperty(exports, "__esModule", {                                                                       // 2457
	  value: true                                                                                                        // 2458
	});                                                                                                                  // 2459
	var name = exports.name = 'angular-templates';                                                                       // 2460
                                                                                                                      // 2461
	try {                                                                                                                // 2462
	  angular.module(name);                                                                                              // 2463
	} catch (e) {                                                                                                        // 2464
	  angular.module(name, []);                                                                                          // 2465
	}                                                                                                                    // 2466
                                                                                                                      // 2467
/***/ }                                                                                                               // 2468
/******/ ])                                                                                                           // 2469
});                                                                                                                   // 2470
;                                                                                                                     // 2471
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}).call(this);


/* Exports */
if (typeof Package === 'undefined') Package = {};
Package['angular-meteor-data'] = {};

})();