nimbu-js-sdk 1.6.5 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nimbu.js +59 -28
- package/dist/nimbu.min.js +2 -2
- package/dist/sdk/functions.js +10 -1
- package/dist/sdk/future.js +23 -1
- package/dist/sdk/version.js +1 -1
- package/package.json +1 -1
- package/src/sdk/functions.coffee +6 -1
- package/src/sdk/future.coffee +17 -2
package/dist/nimbu.js
CHANGED
|
@@ -1432,7 +1432,7 @@ var _events = __webpack_require__(52);
|
|
|
1432
1432
|
|
|
1433
1433
|
var _events2 = _interopRequireDefault(_events);
|
|
1434
1434
|
|
|
1435
|
-
var _future = __webpack_require__(
|
|
1435
|
+
var _future = __webpack_require__(7);
|
|
1436
1436
|
|
|
1437
1437
|
var _future2 = _interopRequireDefault(_future);
|
|
1438
1438
|
|
|
@@ -3034,17 +3034,6 @@ var _traverse = exports._traverse = function _traverse(object, func, seen) {
|
|
|
3034
3034
|
/* 7 */
|
|
3035
3035
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3036
3036
|
|
|
3037
|
-
var isObject = __webpack_require__(14);
|
|
3038
|
-
module.exports = function (it) {
|
|
3039
|
-
if (!isObject(it)) throw TypeError(it + ' is not an object!');
|
|
3040
|
-
return it;
|
|
3041
|
-
};
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
/***/ }),
|
|
3045
|
-
/* 8 */
|
|
3046
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
3047
|
-
|
|
3048
3037
|
"use strict";
|
|
3049
3038
|
/* WEBPACK VAR INJECTION */(function(Promise) {
|
|
3050
3039
|
|
|
@@ -3111,6 +3100,13 @@ _underscore2.default.extend(Future, {
|
|
|
3111
3100
|
future.resolve.apply(future, arguments);
|
|
3112
3101
|
return future;
|
|
3113
3102
|
},
|
|
3103
|
+
// add alias similar to native Promise
|
|
3104
|
+
resolve: function resolve() {
|
|
3105
|
+
var future;
|
|
3106
|
+
future = new Future();
|
|
3107
|
+
future.resolve.apply(future, arguments);
|
|
3108
|
+
return future;
|
|
3109
|
+
},
|
|
3114
3110
|
/*
|
|
3115
3111
|
Returns a new future that is rejected with a given error.
|
|
3116
3112
|
@return {Nimbu.Future} the new future.
|
|
@@ -3121,10 +3117,18 @@ _underscore2.default.extend(Future, {
|
|
|
3121
3117
|
future.reject.apply(future, arguments);
|
|
3122
3118
|
return future;
|
|
3123
3119
|
},
|
|
3120
|
+
// add alias similar to native Promise
|
|
3121
|
+
reject: function reject() {
|
|
3122
|
+
var future;
|
|
3123
|
+
future = new Future();
|
|
3124
|
+
future.reject.apply(future, arguments);
|
|
3125
|
+
return future;
|
|
3126
|
+
},
|
|
3124
3127
|
/*
|
|
3125
3128
|
Returns a new future that is fulfilled when all of the input futures
|
|
3126
3129
|
are resolved. If any future in the list fails, then the returned future
|
|
3127
|
-
will fail with
|
|
3130
|
+
will fail with an array of all the rejected values (null for the futures
|
|
3131
|
+
that didn't fail). If they all succeed, then the returned
|
|
3128
3132
|
future will succeed, with the result being an array with the results of
|
|
3129
3133
|
all the input futures.
|
|
3130
3134
|
@param {Array} futures a list of futures to wait for.
|
|
@@ -3306,6 +3310,9 @@ _underscore2.default.extend(Future.prototype, {
|
|
|
3306
3310
|
always: function always(callback) {
|
|
3307
3311
|
return this.then(callback, callback);
|
|
3308
3312
|
},
|
|
3313
|
+
finally: function _finally(callback) {
|
|
3314
|
+
return this.then(callback, callback);
|
|
3315
|
+
},
|
|
3309
3316
|
/*
|
|
3310
3317
|
Add handlers to be called when the Future object is resolved
|
|
3311
3318
|
*/
|
|
@@ -3318,6 +3325,10 @@ _underscore2.default.extend(Future.prototype, {
|
|
|
3318
3325
|
fail: function fail(callback) {
|
|
3319
3326
|
return this.then(null, callback);
|
|
3320
3327
|
},
|
|
3328
|
+
// alias fail to catch to mimick native Promises
|
|
3329
|
+
catch: function _catch(callback) {
|
|
3330
|
+
return this.then(null, callback);
|
|
3331
|
+
},
|
|
3321
3332
|
/*
|
|
3322
3333
|
* Run the given callbacks after this future is fulfilled.
|
|
3323
3334
|
* @param optionsOrCallback {} A Backbone-style options callback, or a
|
|
@@ -3400,6 +3411,17 @@ _underscore2.default.extend(Future.prototype, {
|
|
|
3400
3411
|
_registry2.default.Future = Future;
|
|
3401
3412
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(38)))
|
|
3402
3413
|
|
|
3414
|
+
/***/ }),
|
|
3415
|
+
/* 8 */
|
|
3416
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3417
|
+
|
|
3418
|
+
var isObject = __webpack_require__(14);
|
|
3419
|
+
module.exports = function (it) {
|
|
3420
|
+
if (!isObject(it)) throw TypeError(it + ' is not an object!');
|
|
3421
|
+
return it;
|
|
3422
|
+
};
|
|
3423
|
+
|
|
3424
|
+
|
|
3403
3425
|
/***/ }),
|
|
3404
3426
|
/* 9 */
|
|
3405
3427
|
/***/ (function(module, exports, __webpack_require__) {
|
|
@@ -3745,7 +3767,7 @@ var _errors = __webpack_require__(9);
|
|
|
3745
3767
|
|
|
3746
3768
|
var _errors2 = _interopRequireDefault(_errors);
|
|
3747
3769
|
|
|
3748
|
-
var _future = __webpack_require__(
|
|
3770
|
+
var _future = __webpack_require__(7);
|
|
3749
3771
|
|
|
3750
3772
|
var _future2 = _interopRequireDefault(_future);
|
|
3751
3773
|
|
|
@@ -4790,7 +4812,7 @@ module.exports = function (it) {
|
|
|
4790
4812
|
/* 19 */
|
|
4791
4813
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4792
4814
|
|
|
4793
|
-
var anObject = __webpack_require__(
|
|
4815
|
+
var anObject = __webpack_require__(8);
|
|
4794
4816
|
var IE8_DOM_DEFINE = __webpack_require__(60);
|
|
4795
4817
|
var toPrimitive = __webpack_require__(61);
|
|
4796
4818
|
var dP = Object.defineProperty;
|
|
@@ -4864,7 +4886,7 @@ module.exports = function (it) {
|
|
|
4864
4886
|
Object.defineProperty(exports, "__esModule", {
|
|
4865
4887
|
value: true
|
|
4866
4888
|
});
|
|
4867
|
-
exports.default = "1.
|
|
4889
|
+
exports.default = "1.7.0";
|
|
4868
4890
|
|
|
4869
4891
|
/***/ }),
|
|
4870
4892
|
/* 24 */
|
|
@@ -6549,7 +6571,7 @@ var _object = __webpack_require__(4);
|
|
|
6549
6571
|
|
|
6550
6572
|
var _object2 = _interopRequireDefault(_object);
|
|
6551
6573
|
|
|
6552
|
-
var _future = __webpack_require__(
|
|
6574
|
+
var _future = __webpack_require__(7);
|
|
6553
6575
|
|
|
6554
6576
|
var _future2 = _interopRequireDefault(_future);
|
|
6555
6577
|
|
|
@@ -8281,7 +8303,7 @@ var _object = __webpack_require__(4);
|
|
|
8281
8303
|
|
|
8282
8304
|
var _object2 = _interopRequireDefault(_object);
|
|
8283
8305
|
|
|
8284
|
-
var _future = __webpack_require__(
|
|
8306
|
+
var _future = __webpack_require__(7);
|
|
8285
8307
|
|
|
8286
8308
|
var _future2 = _interopRequireDefault(_future);
|
|
8287
8309
|
|
|
@@ -8395,7 +8417,7 @@ var _events = __webpack_require__(52);
|
|
|
8395
8417
|
|
|
8396
8418
|
var _events2 = _interopRequireDefault(_events);
|
|
8397
8419
|
|
|
8398
|
-
var _future = __webpack_require__(
|
|
8420
|
+
var _future = __webpack_require__(7);
|
|
8399
8421
|
|
|
8400
8422
|
var _future2 = _interopRequireDefault(_future);
|
|
8401
8423
|
|
|
@@ -8647,7 +8669,7 @@ module.exports = function (Constructor, NAME, next) {
|
|
|
8647
8669
|
/***/ (function(module, exports, __webpack_require__) {
|
|
8648
8670
|
|
|
8649
8671
|
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
|
|
8650
|
-
var anObject = __webpack_require__(
|
|
8672
|
+
var anObject = __webpack_require__(8);
|
|
8651
8673
|
var dPs = __webpack_require__(67);
|
|
8652
8674
|
var enumBugKeys = __webpack_require__(45);
|
|
8653
8675
|
var IE_PROTO = __webpack_require__(33)('IE_PROTO');
|
|
@@ -8694,7 +8716,7 @@ module.exports = Object.create || function create(O, Properties) {
|
|
|
8694
8716
|
/***/ (function(module, exports, __webpack_require__) {
|
|
8695
8717
|
|
|
8696
8718
|
var dP = __webpack_require__(19);
|
|
8697
|
-
var anObject = __webpack_require__(
|
|
8719
|
+
var anObject = __webpack_require__(8);
|
|
8698
8720
|
var getKeys = __webpack_require__(43);
|
|
8699
8721
|
|
|
8700
8722
|
module.exports = __webpack_require__(15) ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
@@ -9253,7 +9275,7 @@ module.exports = function (it, Constructor, name, forbiddenField) {
|
|
|
9253
9275
|
var ctx = __webpack_require__(21);
|
|
9254
9276
|
var call = __webpack_require__(81);
|
|
9255
9277
|
var isArrayIter = __webpack_require__(82);
|
|
9256
|
-
var anObject = __webpack_require__(
|
|
9278
|
+
var anObject = __webpack_require__(8);
|
|
9257
9279
|
var toLength = __webpack_require__(44);
|
|
9258
9280
|
var getIterFn = __webpack_require__(83);
|
|
9259
9281
|
var BREAK = {};
|
|
@@ -9282,7 +9304,7 @@ exports.RETURN = RETURN;
|
|
|
9282
9304
|
/***/ (function(module, exports, __webpack_require__) {
|
|
9283
9305
|
|
|
9284
9306
|
// call something on iterator step with safe closing on error
|
|
9285
|
-
var anObject = __webpack_require__(
|
|
9307
|
+
var anObject = __webpack_require__(8);
|
|
9286
9308
|
module.exports = function (iterator, fn, value, entries) {
|
|
9287
9309
|
try {
|
|
9288
9310
|
return entries ? fn(anObject(value)[0], value[1]) : fn(value);
|
|
@@ -9328,7 +9350,7 @@ module.exports = __webpack_require__(11).getIteratorMethod = function (it) {
|
|
|
9328
9350
|
/***/ (function(module, exports, __webpack_require__) {
|
|
9329
9351
|
|
|
9330
9352
|
// 7.3.20 SpeciesConstructor(O, defaultConstructor)
|
|
9331
|
-
var anObject = __webpack_require__(
|
|
9353
|
+
var anObject = __webpack_require__(8);
|
|
9332
9354
|
var aFunction = __webpack_require__(22);
|
|
9333
9355
|
var SPECIES = __webpack_require__(2)('species');
|
|
9334
9356
|
module.exports = function (O, D) {
|
|
@@ -9462,7 +9484,7 @@ module.exports = navigator && navigator.userAgent || '';
|
|
|
9462
9484
|
/* 89 */
|
|
9463
9485
|
/***/ (function(module, exports, __webpack_require__) {
|
|
9464
9486
|
|
|
9465
|
-
var anObject = __webpack_require__(
|
|
9487
|
+
var anObject = __webpack_require__(8);
|
|
9466
9488
|
var isObject = __webpack_require__(14);
|
|
9467
9489
|
var newPromiseCapability = __webpack_require__(48);
|
|
9468
9490
|
|
|
@@ -10548,7 +10570,7 @@ var _errors = __webpack_require__(9);
|
|
|
10548
10570
|
|
|
10549
10571
|
var _errors2 = _interopRequireDefault(_errors);
|
|
10550
10572
|
|
|
10551
|
-
var _future = __webpack_require__(
|
|
10573
|
+
var _future = __webpack_require__(7);
|
|
10552
10574
|
|
|
10553
10575
|
var _future2 = _interopRequireDefault(_future);
|
|
10554
10576
|
|
|
@@ -11777,6 +11799,10 @@ var _requests = __webpack_require__(10);
|
|
|
11777
11799
|
|
|
11778
11800
|
var _requests2 = _interopRequireDefault(_requests);
|
|
11779
11801
|
|
|
11802
|
+
var _future = __webpack_require__(7);
|
|
11803
|
+
|
|
11804
|
+
var _future2 = _interopRequireDefault(_future);
|
|
11805
|
+
|
|
11780
11806
|
var _global = __webpack_require__(6);
|
|
11781
11807
|
|
|
11782
11808
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -11809,7 +11835,12 @@ _underscore2.default.extend(Cloud, {
|
|
|
11809
11835
|
data: (0, _global._encode)(data, null, true)
|
|
11810
11836
|
});
|
|
11811
11837
|
return request.then(function (resp) {
|
|
11812
|
-
|
|
11838
|
+
data = (0, _global._decode)(null, resp);
|
|
11839
|
+
if (data && data.code === 141) {
|
|
11840
|
+
return _future2.default.error(data);
|
|
11841
|
+
} else {
|
|
11842
|
+
return data.result;
|
|
11843
|
+
}
|
|
11813
11844
|
})._thenRunCallbacks(options);
|
|
11814
11845
|
}
|
|
11815
11846
|
});
|
|
@@ -11843,7 +11874,7 @@ var _errors = __webpack_require__(9);
|
|
|
11843
11874
|
|
|
11844
11875
|
var _errors2 = _interopRequireDefault(_errors);
|
|
11845
11876
|
|
|
11846
|
-
var _future = __webpack_require__(
|
|
11877
|
+
var _future = __webpack_require__(7);
|
|
11847
11878
|
|
|
11848
11879
|
var _future2 = _interopRequireDefault(_future);
|
|
11849
11880
|
|
package/dist/nimbu.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Nimbu=function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=58)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={}},function(t,e,n){(function(){var n=this,r=n._,i={},u=Array.prototype,o=Object.prototype,a=Function.prototype,s=u.push,c=u.slice,l=u.concat,f=o.toString,d=o.hasOwnProperty,h=u.forEach,_=u.map,p=u.reduce,v=u.reduceRight,m=u.filter,g=u.every,y=u.some,b=u.indexOf,C=u.lastIndexOf,w=Array.isArray,S=Object.keys,A=a.bind,O=function(t){return t instanceof O?t:this instanceof O?void(this._wrapped=t):new O(t)};void 0!==t&&t.exports&&(e=t.exports=O),e._=O,O.VERSION="1.5.2";var N=O.each=O.forEach=function(t,e,n){if(null!=t)if(h&&t.forEach===h)t.forEach(e,n);else if(t.length===+t.length){for(var r=0,u=t.length;r<u;r++)if(e.call(n,t[r],r,t)===i)return}else for(var o=O.keys(t),r=0,u=o.length;r<u;r++)if(e.call(n,t[o[r]],o[r],t)===i)return};O.map=O.collect=function(t,e,n){var r=[];return null==t?r:_&&t.map===_?t.map(e,n):(N(t,function(t,i,u){r.push(e.call(n,t,i,u))}),r)};var E="Reduce of empty array with no initial value";O.reduce=O.foldl=O.inject=function(t,e,n,r){var i=arguments.length>2;if(null==t&&(t=[]),p&&t.reduce===p)return r&&(e=O.bind(e,r)),i?t.reduce(e,n):t.reduce(e);if(N(t,function(t,u,o){i?n=e.call(r,n,t,u,o):(n=t,i=!0)}),!i)throw new TypeError(E);return n},O.reduceRight=O.foldr=function(t,e,n,r){var i=arguments.length>2;if(null==t&&(t=[]),v&&t.reduceRight===v)return r&&(e=O.bind(e,r)),i?t.reduceRight(e,n):t.reduceRight(e);var u=t.length;if(u!==+u){var o=O.keys(t);u=o.length}if(N(t,function(a,s,c){s=o?o[--u]:--u,i?n=e.call(r,n,t[s],s,c):(n=t[s],i=!0)}),!i)throw new TypeError(E);return n},O.find=O.detect=function(t,e,n){var r;return j(t,function(t,i,u){if(e.call(n,t,i,u))return r=t,!0}),r},O.filter=O.select=function(t,e,n){var r=[];return null==t?r:m&&t.filter===m?t.filter(e,n):(N(t,function(t,i,u){e.call(n,t,i,u)&&r.push(t)}),r)},O.reject=function(t,e,n){return O.filter(t,function(t,r,i){return!e.call(n,t,r,i)},n)},O.every=O.all=function(t,e,n){e||(e=O.identity);var r=!0;return null==t?r:g&&t.every===g?t.every(e,n):(N(t,function(t,u,o){if(!(r=r&&e.call(n,t,u,o)))return i}),!!r)};var j=O.some=O.any=function(t,e,n){e||(e=O.identity);var r=!1;return null==t?r:y&&t.some===y?t.some(e,n):(N(t,function(t,u,o){if(r||(r=e.call(n,t,u,o)))return i}),!!r)};O.contains=O.include=function(t,e){return null!=t&&(b&&t.indexOf===b?-1!=t.indexOf(e):j(t,function(t){return t===e}))},O.invoke=function(t,e){var n=c.call(arguments,2),r=O.isFunction(e);return O.map(t,function(t){return(r?e:t[e]).apply(t,n)})},O.pluck=function(t,e){return O.map(t,function(t){return t[e]})},O.where=function(t,e,n){return O.isEmpty(e)?n?void 0:[]:O[n?"find":"filter"](t,function(t){for(var n in e)if(e[n]!==t[n])return!1;return!0})},O.findWhere=function(t,e){return O.where(t,e,!0)},O.max=function(t,e,n){if(!e&&O.isArray(t)&&t[0]===+t[0]&&t.length<65535)return Math.max.apply(Math,t);if(!e&&O.isEmpty(t))return-1/0;var r={computed:-1/0,value:-1/0};return N(t,function(t,i,u){var o=e?e.call(n,t,i,u):t;o>r.computed&&(r={value:t,computed:o})}),r.value},O.min=function(t,e,n){if(!e&&O.isArray(t)&&t[0]===+t[0]&&t.length<65535)return Math.min.apply(Math,t);if(!e&&O.isEmpty(t))return 1/0;var r={computed:1/0,value:1/0};return N(t,function(t,i,u){var o=e?e.call(n,t,i,u):t;o<r.computed&&(r={value:t,computed:o})}),r.value},O.shuffle=function(t){var e,n=0,r=[];return N(t,function(t){e=O.random(n++),r[n-1]=r[e],r[e]=t}),r},O.sample=function(t,e,n){return arguments.length<2||n?t[O.random(t.length-1)]:O.shuffle(t).slice(0,Math.max(0,e))};var x=function(t){return O.isFunction(t)?t:function(e){return e[t]}};O.sortBy=function(t,e,n){var r=x(e);return O.pluck(O.map(t,function(t,e,i){return{value:t,index:e,criteria:r.call(n,t,e,i)}}).sort(function(t,e){var n=t.criteria,r=e.criteria;if(n!==r){if(n>r||void 0===n)return 1;if(n<r||void 0===r)return-1}return t.index-e.index}),"value")};var T=function(t){return function(e,n,r){var i={},u=null==n?O.identity:x(n);return N(e,function(n,o){var a=u.call(r,n,o,e);t(i,a,n)}),i}};O.groupBy=T(function(t,e,n){(O.has(t,e)?t[e]:t[e]=[]).push(n)}),O.indexBy=T(function(t,e,n){t[e]=n}),O.countBy=T(function(t,e){O.has(t,e)?t[e]++:t[e]=1}),O.sortedIndex=function(t,e,n,r){n=null==n?O.identity:x(n);for(var i=n.call(r,e),u=0,o=t.length;u<o;){var a=u+o>>>1;n.call(r,t[a])<i?u=a+1:o=a}return u},O.toArray=function(t){return t?O.isArray(t)?c.call(t):t.length===+t.length?O.map(t,O.identity):O.values(t):[]},O.size=function(t){return null==t?0:t.length===+t.length?t.length:O.keys(t).length},O.first=O.head=O.take=function(t,e,n){if(null!=t)return null==e||n?t[0]:c.call(t,0,e)},O.initial=function(t,e,n){return c.call(t,0,t.length-(null==e||n?1:e))},O.last=function(t,e,n){if(null!=t)return null==e||n?t[t.length-1]:c.call(t,Math.max(t.length-e,0))},O.rest=O.tail=O.drop=function(t,e,n){return c.call(t,null==e||n?1:e)},O.compact=function(t){return O.filter(t,O.identity)};var I=function(t,e,n){return e&&O.every(t,O.isArray)?l.apply(n,t):(N(t,function(t){O.isArray(t)||O.isArguments(t)?e?s.apply(n,t):I(t,e,n):n.push(t)}),n)};O.flatten=function(t,e){return I(t,e,[])},O.without=function(t){return O.difference(t,c.call(arguments,1))},O.uniq=O.unique=function(t,e,n,r){O.isFunction(e)&&(r=n,n=e,e=!1);var i=n?O.map(t,n,r):t,u=[],o=[];return N(i,function(n,r){(e?r&&o[o.length-1]===n:O.contains(o,n))||(o.push(n),u.push(t[r]))}),u},O.union=function(){return O.uniq(O.flatten(arguments,!0))},O.intersection=function(t){var e=c.call(arguments,1);return O.filter(O.uniq(t),function(t){return O.every(e,function(e){return O.indexOf(e,t)>=0})})},O.difference=function(t){var e=l.apply(u,c.call(arguments,1));return O.filter(t,function(t){return!O.contains(e,t)})},O.zip=function(){for(var t=O.max(O.pluck(arguments,"length").concat(0)),e=new Array(t),n=0;n<t;n++)e[n]=O.pluck(arguments,""+n);return e},O.object=function(t,e){if(null==t)return{};for(var n={},r=0,i=t.length;r<i;r++)e?n[t[r]]=e[r]:n[t[r][0]]=t[r][1];return n},O.indexOf=function(t,e,n){if(null==t)return-1;var r=0,i=t.length;if(n){if("number"!=typeof n)return r=O.sortedIndex(t,e),t[r]===e?r:-1;r=n<0?Math.max(0,i+n):n}if(b&&t.indexOf===b)return t.indexOf(e,n);for(;r<i;r++)if(t[r]===e)return r;return-1},O.lastIndexOf=function(t,e,n){if(null==t)return-1;var r=null!=n;if(C&&t.lastIndexOf===C)return r?t.lastIndexOf(e,n):t.lastIndexOf(e);for(var i=r?n:t.length;i--;)if(t[i]===e)return i;return-1},O.range=function(t,e,n){arguments.length<=1&&(e=t||0,t=0),n=arguments[2]||1;for(var r=Math.max(Math.ceil((e-t)/n),0),i=0,u=new Array(r);i<r;)u[i++]=t,t+=n;return u};var R=function(){};O.bind=function(t,e){var n,r;if(A&&t.bind===A)return A.apply(t,c.call(arguments,1));if(!O.isFunction(t))throw new TypeError;return n=c.call(arguments,2),r=function(){if(!(this instanceof r))return t.apply(e,n.concat(c.call(arguments)));R.prototype=t.prototype;var i=new R;R.prototype=null;var u=t.apply(i,n.concat(c.call(arguments)));return Object(u)===u?u:i}},O.partial=function(t){var e=c.call(arguments,1);return function(){return t.apply(this,e.concat(c.call(arguments)))}},O.bindAll=function(t){var e=c.call(arguments,1);if(0===e.length)throw new Error("bindAll must be passed function names");return N(e,function(e){t[e]=O.bind(t[e],t)}),t},O.memoize=function(t,e){var n={};return e||(e=O.identity),function(){var r=e.apply(this,arguments);return O.has(n,r)?n[r]:n[r]=t.apply(this,arguments)}},O.delay=function(t,e){var n=c.call(arguments,2);return setTimeout(function(){return t.apply(null,n)},e)},O.defer=function(t){return O.delay.apply(O,[t,1].concat(c.call(arguments,1)))},O.throttle=function(t,e,n){var r,i,u,o=null,a=0;n||(n={});var s=function(){a=!1===n.leading?0:new Date,o=null,u=t.apply(r,i)};return function(){var c=new Date;a||!1!==n.leading||(a=c);var l=e-(c-a);return r=this,i=arguments,l<=0?(clearTimeout(o),o=null,a=c,u=t.apply(r,i)):o||!1===n.trailing||(o=setTimeout(s,l)),u}},O.debounce=function(t,e,n){var r,i,u,o,a;return function(){u=this,i=arguments,o=new Date;var s=function(){var c=new Date-o;c<e?r=setTimeout(s,e-c):(r=null,n||(a=t.apply(u,i)))},c=n&&!r;return r||(r=setTimeout(s,e)),c&&(a=t.apply(u,i)),a}},O.once=function(t){var e,n=!1;return function(){return n?e:(n=!0,e=t.apply(this,arguments),t=null,e)}},O.wrap=function(t,e){return function(){var n=[t];return s.apply(n,arguments),e.apply(this,n)}},O.compose=function(){var t=arguments;return function(){for(var e=arguments,n=t.length-1;n>=0;n--)e=[t[n].apply(this,e)];return e[0]}},O.after=function(t,e){return function(){if(--t<1)return e.apply(this,arguments)}},O.keys=S||function(t){if(t!==Object(t))throw new TypeError("Invalid object");var e=[];for(var n in t)O.has(t,n)&&e.push(n);return e},O.values=function(t){for(var e=O.keys(t),n=e.length,r=new Array(n),i=0;i<n;i++)r[i]=t[e[i]];return r},O.pairs=function(t){for(var e=O.keys(t),n=e.length,r=new Array(n),i=0;i<n;i++)r[i]=[e[i],t[e[i]]];return r},O.invert=function(t){for(var e={},n=O.keys(t),r=0,i=n.length;r<i;r++)e[t[n[r]]]=n[r];return e},O.functions=O.methods=function(t){var e=[];for(var n in t)O.isFunction(t[n])&&e.push(n);return e.sort()},O.extend=function(t){return N(c.call(arguments,1),function(e){if(e)for(var n in e)t[n]=e[n]}),t},O.pick=function(t){var e={},n=l.apply(u,c.call(arguments,1));return N(n,function(n){n in t&&(e[n]=t[n])}),e},O.omit=function(t){var e={},n=l.apply(u,c.call(arguments,1));for(var r in t)O.contains(n,r)||(e[r]=t[r]);return e},O.defaults=function(t){return N(c.call(arguments,1),function(e){if(e)for(var n in e)void 0===t[n]&&(t[n]=e[n])}),t},O.clone=function(t){return O.isObject(t)?O.isArray(t)?t.slice():O.extend({},t):t},O.tap=function(t,e){return e(t),t};var k=function(t,e,n,r){if(t===e)return 0!==t||1/t==1/e;if(null==t||null==e)return t===e;t instanceof O&&(t=t._wrapped),e instanceof O&&(e=e._wrapped);var i=f.call(t);if(i!=f.call(e))return!1;switch(i){case"[object String]":return t==String(e);case"[object Number]":return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case"[object Date]":case"[object Boolean]":return+t==+e;case"[object RegExp]":return t.source==e.source&&t.global==e.global&&t.multiline==e.multiline&&t.ignoreCase==e.ignoreCase}if("object"!=typeof t||"object"!=typeof e)return!1;for(var u=n.length;u--;)if(n[u]==t)return r[u]==e;var o=t.constructor,a=e.constructor;if(o!==a&&!(O.isFunction(o)&&o instanceof o&&O.isFunction(a)&&a instanceof a))return!1;n.push(t),r.push(e);var s=0,c=!0;if("[object Array]"==i){if(s=t.length,c=s==e.length)for(;s--&&(c=k(t[s],e[s],n,r)););}else{for(var l in t)if(O.has(t,l)&&(s++,!(c=O.has(e,l)&&k(t[l],e[l],n,r))))break;if(c){for(l in e)if(O.has(e,l)&&!s--)break;c=!s}}return n.pop(),r.pop(),c};O.isEqual=function(t,e){return k(t,e,[],[])},O.isEmpty=function(t){if(null==t)return!0;if(O.isArray(t)||O.isString(t))return 0===t.length;for(var e in t)if(O.has(t,e))return!1;return!0},O.isElement=function(t){return!(!t||1!==t.nodeType)},O.isArray=w||function(t){return"[object Array]"==f.call(t)},O.isObject=function(t){return t===Object(t)},N(["Arguments","Function","String","Number","Date","RegExp"],function(t){O["is"+t]=function(e){return f.call(e)=="[object "+t+"]"}}),O.isArguments(arguments)||(O.isArguments=function(t){return!(!t||!O.has(t,"callee"))}),O.isFunction=function(t){return"function"==typeof t},O.isFinite=function(t){return isFinite(t)&&!isNaN(parseFloat(t))},O.isNaN=function(t){return O.isNumber(t)&&t!=+t},O.isBoolean=function(t){return!0===t||!1===t||"[object Boolean]"==f.call(t)},O.isNull=function(t){return null===t},O.isUndefined=function(t){return void 0===t},O.has=function(t,e){return d.call(t,e)},O.noConflict=function(){return n._=r,this},O.identity=function(t){return t},O.times=function(t,e,n){for(var r=Array(Math.max(0,t)),i=0;i<t;i++)r[i]=e.call(n,i);return r},O.random=function(t,e){return null==e&&(e=t,t=0),t+Math.floor(Math.random()*(e-t+1))};var P={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};P.unescape=O.invert(P.escape);var D={escape:new RegExp("["+O.keys(P.escape).join("")+"]","g"),unescape:new RegExp("("+O.keys(P.unescape).join("|")+")","g")};O.each(["escape","unescape"],function(t){O[t]=function(e){return null==e?"":(""+e).replace(D[t],function(e){return P[t][e]})}}),O.result=function(t,e){if(null!=t){var n=t[e];return O.isFunction(n)?n.call(t):n}},O.mixin=function(t){N(O.functions(t),function(e){var n=O[e]=t[e];O.prototype[e]=function(){var t=[this._wrapped];return s.apply(t,arguments),G.call(this,n.apply(O,t))}})};var M=0;O.uniqueId=function(t){var e=++M+"";return t?t+e:e},O.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var L=/(.)^/,U={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},F=/\\|'|\r|\n|\t|\u2028|\u2029/g;O.template=function(t,e,n){var r;n=O.defaults({},n,O.templateSettings);var i=new RegExp([(n.escape||L).source,(n.interpolate||L).source,(n.evaluate||L).source].join("|")+"|$","g"),u=0,o="__p+='";t.replace(i,function(e,n,r,i,a){return o+=t.slice(u,a).replace(F,function(t){return"\\"+U[t]}),n&&(o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),r&&(o+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),i&&(o+="';\n"+i+"\n__p+='"),u=a+e.length,e}),o+="';\n",n.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{r=new Function(n.variable||"obj","_",o)}catch(t){throw t.source=o,t}if(e)return r(e,O);var a=function(t){return r.call(this,t,O)};return a.source="function("+(n.variable||"obj")+"){\n"+o+"}",a},O.chain=function(t){return O(t).chain()};var G=function(t){return this._chain?O(t).chain():t};O.mixin(O),N(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=u[t];O.prototype[t]=function(){var n=this._wrapped;return e.apply(n,arguments),"shift"!=t&&"splice"!=t||0!==n.length||delete n[0],G.call(this,n)}}),N(["concat","join","slice"],function(t){var e=u[t];O.prototype[t]=function(){return G.call(this,e.apply(this._wrapped,arguments))}}),O.extend(O.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this)},function(t,e,n){var r=n(26)("wks"),i=n(28),u=n(3).Symbol,o="function"==typeof u;(t.exports=function(t){return r[t]||(r[t]=o&&u[t]||(o?u:i)("Symbol."+t))}).store=r},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u,o,a,s,c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l=n(0),f=r(l),d=n(5),h=n(6),_=n(35),p=r(_),v=n(49),m=r(v),g=n(50),y=r(g),b=n(17),C=r(b),w=n(36),S=r(w),A=n(52),O=r(A),N=n(8),E=r(N),j=n(9),x=r(j),T=n(53),I=r(T),R=n(10),k=r(R),P=n(1),D=r(P);o=[],s=o.slice,u={},e.default=i=function(t,e){var n;if(D.default.isString(t))return i._create.apply(this,arguments);if(n=t||{},e||(e={}),this.cid=D.default.uniqueId("c"),this.changed={},this._silent={},this._pending={},this._serverData={},this._hashedJSON={},this._escapedAttributes={},this._hasData=!0,this._previousAttributes=D.default.clone(this.attributes),this._atomicChangesQueue=[{}],this.attributes={},e.collection&&(this.collection=e.collection),e.parse&&(n=this.parse(n,e)||{}),n=D.default.defaults({},n,D.default.result(this,"defaults")),!this.set(n,{silent:!0}))throw new x.default("Can't create Nimbu.Object: invalid data");return this.initialize.apply(this,arguments)},D.default.extend(i.prototype,O.default,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(){var t;return t=this._toFullJSON(),(0,d._arrayEach)(["__type","__className"],function(e){return delete t[e]}),t},_toFullJSON:function(t){var e;return e=D.default.clone(this.attributes),(0,d._objectEach)(e,function(n,r){return e[r]=(0,h._encode)(n,t)}),(0,d._objectEach)(this._operations,function(t,n){return e[n]=t}),D.default.has(this,"id")&&(e.id=this.id),D.default.has(this,"created_at")&&(D.default.isDate(this.created_at)?e.created_at=this.created_at.toJSON():e.created_at=this.created_at),D.default.has(this,"updated_at")&&(D.default.isDate(this.updated_at)?e.updated_at=this.updated_at.toJSON():e.updated_at=this.updated_at),e.__type="Object",e.className=this.className,e},_refreshCache:function(){var t;if(t=this,!t._refreshingCache)return t._refreshingCache=!0,(0,d._objectEach)(this.attributes,function(e,n){return e instanceof i?e._refreshCache():D.default.isObject(e)&&t._resetCacheForKey(n)?t.set(n,new C.default.Set(e),{silent:!0}):void 0}),delete t._refreshingCache},get:function(t,e){var n;return e=e||u,n=this.attributes[t],n instanceof p.default&&!e.options?n=n.value:n instanceof m.default&&!e.options&&(n=n.values()),null!=n&&null!=n._ensureParentAndKey&&e.options&&n._ensureParentAndKey(this,t),n},escape:function(t){return D.default.escape(this.get(t))},has:function(t){return null!=this.get(t)},_mergeSystemFields:function(t){var e,n;return e=this,n=["id","short_id","created_at","updated_at"],(0,d._arrayEach)(n,function(n){if(t[n])return"id"===n?e.id=t[n]:"created_at"!==n&&"updated_at"!==n||D.default.isDate(t[n])?e[n]=t[n]:e[n]=(0,d._parseDate)(t[n]),delete t[n]})},set:function(t,e,n){var r,u,o;return r=void 0,void 0,D.default.isObject(t)||(0,d._isNullOrUndefined)(t)?(r=t,(0,d._objectEach)(r,function(t,e){return r[e]=(0,h._decode)(e,t)}),n=e):(r={},r[t]=(0,h._decode)(t,e)),n=n||{},r?(r instanceof i&&(r=r.attributes),n.unset&&(0,d._objectEach)(r,function(t,e){return r[e]=new C.default.Unset}),o=this,!!this._validate(r,n)&&(this._mergeSystemFields(r),n.changes={},u=this._escapedAttributes,this._previousAttributes||{},(0,d._arrayEach)(D.default.keys(r),function(t){var e,i,a;return a=r[t],(a instanceof y.default||a instanceof S.default||a instanceof m.default)&&(a.parent=o),a instanceof C.default||(a=new C.default.Set(a)),i=!0,a instanceof C.default.Set&&D.default.isEqual(o.attributes[t],a.value)&&(i=!1),i&&(delete u[t],n.silent?o._silent[t]=!0:n.changes[t]=!0),e=D.default.last(o._atomicChangesQueue),e[t]=a._mergeWithPrevious(e[t]),o._rebuildEstimatedDataForKey(t),i?(o.changed[t]=o.attributes[t],n.silent?void 0:o._pending[t]=!0):(delete o.changed[t],delete o._pending[t])}),n.silent||this.change(n),this)):this},unset:function(t,e){return e=e||{},e.unset=!0,this.set(t,null,e)},increment:function(t,e){return null==e&&(e=1),this.set(t,new C.default.Increment(e))},clear:function(t){var e,n;e={};for(n in this.attributes)e[n]=void 0;return this.set(e,D.default.extend({},t,{unset:!0}))},_toReference:function(){if(!this.id)throw new x.default("Can't serialize an unsaved Nimbu.Object");return{__type:"Reference",className:this.className,id:this.id}},relation:function(t){var e;if(e=this.get(t)){if(!(e instanceof y.default))throw"Called relation() on non-relation field "+t;return e._ensureParentAndKey(this,t),e}return new y.default(this,t)},gallery:function(t){var e;if(e=this.get(t)){if(!(e instanceof S.default))throw"Called gallery() on a non-gallery field "+t;return e._ensureParentAndKey(this,t),e}return new S.default(this,t)},file:function(t){var e;if(e=this.get(t)){if(!(e instanceof I.default))throw"Called file() on a non-file field"+t;return e._ensureParentAndKey(this,t),e}},hasChanged:function(t){return null==t?!D.default.isEmpty(this.changed):D.default.has(this.changed,t)},changedAttributes:function(t){var e,n,r,i;if(!t)return!!this.hasChanged()&&D.default.clone(this.changed);i=void 0,n=!1,r=this._changing?this._previousAttributes:this.attributes;for(e in t)D.default.isEqual(r[e],i=t[e])||((n||(n={}))[e]=i);return n},previous:function(t){return null!=t&&this._previousAttributes?this._previousAttributes[t]:null},previousAttributes:function(){return D.default.clone(this._previousAttributes)},fetch:function(t){var e,n;return n=this,t=t||{},e=(0,k.default)({method:"GET",route:"objects",className:this.className,id:this.id,useACL:t.useACL,forceChannel:t.forceChannel}),e.then(function(t,e,r){return n._finishFetch(n.parse(t,e,r),!0),n})._thenRunCallbacks(t,this)},save:function(t,e,n){var r,i,u,o,a,s,l,f;return i=void 0,a=void 0,void 0,this.attributes,null==t||"object"===(void 0===t?"undefined":c(t))?(i=t,n=e):(i={})[t]=e,!(n=D.default.extend({validate:!0},n))&&i&&(o=D.default.reject(i,function(t,e){return D.default.include(["success","error","wait"],e)}),0===o.length&&(r=!0,D.default.has(i,"success")&&!D.default.isFunction(i.success)&&(r=!1),D.default.has(i,"error")&&!D.default.isFunction(i.error)&&(r=!1),r))?this.save(null,i):(n=D.default.clone(n)||{},n.wait&&(u=D.default.clone(this.attributes)),f=D.default.clone(n)||{},f.wait&&(f.silent=!0),l=void 0,f.error=function(t,e){return l=e},i&&!this.set(i,f)?E.default.error(l)._thenRunCallbacks(n,this):(s=this,s._refreshCache(),[],this._startSave(),this._saving=(this._saving||0)+1,this._allPreviousSaves=this._allPreviousSaves||E.default.as(),this._allPreviousSaves=this._allPreviousSaves._continueWith(function(){var t,e,r,o;return a=s.id?"PUT":"POST",e=s._getSaveJSON(),o="objects",t=s.className,"_Customer"!==s.className||s.id||(o="customers",t=null),r=(0,k.default)({route:o,className:t,id:s.id,method:a,data:e,useACL:n.useACL,forceChannel:n.forceChannel}),r=r.then(function(t,e,r){var o;return o=s.parse(t,e,r),n.wait&&(o=D.default.extend(i||{},o)),s._finishSave(o),n.wait&&s.set(u,f),s},function(t){return s._cancelSave(),E.default.error(t)})._thenRunCallbacks(n,s)}),this._allPreviousSaves))},destroy:function(t){var e,n,r;return t=t||{},e=this,r=function(){return e.trigger("destroy",e,e.collection,t)},this.id?(t.wait||r(),n=(0,k.default)({route:"objects",className:this.className,id:this.id,method:"DELETE",useACL:t.useACL,forceChannel:t.forceChannel}),n.then(function(){return t.wait&&r(),e})._thenRunCallbacks(t,this)):r()},url:function(){var t;return t=D.default.result(this,"urlRoot")||D.default.result(this.collection,"url")||urlError(),this.isNew()?t:t.replace(/([^\/])$/,"$1/")+encodeURIComponent(this.id)},parse:function(t,e,n){var r;return r=D.default.clone(t),(0,D.default)(["created_at","updated_at"]).each(function(t){if(r[t])return r[t]=(0,d._parseDate)(r[t])}),r.updated_at||(r.updated_at=r.created_at),e&&(this._existed=201!==e),r},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},getACL:function(){return this.get("_acl")},setACL:function(t,e){return this.set("_acl",t,e)},change:function(t){var e,n,r,i;if(t=t||{},n=this._changing,this._changing=!0,i=this,(0,d._objectEach)(this._silent,function(t){return i._pending[t]=!0}),e=D.default.extend({},t.changes,this._silent),this._silent={},(0,d._objectEach)(e,function(e,n){return i.trigger("change:"+n,i,i.get(n),t)}),n)return this;for(r=function(t,e){if(!i._pending[e]&&!i._silent[e])return delete i.changed[e]};!D.default.isEmpty(this._pending);)this._pending={},this.trigger("change",this,t),(0,d._objectEach)(this.changed,r),i._previousAttributes=D.default.clone(this.attributes);return this._changing=!1,this},isValid:function(t){return this._validate({},D.default.extend(t||{},{validate:!0}))},validate:function(t,e){var n;return!D.default.has(t,"_acl")||t._acl instanceof f.default.ACL?(n=!0,(0,d._objectEach)(t,function(t,e){if(!/^[A-Za-z][0-9A-Za-z_]*$/.test(e))return n=!1}),!n&&new x.default(x.default.INVALID_KEY_NAME)):new x.default(x.default.OTHER_CAUSE,"ACL must be a Nimbu.ACL.")},_getSaveJSON:function(){var t;return t=D.default.clone(D.default.first(this._atomicChangesQueue)),(0,d._objectEach)(t,function(e,n){return t[n]=e.toJSON()}),t},_validate:function(t,e){var n;return!e.validate||!this.validate||(t=D.default.extend({},this.attributes,t),!(n=this.validationError=this.validate(t,e)||null)||(this.trigger("invalid",this,n,D.default.extend(e,{validationError:n})),!1))},_startSave:function(){return this._atomicChangesQueue.push({})},_cancelSave:function(){var t,e;return this,t=D.default.first(this._atomicChangesQueue),this._atomicChangesQueue=D.default.rest(this._atomicChangesQueue),e=D.default.first(this._atomicChangesQueue),(0,d._objectEach)(t,function(n,r){var i,u;return i=t[r],u=e[r],i&&u?e[r]=u._mergeWithPrevious(i):i?e[r]=i:void 0}),this._saving=this._saving-1},_finishSave:function(t){var e,n,r;return e={},(0,h._traverse)(this.attributes,function(t){if(t instanceof i&&t.id&&t._hasData)return e[t.id]=t}),n=D.default.first(this._atomicChangesQueue),this._atomicChangesQueue=D.default.rest(this._atomicChangesQueue),this._applyOpSet(n,this._serverData),this._mergeSystemFields(t),r=this,(0,d._objectEach)(t,function(t,n){var u,o;if(o=(0,h._decode)(n,t),(o instanceof y.default||o instanceof S.default)&&(o.parent=r),r._serverData[n]=o,u=(0,h._traverse)(r._serverData[n],function(t){if(t instanceof i&&e[t.id])return e[t.id]}))return r._serverData[n]=u}),this._rebuildAllEstimatedData(),this._saving=this._saving-1},_finishFetch:function(t,e){var n,r;return this._atomicChangesQueue=[{}],this._mergeSystemFields(t),n=this,r={},(0,d._objectEach)(t,function(t,e){var i;return i=(0,h._decode)(e,t),(i instanceof y.default||i instanceof S.default)&&(i.parent=n),r[e]=i}),n._serverData=r,this._rebuildAllEstimatedData(),this._refreshCache(),this._atomicChangesQueue=[{}],this._hasData=e},_applyOpSet:function(t,e){var n;return n=this,(0,d._objectEach)(t,function(t,r){if(e[r]=t._estimate(e[r],n,r),e[r]===C.default._UNSET)return delete e[r]})},_resetCacheForKey:function(t){var e,n;return n=this.attributes[t],!(!D.default.isObject(n)||n instanceof i||(n=n.toJSON?n.toJSON():n,e=JSON.stringify(n),this._hashedJSON[t]===e))&&(this._hashedJSON[t]=e,!0)},_rebuildEstimatedDataForKey:function(t){var e;e=this,delete this.attributes[t],this._serverData[t]&&(this.attributes[t]=this._serverData[t]),(0,d._arrayEach)(this._atomicChangesQueue,function(n){var r;if(r=n[t])return e.attributes[t]=r._estimate(e.attributes[t],e,t),e.attributes[t]===C.default._UNSET?delete e.attributes[t]:e._resetCacheForKey(t)})},_rebuildAllEstimatedData:function(){var t,e;return e=this,t=D.default.clone(this.attributes),this.attributes=D.default.clone(this._serverData),(0,d._arrayEach)(this._atomicChangesQueue,function(t){return e._applyOpSet(t,e.attributes),(0,d._objectEach)(t,function(t,n){return e._resetCacheForKey(n)})}),(0,d._objectEach)(t,function(t,n){if(e.attributes[n]!==t)return e.trigger("change:"+n,e,e.attributes[n],{})}),(0,d._objectEach)(this.attributes,function(n,r){if(!D.default.has(t,r))return e.trigger("change:"+r,e,n,{})})}}),a=["keys","values","pairs","invert","pick","omit"],D.default.each(a,function(t){return i.prototype[t]=function(){var e;return e=s.call(arguments),e.unshift(this.attributes),D.default[t].apply(D.default,e)}}),i._getSubclass=function(t){var e;if(!D.default.isString(t))throw"Nimbu.Object._getSubclass requires a string argument.";return e=i._classMap[t],e||(e=i.extend(t),i._classMap[t]=e),e},i._create=function(t,e,n){return new(i._getSubclass(t))(e,n)},i._classMap={},i._extend=d._extend,i.config=function(t){var e;return this,t=t||{},e=(0,k.default)({method:"GET",route:"objects",className:this.prototype.className,id:"customizations",forceChannel:t.forceChannel}),e.then(function(t,e,n){return t})._thenRunCallbacks(t,null)},i.extend=function(t,e,n){var r,u;if(!D.default.isString(t)){if(t&&D.default.has(t,"className"))return i.extend(t.className,t,e);throw new x.default("Nimbu.Object.extend's first argument should be the className.")}return e=e||{},e.className=t,r=null,D.default.has(i._classMap,t)?(u=i._classMap[t],r=u._extend(e,n)):r=this._extend(e,n),r.extend=function(e){var n;return D.default.isString(e)||e&&D.default.has(e,"className")?i.extend.apply(r,arguments):(n=[t].concat(D.default.toArray(arguments)),i.extend.apply(r,n))},i._classMap[t]=r,r},i.setDefaultGetOptions=function(t){return u=t},f.default.Object=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e._toQueryString=e._parseDate=e._getValue=e._toUnderscore=e._toCamel=e._trim=e._isNullOrUndefined=e._each=e._objectEach=e._arrayEach=e._extend=void 0;var r,i,u=n(1),o=function(t){return t&&t.__esModule?t:{default:t}}(u);r=function(){},i=function(t,e,n){var i;return i=void 0,i=e&&e.hasOwnProperty("constructor")?e.constructor:function(){return t.apply(this,arguments)},o.default.extend(i,t),r.prototype=t.prototype,i.prototype=new r,e&&o.default.extend(i.prototype,e),n&&o.default.extend(i,n),i.prototype.constructor=i,i.__super__=t.prototype,i};var a=(e._extend=function(t,e){var n;return n=i(this,t,e),n.extend=this.extend,n},e._arrayEach=o.default.each,e._objectEach=function(t,e){return o.default.isObject(t)?o.default.each(o.default.keys(t),function(n){return e(t[n],n)}):o.default.each(t,e)});e._each=a,e._isNullOrUndefined=function(t){return o.default.isNull(t)||o.default.isUndefined(t)},e._trim=function(t){return t.replace(/^\s+|\s+$/g,"")},e._toCamel=function(t){return t.replace(/(\_[a-z])/g,function(t){return t.toUpperCase().replace("_","")})},e._toUnderscore=function(t){return t.replace(/([A-Z])/g,function(t){return"_"+t.toLowerCase()})},e._getValue=function(t,e){return t&&t[e]?o.default.isFunction(t[e])?t[e]():t[e]:null},e._parseDate=function(t){var e,n,r,i,u,o,a,s,c;return a=new RegExp("^([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2})T([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})(.([0-9]+))?Z$"),(r=a.exec(t))?(c=r[1]||0,o=(r[2]||1)-1,e=r[3]||0,n=r[4]||0,u=r[5]||0,s=r[6]||0,i=r[8]||0,new Date(Date.UTC(c,o,e,n,u,s,i))):null},e._toQueryString=function(t){var e,n;n=[];for(e in t)t.hasOwnProperty(e)&&n.push(encodeURIComponent(e)+"="+encodeURIComponent(t[e]));return n.join("&")}},function(t,e,n){"use strict";(function(t){function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e._traverse=e._decode=e._encode=e._getInstallationId=e._getStoragePath=e.useSSO=e.useACL=e.initialize=e._useACL=e.accessToken=e._isNode=e.endpoint=e.isIE=void 0;var i,u,o,a,s=n(5),c=n(0),l=r(c),f=n(1),d=r(f),h=n(24),_=r(h),p=(e.isIE=function(){var t;return"undefined"!=typeof navigator&&null!==navigator&&null!=navigator.userAgent&&(t=navigator.userAgent.toLowerCase(),-1!==t.indexOf("msie")&&parseInt(t.split("msie")[1]))},e.endpoint="https://api.nimbu.io"),v=(e._isNode=!(void 0===t||null===t||!t.versions||!t.versions.node),e.accessToken=void 0),m=e._useACL=!1;a=!1,o=null;e.initialize=function(t,n,r){return e.accessToken=v=t,e._useACL=m=!1,a=!1,null!=n&&(e.endpoint=p=n),null!=r&&(o=r),u().then(function(){return l.default.Customer._initCurrent()})},e.useACL=function(){return e._useACL=m=!0};i="sso";var g=(e.useSSO=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return a=t},e._getStoragePath=function(t){var e;if(!v)throw"You need to call Nimbu.initialize before using the SDK.";if(t||(t=""),!d.default.isString(t))throw"Tried to get a storage path that wasn't a String.";return"/"===t[0]&&(t=t.substring(1)),e=v,a&&(e=i),"nimbu/"+e+"/"+t});e._getInstallationId=function(){if(o)return o;throw"You need to call Nimbu.initialize before using the SDK."};u=function(){var t,e;return null!=o&&""!==o?l.default.Future.as(o):(e=g("installationId"),t=new l.default.Future,_.default.getItem(e).then(function(n){var r;return o=n,o&&""!==o?t.resolve(o):(r=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)},o=r()+r()+"-"+r()+"-"+r()+"-"+r()+"-"+r()+r()+r(),_.default.setItem(e,o).then(t.resolve(o)))}),t)};e._encode=function t(e,n,r){var i;if(e instanceof l.default.Object){if(r)throw"Nimbu.Objects not allowed here";if(!n||d.default.include(n,e)||!e._hasData)return e._toReference();if(!e.dirty())return n=n.concat(e),t(e._toFullJSON(n),n,r);throw"Tried to save an object with a pointer to a new, unsaved object."}return e instanceof l.default.ACL?e.toJSON():d.default.isDate(e)?e.toJSON():d.default.isArray(e)?d.default.map(e,function(e){return t(e,n,r)}):d.default.isRegExp(e)?e.source:e instanceof l.default.Relation?e.toJSON():e instanceof l.default.File?e.toJSON():e instanceof l.default.Gallery?e.toJSON():e instanceof l.default.GalleryImage?e.toJSON():e instanceof l.default.SelectOption?e.toJSON():e instanceof l.default.SelectOptionList?e.toJSON():d.default.isObject(e)?(i={},(0,s._objectEach)(e,function(e,u){return i[u]=t(e,n,r)}),i):e},e._decode=function t(e,n){var r,i,u,o,a,c,f;return d.default.isString(n)&&null!=(i=(0,s._parseDate)(n))?i:d.default.isObject(n)?d.default.isArray(n)?((0,s._arrayEach)(n,function(e,r){return n[r]=t(r,e)}),n):n instanceof l.default.Object?n:n instanceof l.default.Atomic?n:"_acl"===e?n instanceof l.default.ACL?n:new l.default.ACL(n):"File"===n.__type?new l.default.File(n.filename,n):"Select"===n.__type?new l.default.SelectOption(n.id,n.value):"MultiSelect"===n.__type?l.default.SelectOptionList._decode(null,e,n):"Reference"===n.__type?(a=l.default.Object._create(n.className),a._finishFetch({id:n.id},!1),a):"Object"===n.__type?(r=n.className,delete n.__type,delete n.className,o=l.default.Object._create(r),o._finishFetch(n,!0),o):"Relation"===n.__type?(f=d.default.map(n.objects,function(e,n){return t(n,e)}),c=new l.default.Relation(null,e,f),c.targetClassName=n.className,c):"Gallery"===n.__type?(u=d.default.map(n.images,function(e){return t("image",e)}),new l.default.Gallery(null,e,u)):"GalleryImage"===n.__type?(n.file=t("file",n.file),new l.default.GalleryImage(n)):((0,s._objectEach)(n,function(e,r){return n[r]=t(r,e)}),n):n},e._traverse=function t(e,n,r){if(e instanceof l.default.Object){if(r=r||[],d.default.indexOf(r,e)>=0)return;return r.push(e),t(e.attributes,n,r),n(e)}return e instanceof l.default.GalleryImage?n(e):d.default.isArray(e)?(d.default.each(e,function(i,u){var o;if(o=t(i,n,r))return e[u]=o}),n(e)):d.default.isObject(e)?((0,s._each)(e,function(i,u){var o;if(o=t(i,n,r))return e[u]=o}),n(e)):n(e)}}).call(e,n(37))},function(t,e,n){var r=n(14);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e,n){"use strict";(function(t){function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(5),s=n(1),c=r(s);e.default=i=function(){return this._resolved=!1,this._rejected=!1,this._resolvedCallbacks=[],this._rejectedCallbacks=[],!0},c.default.extend(i,{is:function(t){return t&&t.then&&c.default.isFunction(t.then)},as:function(){var t;return t=new i,t.resolve.apply(t,arguments),t},error:function(){var t;return t=new i,t.reject.apply(t,arguments),t},when:function(t){var e,n,r,u,o,s,c;return u=void 0,u=t&&(0,a._isNullOrUndefined)(t.length)?arguments:t,c=u.length,r=!1,s=[],e=[],s.length=u.length,e.length=u.length,0===c?i.as.apply(this,[s]):(n=new i,o=function(){if(0===(c-=1))return r?n.reject(e):n.resolve.apply(n,[s])},(0,a._arrayEach)(u,function(t,n){return i.is(t)?t.then(function(t){return s[n]=t,o()},function(t){return e[n]=t,r=!0,o()}):(s[n]=t,o())}),n)},_continueWhile:function(t,e){return t()?e().then(function(){return i._continueWhile(t,e)}):i.as()}}),c.default.extend(i.prototype,{resolve:function(t){var e;if(this._resolved||this._rejected)throw"A future was resolved even though it had already been "+(this._resolved?"resolved":"rejected")+".";return this._resolved=!0,this._result=arguments,e=arguments,(0,a._arrayEach)(this._resolvedCallbacks,function(t){return t.apply(this,e)}),this._resolvedCallbacks=[],this._rejectedCallbacks=[]},reject:function(t){if(this._resolved||this._rejected)throw"A future was rejected even though it had already been "+(this._resolved?"resolved":"rejected")+".";return this._rejected=!0,this._error=t,(0,a._arrayEach)(this._rejectedCallbacks,function(e){return e(t)}),this._resolvedCallbacks=[],this._rejectedCallbacks=[]},then:function(t,e){var n,r,u;return n=new i,u=function(){var e;return e=arguments,t&&(e=[t.apply(this,e)]),1===e.length&&i.is(e[0])?e[0].then(function(){return n.resolve.apply(n,arguments)},function(t){return n.reject(t)}):n.resolve.apply(n,e)},r=function(t){var r;return r=[],e?(r=[e(t)],1===r.length&&i.is(r[0])?r[0].then(function(){return n.resolve.apply(n,arguments)},function(t){return n.reject(t)}):n.reject(r[0])):n.reject(t)},this._resolved?u.apply(this,this._result):this._rejected?r(this._error):(this._resolvedCallbacks.push(u),this._rejectedCallbacks.push(r)),n},always:function(t){return this.then(t,t)},done:function(t){return this.then(t)},fail:function(t){return this.then(null,t)},_thenRunCallbacks:function(t,e){var n,r;return r=void 0,c.default.isFunction(t)?(n=t,r={success:function(t){return n(t,null)},error:function(t){return n(null,t)}}):r=c.default.clone(t),r=r||{},this.then(function(t){return r.success?r.success.apply(this,arguments):e&&e.trigger("sync",e,t,r),i.as.apply(i,arguments)},function(t){return r.error?c.default.isUndefined(e)?r.error(t):r.error(e,t):e&&e.trigger("error",e,t,r),i.error(t)})},_continueWith:function(t){return this.then(function(){return t(arguments,null)},function(e){return t(null,e)})},asPromise:function(){var e=this;return new t(function(t,n){return e.then(t,n)})}}),o.default.Future=i}).call(e,n(38))},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(1),s=r(a);e.default=i=function(t,e){return this.code=t,this.message=e,!0},s.default.extend(i,{OTHER_CAUSE:-1,INTERNAL_SERVER_ERROR:1,CONNECTION_FAILED:100,OBJECT_NOT_FOUND:101,INVALID_QUERY:102,INVALID_CLASS_NAME:103,MISSING_OBJECT_ID:104,INVALID_KEY_NAME:105,INVALID_POINTER:106,INVALID_JSON:107,COMMAND_UNAVAILABLE:108,NOT_INITIALIZED:109,INCORRECT_TYPE:111,INVALID_CHANNEL_NAME:112,PUSH_MISCONFIGURED:115,OBJECT_TOO_LARGE:116,OPERATION_FORBIDDEN:119,CACHE_MISS:120,INVALID_NESTED_KEY:121,INVALID_FILE_NAME:122,INVALID_ACL:123,TIMEOUT:124,INVALID_EMAIL_ADDRESS:125,MISSING_CONTENT_TYPE:126,MISSING_CONTENT_LENGTH:127,INVALID_CONTENT_LENGTH:128,FILE_TOO_LARGE:129,FILE_SAVE_ERROR:130,FILE_DELETE_ERROR:153,DUPLICATE_VALUE:137,INVALID_ROLE_NAME:139,EXCEEDED_QUOTA:140,SCRIPT_FAILED:141,VALIDATION_ERROR:142,INVALID_IMAGE_DATA:150,UNSAVED_FILE_ERROR:151,INVALID_PUSH_TIME_ERROR:152,USERNAME_MISSING:200,PASSWORD_MISSING:201,USERNAME_TAKEN:202,EMAIL_TAKEN:203,EMAIL_MISSING:204,EMAIL_NOT_FOUND:205,SESSION_MISSING:206,MUST_CREATE_USER_THROUGH_SIGNUP:207,ACCOUNT_ALREADY_LINKED:208,LINKED_ID_MISSING:250,INVALID_LINKED_SESSION:251,UNSUPPORTED_SERVICE:252,AGGREGATE_ERROR:600}),o.default.Error=i},function(t,e,n){"use strict";(function(t){function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.enableChaos=e.setAjax=e._ajax=void 0;var i,u,o=n(0),a=r(o),s=n(23),c=r(s),l=n(6),f=n(9),d=r(f),h=n(8),_=r(h),p=n(1),v=r(p);u=!1,i=.95,e.default=function(t){var e,n,r,i,u,o,s,f,h,p,g,y,b,C,w;if(y=t.route,e=t.className,f=t.id,h=t.method,w=t.useACL,b=t.sessionToken,u=t.data,g=t.query,p=t.path,o=t.forceChannel,!l.accessToken)throw"You must specify your accessToken using Nimbu.initialize().";if(v.default.isUndefined(w)&&(w=l._useACL),b||(r=a.default.Customer.current())&&r.session_token&&(b=r.session_token),w&&null!=g?g+="&use_acl=1":w&&(g="use_acl=1"),!p){if("batch"!==y&&"objects"!==y&&"events"!==y&&"files"!==y&&"functions"!==y&&"login"!==y&&"push"!==y&&"customers"!==y&&"jobs"!==y)throw"Bad route: '"+y+"'.";"objects"===y&&(o?(y="channels","customizations"!==f&&(n="entries")):"customer"===e||"customers"===e?(y="customers",e=void 0):"product"===e||"products"===e?(y="products",e=void 0):"role"===e?(y="roles",e=void 0):"coupon"===e||"coupons"===e?(y="coupons",e=void 0):"order"===e||"orders"===e?(y="orders",e=void 0):"device"===e||"devices"===e?(y="devices",e=void 0):(y="channels","customizations"!==f&&(n="entries"))),"push"===y&&(y="devices",e="push"),p=y,e&&(p+="/"+e),n&&(p+="/"+n),f&&(p+="/"+f)}return C=l.endpoint,"/"!==C.charAt(C.length-1)&&(C+="/"),C+=p,g&&(C+="?"+g),u=v.default.clone(u||{}),s={},s._accessToken=l.accessToken,null!=b&&(s._sessionToken=b),s._clientVersion=c.default,s._installationId=(0,l._getInstallationId)(),i=JSON.stringify(u),m(h,C,i,s).then(null,function(t){var e,n;if(e=void 0,t&&t.responseText)try{n=JSON.parse(t.responseText),n&&(e=new d.default(n.code,n.message)),null!=n.errors&&(e.errors=n.errors)}catch(t){}return e=e||new d.default(-1,t.responseText),_.default.error(e)})};var m=e._ajax=function(e,n,r,o,s,f){var d,h,p,m,g;return v.default.isString(r)||(r=JSON.stringify(r)),m={success:s,error:f},u&&Math.random()>i?(d=a.default.Future.error("Chaos!"),d._thenRunCallbacks(m)):(h=new _.default,p=!1,g=new XMLHttpRequest,g.onreadystatechange=function(){var t,e;if(4===g.readyState){if(p)return;if(p=!0,!(g.status>=200&&g.status<300))return h.reject(g);e=void 0;try{e=204!==g.status?JSON.parse(g.responseText):""}catch(e){t=e,h.reject(t)}if(e||204===g.status)return h.resolve(e,g.status,g)}},g.open(e,n,!0),g.setRequestHeader("Content-Type","text/plain"),null!=o._accessToken&&g.setRequestHeader("X-Nimbu-Access-Token","token "+o._accessToken),null!=o._sessionToken&&g.setRequestHeader("X-Nimbu-Session-Token",o._sessionToken),null!=o._clientVersion&&g.setRequestHeader("X-Nimbu-Client-Version",o._clientVersion),null!=o._installationId&&g.setRequestHeader("X-Nimbu-Installation-Id",o._installationId),null!=o._csrfToken&&g.setRequestHeader("X-CSRF-Token",o._csrfToken),l._isNode&&g.setRequestHeader("User-Agent","Nimbu/"+c.default+" (NodeJS "+t.versions.node+")"),"GET"===e.toUpperCase()?g.send():g.send(r),h._thenRunCallbacks(m))};e.setAjax=function(t){return e._ajax=m=t},e.enableChaos=function(t){if(u=!0,null!=t)return i=1-t/100}}).call(e,n(37))},function(t,e){var n=t.exports={version:"2.6.5"};"number"==typeof __e&&(__e=n)},function(t,e,n){var r=n(19),i=n(40);t.exports=n(15)?function(t,e,n){return r.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(3),i=n(12),u=n(20),o=n(28)("src"),a=n(62),s=(""+a).split("toString");n(11).inspectSource=function(t){return a.call(t)},(t.exports=function(t,e,n,a){var c="function"==typeof n;c&&(u(n,"name")||i(n,"name",e)),t[e]!==n&&(c&&(u(n,o)||i(n,o,t[e]?""+t[e]:s.join(String(e)))),t===r?t[e]=n:a?t[e]?t[e]=n:i(t,e,n):(delete t[e],i(t,e,n)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[o]||a.call(this)})},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){t.exports=!n(39)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){t.exports={}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(6),s=n(5),c=n(4),l=r(c),f=n(36),d=r(f),h=n(51),_=r(h),p=n(1),v=r(p);e.default=i=function(){return this._initialize.apply(this,arguments),!0},i._extend=s._extend,i.prototype={_initialize:function(){}},v.default.extend(i,{_opDecoderMap:{},_registerDecoder:function(t,e){return i._opDecoderMap[t]=e},_decode:function(t){var e;return e=i._opDecoderMap[t.__op],e?e(t):void 0}}),i._registerDecoder("Batch",function(t){var e;return e=null,(0,s._arrayEach)(t.ops,function(t){return t=i._decode(t),e=t._mergeWithPrevious(e)}),e}),i.Set=i._extend({_initialize:function(t){return this._value=t},value:function(){return this._value},toJSON:function(){return(0,a._encode)(this.value())},_mergeWithPrevious:function(t){return this},_estimate:function(t){return this.value()}}),i._UNSET={},i.Unset=i._extend({toJSON:function(){return{__op:"Delete"}},_mergeWithPrevious:function(t){return this},_estimate:function(t){return i._UNSET}}),i._registerDecoder("Delete",function(t){return new i.Unset}),i.Increment=i._extend({_initialize:function(t){return this._amount=t},amount:function(){return this._amount},toJSON:function(){return{__op:"Increment",amount:this._amount}},_mergeWithPrevious:function(t){if(t){if(t instanceof i.Unset)return new i.Set(this.amount());if(t instanceof i.Set)return new i.Set(t.value()+this.amount());if(t instanceof i.Increment)return new i.Increment(this.amount()+t.amount());throw"Atomic is invalid after previous op."}return this},_estimate:function(t){return t?t+this.amount():this.amount()}}),i._registerDecoder("Increment",function(t){return new i.Increment(t.amount)}),i.Add=i._extend({_initialize:function(t){return this._objects=t},objects:function(){return this._objects},toJSON:function(){return{__op:"Add",objects:(0,a._encode)(this.objects())}},_mergeWithPrevious:function(t){if(t){if(t instanceof i.Unset)return new i.Set(this.objects());if(t instanceof i.Set)return new i.Set(this._estimate(t.value()));if(t instanceof i.Add)return new i.Add(t.objects().concat(this.objects()));throw"Atomic is invalid after previous op."}return this},_estimate:function(t){return t?t.concat(this.objects()):v.default.clone(this.objects())}}),i._registerDecoder("Add",function(t){return new i.Add((0,a._decode)(void 0,t.objects))}),i.AddUnique=i._extend({_initialize:function(t){return this._objects=v.default.uniq(t)},objects:function(){return this._objects},toJSON:function(){return{__op:"AddUnique",objects:(0,a._encode)(this.objects())}},_mergeWithPrevious:function(t){if(t){if(t instanceof i.Unset)return new i.Set(this.objects());if(t instanceof i.Set)return new i.Set(this._estimate(t.value()));if(t instanceof i.AddUnique)return new i.AddUnique(this._estimate(t.objects()));throw"Atomic is invalid after previous op."}return this},_estimate:function(t){var e;return t?(e=v.default.clone(t),(0,s._arrayEach)(this.objects(),function(t){var n,r;return t instanceof l.default&&t.id?(r=v.default.find(e,function(e){return e instanceof l.default&&e.id===t.id}),r?(n=v.default.indexOf(e,r),e[n]=t):e.push(t)):v.default.contains(e,t)?void 0:e.push(t)}),e):v.default.clone(this.objects())}}),i._registerDecoder("AddUnique",function(t){return new i.AddUnique((0,a._decode)(void 0,t.objects))}),i.Remove=i._extend({_initialize:function(t){return this._objects=v.default.uniq(t)},objects:function(){return this._objects},toJSON:function(){return{__op:"Remove",objects:(0,a._encode)(this.objects())}},_mergeWithPrevious:function(t){if(t){if(t instanceof i.Unset)return t;if(t instanceof i.Set)return new i.Set(this._estimate(t.value()));if(t instanceof i.Remove)return new i.Remove(v.default.union(t.objects(),this.objects()));throw"Atomic is invalid after previous op."}return this},_estimate:function(t){var e;return t?(e=v.default.difference(t,this.objects()),(0,s._arrayEach)(this.objects(),function(t){if(t instanceof l.default&&t.id)return e=v.default.reject(e,function(e){return e instanceof l.default&&e.id===t.id})}),e):[]}}),i._registerDecoder("Remove",function(t){return new i.Remove((0,a._decode)(void 0,t.objects))}),i.Relation=i._extend({_initialize:function(t,e){var n,r;return this._targetClassName=null,r=this,n=function(t){if(t instanceof l.default){if(!t.id)throw"You can't add an unsaved Nimbu.Object to a relation.";if(r._targetClassName||(r._targetClassName=t.className),r._targetClassName!==t.className)throw"Tried to create a Nimbu.Relation with 2 different types: "+r._targetClassName+" and "+t.className+".";return t.id}return t},this.referencesToAdd=v.default.uniq(v.default.map(t,n)),this.referencesToRemove=v.default.uniq(v.default.map(e,n))},added:function(){var t;return t=this,v.default.map(this.referencesToAdd,function(e){var n;return n=l.default._create(t._targetClassName),n.id=e,n})},removed:function(){var t;return t=this,v.default.map(this.referencesToRemove,function(e){var n;return n=l.default._create(t._targetClassName),n.id=e,n})},toJSON:function(){var t,e,n,r,i;return t=null,r=null,i=this,e=function(t){return{__type:"Reference",className:i._targetClassName,id:t}},n=null,this.referencesToAdd.length>0&&(n=v.default.map(this.referencesToAdd,e),t={__op:"AddReference",objects:n}),this.referencesToRemove.length>0&&(n=v.default.map(this.referencesToRemove,e),r={__op:"RemoveReference",objects:n}),t&&r?{__op:"Batch",changes:[t,r]}:t||r||{}},_mergeWithPrevious:function(t){var e,n,r;if(t){if(t instanceof i.Unset)throw"You can't modify a relation after deleting it.";if(t instanceof i.Relation){if(t._targetClassName&&t._targetClassName!==this._targetClassName)throw"Related object must be of class "+t._targetClassName+", but "+this._targetClassName+" was passed in.";return e=v.default.union(v.default.difference(t.referencesToAdd,this.referencesToRemove),this.referencesToAdd),r=v.default.union(v.default.difference(t.referencesToRemove,this.referencesToAdd),this.referencesToRemove),n=new i.Relation(e,r),n._targetClassName=this._targetClassName,n}throw"Atomic is invalid after previous op."}return this},_estimate:function(t,e,n){var r;if(t){if(t instanceof o.default.Relation){if(this._targetClassName)if(t.targetClassName){if(t.targetClassName!==this._targetClassName)throw"Related object must be a "+t.targetClassName+", but a "+this._targetClassName+" was passed in."}else t.targetClassName=this._targetClassName;return t}throw"Atomic is invalid after previous op."}return r=new o.default.Relation(e,n),r.targetClassName=this._targetClassName,r}}),i._registerDecoder("AddRelation",function(t){return new i.Relation((0,a._decode)(void 0,t.objects),[])}),i._registerDecoder("RemoveRelation",function(t){return new i.Relation([],(0,a._decode)(void 0,t.objects))}),i.Gallery=i._extend({_initialize:function(t,e,n){this._imagesToAdd=v.default.reject(t,function(t){return null!=(null!=t?t.id:void 0)}),this._idsToAdd=v.default.compact(v.default.map(t,function(t){return null!=t?t.id:void 0})),this._idsToRemove=v.default.compact(v.default.map(e,function(t){return null!=t?t.id:void 0})),this._imagesToRemove=v.default.reject(e,function(t){return null!=(null!=t?t.id:void 0)}),this._idsToUpdate=n},_additions:function(){return v.default.map(this._imagesToAdd,function(t){return t.toJSON()})},_removals:function(){return v.default.map(this._idsToRemove,function(t){return{__type:"GalleryImage",id:t,remove:!0}})},_updates:function(){return v.default.map(v.default.pairs(this._idsToUpdate),function(t){return v.default.extend({__type:"GalleryImage",id:t[0]},t[1])})},_images:function(){var t;return t=this._additions(),t=t.concat(this._removals()),t=t.concat(this._updates())},toJSON:function(){return{__type:"Gallery",images:this._images()}},_mergeWithPrevious:function(t){var e;return t?(this._imagesToAdd=v.default.union(v.default.difference(t._imagesToAdd,this._imagesToRemove),this._imagesToAdd),this._idsToRemove=v.default.union(v.default.difference(t._idsToRemove,this._idsToAdd),this._idsToRemove),e={},(0,s._objectEach)(this._idsToUpdate,function(n,r){return null!=t._idsToUpdate[r]?e[r]=v.default.extend(t._idsToUpdate[r],n):e[r]=n}),this._idsToUpdate=e,this._idsToAdd=[],this._imagesToRemove=[],this):this},_estimate:function(t,e,n){var r,i,u;if(t){if(t instanceof d.default)return u=this,i=v.default.map(t._images,function(t){var e;return e=t.attributes,null!=u._idsToUpdate&&null!=u._idsToUpdate[t.id]&&(e=v.default.extend({},e,u._idsToUpdate[t.id])),new _.default(e)}),r=v.default.union(i,this._imagesToAdd),r=v.default.reject(r,function(t){return v.default.contains(this._idsToRemove,t.id)}),new d.default(e,n,r);throw"Atomic is invalid after previous op"}return new d.default(e,n,[].concat(this._imagesToAdd))}}),i.RemoveFile=i._extend({toJSON:function(){return{__type:"File",remove:"1"}},_mergeWithPrevious:function(t){return this},_estimate:function(t){return i._UNSET}}),o.default.Atomic=i},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){var r=n(7),i=n(60),u=n(61),o=Object.defineProperty;e.f=n(15)?Object.defineProperty:function(t,e,n){if(r(t),e=u(e,!0),r(n),i)try{return o(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var r=n(22);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default="1.6.5"},function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0});var n,r,i,u;n=void 0;e.setEngine=function(t){return n=t};u=function(e,r){return null!=n?n.setItem(e,r):t.resolve(localStorage.setItem(e,r))},r=function(e){return null!=n?n.getItem(e):t.resolve(localStorage.getItem(e))},i=function(e){return null!=n?n.removeItem(e):t.resolve(localStorage.removeItem(e))},e.default={setItem:u,getItem:r,removeItem:i}}).call(e,n(38))},function(t,e,n){var r=n(18),i=n(2)("toStringTag"),u="Arguments"==r(function(){return arguments}()),o=function(t,e){try{return t[e]}catch(t){}};t.exports=function(t){var e,n,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=o(e=Object(t),i))?n:u?r(e):"Object"==(a=r(e))&&"function"==typeof e.callee?"Arguments":a}},function(t,e,n){var r=n(11),i=n(3),u=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(t.exports=function(t,e){return u[t]||(u[t]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:n(27)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(t,e){t.exports=!1},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e,n){var r=n(14),i=n(3).document,u=r(i)&&r(i.createElement);t.exports=function(t){return u?i.createElement(t):{}}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){var r=n(69),i=n(31);t.exports=function(t){return r(i(t))}},function(t,e,n){var r=n(26)("keys"),i=n(28);t.exports=function(t){return r[t]||(r[t]=i(t))}},function(t,e,n){var r=n(19).f,i=n(20),u=n(2)("toStringTag");t.exports=function(t,e,n){t&&!i(t=n?t:t.prototype,u)&&r(t,u,{configurable:!0,value:e})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,i=n(0),u=function(t){return t&&t.__esModule?t:{default:t}}(i);e.default=r=function(t,e){return this.id=t,this.value=e},r.prototype={toJSON:function(){return null!=this.id?this.id:this.value}},u.default.SelectOption=r},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u,o,a,s,c=n(0),l=r(c),f=n(6),d=n(17),h=r(d),_=n(5),p=n(1),v=r(p);u=function(t,e,n){var r,i;return!(!n||null!=t.gallery)||(null!=e?(null!=(r=t.gallery)?r.parent:void 0)===(null!=e?e.parent:void 0)&&(null!=(i=t.gallery)?i.key:void 0)===(null!=e?e.key:void 0):null==t.gallery)},a=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t instanceof l.default.GalleryImage&&u(t,e,n)},s=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!!v.default.isObject(t)&&(a(t,e,n)||v.default.isArray(t)&&v.default.all(t,function(t){return a(t,e,n)}))},e.default=i=function(t,e,n){var r;this.parent=t,this.key=e,null!=n?(this._images=n,r=this,v.default.each(this._images,function(t){return t._setGallery(r)})):this._images=[]},i.prototype={_ensureParentAndKey:function(t,e){if(this.parent=this.parent||t,this.key=this.key||e,this.parent!==t)throw"Internal Error. Gallery retrieved from two different Objects.";if(this.key!==e)throw"Internal Error. Gallery retrieved from two different keys."},list:function(){return this._images},add:function(t){var e;if(!s(t,this,!0))throw"You must supply a Nimbu.GalleryImage or array of Nimbu.GalleryImage that don't belong to a gallery yet.";v.default.isArray(t)||(t=[t]),e=new h.default.Gallery(t,[],[]),this.parent.set(this.key,e)},remove:function(t){var e;if(!s(t,this))throw"You must supply a Nimbu.GalleryImage or array of Nimbu.GalleryImage that belong to this gallery.";v.default.isArray(t)||(t=[t]),e=new h.default.Gallery([],t,[]),this.parent.set(this.key,e)},_updateImage:function(t,e){var n,r,i;if(!a(t,this))throw"You must supply a Nimbu.GalleryImage that belongs to this gallery.";r=v.default.indexOf(this._images,t),this._images[r]=new l.default.GalleryImage(t.attributes),i={},i[t.id]=e,n=new h.default.Gallery([],[],i),this.parent.set(this.key,n)},toJSON:function(){return{__type:"Gallery",images:v.default.map(this._images,function(t){return(0,f._encode)(t)})}}},o=["forEach","each","map","reduce","reduceRight","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","sortBy","sortedIndex","toArray","size","first","initial","rest","last","without","indexOf","shuffle","lastIndexOf","isEmpty","groupBy"],(0,_._arrayEach)(o,function(t){return i.prototype[t]=function(){return v.default[t].apply(v.default,[this._images].concat(v.default.toArray(arguments)))}}),l.default.Gallery=i},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(t){if(l===setTimeout)return setTimeout(t,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(t,0);try{return l(t,0)}catch(e){try{return l.call(null,t,0)}catch(e){return l.call(this,t,0)}}}function u(t){if(f===clearTimeout)return clearTimeout(t);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(t);try{return f(t)}catch(e){try{return f.call(null,t)}catch(e){return f.call(this,t)}}}function o(){p&&h&&(p=!1,h.length?_=h.concat(_):v=-1,_.length&&a())}function a(){if(!p){var t=i(o);p=!0;for(var e=_.length;e;){for(h=_,_=[];++v<e;)h&&h[v].run();v=-1,e=_.length}h=null,p=!1,u(t)}}function s(t,e){this.fun=t,this.array=e}function c(){}var l,f,d=t.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:n}catch(t){l=n}try{f="function"==typeof clearTimeout?clearTimeout:r}catch(t){f=r}}();var h,_=[],p=!1,v=-1;d.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];_.push(new s(t,e)),1!==_.length||p||i(a)},s.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.prependListener=c,d.prependOnceListener=c,d.listeners=function(t){return[]},d.binding=function(t){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(t){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},function(t,e,n){n(59),n(63),n(74),n(78),t.exports=n(11).Promise},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){"use strict";var r=n(27),i=n(42),u=n(13),o=n(12),a=n(16),s=n(65),c=n(34),l=n(72),f=n(2)("iterator"),d=!([].keys&&"next"in[].keys()),h=function(){return this};t.exports=function(t,e,n,_,p,v,m){s(n,e,_);var g,y,b,C=function(t){if(!d&&t in O)return O[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},w=e+" Iterator",S="values"==p,A=!1,O=t.prototype,N=O[f]||O["@@iterator"]||p&&O[p],E=N||C(p),j=p?S?C("entries"):E:void 0,x="Array"==e?O.entries||N:N;if(x&&(b=l(x.call(new t)))!==Object.prototype&&b.next&&(c(b,w,!0),r||"function"==typeof b[f]||o(b,f,h)),S&&N&&"values"!==N.name&&(A=!0,E=function(){return N.call(this)}),r&&!m||!d&&!A&&O[f]||o(O,f,E),a[e]=E,a[w]=h,p)if(g={values:S?E:C("values"),keys:v?E:C("keys"),entries:j},m)for(y in g)y in O||u(O,y,g[y]);else i(i.P+i.F*(d||A),e,g);return g}},function(t,e,n){var r=n(3),i=n(11),u=n(12),o=n(13),a=n(21),s=function(t,e,n){var c,l,f,d,h=t&s.F,_=t&s.G,p=t&s.S,v=t&s.P,m=t&s.B,g=_?r:p?r[e]||(r[e]={}):(r[e]||{}).prototype,y=_?i:i[e]||(i[e]={}),b=y.prototype||(y.prototype={});_&&(n=e);for(c in n)l=!h&&g&&void 0!==g[c],f=(l?g:n)[c],d=m&&l?a(f,r):v&&"function"==typeof f?a(Function.call,f):f,g&&o(g,c,f,t&s.U),y[c]!=f&&u(y,c,d),v&&b[c]!=f&&(b[c]=f)};r.core=i,s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,t.exports=s},function(t,e,n){var r=n(68),i=n(45);t.exports=Object.keys||function(t){return r(t,i)}},function(t,e,n){var r=n(30),i=Math.min;t.exports=function(t){return t>0?i(r(t),9007199254740991):0}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,n){var r=n(3).document;t.exports=r&&r.documentElement},function(t,e,n){var r,i,u,o=n(21),a=n(85),s=n(46),c=n(29),l=n(3),f=l.process,d=l.setImmediate,h=l.clearImmediate,_=l.MessageChannel,p=l.Dispatch,v=0,m={},g=function(){var t=+this;if(m.hasOwnProperty(t)){var e=m[t];delete m[t],e()}},y=function(t){g.call(t.data)};d&&h||(d=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return m[++v]=function(){a("function"==typeof t?t:Function(t),e)},r(v),v},h=function(t){delete m[t]},"process"==n(18)(f)?r=function(t){f.nextTick(o(g,t,1))}:p&&p.now?r=function(t){p.now(o(g,t,1))}:_?(i=new _,u=i.port2,i.port1.onmessage=y,r=o(u.postMessage,u,1)):l.addEventListener&&"function"==typeof postMessage&&!l.importScripts?(r=function(t){l.postMessage(t+"","*")},l.addEventListener("message",y,!1)):r="onreadystatechange"in c("script")?function(t){s.appendChild(c("script")).onreadystatechange=function(){s.removeChild(this),g.call(t)}}:function(t){setTimeout(o(g,t,1),0)}),t.exports={set:d,clear:h}},function(t,e,n){"use strict";function r(t){var e,n;this.promise=new t(function(t,r){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=r}),this.resolve=i(e),this.reject=i(n)}var i=n(22);t.exports.f=function(t){return new r(t)}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(1),s=r(a),c=n(35),l=r(c);e.default=i=function(t,e,n){this.parent=t,this.key=e,this._options=null!=n?n:[]},i._decode=function(t,e,n){var r;if("MultiSelect"!==n.__type)throw"Internal Error. Tried to decode a value that isn't a MultiSelect to SelectOptionList";return r=s.default.map(n.ids,function(t,e){return new l.default(t,n.values[e])}),new i(t,e,r)},i.prototype={_ensureParentAndKey:function(t,e){if(this.parent=this.parent||t,this.key=this.key||e,this.parent!==t)throw"Internal Error. SelectOptionList retrieved from two different Objects.";if(this.key!==e)throw"Internal Error. SelectOptionList retrieved from two different keys."},list:function(){return this._options},values:function(){return s.default.map(this._options,function(t){return t.value})},ids:function(){return s.default.map(this._options,function(t){return t.id})},includes:function(t){if(!(t instanceof l.default))throw"You need to provide an instance of Nimbu.SelectOption";return null!=s.default.find(this._options,function(e){return null!=e.id&&e.id===t.id||null!=e.value&&e.value===t.value})},includesValue:function(t){return null!=s.default.find(this._options,function(e){return e.value===t})},includesId:function(t){return null!=s.default.find(this._options,function(e){return e.id===t})},add:function(t){if(!(t instanceof l.default))throw"You need to provide an instance of Nimbu.SelectOption";if(!this.includes(t))return this._options=s.default.union(this._options,[t]),this.parent.set(this.key,this)},addValue:function(t){return this.add(new l.default(null,t))},addId:function(t){return this.add(new l.default(t,null))},remove:function(t){var e;if(!(t instanceof l.default))throw"You need to provide an instance of Nimbu.SelectOption";if(null!=(e=s.default.find(this._options,function(e){return null!=e.id&&e.id===t.id||null!=e.value&&e.value===t.value})))return this._options=s.default.without(this._options,e),this.parent.set(this.key,this)},removeValue:function(t){return this.remove(new l.default(null,t))},removeId:function(t){return this.remove(new l.default(t,null))},toJSON:function(){return s.default.map(this._options,function(t){return t.toJSON()})}},o.default.SelectOptionList=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(17),s=r(a),c=n(1),l=r(c);e.default=i=function(t,e,n){this.parent=t,this.key=e,this.targetClassName=null,this._objects=null!=n?n:[]},i.prototype={_ensureParentAndKey:function(t,e){if(this.parent=this.parent||t,this.key=this.key||e,this.parent!==t)throw"Internal Error. Relation retrieved from two different Objects.";if(this.key!==e)throw"Internal Error. Relation retrieved from two different keys."},list:function(){return this._objects},add:function(t){var e;if(!l.default.isObject(t))throw"You must supply a Nimbu.Object or array of Nimbu.Object";l.default.isArray(t)||(t=[t]),e=new s.default.Relation(t,[]),this.parent.set(this.key,e),this.targetClassName=e._targetClassName},remove:function(t){var e;if(!l.default.isObject(t))throw"You must supply a Nimbu.Object or array of Nimbu.Object";l.default.isArray(t)||(t=[t]),e=new s.default.Relation([],t),this.parent.set(this.key,e),this.targetClassName=e._targetClassName},toJSON:function(){return{__type:"Relation",className:this.targetClassName}}},o.default.Relation=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(6),s=n(1),c=r(s);e.default=i=function(t){this.id=t.id,this.attributes=c.default.clone(t)||{}},i.prototype={_setGallery:function(t){return this.gallery=t},has:function(t){return null!=this.attributes[t]},get:function(t){return this.attributes[t]},set:function(t,e){var n;return null!=this.gallery&&null!=this.id&&(n={},n[t]=e,this.gallery._updateImage(this,n)),this.attributes[t]=e},toJSON:function(){var t;return t={__type:"GalleryImage",id:this.id},this.has("caption")&&(t.caption=this.get("caption")),this.has("position")&&(t.position=this.get("position")),this.has("file")&&(t.file=(0,a._encode)(this.get("file"))),t}},o.default.GalleryImage=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u,o,a,s,c,l,f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d=n(0),h=r(d),_=n(1),p=r(_);u=[],c=u.slice,e.default=i={on:function(t,e,n){var r;return a(this,"on",t,[e,n])&&e?(this._events||(this._events={}),r=this._events[t]||(this._events[t]=[]),r.push({callback:e,context:n,ctx:n||this}),this):this},once:function(t,e,n){var r,i;return a(this,"once",t,[e,n])&&e?(i=this,r=p.default.once(function(){return i.off(t,r),e.apply(this,arguments)}),r._callback=e,this.on(t,r,n)):this},off:function(t,e,n){var r,i,u,o,s,c,l,f;if(f=void 0,r=void 0,i=void 0,l=void 0,u=void 0,c=void 0,o=void 0,s=void 0,!this._events||!a(this,"off",t,[e,n]))return this;if(!t&&!e&&!n)return this._events=void 0,this;for(l=t?[t]:p.default.keys(this._events),u=0,c=l.length;u<c;){if(t=l[u],i=this._events[t]){if(this._events[t]=f=[],e||n)for(o=0,s=i.length;o<s;)r=i[o],(e&&e!==r.callback&&e!==r.callback._callback||n&&n!==r.context)&&f.push(r),o++;f.length||delete this._events[t]}u++}return this},trigger:function(t){var e,n,r;return this._events?(n=c.call(arguments,1),a(this,"trigger",t,n)?(r=this._events[t],e=this._events.all,r&&l(r,n),e&&l(e,arguments),this):this):this},stopListening:function(t,e,n){var r,i,u;if(!(i=this._listeningTo))return this;u=!e&&!n,n||"object"!==(void 0===e?"undefined":f(e))||(n=this),t&&((i={})[t._listenId]=t);for(r in i)t=i[r],t.off(e,n,this),(u||p.default.isEmpty(t._events))&&delete this._listeningTo[r];return this}},o=/\s+/,a=function(t,e,n,r){var i,u,a,s;if(!n)return!0;if("object"===(void 0===n?"undefined":f(n))){for(u in n)t[e].apply(t,[u,n[u]].concat(r));return!1}if(o.test(n)){for(s=n.split(o),i=0,a=s.length;i<a;)t[e].apply(t,[s[i]].concat(r)),i++;return!1}return!0},l=function(t,e){var n,r,i,u,o,a;switch(u=void 0,o=-1,a=t.length,n=e[0],r=e[1],i=e[2],e.length){case 0:for(;++o<a;)(u=t[o]).callback.call(u.ctx);break;case 1:for(;++o<a;)(u=t[o]).callback.call(u.ctx,n);break;case 2:for(;++o<a;)(u=t[o]).callback.call(u.ctx,n,r);break;case 3:for(;++o<a;)(u=t[o]).callback.call(u.ctx,n,r,i);break;default:for(;++o<a;)(u=t[o]).callback.apply(u.ctx,e)}},s={listenTo:"on",listenToOnce:"once"},p.default.each(s,function(t,e){return i[e]=function(e,n,r){var i,u;return u=this._listeningTo||(this._listeningTo={}),i=e._listenId||(e._listenId=p.default.uniqueId("l")),u[i]=e,r||"object"!==(void 0===n?"undefined":f(n))||(r=this),e[t](n,r,this),this}}),i.bind=i.on,i.unbind=i.off,h.default.Events=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u,o,a=n(0),s=r(a),c=n(17),l=r(c),f=n(1),d=r(f);o=function(t){if(t<26)return String.fromCharCode(65+t);if(t<52)return String.fromCharCode(97+t-26);if(t<62)return String.fromCharCode(48+t-52);if(62===t)return"+";if(63===t)return"/";throw"Tried to encode large digit "+t+" in base64."},u=function(t){var e;return e=[],e.length=Math.ceil(t.length/3),d.default.times(e.length,function(n){var r,i,u,a,s;r=t[3*n],i=t[3*n+1]||0,u=t[3*n+2]||0,a=3*n+1<t.length,s=3*n+2<t.length,e[n]=[o(r>>2&63),o(r<<4&48|i>>4&15),a?o(i<<2&60|u>>6&3):"=",s?o(63&u):"="].join("")}),e.join("")},e.default=i=function(t,e){var n,r;if(this.filename=t,null!=e&&d.default.isObject(e)&&null!=e.url)this.url=e.url,this.width=e.width,this.height=e.height,this.content_type=e.content_type,this.version=e.version,this.checksum=e.checksum,this.size=e.size,null!=e.private&&(this.private=e.private,this.permanent_url=e.permanent_url,this.permanent_relative_url=e.permanent_relative_url,this.permanent_backend_url=e.permanent_backend_url);else if(null!=e&&d.default.isObject(e)&&null!=e.base64)r=/^data:([a-zA-Z]*\/[a-zA-Z+.-]*);(charset=[a-zA-Z0-9\-\/\s]*,)?base64,(\S+)/,n=r.exec(e.base64),n&&n.length>0?this._data=4===n.length?n[3]:n[2]:this._data=e.base64;else if(null!=e&&d.default.isArray(e))this._data=u(e);else if(d.default.isString(e))throw"Creating a Nimbu.File from a String is not yet supported."},i.prototype={_ensureParentAndKey:function(t,e){if(this.parent=this.parent||t,this.key=this.key||e,this.parent!==t)throw"Internal Error. File retrieved from two different Objects.";if(this.key!==e)throw"Internal Error. File retrieved from two different keys."},toJSON:function(){var t;return t={__type:"File",filename:this.filename},null!=this._data&&(t.attachment=this._data),null!=this.url&&(t.url=this.url),t},remove:function(){if(null!=this.parent&&null!=this.key)return this.removed=!0,this.parent.set(this.key,new l.default.RemoveFile),!0;throw"Internal Error. Tried to remove a File that is not linked to an Object."}},s.default.File=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u,o=n(0),a=r(o),s=n(23),c=r(s),l=n(6),f=n(4),d=r(f),h=n(8),_=r(h),p=n(9),v=r(p),m=n(93),g=r(m),y=n(10),b=r(y),C=n(5),w=n(1),S=r(w),A=n(24),O=r(A);u=null,e.default=i=d.default.extend("customer",{_isCurrentCustomer:!1,_mergeSystemFields:function(t){return t.session_token&&(this.session_token=t.session_token,delete t.session_token),i.__super__._mergeSystemFields.call(this,t)},_cleanupAuthData:function(){var t;if(this.isCurrent()&&(t=this.get("authData")))return(0,C._objectEach)(this.get("authData"),function(e,n){if(!t[n])return delete t[n]})},_synchronizeAllAuthData:function(){var t;if(this.get("authData"))return t=this,(0,C._objectEach)(this.get("authData"),function(e,n){return t._synchronizeAuthData(n)})},_synchronizeAuthData:function(t){var e,n,r;if(this.isCurrent()&&(n=void 0,S.default.isString(t)?(n=t,t=i._authProviders[n]):n=t.getAuthType(),(e=this.get("authData"))&&t))return r=t.restoreAuthentication(e[n]),r?void 0:this._unlinkFrom(t)},_handleSaveResult:function(t){if(t&&(this._isCurrentCustomer=!0),this._cleanupAuthData(),this._synchronizeAllAuthData(),delete this._serverData.password,this._rebuildEstimatedDataForKey("password"),this._refreshCache(),t||this.isCurrent())return i._saveCurrentCustomer(this)},_linkWith:function(t,e){var n,r,u,o,a;return r=void 0,S.default.isString(t)?(r=t,t=i._authProviders[t]):r=t.getAuthType(),S.default.has(e,"authData")?(n=this.get("authData")||{},n[r]=e.authData,this.set("authData",n),u=S.default.clone(e)||{},u.success=function(t){if(t._handleSaveResult(!0),e.success)return e.success.apply(this,arguments)},this.save({authData:n},u)):(a=this,o=new _.default,t.authenticate({success:function(t,n){return a._linkWith(t,{authData:n,success:e.success,error:e.error}).then(function(){return o.resolve(a)})},error:function(t,n){return e.error&&e.error(a,n),o.reject(n)}}),o)},_unlinkFrom:function(t,e){var n,r;return void 0,S.default.isString(t)?(t,t=i._authProviders[t]):t.getAuthType(),n=S.default.clone(e),r=this,n.authData=null,n.success=function(n){if(r._synchronizeAuthData(t),e.success)return e.success.apply(this,arguments)},this._linkWith(t,n)},_isLinked:function(t){var e,n;return n=void 0,n=S.default.isString(t)?t:t.getAuthType(),e=this.get("authData")||{},!!e[n]},_logOutWithAll:function(){var t;if(this.get("authData"))return t=this,(0,C._objectEach)(this.get("authData"),function(e,n){return t._logOutWith(n)})},_logOutWith:function(t){if(this.isCurrent())return S.default.isString(t)&&(t=i._authProviders[t]),t&&t.deauthenticate?t.deauthenticate():void 0},signUp:function(t,e){var n,r,i,u;return n=void 0,e=e||{},(u=t&&t.username||this.get("username"))&&""!==u?(i=t&&t.password||this.get("password"))&&""!==i?(r=S.default.clone(e),r.success=function(t){if(t._handleSaveResult(!0),e.success)return e.success.apply(this,arguments)},this.save(t,r)):(n=new v.default(v.default.OTHER_CAUSE,"Cannot sign up user with an empty password."),e&&e.error&&e.error(this,n),_.default.error(n)):(n=new v.default(v.default.OTHER_CAUSE,"Cannot sign up user with an empty name."),e&&e.error&&e.error(this,n),_.default.error(n))},logIn:function(t){var e,n;return e=this,t=t||{},n=(0,b.default)({route:"customers",className:"login",method:"POST",data:this.toJSON(),useACL:t.useACL}),n.then(function(t,n,r){var i;return i=e.parse(t,n,r),e._finishFetch(i),e._handleSaveResult(!0),e})._thenRunCallbacks(t,this)},save:function(t,e,n){var r,i,u;return void 0,r=void 0,void 0,u=void 0,void 0,S.default.isObject(t)||S.default.isNull(t)||S.default.isUndefined(t)?(r=t,u=e):(r={},r[t]=e,u=n),u=u||{},i=S.default.clone(u),i.success=function(t){if(t._handleSaveResult(!1),u.success)return u.success.apply(this,arguments)},d.default.prototype.save.call(this,r,i)},fetch:function(t){var e;return e=t?S.default.clone(t):{},e.success=function(e){if(e._handleSaveResult(!1),t&&t.success)return t.success.apply(this,arguments)},d.default.prototype.fetch.call(this,e)},isCurrent:function(){return this._isCurrentCustomer},getCustomername:function(){return this.get("username")},setCustomername:function(t,e){return this.set("username",t,e)},setPassword:function(t,e){return this.set("password",t,e)},getEmail:function(){return this.get("email")},setEmail:function(t,e){return this.set("email",t,e)},authenticated:function(){return!!this.session_token&&i.current()&&i.current().id===this.id},getAutologinToken:function(t){var e;return this.isCurrent()?(e=null,(0,b.default)({path:"customers/me/authentication_token",method:"GET"}).then(function(t,n,r){return e=t.authentication_token})._thenRunCallbacks(t,e)):_.default.error("You can only request the autologin token for the current customer")},validateSession:function(t){var e;return this.isCurrent()?(e=null,(0,b.default)({path:"customers/me",method:"GET"}).fail(function(t){return a.default.Customer.logOut()})._thenRunCallbacks(t,e)):_.default.error("You can validate the login session for the current customer")}},{_currentCustomer:null,_currentCustomerMatchesDisk:!1,_CURRENT_USER_KEY:"currentCustomer",_authProviders:{},_performCustomerRewrite:!0,signUp:function(t,e,n,r){var i;return n=n||{},n.username=t,n.password=e,i=d.default._create("customer"),i.signUp(n,r)},logIn:function(t,e,n){var r;return r=d.default._create("customer"),r._finishFetch({username:t,password:e}),r.logIn(n)},become:function(t,e){var n;return e=e||{},n=d.default._create("customer"),(0,b.default)({route:"customers",className:"me",method:"GET",useACL:e.useACL,sessionToken:t}).then(function(e,r,i){var u;return u=n.parse(e,r,i),u.session_token=t,n._finishFetch(u),n._handleSaveResult(!0),n})._thenRunCallbacks(e,n)},logOut:function(){return null!==i._currentCustomer&&(i._currentCustomer._logOutWithAll(),i._currentCustomer._isCurrentCustomer=!1),i._currentCustomerMatchesDisk=!0,i._currentCustomer=null,O.default.removeItem((0,l._getStoragePath)(i._CURRENT_USER_KEY)),!0},requestPasswordReset:function(t,e){var n;return e=e||{},n=(0,b.default)({route:"customers",className:"password/reset",method:"POST",useACL:e.useACL,data:{email:t}}),n._thenRunCallbacks(e)},validateCurrent:function(t){var e,n,r,o,a,s,f,h,p;if(u=null,(0,l.useSSO)(!0),!l.accessToken)throw"You must specify your accessToken using Nimbu.initialize().";if("undefined"==typeof document||null===document||"undefined"==typeof window||null===window)throw"Nimbu.Customer.validateCurrent() can only be run from within a browser.";for(r=new _.default,a=document.getElementsByTagName("meta"),f=null,o=0;o<a.length;){if("nimbu:sso:current"===a[o].getAttribute("property")){f=a[o].getAttribute("content");break}o++}for(p=null,o=0;o<a.length;){if("nimbu:sso:authorize_url"===a[o].getAttribute("property")){p=a[o].getAttribute("content");break}o++}for(e=null,o=0;o<a.length;){if("csrf-token"===a[o].getAttribute("name")){e=a[o].getAttribute("content");break}o++}if(null==e)throw"Please include the CSRF meta tags in your html header.";if(null!=f&&null!=p)try{h=g.default.dec(decodeURIComponent(f),l.accessToken)}catch(t){t,h="unauthenticated"}return n=i.current(),null==h||"unauthenticated"===h?(i.logOut(),r.resolve(null)):null!=n&&h!==n.id?(i.logOut(),r.resolve(null)):null==h||"unauthenticated"===h||null!=n&&h===n.id?r.resolve(n):(s=(0,b.default)({route:"customers",className:"sso",method:"POST"}),s.then(function(t,n,r){var i;return u=g.default.dec(t.shared_secret,l.accessToken),i={},i._accessToken=l.accessToken,i._clientVersion=c.default,i._installationId=(0,l._getInstallationId)(),i._csrfToken=e,(0,y._ajax)("POST",p,JSON.stringify({}),i)}).then(function(t,e,n){var i,o;return i=d.default._create("customer"),o=i.parse(t,e,n),o.session_token=g.default.dec(o.session_token,u),u=null,i._finishFetch(o),i._handleSaveResult(!0),r.resolve(i)})),r._thenRunCallbacks(t)},current:function(){if(i._currentCustomer||i._currentCustomerMatchesDisk)return i._currentCustomer;throw"You need to call Nimbu.initialize before using the SDK."},_initCurrent:function(){var t;return i._currentCustomer?a.default.Future.as(i._currentCustomer):i._currentCustomerMatchesDisk?a.default.Future.as(i._currentCustomer):(t=new a.default.Future,O.default.getItem((0,l._getStoragePath)(i._CURRENT_USER_KEY)).then(function(e){var n;return e?(i._currentCustomer=d.default._create("customer"),i._currentCustomer._isCurrentCustomer=!0,n=JSON.parse(e),i._currentCustomer.id=n._id,delete n._id,i._currentCustomer.session_token=n.session_token,delete n.session_token,i._currentCustomer.set(n),i._currentCustomer._synchronizeAllAuthData(),i._currentCustomer._refreshCache(),i._currentCustomer._opSetQueue=[{}],i._currentCustomer,i._currentCustomerMatchesDisk=!0,t.resolve(i._currentCustomer)):(i._currentCustomerMatchesDisk=!0,t.resolve(null))}),t)},allowCustomCustomerClass:function(t){return this._performCustomerRewrite=!t},_saveCurrentCustomer:function(t){var e;return i._currentCustomer!==t&&i.logOut(),t._isCurrentCustomer=!0,i._currentCustomer=t,i._currentCustomerMatchesDisk=!0,e=t.toJSON(),e._id=t.id,e.session_token=t.session_token,O.default.setItem((0,l._getStoragePath)(i._CURRENT_USER_KEY),JSON.stringify(e))},_registerAuthenticationProvider:function(t){if(i._authProviders[t.getAuthType()]=t,i.current())return i.current()._synchronizeAuthData(t.getAuthType())},_logInWith:function(t,e){var n;return n=d.default._create("customer"),n._linkWith(t,e)}}),a.default.Customer=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u,o=n(0),a=r(o),s=n(5),c=n(1),l=r(c);e.default=i=function(t,e){if(e=e||{},e.comparator&&(this.comparator=e.comparator),e.model&&(this.model=e.model),e.query&&(this.query=e.query),this._reset(),this.initialize.apply(this,arguments),t)return this.reset(t,{silent:!0,parse:e.parse})},l.default.extend(i.prototype,a.default.Events,{model:a.default.Object,initialize:function(){},toJSON:function(){return this.map(function(t){return t.toJSON()})},add:function(t,e){var n,r,i,u,o,a,c,f;for(i=void 0,a=void 0,c=void 0,f=void 0,n=void 0,u=void 0,r={},o={},e=e||{},t=l.default.isArray(t)?t.slice():[t],i=0,c=t.length;i<c;){if(t[i]=this._prepareModel(t[i],e),!(f=t[i]))throw new Error("Can't add an blank model to a collection");n=f.cid,u=f.id,r[n]||this._byCid[n]||!(0,s._isNullOrUndefined)(u)&&(o[u]||this._byId[u])?(t.splice(i,1),c=t.length):(o[u]=f,r[n]=f,i++)}for(i=0;i<c;)(f=t[i]).on("all",this._onModelEvent,this),this._byCid[f.cid]=f,f.id&&(this._byId[f.id]=f),i++;if(this.length+=c,a=(0,s._isNullOrUndefined)(e.at)?this.models.length:e.at,this.models.splice.apply(this.models,[a,0].concat(t)),this.comparator&&this.sort({silent:!0}),e.silent)return this;for(i=0,c=this.models.length;i<c;)f=this.models[i],r[f.cid]&&(e.index=i,f.trigger("add",f,this,e)),i++;return this},remove:function(t,e){var n,r,i,u;for(n=void 0,i=void 0,r=void 0,u=void 0,e=e||{},t=l.default.isArray(t)?t.slice():[t],n=0,i=t.length;n<i;)(u=this.getByCid(t[n])||this.get(t[n]))&&(delete this._byId[u.id],delete this._byCid[u.cid],r=this.indexOf(u),this.models.splice(r,1),this.length--,e.silent||(e.index=r,u.trigger("remove",u,this,e)),this._removeReference(u),n++);return this},get:function(t){return t&&this._byId[t.id||t]},getByCid:function(t){return t&&this._byCid[t.cid||t]},at:function(t){return this.models[t]},sort:function(t){var e;if(t=t||{},!this.comparator)throw new Error("Cannot sort a set without a comparator");return e=l.default.bind(this.comparator,this),1===this.comparator.length?this.models=this.sortBy(e):this.models.sort(e),t.silent||this.trigger("reset",this,t),this},pluck:function(t){return l.default.map(this.models,function(e){return e.get(t)})},reset:function(t,e){var n;return n=this,t=t||[],e=e||{},(0,s._arrayEach)(this.models,function(t){return n._removeReference(t)}),this._reset(),this.add(t,{silent:!0,parse:e.parse}),e.silent||this.trigger("reset",this,e),this},fetch:function(t){var e,n,r,i;return t=l.default.clone(t)||{},null!=t.parse&&(t.parse=!0),e=this,n=0,i=this.query||new a.default.Query(this.model),r=!1,a.default.Future._continueWhile(function(){return!r},function(){return i.find({useACL:t.useACL}).then(function(u){return t.add||n>0?e.add(u,t):e.reset(u,t),n+=1,i.hasNext()?(null==i._page&&(i._page=1),i.page(i._page+1)):r=!0,e})}).then(function(){return e})._thenRunCallbacks(t,this)},create:function(t,e){var n,r;return n=this,e=e?l.default.clone(e):{},!!(t=this._prepareModel(t,e))&&(e.wait||n.add(t,e),r=e.success,e.success=function(i,u,o){return e.wait&&n.add(i,e),r?r(i,u):i.trigger("sync",t,u,e)},t.save(null,e),t)},parse:function(t,e){return t},chain:function(){return(0,l.default)(this.models).chain()},_reset:function(t){return this.length=0,this.models=[],this._byId={},this._byCid={}},_prepareModel:function(t,e){var n;return t instanceof a.default.Object?t.collection||(t.collection=this):(n=t,e.collection=this,t=new this.model(n,e),t._validate(t.attributes,e)||(t=!1)),t},_removeReference:function(t){return this===t.collection&&delete t.collection,t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,n,r){if("add"!==t&&"remove"!==t||n===this)return"destroy"===t&&this.remove(e,r),e&&"change:objectId"===t&&(delete this._byId[e.previous("objectId")],this._byId[e.id]=e),this.trigger.apply(this,arguments)}}),u=["forEach","each","map","reduce","reduceRight","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","sortBy","sortedIndex","toArray","size","first","initial","rest","last","without","indexOf","shuffle","lastIndexOf","isEmpty","groupBy"],(0,s._arrayEach)(u,function(t){return i.prototype[t]=function(){return l.default[t].apply(l.default,[this.models].concat(l.default.toArray(arguments)))}}),i.extend=s._extend,a.default.Collection=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u,o,a=n(0),s=r(a),c=n(5),l=n(54),f=(r(l),n(1)),d=r(f);o="*",u="users",e.default=i=function(t){var e;if(e=this,e.permissionsById={},d.default.isObject(t)){if(t instanceof s.default.Customer)return e.allowRead(t,!0),e.allowUpdate(t,!0),e.allowDelete(t,!0);if(d.default.isFunction(t))throw"Nimbu.ACL() called with a function?";return(0,c._objectEach)(t,function(t,n){if(!d.default.isString(n))throw"Tried to create an ACL with an invalid customerId.";return e.permissionsById[n]={},(0,c._objectEach)(t,function(t,r){if("read"!==r&&"update"!==r&&"delete"!==r)throw"Tried to create an ACL with an invalid permission type "+r+".";if(!d.default.isBoolean(t))throw"Tried to create an ACL with an invalid permission value.";return e.permissionsById[n][r]=t})})}},i.prototype.toJSON=function(){return d.default.clone(this.permissionsById)},i.prototype._setPermission=function(t,e,n){var r;if(e instanceof s.default.Customer?e="id:"+e.id:e instanceof s.default.Role&&(e="role:"+e.getName()),!d.default.isString(e))throw"customerId must be a string.";if(!d.default.isBoolean(n))throw"allowed must be either true or false.";if(!(r=this.permissionsById[e])){if(!n)return;r={},this.permissionsById[e]=r}return n?this.permissionsById[e][t]=!0:(delete r[t],d.default.isEmpty(r)?delete r[e]:void 0)},i.prototype._getPermission=function(t,e){var n;return e instanceof s.default.Customer?e="id:"+e.id:e instanceof s.default.Role&&(e="role:"+e.getName()),!!(n=this.permissionsById[e])&&!!n[t]},i.prototype.allowRead=function(t,e){return this._setPermission("read",t,e)},i.prototype.getReadAccess=function(t){return this._getPermission("read",t)},i.prototype.allowUpdate=function(t,e){return this._setPermission("update",t,e)},i.prototype.getUpdateAccess=function(t){return this._getPermission("update",t)},i.prototype.allowDelete=function(t,e){return this._setPermission("delete",t,e)},i.prototype.getDeleteAccess=function(t){return this._getPermission("delete",t)},i.prototype.setPublicReadAccess=function(t){return this.allowRead(o,t)},i.prototype.getPublicReadAccess=function(){return this.getReadAccess(o)},i.prototype.setPublicUpdateAccess=function(t){return this.allowUpdate(o,t)},i.prototype.getPublicUpdateAccess=function(){return this.getUpdateAccess(o)},i.prototype.setPublicDeleteAccess=function(t){return this.allowDelete(o,t)},i.prototype.getPublicDeleteAccess=function(){return this.getDeleteAccess(o)},i.prototype.setLoggedInReadAccess=function(t){return this.allowRead(u,t)},i.prototype.getLoggedInReadAccess=function(){return this.getReadAccess(u)},i.prototype.setLoggedInUpdateAccess=function(t){return this.allowUpdate(u,t)},i.prototype.getLoggedInUpdateAccess=function(){return this.getUpdateAccess(u)},i.prototype.setLoggedInDeleteAccess=function(t){return this.allowDelete(u,t)},i.prototype.getLoggedInDeleteAccess=function(){return this.getDeleteAccess(u)},i.prototype.getRoleReadAccess=function(t){if(t instanceof s.default.Role&&(t=t.getName()),d.default.isString(t))return this.getReadAccess("role:"+t);throw"role must be a Nimbu.Role or a String"},i.prototype.getRoleUpdateAccess=function(t){if(t instanceof s.default.Role&&(t=t.getName()),d.default.isString(t))return this.getUpdateAccess("role:"+t);throw"role must be a Nimbu.Role or a String"},i.prototype.getRoleDeleteAccess=function(t){if(t instanceof s.default.Role&&(t=t.getName()),d.default.isString(t))return this.getDeleteAccess("role:"+t);throw"role must be a Nimbu.Role or a String"},i.prototype.setRoleReadAccess=function(t,e){if(t instanceof s.default.Role&&(t=t.getName()),d.default.isString(t))return void this.allowRead("role:"+t,e);throw"role must be a Nimbu.Role or a String"},i.prototype.setRoleUpdateAccess=function(t,e){if(t instanceof s.default.Role&&(t=t.getName()),d.default.isString(t))return void this.allowUpdate("role:"+t,e);throw"role must be a Nimbu.Role or a String"},i.prototype.setRoleDeleteAccess=function(t,e){if(t instanceof s.default.Role&&(t=t.getName()),d.default.isString(t))return void this.allowDelete("role:"+t,e);throw"role must be a Nimbu.Role or a String"},s.default.ACL=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(1),s=r(a),c=n(4),l=r(c),f=n(8),d=r(f);e.default=i=l.default.extend("product_aggregate",{constructor:function(t,e){return null==e&&(e={}),e.parse=!0,l.default.apply(this,[t,e])},getProductId:function(){var t;if(null!=this.id&&(t=this.id.split("-")),(null!=t?t.length:void 0)>=1)return t[0]},getVariantId:function(){var t;if(null!=this.id&&(t=this.id.split("-")),2===(null!=t?t.length:void 0))return t[1]},getProduct:function(){return new o.default.Product({id:this.getProductId()})},save:function(t,e,n){return d.default.error("Product Aggregates are read-only")},fetch:function(t){return d.default.as(this)},destroy:function(t){return d.default.error("Product Aggregates are read-only")},parse:function(t,e,n){var r,i,u;return i=t.product,u=t.variant,s.default.isObject(i)&&(i=i.id),s.default.isObject(u)&&(u=u.id),r=s.default.compact([i,u]).join("-"),null!=r&&(t.id=r),t.product=void 0,t.variant=void 0,l.default.prototype.parse.apply(this,arguments)}}),o.default.ProductAggregate=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(23),u=r(i),o=n(4),a=r(o),s=n(9),c=r(s),l=n(17),f=r(l),d=n(52),h=r(d),_=n(8),p=r(_),v=n(54),m=r(v),g=n(50),y=r(g),b=n(36),C=r(b),w=n(51),S=r(w),A=n(94),O=r(A),N=n(53),E=r(N),j=n(95),x=r(j),T=n(56),I=r(T),R=n(96),k=r(R),P=n(55),D=r(P),M=n(97),L=r(M),U=n(98),F=r(U),G=n(99),J=r(G),q=n(100),z=r(q),V=n(57),B=r(V),K=n(101),W=r(K),Q=n(35),H=r(Q),Y=n(49),Z=r(Y),X=n(24),$=n(1),tt=r($),et=n(6),nt=n(10),rt={VERSION:u.default,_:tt.default.noConflict(),initialize:et.initialize,useACL:et.useACL,useSSO:et.useSSO,getInstallationId:et._getInstallationId,Error:c.default,Atomic:f.default,API:k.default,Events:h.default,Future:p.default,Object:a.default,Relation:y.default,Gallery:C.default,GalleryImage:S.default,Query:O.default,Customer:m.default,ACL:I.default,Role:x.default,File:E.default,Collection:D.default,Coupon:L.default,Device:F.default,Cloud:J.default,Order:z.default,ProductAggregate:B.default,Product:W.default,SelectOption:H.default,SelectOptionList:Z.default,setStorageEngine:X.setEngine,setAjax:nt.setAjax,enableChaos:nt.enableChaos};tt.default.extend(rt,h.default),e.default=rt},function(t,e,n){"use strict";var r=n(25),i={};i[n(2)("toStringTag")]="z",i+""!="[object z]"&&n(13)(Object.prototype,"toString",function(){return"[object "+r(this)+"]"},!0)},function(t,e,n){t.exports=!n(15)&&!n(39)(function(){return 7!=Object.defineProperty(n(29)("div"),"a",{get:function(){return 7}}).a})},function(t,e,n){var r=n(14);t.exports=function(t,e){if(!r(t))return t;var n,i;if(e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;if("function"==typeof(n=t.valueOf)&&!r(i=n.call(t)))return i;if(!e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},function(t,e,n){t.exports=n(26)("native-function-to-string",Function.toString)},function(t,e,n){"use strict";var r=n(64)(!0);n(41)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=r(e,n),this._i+=t.length,{value:t,done:!1})})},function(t,e,n){var r=n(30),i=n(31);t.exports=function(t){return function(e,n){var u,o,a=String(i(e)),s=r(n),c=a.length;return s<0||s>=c?t?"":void 0:(u=a.charCodeAt(s),u<55296||u>56319||s+1===c||(o=a.charCodeAt(s+1))<56320||o>57343?t?a.charAt(s):u:t?a.slice(s,s+2):o-56320+(u-55296<<10)+65536)}}},function(t,e,n){"use strict";var r=n(66),i=n(40),u=n(34),o={};n(12)(o,n(2)("iterator"),function(){return this}),t.exports=function(t,e,n){t.prototype=r(o,{next:i(1,n)}),u(t,e+" Iterator")}},function(t,e,n){var r=n(7),i=n(67),u=n(45),o=n(33)("IE_PROTO"),a=function(){},s=function(){var t,e=n(29)("iframe"),r=u.length;for(e.style.display="none",n(46).appendChild(e),e.src="javascript:",t=e.contentWindow.document,t.open(),t.write("<script>document.F=Object<\/script>"),t.close(),s=t.F;r--;)delete s.prototype[u[r]];return s()};t.exports=Object.create||function(t,e){var n;return null!==t?(a.prototype=r(t),n=new a,a.prototype=null,n[o]=t):n=s(),void 0===e?n:i(n,e)}},function(t,e,n){var r=n(19),i=n(7),u=n(43);t.exports=n(15)?Object.defineProperties:function(t,e){i(t);for(var n,o=u(e),a=o.length,s=0;a>s;)r.f(t,n=o[s++],e[n]);return t}},function(t,e,n){var r=n(20),i=n(32),u=n(70)(!1),o=n(33)("IE_PROTO");t.exports=function(t,e){var n,a=i(t),s=0,c=[];for(n in a)n!=o&&r(a,n)&&c.push(n);for(;e.length>s;)r(a,n=e[s++])&&(~u(c,n)||c.push(n));return c}},function(t,e,n){var r=n(18);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,e,n){var r=n(32),i=n(44),u=n(71);t.exports=function(t){return function(e,n,o){var a,s=r(e),c=i(s.length),l=u(o,c);if(t&&n!=n){for(;c>l;)if((a=s[l++])!=a)return!0}else for(;c>l;l++)if((t||l in s)&&s[l]===n)return t||l||0;return!t&&-1}}},function(t,e,n){var r=n(30),i=Math.max,u=Math.min;t.exports=function(t,e){return t=r(t),t<0?i(t+e,0):u(t,e)}},function(t,e,n){var r=n(20),i=n(73),u=n(33)("IE_PROTO"),o=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=i(t),r(t,u)?t[u]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?o:null}},function(t,e,n){var r=n(31);t.exports=function(t){return Object(r(t))}},function(t,e,n){for(var r=n(75),i=n(43),u=n(13),o=n(3),a=n(12),s=n(16),c=n(2),l=c("iterator"),f=c("toStringTag"),d=s.Array,h={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},_=i(h),p=0;p<_.length;p++){var v,m=_[p],g=h[m],y=o[m],b=y&&y.prototype;if(b&&(b[l]||a(b,l,d),b[f]||a(b,f,m),s[m]=d,g))for(v in r)b[v]||u(b,v,r[v],!0)}},function(t,e,n){"use strict";var r=n(76),i=n(77),u=n(16),o=n(32);t.exports=n(41)(Array,"Array",function(t,e){this._t=o(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,i(1)):"keys"==e?i(0,n):"values"==e?i(0,t[n]):i(0,[n,t[n]])},"values"),u.Arguments=u.Array,r("keys"),r("values"),r("entries")},function(t,e,n){var r=n(2)("unscopables"),i=Array.prototype;void 0==i[r]&&n(12)(i,r,{}),t.exports=function(t){i[r][t]=!0}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,n){"use strict";var r,i,u,o,a=n(27),s=n(3),c=n(21),l=n(25),f=n(42),d=n(14),h=n(22),_=n(79),p=n(80),v=n(84),m=n(47).set,g=n(86)(),y=n(48),b=n(87),C=n(88),w=n(89),S=s.TypeError,A=s.process,O=A&&A.versions,N=O&&O.v8||"",E=s.Promise,j="process"==l(A),x=function(){},T=i=y.f,I=!!function(){try{var t=E.resolve(1),e=(t.constructor={})[n(2)("species")]=function(t){t(x,x)};return(j||"function"==typeof PromiseRejectionEvent)&&t.then(x)instanceof e&&0!==N.indexOf("6.6")&&-1===C.indexOf("Chrome/66")}catch(t){}}(),R=function(t){var e;return!(!d(t)||"function"!=typeof(e=t.then))&&e},k=function(t,e){if(!t._n){t._n=!0;var n=t._c;g(function(){for(var r=t._v,i=1==t._s,u=0;n.length>u;)!function(e){var n,u,o,a=i?e.ok:e.fail,s=e.resolve,c=e.reject,l=e.domain;try{a?(i||(2==t._h&&M(t),t._h=1),!0===a?n=r:(l&&l.enter(),n=a(r),l&&(l.exit(),o=!0)),n===e.promise?c(S("Promise-chain cycle")):(u=R(n))?u.call(n,s,c):s(n)):c(r)}catch(t){l&&!o&&l.exit(),c(t)}}(n[u++]);t._c=[],t._n=!1,e&&!t._h&&P(t)})}},P=function(t){m.call(s,function(){var e,n,r,i=t._v,u=D(t);if(u&&(e=b(function(){j?A.emit("unhandledRejection",i,t):(n=s.onunhandledrejection)?n({promise:t,reason:i}):(r=s.console)&&r.error&&r.error("Unhandled promise rejection",i)}),t._h=j||D(t)?2:1),t._a=void 0,u&&e.e)throw e.v})},D=function(t){return 1!==t._h&&0===(t._a||t._c).length},M=function(t){m.call(s,function(){var e;j?A.emit("rejectionHandled",t):(e=s.onrejectionhandled)&&e({promise:t,reason:t._v})})},L=function(t){var e=this;e._d||(e._d=!0,e=e._w||e,e._v=t,e._s=2,e._a||(e._a=e._c.slice()),k(e,!0))},U=function(t){var e,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===t)throw S("Promise can't be resolved itself");(e=R(t))?g(function(){var r={_w:n,_d:!1};try{e.call(t,c(U,r,1),c(L,r,1))}catch(t){L.call(r,t)}}):(n._v=t,n._s=1,k(n,!1))}catch(t){L.call({_w:n,_d:!1},t)}}};I||(E=function(t){_(this,E,"Promise","_h"),h(t),r.call(this);try{t(c(U,this,1),c(L,this,1))}catch(t){L.call(this,t)}},r=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},r.prototype=n(90)(E.prototype,{then:function(t,e){var n=T(v(this,E));return n.ok="function"!=typeof t||t,n.fail="function"==typeof e&&e,n.domain=j?A.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&k(this,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),u=function(){var t=new r;this.promise=t,this.resolve=c(U,t,1),this.reject=c(L,t,1)},y.f=T=function(t){return t===E||t===o?new u(t):i(t)}),f(f.G+f.W+f.F*!I,{Promise:E}),n(34)(E,"Promise"),n(91)("Promise"),o=n(11).Promise,f(f.S+f.F*!I,"Promise",{reject:function(t){var e=T(this);return(0,e.reject)(t),e.promise}}),f(f.S+f.F*(a||!I),"Promise",{resolve:function(t){return w(a&&this===o?E:this,t)}}),f(f.S+f.F*!(I&&n(92)(function(t){E.all(t).catch(x)})),"Promise",{all:function(t){var e=this,n=T(e),r=n.resolve,i=n.reject,u=b(function(){var n=[],u=0,o=1;p(t,!1,function(t){var a=u++,s=!1;n.push(void 0),o++,e.resolve(t).then(function(t){s||(s=!0,n[a]=t,--o||r(n))},i)}),--o||r(n)});return u.e&&i(u.v),n.promise},race:function(t){var e=this,n=T(e),r=n.reject,i=b(function(){p(t,!1,function(t){e.resolve(t).then(n.resolve,r)})});return i.e&&r(i.v),n.promise}})},function(t,e){t.exports=function(t,e,n,r){if(!(t instanceof e)||void 0!==r&&r in t)throw TypeError(n+": incorrect invocation!");return t}},function(t,e,n){var r=n(21),i=n(81),u=n(82),o=n(7),a=n(44),s=n(83),c={},l={},e=t.exports=function(t,e,n,f,d){var h,_,p,v,m=d?function(){return t}:s(t),g=r(n,f,e?2:1),y=0;if("function"!=typeof m)throw TypeError(t+" is not iterable!");if(u(m)){for(h=a(t.length);h>y;y++)if((v=e?g(o(_=t[y])[0],_[1]):g(t[y]))===c||v===l)return v}else for(p=m.call(t);!(_=p.next()).done;)if((v=i(p,g,_.value,e))===c||v===l)return v};e.BREAK=c,e.RETURN=l},function(t,e,n){var r=n(7);t.exports=function(t,e,n,i){try{return i?e(r(n)[0],n[1]):e(n)}catch(e){var u=t.return;throw void 0!==u&&r(u.call(t)),e}}},function(t,e,n){var r=n(16),i=n(2)("iterator"),u=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||u[i]===t)}},function(t,e,n){var r=n(25),i=n(2)("iterator"),u=n(16);t.exports=n(11).getIteratorMethod=function(t){if(void 0!=t)return t[i]||t["@@iterator"]||u[r(t)]}},function(t,e,n){var r=n(7),i=n(22),u=n(2)("species");t.exports=function(t,e){var n,o=r(t).constructor;return void 0===o||void 0==(n=r(o)[u])?e:i(n)}},function(t,e){t.exports=function(t,e,n){var r=void 0===n;switch(e.length){case 0:return r?t():t.call(n);case 1:return r?t(e[0]):t.call(n,e[0]);case 2:return r?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return r?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return r?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}},function(t,e,n){var r=n(3),i=n(47).set,u=r.MutationObserver||r.WebKitMutationObserver,o=r.process,a=r.Promise,s="process"==n(18)(o);t.exports=function(){var t,e,n,c=function(){var r,i;for(s&&(r=o.domain)&&r.exit();t;){i=t.fn,t=t.next;try{i()}catch(r){throw t?n():e=void 0,r}}e=void 0,r&&r.enter()};if(s)n=function(){o.nextTick(c)};else if(!u||r.navigator&&r.navigator.standalone)if(a&&a.resolve){var l=a.resolve(void 0);n=function(){l.then(c)}}else n=function(){i.call(r,c)};else{var f=!0,d=document.createTextNode("");new u(c).observe(d,{characterData:!0}),n=function(){d.data=f=!f}}return function(r){var i={fn:r,next:void 0};e&&(e.next=i),t||(t=i,n()),e=i}}},function(t,e){t.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},function(t,e,n){var r=n(3),i=r.navigator;t.exports=i&&i.userAgent||""},function(t,e,n){var r=n(7),i=n(14),u=n(48);t.exports=function(t,e){if(r(t),i(e)&&e.constructor===t)return e;var n=u.f(t);return(0,n.resolve)(e),n.promise}},function(t,e,n){var r=n(13);t.exports=function(t,e,n){for(var i in e)r(t,i,e[i],n);return t}},function(t,e,n){"use strict";var r=n(3),i=n(19),u=n(15),o=n(2)("species");t.exports=function(t){var e=r[t];u&&e&&!e[o]&&i.f(e,o,{configurable:!0,get:function(){return this}})}},function(t,e,n){var r=n(2)("iterator"),i=!1;try{var u=[7][r]();u.return=function(){i=!0},Array.from(u,function(){throw 2})}catch(t){}t.exports=function(t,e){if(!e&&!i)return!1;var n=!1;try{var u=[7],o=u[r]();o.next=function(){return{done:n=!0}},u[r]=function(){return o},t(u)}catch(t){}return n}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=/**
|
|
1
|
+
var Nimbu=function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=58)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={}},function(t,e,n){(function(){var n=this,r=n._,i={},u=Array.prototype,o=Object.prototype,a=Function.prototype,s=u.push,c=u.slice,l=u.concat,f=o.toString,d=o.hasOwnProperty,h=u.forEach,_=u.map,p=u.reduce,v=u.reduceRight,m=u.filter,g=u.every,y=u.some,b=u.indexOf,C=u.lastIndexOf,w=Array.isArray,S=Object.keys,A=a.bind,O=function(t){return t instanceof O?t:this instanceof O?void(this._wrapped=t):new O(t)};void 0!==t&&t.exports&&(e=t.exports=O),e._=O,O.VERSION="1.5.2";var N=O.each=O.forEach=function(t,e,n){if(null!=t)if(h&&t.forEach===h)t.forEach(e,n);else if(t.length===+t.length){for(var r=0,u=t.length;r<u;r++)if(e.call(n,t[r],r,t)===i)return}else for(var o=O.keys(t),r=0,u=o.length;r<u;r++)if(e.call(n,t[o[r]],o[r],t)===i)return};O.map=O.collect=function(t,e,n){var r=[];return null==t?r:_&&t.map===_?t.map(e,n):(N(t,function(t,i,u){r.push(e.call(n,t,i,u))}),r)};var E="Reduce of empty array with no initial value";O.reduce=O.foldl=O.inject=function(t,e,n,r){var i=arguments.length>2;if(null==t&&(t=[]),p&&t.reduce===p)return r&&(e=O.bind(e,r)),i?t.reduce(e,n):t.reduce(e);if(N(t,function(t,u,o){i?n=e.call(r,n,t,u,o):(n=t,i=!0)}),!i)throw new TypeError(E);return n},O.reduceRight=O.foldr=function(t,e,n,r){var i=arguments.length>2;if(null==t&&(t=[]),v&&t.reduceRight===v)return r&&(e=O.bind(e,r)),i?t.reduceRight(e,n):t.reduceRight(e);var u=t.length;if(u!==+u){var o=O.keys(t);u=o.length}if(N(t,function(a,s,c){s=o?o[--u]:--u,i?n=e.call(r,n,t[s],s,c):(n=t[s],i=!0)}),!i)throw new TypeError(E);return n},O.find=O.detect=function(t,e,n){var r;return j(t,function(t,i,u){if(e.call(n,t,i,u))return r=t,!0}),r},O.filter=O.select=function(t,e,n){var r=[];return null==t?r:m&&t.filter===m?t.filter(e,n):(N(t,function(t,i,u){e.call(n,t,i,u)&&r.push(t)}),r)},O.reject=function(t,e,n){return O.filter(t,function(t,r,i){return!e.call(n,t,r,i)},n)},O.every=O.all=function(t,e,n){e||(e=O.identity);var r=!0;return null==t?r:g&&t.every===g?t.every(e,n):(N(t,function(t,u,o){if(!(r=r&&e.call(n,t,u,o)))return i}),!!r)};var j=O.some=O.any=function(t,e,n){e||(e=O.identity);var r=!1;return null==t?r:y&&t.some===y?t.some(e,n):(N(t,function(t,u,o){if(r||(r=e.call(n,t,u,o)))return i}),!!r)};O.contains=O.include=function(t,e){return null!=t&&(b&&t.indexOf===b?-1!=t.indexOf(e):j(t,function(t){return t===e}))},O.invoke=function(t,e){var n=c.call(arguments,2),r=O.isFunction(e);return O.map(t,function(t){return(r?e:t[e]).apply(t,n)})},O.pluck=function(t,e){return O.map(t,function(t){return t[e]})},O.where=function(t,e,n){return O.isEmpty(e)?n?void 0:[]:O[n?"find":"filter"](t,function(t){for(var n in e)if(e[n]!==t[n])return!1;return!0})},O.findWhere=function(t,e){return O.where(t,e,!0)},O.max=function(t,e,n){if(!e&&O.isArray(t)&&t[0]===+t[0]&&t.length<65535)return Math.max.apply(Math,t);if(!e&&O.isEmpty(t))return-1/0;var r={computed:-1/0,value:-1/0};return N(t,function(t,i,u){var o=e?e.call(n,t,i,u):t;o>r.computed&&(r={value:t,computed:o})}),r.value},O.min=function(t,e,n){if(!e&&O.isArray(t)&&t[0]===+t[0]&&t.length<65535)return Math.min.apply(Math,t);if(!e&&O.isEmpty(t))return 1/0;var r={computed:1/0,value:1/0};return N(t,function(t,i,u){var o=e?e.call(n,t,i,u):t;o<r.computed&&(r={value:t,computed:o})}),r.value},O.shuffle=function(t){var e,n=0,r=[];return N(t,function(t){e=O.random(n++),r[n-1]=r[e],r[e]=t}),r},O.sample=function(t,e,n){return arguments.length<2||n?t[O.random(t.length-1)]:O.shuffle(t).slice(0,Math.max(0,e))};var x=function(t){return O.isFunction(t)?t:function(e){return e[t]}};O.sortBy=function(t,e,n){var r=x(e);return O.pluck(O.map(t,function(t,e,i){return{value:t,index:e,criteria:r.call(n,t,e,i)}}).sort(function(t,e){var n=t.criteria,r=e.criteria;if(n!==r){if(n>r||void 0===n)return 1;if(n<r||void 0===r)return-1}return t.index-e.index}),"value")};var T=function(t){return function(e,n,r){var i={},u=null==n?O.identity:x(n);return N(e,function(n,o){var a=u.call(r,n,o,e);t(i,a,n)}),i}};O.groupBy=T(function(t,e,n){(O.has(t,e)?t[e]:t[e]=[]).push(n)}),O.indexBy=T(function(t,e,n){t[e]=n}),O.countBy=T(function(t,e){O.has(t,e)?t[e]++:t[e]=1}),O.sortedIndex=function(t,e,n,r){n=null==n?O.identity:x(n);for(var i=n.call(r,e),u=0,o=t.length;u<o;){var a=u+o>>>1;n.call(r,t[a])<i?u=a+1:o=a}return u},O.toArray=function(t){return t?O.isArray(t)?c.call(t):t.length===+t.length?O.map(t,O.identity):O.values(t):[]},O.size=function(t){return null==t?0:t.length===+t.length?t.length:O.keys(t).length},O.first=O.head=O.take=function(t,e,n){if(null!=t)return null==e||n?t[0]:c.call(t,0,e)},O.initial=function(t,e,n){return c.call(t,0,t.length-(null==e||n?1:e))},O.last=function(t,e,n){if(null!=t)return null==e||n?t[t.length-1]:c.call(t,Math.max(t.length-e,0))},O.rest=O.tail=O.drop=function(t,e,n){return c.call(t,null==e||n?1:e)},O.compact=function(t){return O.filter(t,O.identity)};var I=function(t,e,n){return e&&O.every(t,O.isArray)?l.apply(n,t):(N(t,function(t){O.isArray(t)||O.isArguments(t)?e?s.apply(n,t):I(t,e,n):n.push(t)}),n)};O.flatten=function(t,e){return I(t,e,[])},O.without=function(t){return O.difference(t,c.call(arguments,1))},O.uniq=O.unique=function(t,e,n,r){O.isFunction(e)&&(r=n,n=e,e=!1);var i=n?O.map(t,n,r):t,u=[],o=[];return N(i,function(n,r){(e?r&&o[o.length-1]===n:O.contains(o,n))||(o.push(n),u.push(t[r]))}),u},O.union=function(){return O.uniq(O.flatten(arguments,!0))},O.intersection=function(t){var e=c.call(arguments,1);return O.filter(O.uniq(t),function(t){return O.every(e,function(e){return O.indexOf(e,t)>=0})})},O.difference=function(t){var e=l.apply(u,c.call(arguments,1));return O.filter(t,function(t){return!O.contains(e,t)})},O.zip=function(){for(var t=O.max(O.pluck(arguments,"length").concat(0)),e=new Array(t),n=0;n<t;n++)e[n]=O.pluck(arguments,""+n);return e},O.object=function(t,e){if(null==t)return{};for(var n={},r=0,i=t.length;r<i;r++)e?n[t[r]]=e[r]:n[t[r][0]]=t[r][1];return n},O.indexOf=function(t,e,n){if(null==t)return-1;var r=0,i=t.length;if(n){if("number"!=typeof n)return r=O.sortedIndex(t,e),t[r]===e?r:-1;r=n<0?Math.max(0,i+n):n}if(b&&t.indexOf===b)return t.indexOf(e,n);for(;r<i;r++)if(t[r]===e)return r;return-1},O.lastIndexOf=function(t,e,n){if(null==t)return-1;var r=null!=n;if(C&&t.lastIndexOf===C)return r?t.lastIndexOf(e,n):t.lastIndexOf(e);for(var i=r?n:t.length;i--;)if(t[i]===e)return i;return-1},O.range=function(t,e,n){arguments.length<=1&&(e=t||0,t=0),n=arguments[2]||1;for(var r=Math.max(Math.ceil((e-t)/n),0),i=0,u=new Array(r);i<r;)u[i++]=t,t+=n;return u};var R=function(){};O.bind=function(t,e){var n,r;if(A&&t.bind===A)return A.apply(t,c.call(arguments,1));if(!O.isFunction(t))throw new TypeError;return n=c.call(arguments,2),r=function(){if(!(this instanceof r))return t.apply(e,n.concat(c.call(arguments)));R.prototype=t.prototype;var i=new R;R.prototype=null;var u=t.apply(i,n.concat(c.call(arguments)));return Object(u)===u?u:i}},O.partial=function(t){var e=c.call(arguments,1);return function(){return t.apply(this,e.concat(c.call(arguments)))}},O.bindAll=function(t){var e=c.call(arguments,1);if(0===e.length)throw new Error("bindAll must be passed function names");return N(e,function(e){t[e]=O.bind(t[e],t)}),t},O.memoize=function(t,e){var n={};return e||(e=O.identity),function(){var r=e.apply(this,arguments);return O.has(n,r)?n[r]:n[r]=t.apply(this,arguments)}},O.delay=function(t,e){var n=c.call(arguments,2);return setTimeout(function(){return t.apply(null,n)},e)},O.defer=function(t){return O.delay.apply(O,[t,1].concat(c.call(arguments,1)))},O.throttle=function(t,e,n){var r,i,u,o=null,a=0;n||(n={});var s=function(){a=!1===n.leading?0:new Date,o=null,u=t.apply(r,i)};return function(){var c=new Date;a||!1!==n.leading||(a=c);var l=e-(c-a);return r=this,i=arguments,l<=0?(clearTimeout(o),o=null,a=c,u=t.apply(r,i)):o||!1===n.trailing||(o=setTimeout(s,l)),u}},O.debounce=function(t,e,n){var r,i,u,o,a;return function(){u=this,i=arguments,o=new Date;var s=function(){var c=new Date-o;c<e?r=setTimeout(s,e-c):(r=null,n||(a=t.apply(u,i)))},c=n&&!r;return r||(r=setTimeout(s,e)),c&&(a=t.apply(u,i)),a}},O.once=function(t){var e,n=!1;return function(){return n?e:(n=!0,e=t.apply(this,arguments),t=null,e)}},O.wrap=function(t,e){return function(){var n=[t];return s.apply(n,arguments),e.apply(this,n)}},O.compose=function(){var t=arguments;return function(){for(var e=arguments,n=t.length-1;n>=0;n--)e=[t[n].apply(this,e)];return e[0]}},O.after=function(t,e){return function(){if(--t<1)return e.apply(this,arguments)}},O.keys=S||function(t){if(t!==Object(t))throw new TypeError("Invalid object");var e=[];for(var n in t)O.has(t,n)&&e.push(n);return e},O.values=function(t){for(var e=O.keys(t),n=e.length,r=new Array(n),i=0;i<n;i++)r[i]=t[e[i]];return r},O.pairs=function(t){for(var e=O.keys(t),n=e.length,r=new Array(n),i=0;i<n;i++)r[i]=[e[i],t[e[i]]];return r},O.invert=function(t){for(var e={},n=O.keys(t),r=0,i=n.length;r<i;r++)e[t[n[r]]]=n[r];return e},O.functions=O.methods=function(t){var e=[];for(var n in t)O.isFunction(t[n])&&e.push(n);return e.sort()},O.extend=function(t){return N(c.call(arguments,1),function(e){if(e)for(var n in e)t[n]=e[n]}),t},O.pick=function(t){var e={},n=l.apply(u,c.call(arguments,1));return N(n,function(n){n in t&&(e[n]=t[n])}),e},O.omit=function(t){var e={},n=l.apply(u,c.call(arguments,1));for(var r in t)O.contains(n,r)||(e[r]=t[r]);return e},O.defaults=function(t){return N(c.call(arguments,1),function(e){if(e)for(var n in e)void 0===t[n]&&(t[n]=e[n])}),t},O.clone=function(t){return O.isObject(t)?O.isArray(t)?t.slice():O.extend({},t):t},O.tap=function(t,e){return e(t),t};var k=function(t,e,n,r){if(t===e)return 0!==t||1/t==1/e;if(null==t||null==e)return t===e;t instanceof O&&(t=t._wrapped),e instanceof O&&(e=e._wrapped);var i=f.call(t);if(i!=f.call(e))return!1;switch(i){case"[object String]":return t==String(e);case"[object Number]":return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case"[object Date]":case"[object Boolean]":return+t==+e;case"[object RegExp]":return t.source==e.source&&t.global==e.global&&t.multiline==e.multiline&&t.ignoreCase==e.ignoreCase}if("object"!=typeof t||"object"!=typeof e)return!1;for(var u=n.length;u--;)if(n[u]==t)return r[u]==e;var o=t.constructor,a=e.constructor;if(o!==a&&!(O.isFunction(o)&&o instanceof o&&O.isFunction(a)&&a instanceof a))return!1;n.push(t),r.push(e);var s=0,c=!0;if("[object Array]"==i){if(s=t.length,c=s==e.length)for(;s--&&(c=k(t[s],e[s],n,r)););}else{for(var l in t)if(O.has(t,l)&&(s++,!(c=O.has(e,l)&&k(t[l],e[l],n,r))))break;if(c){for(l in e)if(O.has(e,l)&&!s--)break;c=!s}}return n.pop(),r.pop(),c};O.isEqual=function(t,e){return k(t,e,[],[])},O.isEmpty=function(t){if(null==t)return!0;if(O.isArray(t)||O.isString(t))return 0===t.length;for(var e in t)if(O.has(t,e))return!1;return!0},O.isElement=function(t){return!(!t||1!==t.nodeType)},O.isArray=w||function(t){return"[object Array]"==f.call(t)},O.isObject=function(t){return t===Object(t)},N(["Arguments","Function","String","Number","Date","RegExp"],function(t){O["is"+t]=function(e){return f.call(e)=="[object "+t+"]"}}),O.isArguments(arguments)||(O.isArguments=function(t){return!(!t||!O.has(t,"callee"))}),O.isFunction=function(t){return"function"==typeof t},O.isFinite=function(t){return isFinite(t)&&!isNaN(parseFloat(t))},O.isNaN=function(t){return O.isNumber(t)&&t!=+t},O.isBoolean=function(t){return!0===t||!1===t||"[object Boolean]"==f.call(t)},O.isNull=function(t){return null===t},O.isUndefined=function(t){return void 0===t},O.has=function(t,e){return d.call(t,e)},O.noConflict=function(){return n._=r,this},O.identity=function(t){return t},O.times=function(t,e,n){for(var r=Array(Math.max(0,t)),i=0;i<t;i++)r[i]=e.call(n,i);return r},O.random=function(t,e){return null==e&&(e=t,t=0),t+Math.floor(Math.random()*(e-t+1))};var P={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};P.unescape=O.invert(P.escape);var D={escape:new RegExp("["+O.keys(P.escape).join("")+"]","g"),unescape:new RegExp("("+O.keys(P.unescape).join("|")+")","g")};O.each(["escape","unescape"],function(t){O[t]=function(e){return null==e?"":(""+e).replace(D[t],function(e){return P[t][e]})}}),O.result=function(t,e){if(null!=t){var n=t[e];return O.isFunction(n)?n.call(t):n}},O.mixin=function(t){N(O.functions(t),function(e){var n=O[e]=t[e];O.prototype[e]=function(){var t=[this._wrapped];return s.apply(t,arguments),G.call(this,n.apply(O,t))}})};var M=0;O.uniqueId=function(t){var e=++M+"";return t?t+e:e},O.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var L=/(.)^/,U={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},F=/\\|'|\r|\n|\t|\u2028|\u2029/g;O.template=function(t,e,n){var r;n=O.defaults({},n,O.templateSettings);var i=new RegExp([(n.escape||L).source,(n.interpolate||L).source,(n.evaluate||L).source].join("|")+"|$","g"),u=0,o="__p+='";t.replace(i,function(e,n,r,i,a){return o+=t.slice(u,a).replace(F,function(t){return"\\"+U[t]}),n&&(o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),r&&(o+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),i&&(o+="';\n"+i+"\n__p+='"),u=a+e.length,e}),o+="';\n",n.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{r=new Function(n.variable||"obj","_",o)}catch(t){throw t.source=o,t}if(e)return r(e,O);var a=function(t){return r.call(this,t,O)};return a.source="function("+(n.variable||"obj")+"){\n"+o+"}",a},O.chain=function(t){return O(t).chain()};var G=function(t){return this._chain?O(t).chain():t};O.mixin(O),N(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=u[t];O.prototype[t]=function(){var n=this._wrapped;return e.apply(n,arguments),"shift"!=t&&"splice"!=t||0!==n.length||delete n[0],G.call(this,n)}}),N(["concat","join","slice"],function(t){var e=u[t];O.prototype[t]=function(){return G.call(this,e.apply(this._wrapped,arguments))}}),O.extend(O.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this)},function(t,e,n){var r=n(26)("wks"),i=n(28),u=n(3).Symbol,o="function"==typeof u;(t.exports=function(t){return r[t]||(r[t]=o&&u[t]||(o?u:i)("Symbol."+t))}).store=r},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u,o,a,s,c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l=n(0),f=r(l),d=n(5),h=n(6),_=n(35),p=r(_),v=n(49),m=r(v),g=n(50),y=r(g),b=n(17),C=r(b),w=n(36),S=r(w),A=n(52),O=r(A),N=n(7),E=r(N),j=n(9),x=r(j),T=n(53),I=r(T),R=n(10),k=r(R),P=n(1),D=r(P);o=[],s=o.slice,u={},e.default=i=function(t,e){var n;if(D.default.isString(t))return i._create.apply(this,arguments);if(n=t||{},e||(e={}),this.cid=D.default.uniqueId("c"),this.changed={},this._silent={},this._pending={},this._serverData={},this._hashedJSON={},this._escapedAttributes={},this._hasData=!0,this._previousAttributes=D.default.clone(this.attributes),this._atomicChangesQueue=[{}],this.attributes={},e.collection&&(this.collection=e.collection),e.parse&&(n=this.parse(n,e)||{}),n=D.default.defaults({},n,D.default.result(this,"defaults")),!this.set(n,{silent:!0}))throw new x.default("Can't create Nimbu.Object: invalid data");return this.initialize.apply(this,arguments)},D.default.extend(i.prototype,O.default,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(){var t;return t=this._toFullJSON(),(0,d._arrayEach)(["__type","__className"],function(e){return delete t[e]}),t},_toFullJSON:function(t){var e;return e=D.default.clone(this.attributes),(0,d._objectEach)(e,function(n,r){return e[r]=(0,h._encode)(n,t)}),(0,d._objectEach)(this._operations,function(t,n){return e[n]=t}),D.default.has(this,"id")&&(e.id=this.id),D.default.has(this,"created_at")&&(D.default.isDate(this.created_at)?e.created_at=this.created_at.toJSON():e.created_at=this.created_at),D.default.has(this,"updated_at")&&(D.default.isDate(this.updated_at)?e.updated_at=this.updated_at.toJSON():e.updated_at=this.updated_at),e.__type="Object",e.className=this.className,e},_refreshCache:function(){var t;if(t=this,!t._refreshingCache)return t._refreshingCache=!0,(0,d._objectEach)(this.attributes,function(e,n){return e instanceof i?e._refreshCache():D.default.isObject(e)&&t._resetCacheForKey(n)?t.set(n,new C.default.Set(e),{silent:!0}):void 0}),delete t._refreshingCache},get:function(t,e){var n;return e=e||u,n=this.attributes[t],n instanceof p.default&&!e.options?n=n.value:n instanceof m.default&&!e.options&&(n=n.values()),null!=n&&null!=n._ensureParentAndKey&&e.options&&n._ensureParentAndKey(this,t),n},escape:function(t){return D.default.escape(this.get(t))},has:function(t){return null!=this.get(t)},_mergeSystemFields:function(t){var e,n;return e=this,n=["id","short_id","created_at","updated_at"],(0,d._arrayEach)(n,function(n){if(t[n])return"id"===n?e.id=t[n]:"created_at"!==n&&"updated_at"!==n||D.default.isDate(t[n])?e[n]=t[n]:e[n]=(0,d._parseDate)(t[n]),delete t[n]})},set:function(t,e,n){var r,u,o;return r=void 0,void 0,D.default.isObject(t)||(0,d._isNullOrUndefined)(t)?(r=t,(0,d._objectEach)(r,function(t,e){return r[e]=(0,h._decode)(e,t)}),n=e):(r={},r[t]=(0,h._decode)(t,e)),n=n||{},r?(r instanceof i&&(r=r.attributes),n.unset&&(0,d._objectEach)(r,function(t,e){return r[e]=new C.default.Unset}),o=this,!!this._validate(r,n)&&(this._mergeSystemFields(r),n.changes={},u=this._escapedAttributes,this._previousAttributes||{},(0,d._arrayEach)(D.default.keys(r),function(t){var e,i,a;return a=r[t],(a instanceof y.default||a instanceof S.default||a instanceof m.default)&&(a.parent=o),a instanceof C.default||(a=new C.default.Set(a)),i=!0,a instanceof C.default.Set&&D.default.isEqual(o.attributes[t],a.value)&&(i=!1),i&&(delete u[t],n.silent?o._silent[t]=!0:n.changes[t]=!0),e=D.default.last(o._atomicChangesQueue),e[t]=a._mergeWithPrevious(e[t]),o._rebuildEstimatedDataForKey(t),i?(o.changed[t]=o.attributes[t],n.silent?void 0:o._pending[t]=!0):(delete o.changed[t],delete o._pending[t])}),n.silent||this.change(n),this)):this},unset:function(t,e){return e=e||{},e.unset=!0,this.set(t,null,e)},increment:function(t,e){return null==e&&(e=1),this.set(t,new C.default.Increment(e))},clear:function(t){var e,n;e={};for(n in this.attributes)e[n]=void 0;return this.set(e,D.default.extend({},t,{unset:!0}))},_toReference:function(){if(!this.id)throw new x.default("Can't serialize an unsaved Nimbu.Object");return{__type:"Reference",className:this.className,id:this.id}},relation:function(t){var e;if(e=this.get(t)){if(!(e instanceof y.default))throw"Called relation() on non-relation field "+t;return e._ensureParentAndKey(this,t),e}return new y.default(this,t)},gallery:function(t){var e;if(e=this.get(t)){if(!(e instanceof S.default))throw"Called gallery() on a non-gallery field "+t;return e._ensureParentAndKey(this,t),e}return new S.default(this,t)},file:function(t){var e;if(e=this.get(t)){if(!(e instanceof I.default))throw"Called file() on a non-file field"+t;return e._ensureParentAndKey(this,t),e}},hasChanged:function(t){return null==t?!D.default.isEmpty(this.changed):D.default.has(this.changed,t)},changedAttributes:function(t){var e,n,r,i;if(!t)return!!this.hasChanged()&&D.default.clone(this.changed);i=void 0,n=!1,r=this._changing?this._previousAttributes:this.attributes;for(e in t)D.default.isEqual(r[e],i=t[e])||((n||(n={}))[e]=i);return n},previous:function(t){return null!=t&&this._previousAttributes?this._previousAttributes[t]:null},previousAttributes:function(){return D.default.clone(this._previousAttributes)},fetch:function(t){var e,n;return n=this,t=t||{},e=(0,k.default)({method:"GET",route:"objects",className:this.className,id:this.id,useACL:t.useACL,forceChannel:t.forceChannel}),e.then(function(t,e,r){return n._finishFetch(n.parse(t,e,r),!0),n})._thenRunCallbacks(t,this)},save:function(t,e,n){var r,i,u,o,a,s,l,f;return i=void 0,a=void 0,void 0,this.attributes,null==t||"object"===(void 0===t?"undefined":c(t))?(i=t,n=e):(i={})[t]=e,!(n=D.default.extend({validate:!0},n))&&i&&(o=D.default.reject(i,function(t,e){return D.default.include(["success","error","wait"],e)}),0===o.length&&(r=!0,D.default.has(i,"success")&&!D.default.isFunction(i.success)&&(r=!1),D.default.has(i,"error")&&!D.default.isFunction(i.error)&&(r=!1),r))?this.save(null,i):(n=D.default.clone(n)||{},n.wait&&(u=D.default.clone(this.attributes)),f=D.default.clone(n)||{},f.wait&&(f.silent=!0),l=void 0,f.error=function(t,e){return l=e},i&&!this.set(i,f)?E.default.error(l)._thenRunCallbacks(n,this):(s=this,s._refreshCache(),[],this._startSave(),this._saving=(this._saving||0)+1,this._allPreviousSaves=this._allPreviousSaves||E.default.as(),this._allPreviousSaves=this._allPreviousSaves._continueWith(function(){var t,e,r,o;return a=s.id?"PUT":"POST",e=s._getSaveJSON(),o="objects",t=s.className,"_Customer"!==s.className||s.id||(o="customers",t=null),r=(0,k.default)({route:o,className:t,id:s.id,method:a,data:e,useACL:n.useACL,forceChannel:n.forceChannel}),r=r.then(function(t,e,r){var o;return o=s.parse(t,e,r),n.wait&&(o=D.default.extend(i||{},o)),s._finishSave(o),n.wait&&s.set(u,f),s},function(t){return s._cancelSave(),E.default.error(t)})._thenRunCallbacks(n,s)}),this._allPreviousSaves))},destroy:function(t){var e,n,r;return t=t||{},e=this,r=function(){return e.trigger("destroy",e,e.collection,t)},this.id?(t.wait||r(),n=(0,k.default)({route:"objects",className:this.className,id:this.id,method:"DELETE",useACL:t.useACL,forceChannel:t.forceChannel}),n.then(function(){return t.wait&&r(),e})._thenRunCallbacks(t,this)):r()},url:function(){var t;return t=D.default.result(this,"urlRoot")||D.default.result(this.collection,"url")||urlError(),this.isNew()?t:t.replace(/([^\/])$/,"$1/")+encodeURIComponent(this.id)},parse:function(t,e,n){var r;return r=D.default.clone(t),(0,D.default)(["created_at","updated_at"]).each(function(t){if(r[t])return r[t]=(0,d._parseDate)(r[t])}),r.updated_at||(r.updated_at=r.created_at),e&&(this._existed=201!==e),r},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},getACL:function(){return this.get("_acl")},setACL:function(t,e){return this.set("_acl",t,e)},change:function(t){var e,n,r,i;if(t=t||{},n=this._changing,this._changing=!0,i=this,(0,d._objectEach)(this._silent,function(t){return i._pending[t]=!0}),e=D.default.extend({},t.changes,this._silent),this._silent={},(0,d._objectEach)(e,function(e,n){return i.trigger("change:"+n,i,i.get(n),t)}),n)return this;for(r=function(t,e){if(!i._pending[e]&&!i._silent[e])return delete i.changed[e]};!D.default.isEmpty(this._pending);)this._pending={},this.trigger("change",this,t),(0,d._objectEach)(this.changed,r),i._previousAttributes=D.default.clone(this.attributes);return this._changing=!1,this},isValid:function(t){return this._validate({},D.default.extend(t||{},{validate:!0}))},validate:function(t,e){var n;return!D.default.has(t,"_acl")||t._acl instanceof f.default.ACL?(n=!0,(0,d._objectEach)(t,function(t,e){if(!/^[A-Za-z][0-9A-Za-z_]*$/.test(e))return n=!1}),!n&&new x.default(x.default.INVALID_KEY_NAME)):new x.default(x.default.OTHER_CAUSE,"ACL must be a Nimbu.ACL.")},_getSaveJSON:function(){var t;return t=D.default.clone(D.default.first(this._atomicChangesQueue)),(0,d._objectEach)(t,function(e,n){return t[n]=e.toJSON()}),t},_validate:function(t,e){var n;return!e.validate||!this.validate||(t=D.default.extend({},this.attributes,t),!(n=this.validationError=this.validate(t,e)||null)||(this.trigger("invalid",this,n,D.default.extend(e,{validationError:n})),!1))},_startSave:function(){return this._atomicChangesQueue.push({})},_cancelSave:function(){var t,e;return this,t=D.default.first(this._atomicChangesQueue),this._atomicChangesQueue=D.default.rest(this._atomicChangesQueue),e=D.default.first(this._atomicChangesQueue),(0,d._objectEach)(t,function(n,r){var i,u;return i=t[r],u=e[r],i&&u?e[r]=u._mergeWithPrevious(i):i?e[r]=i:void 0}),this._saving=this._saving-1},_finishSave:function(t){var e,n,r;return e={},(0,h._traverse)(this.attributes,function(t){if(t instanceof i&&t.id&&t._hasData)return e[t.id]=t}),n=D.default.first(this._atomicChangesQueue),this._atomicChangesQueue=D.default.rest(this._atomicChangesQueue),this._applyOpSet(n,this._serverData),this._mergeSystemFields(t),r=this,(0,d._objectEach)(t,function(t,n){var u,o;if(o=(0,h._decode)(n,t),(o instanceof y.default||o instanceof S.default)&&(o.parent=r),r._serverData[n]=o,u=(0,h._traverse)(r._serverData[n],function(t){if(t instanceof i&&e[t.id])return e[t.id]}))return r._serverData[n]=u}),this._rebuildAllEstimatedData(),this._saving=this._saving-1},_finishFetch:function(t,e){var n,r;return this._atomicChangesQueue=[{}],this._mergeSystemFields(t),n=this,r={},(0,d._objectEach)(t,function(t,e){var i;return i=(0,h._decode)(e,t),(i instanceof y.default||i instanceof S.default)&&(i.parent=n),r[e]=i}),n._serverData=r,this._rebuildAllEstimatedData(),this._refreshCache(),this._atomicChangesQueue=[{}],this._hasData=e},_applyOpSet:function(t,e){var n;return n=this,(0,d._objectEach)(t,function(t,r){if(e[r]=t._estimate(e[r],n,r),e[r]===C.default._UNSET)return delete e[r]})},_resetCacheForKey:function(t){var e,n;return n=this.attributes[t],!(!D.default.isObject(n)||n instanceof i||(n=n.toJSON?n.toJSON():n,e=JSON.stringify(n),this._hashedJSON[t]===e))&&(this._hashedJSON[t]=e,!0)},_rebuildEstimatedDataForKey:function(t){var e;e=this,delete this.attributes[t],this._serverData[t]&&(this.attributes[t]=this._serverData[t]),(0,d._arrayEach)(this._atomicChangesQueue,function(n){var r;if(r=n[t])return e.attributes[t]=r._estimate(e.attributes[t],e,t),e.attributes[t]===C.default._UNSET?delete e.attributes[t]:e._resetCacheForKey(t)})},_rebuildAllEstimatedData:function(){var t,e;return e=this,t=D.default.clone(this.attributes),this.attributes=D.default.clone(this._serverData),(0,d._arrayEach)(this._atomicChangesQueue,function(t){return e._applyOpSet(t,e.attributes),(0,d._objectEach)(t,function(t,n){return e._resetCacheForKey(n)})}),(0,d._objectEach)(t,function(t,n){if(e.attributes[n]!==t)return e.trigger("change:"+n,e,e.attributes[n],{})}),(0,d._objectEach)(this.attributes,function(n,r){if(!D.default.has(t,r))return e.trigger("change:"+r,e,n,{})})}}),a=["keys","values","pairs","invert","pick","omit"],D.default.each(a,function(t){return i.prototype[t]=function(){var e;return e=s.call(arguments),e.unshift(this.attributes),D.default[t].apply(D.default,e)}}),i._getSubclass=function(t){var e;if(!D.default.isString(t))throw"Nimbu.Object._getSubclass requires a string argument.";return e=i._classMap[t],e||(e=i.extend(t),i._classMap[t]=e),e},i._create=function(t,e,n){return new(i._getSubclass(t))(e,n)},i._classMap={},i._extend=d._extend,i.config=function(t){var e;return this,t=t||{},e=(0,k.default)({method:"GET",route:"objects",className:this.prototype.className,id:"customizations",forceChannel:t.forceChannel}),e.then(function(t,e,n){return t})._thenRunCallbacks(t,null)},i.extend=function(t,e,n){var r,u;if(!D.default.isString(t)){if(t&&D.default.has(t,"className"))return i.extend(t.className,t,e);throw new x.default("Nimbu.Object.extend's first argument should be the className.")}return e=e||{},e.className=t,r=null,D.default.has(i._classMap,t)?(u=i._classMap[t],r=u._extend(e,n)):r=this._extend(e,n),r.extend=function(e){var n;return D.default.isString(e)||e&&D.default.has(e,"className")?i.extend.apply(r,arguments):(n=[t].concat(D.default.toArray(arguments)),i.extend.apply(r,n))},i._classMap[t]=r,r},i.setDefaultGetOptions=function(t){return u=t},f.default.Object=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e._toQueryString=e._parseDate=e._getValue=e._toUnderscore=e._toCamel=e._trim=e._isNullOrUndefined=e._each=e._objectEach=e._arrayEach=e._extend=void 0;var r,i,u=n(1),o=function(t){return t&&t.__esModule?t:{default:t}}(u);r=function(){},i=function(t,e,n){var i;return i=void 0,i=e&&e.hasOwnProperty("constructor")?e.constructor:function(){return t.apply(this,arguments)},o.default.extend(i,t),r.prototype=t.prototype,i.prototype=new r,e&&o.default.extend(i.prototype,e),n&&o.default.extend(i,n),i.prototype.constructor=i,i.__super__=t.prototype,i};var a=(e._extend=function(t,e){var n;return n=i(this,t,e),n.extend=this.extend,n},e._arrayEach=o.default.each,e._objectEach=function(t,e){return o.default.isObject(t)?o.default.each(o.default.keys(t),function(n){return e(t[n],n)}):o.default.each(t,e)});e._each=a,e._isNullOrUndefined=function(t){return o.default.isNull(t)||o.default.isUndefined(t)},e._trim=function(t){return t.replace(/^\s+|\s+$/g,"")},e._toCamel=function(t){return t.replace(/(\_[a-z])/g,function(t){return t.toUpperCase().replace("_","")})},e._toUnderscore=function(t){return t.replace(/([A-Z])/g,function(t){return"_"+t.toLowerCase()})},e._getValue=function(t,e){return t&&t[e]?o.default.isFunction(t[e])?t[e]():t[e]:null},e._parseDate=function(t){var e,n,r,i,u,o,a,s,c;return a=new RegExp("^([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2})T([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})(.([0-9]+))?Z$"),(r=a.exec(t))?(c=r[1]||0,o=(r[2]||1)-1,e=r[3]||0,n=r[4]||0,u=r[5]||0,s=r[6]||0,i=r[8]||0,new Date(Date.UTC(c,o,e,n,u,s,i))):null},e._toQueryString=function(t){var e,n;n=[];for(e in t)t.hasOwnProperty(e)&&n.push(encodeURIComponent(e)+"="+encodeURIComponent(t[e]));return n.join("&")}},function(t,e,n){"use strict";(function(t){function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e._traverse=e._decode=e._encode=e._getInstallationId=e._getStoragePath=e.useSSO=e.useACL=e.initialize=e._useACL=e.accessToken=e._isNode=e.endpoint=e.isIE=void 0;var i,u,o,a,s=n(5),c=n(0),l=r(c),f=n(1),d=r(f),h=n(24),_=r(h),p=(e.isIE=function(){var t;return"undefined"!=typeof navigator&&null!==navigator&&null!=navigator.userAgent&&(t=navigator.userAgent.toLowerCase(),-1!==t.indexOf("msie")&&parseInt(t.split("msie")[1]))},e.endpoint="https://api.nimbu.io"),v=(e._isNode=!(void 0===t||null===t||!t.versions||!t.versions.node),e.accessToken=void 0),m=e._useACL=!1;a=!1,o=null;e.initialize=function(t,n,r){return e.accessToken=v=t,e._useACL=m=!1,a=!1,null!=n&&(e.endpoint=p=n),null!=r&&(o=r),u().then(function(){return l.default.Customer._initCurrent()})},e.useACL=function(){return e._useACL=m=!0};i="sso";var g=(e.useSSO=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return a=t},e._getStoragePath=function(t){var e;if(!v)throw"You need to call Nimbu.initialize before using the SDK.";if(t||(t=""),!d.default.isString(t))throw"Tried to get a storage path that wasn't a String.";return"/"===t[0]&&(t=t.substring(1)),e=v,a&&(e=i),"nimbu/"+e+"/"+t});e._getInstallationId=function(){if(o)return o;throw"You need to call Nimbu.initialize before using the SDK."};u=function(){var t,e;return null!=o&&""!==o?l.default.Future.as(o):(e=g("installationId"),t=new l.default.Future,_.default.getItem(e).then(function(n){var r;return o=n,o&&""!==o?t.resolve(o):(r=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)},o=r()+r()+"-"+r()+"-"+r()+"-"+r()+"-"+r()+r()+r(),_.default.setItem(e,o).then(t.resolve(o)))}),t)};e._encode=function t(e,n,r){var i;if(e instanceof l.default.Object){if(r)throw"Nimbu.Objects not allowed here";if(!n||d.default.include(n,e)||!e._hasData)return e._toReference();if(!e.dirty())return n=n.concat(e),t(e._toFullJSON(n),n,r);throw"Tried to save an object with a pointer to a new, unsaved object."}return e instanceof l.default.ACL?e.toJSON():d.default.isDate(e)?e.toJSON():d.default.isArray(e)?d.default.map(e,function(e){return t(e,n,r)}):d.default.isRegExp(e)?e.source:e instanceof l.default.Relation?e.toJSON():e instanceof l.default.File?e.toJSON():e instanceof l.default.Gallery?e.toJSON():e instanceof l.default.GalleryImage?e.toJSON():e instanceof l.default.SelectOption?e.toJSON():e instanceof l.default.SelectOptionList?e.toJSON():d.default.isObject(e)?(i={},(0,s._objectEach)(e,function(e,u){return i[u]=t(e,n,r)}),i):e},e._decode=function t(e,n){var r,i,u,o,a,c,f;return d.default.isString(n)&&null!=(i=(0,s._parseDate)(n))?i:d.default.isObject(n)?d.default.isArray(n)?((0,s._arrayEach)(n,function(e,r){return n[r]=t(r,e)}),n):n instanceof l.default.Object?n:n instanceof l.default.Atomic?n:"_acl"===e?n instanceof l.default.ACL?n:new l.default.ACL(n):"File"===n.__type?new l.default.File(n.filename,n):"Select"===n.__type?new l.default.SelectOption(n.id,n.value):"MultiSelect"===n.__type?l.default.SelectOptionList._decode(null,e,n):"Reference"===n.__type?(a=l.default.Object._create(n.className),a._finishFetch({id:n.id},!1),a):"Object"===n.__type?(r=n.className,delete n.__type,delete n.className,o=l.default.Object._create(r),o._finishFetch(n,!0),o):"Relation"===n.__type?(f=d.default.map(n.objects,function(e,n){return t(n,e)}),c=new l.default.Relation(null,e,f),c.targetClassName=n.className,c):"Gallery"===n.__type?(u=d.default.map(n.images,function(e){return t("image",e)}),new l.default.Gallery(null,e,u)):"GalleryImage"===n.__type?(n.file=t("file",n.file),new l.default.GalleryImage(n)):((0,s._objectEach)(n,function(e,r){return n[r]=t(r,e)}),n):n},e._traverse=function t(e,n,r){if(e instanceof l.default.Object){if(r=r||[],d.default.indexOf(r,e)>=0)return;return r.push(e),t(e.attributes,n,r),n(e)}return e instanceof l.default.GalleryImage?n(e):d.default.isArray(e)?(d.default.each(e,function(i,u){var o;if(o=t(i,n,r))return e[u]=o}),n(e)):d.default.isObject(e)?((0,s._each)(e,function(i,u){var o;if(o=t(i,n,r))return e[u]=o}),n(e)):n(e)}}).call(e,n(37))},function(t,e,n){"use strict";(function(t){function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(5),s=n(1),c=r(s);e.default=i=function(){return this._resolved=!1,this._rejected=!1,this._resolvedCallbacks=[],this._rejectedCallbacks=[],!0},c.default.extend(i,{is:function(t){return t&&t.then&&c.default.isFunction(t.then)},as:function(){var t;return t=new i,t.resolve.apply(t,arguments),t},resolve:function(){var t;return t=new i,t.resolve.apply(t,arguments),t},error:function(){var t;return t=new i,t.reject.apply(t,arguments),t},reject:function(){var t;return t=new i,t.reject.apply(t,arguments),t},when:function(t){var e,n,r,u,o,s,c;return u=void 0,u=t&&(0,a._isNullOrUndefined)(t.length)?arguments:t,c=u.length,r=!1,s=[],e=[],s.length=u.length,e.length=u.length,0===c?i.as.apply(this,[s]):(n=new i,o=function(){if(0===(c-=1))return r?n.reject(e):n.resolve.apply(n,[s])},(0,a._arrayEach)(u,function(t,n){return i.is(t)?t.then(function(t){return s[n]=t,o()},function(t){return e[n]=t,r=!0,o()}):(s[n]=t,o())}),n)},_continueWhile:function(t,e){return t()?e().then(function(){return i._continueWhile(t,e)}):i.as()}}),c.default.extend(i.prototype,{resolve:function(t){var e;if(this._resolved||this._rejected)throw"A future was resolved even though it had already been "+(this._resolved?"resolved":"rejected")+".";return this._resolved=!0,this._result=arguments,e=arguments,(0,a._arrayEach)(this._resolvedCallbacks,function(t){return t.apply(this,e)}),this._resolvedCallbacks=[],this._rejectedCallbacks=[]},reject:function(t){if(this._resolved||this._rejected)throw"A future was rejected even though it had already been "+(this._resolved?"resolved":"rejected")+".";return this._rejected=!0,this._error=t,(0,a._arrayEach)(this._rejectedCallbacks,function(e){return e(t)}),this._resolvedCallbacks=[],this._rejectedCallbacks=[]},then:function(t,e){var n,r,u;return n=new i,u=function(){var e;return e=arguments,t&&(e=[t.apply(this,e)]),1===e.length&&i.is(e[0])?e[0].then(function(){return n.resolve.apply(n,arguments)},function(t){return n.reject(t)}):n.resolve.apply(n,e)},r=function(t){var r;return r=[],e?(r=[e(t)],1===r.length&&i.is(r[0])?r[0].then(function(){return n.resolve.apply(n,arguments)},function(t){return n.reject(t)}):n.reject(r[0])):n.reject(t)},this._resolved?u.apply(this,this._result):this._rejected?r(this._error):(this._resolvedCallbacks.push(u),this._rejectedCallbacks.push(r)),n},always:function(t){return this.then(t,t)},finally:function(t){return this.then(t,t)},done:function(t){return this.then(t)},fail:function(t){return this.then(null,t)},catch:function(t){return this.then(null,t)},_thenRunCallbacks:function(t,e){var n,r;return r=void 0,c.default.isFunction(t)?(n=t,r={success:function(t){return n(t,null)},error:function(t){return n(null,t)}}):r=c.default.clone(t),r=r||{},this.then(function(t){return r.success?r.success.apply(this,arguments):e&&e.trigger("sync",e,t,r),i.as.apply(i,arguments)},function(t){return r.error?c.default.isUndefined(e)?r.error(t):r.error(e,t):e&&e.trigger("error",e,t,r),i.error(t)})},_continueWith:function(t){return this.then(function(){return t(arguments,null)},function(e){return t(null,e)})},asPromise:function(){var e=this;return new t(function(t,n){return e.then(t,n)})}}),o.default.Future=i}).call(e,n(38))},function(t,e,n){var r=n(14);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(1),s=r(a);e.default=i=function(t,e){return this.code=t,this.message=e,!0},s.default.extend(i,{OTHER_CAUSE:-1,INTERNAL_SERVER_ERROR:1,CONNECTION_FAILED:100,OBJECT_NOT_FOUND:101,INVALID_QUERY:102,INVALID_CLASS_NAME:103,MISSING_OBJECT_ID:104,INVALID_KEY_NAME:105,INVALID_POINTER:106,INVALID_JSON:107,COMMAND_UNAVAILABLE:108,NOT_INITIALIZED:109,INCORRECT_TYPE:111,INVALID_CHANNEL_NAME:112,PUSH_MISCONFIGURED:115,OBJECT_TOO_LARGE:116,OPERATION_FORBIDDEN:119,CACHE_MISS:120,INVALID_NESTED_KEY:121,INVALID_FILE_NAME:122,INVALID_ACL:123,TIMEOUT:124,INVALID_EMAIL_ADDRESS:125,MISSING_CONTENT_TYPE:126,MISSING_CONTENT_LENGTH:127,INVALID_CONTENT_LENGTH:128,FILE_TOO_LARGE:129,FILE_SAVE_ERROR:130,FILE_DELETE_ERROR:153,DUPLICATE_VALUE:137,INVALID_ROLE_NAME:139,EXCEEDED_QUOTA:140,SCRIPT_FAILED:141,VALIDATION_ERROR:142,INVALID_IMAGE_DATA:150,UNSAVED_FILE_ERROR:151,INVALID_PUSH_TIME_ERROR:152,USERNAME_MISSING:200,PASSWORD_MISSING:201,USERNAME_TAKEN:202,EMAIL_TAKEN:203,EMAIL_MISSING:204,EMAIL_NOT_FOUND:205,SESSION_MISSING:206,MUST_CREATE_USER_THROUGH_SIGNUP:207,ACCOUNT_ALREADY_LINKED:208,LINKED_ID_MISSING:250,INVALID_LINKED_SESSION:251,UNSUPPORTED_SERVICE:252,AGGREGATE_ERROR:600}),o.default.Error=i},function(t,e,n){"use strict";(function(t){function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.enableChaos=e.setAjax=e._ajax=void 0;var i,u,o=n(0),a=r(o),s=n(23),c=r(s),l=n(6),f=n(9),d=r(f),h=n(7),_=r(h),p=n(1),v=r(p);u=!1,i=.95,e.default=function(t){var e,n,r,i,u,o,s,f,h,p,g,y,b,C,w;if(y=t.route,e=t.className,f=t.id,h=t.method,w=t.useACL,b=t.sessionToken,u=t.data,g=t.query,p=t.path,o=t.forceChannel,!l.accessToken)throw"You must specify your accessToken using Nimbu.initialize().";if(v.default.isUndefined(w)&&(w=l._useACL),b||(r=a.default.Customer.current())&&r.session_token&&(b=r.session_token),w&&null!=g?g+="&use_acl=1":w&&(g="use_acl=1"),!p){if("batch"!==y&&"objects"!==y&&"events"!==y&&"files"!==y&&"functions"!==y&&"login"!==y&&"push"!==y&&"customers"!==y&&"jobs"!==y)throw"Bad route: '"+y+"'.";"objects"===y&&(o?(y="channels","customizations"!==f&&(n="entries")):"customer"===e||"customers"===e?(y="customers",e=void 0):"product"===e||"products"===e?(y="products",e=void 0):"role"===e?(y="roles",e=void 0):"coupon"===e||"coupons"===e?(y="coupons",e=void 0):"order"===e||"orders"===e?(y="orders",e=void 0):"device"===e||"devices"===e?(y="devices",e=void 0):(y="channels","customizations"!==f&&(n="entries"))),"push"===y&&(y="devices",e="push"),p=y,e&&(p+="/"+e),n&&(p+="/"+n),f&&(p+="/"+f)}return C=l.endpoint,"/"!==C.charAt(C.length-1)&&(C+="/"),C+=p,g&&(C+="?"+g),u=v.default.clone(u||{}),s={},s._accessToken=l.accessToken,null!=b&&(s._sessionToken=b),s._clientVersion=c.default,s._installationId=(0,l._getInstallationId)(),i=JSON.stringify(u),m(h,C,i,s).then(null,function(t){var e,n;if(e=void 0,t&&t.responseText)try{n=JSON.parse(t.responseText),n&&(e=new d.default(n.code,n.message)),null!=n.errors&&(e.errors=n.errors)}catch(t){}return e=e||new d.default(-1,t.responseText),_.default.error(e)})};var m=e._ajax=function(e,n,r,o,s,f){var d,h,p,m,g;return v.default.isString(r)||(r=JSON.stringify(r)),m={success:s,error:f},u&&Math.random()>i?(d=a.default.Future.error("Chaos!"),d._thenRunCallbacks(m)):(h=new _.default,p=!1,g=new XMLHttpRequest,g.onreadystatechange=function(){var t,e;if(4===g.readyState){if(p)return;if(p=!0,!(g.status>=200&&g.status<300))return h.reject(g);e=void 0;try{e=204!==g.status?JSON.parse(g.responseText):""}catch(e){t=e,h.reject(t)}if(e||204===g.status)return h.resolve(e,g.status,g)}},g.open(e,n,!0),g.setRequestHeader("Content-Type","text/plain"),null!=o._accessToken&&g.setRequestHeader("X-Nimbu-Access-Token","token "+o._accessToken),null!=o._sessionToken&&g.setRequestHeader("X-Nimbu-Session-Token",o._sessionToken),null!=o._clientVersion&&g.setRequestHeader("X-Nimbu-Client-Version",o._clientVersion),null!=o._installationId&&g.setRequestHeader("X-Nimbu-Installation-Id",o._installationId),null!=o._csrfToken&&g.setRequestHeader("X-CSRF-Token",o._csrfToken),l._isNode&&g.setRequestHeader("User-Agent","Nimbu/"+c.default+" (NodeJS "+t.versions.node+")"),"GET"===e.toUpperCase()?g.send():g.send(r),h._thenRunCallbacks(m))};e.setAjax=function(t){return e._ajax=m=t},e.enableChaos=function(t){if(u=!0,null!=t)return i=1-t/100}}).call(e,n(37))},function(t,e){var n=t.exports={version:"2.6.5"};"number"==typeof __e&&(__e=n)},function(t,e,n){var r=n(19),i=n(40);t.exports=n(15)?function(t,e,n){return r.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(3),i=n(12),u=n(20),o=n(28)("src"),a=n(62),s=(""+a).split("toString");n(11).inspectSource=function(t){return a.call(t)},(t.exports=function(t,e,n,a){var c="function"==typeof n;c&&(u(n,"name")||i(n,"name",e)),t[e]!==n&&(c&&(u(n,o)||i(n,o,t[e]?""+t[e]:s.join(String(e)))),t===r?t[e]=n:a?t[e]?t[e]=n:i(t,e,n):(delete t[e],i(t,e,n)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[o]||a.call(this)})},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){t.exports=!n(39)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){t.exports={}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(6),s=n(5),c=n(4),l=r(c),f=n(36),d=r(f),h=n(51),_=r(h),p=n(1),v=r(p);e.default=i=function(){return this._initialize.apply(this,arguments),!0},i._extend=s._extend,i.prototype={_initialize:function(){}},v.default.extend(i,{_opDecoderMap:{},_registerDecoder:function(t,e){return i._opDecoderMap[t]=e},_decode:function(t){var e;return e=i._opDecoderMap[t.__op],e?e(t):void 0}}),i._registerDecoder("Batch",function(t){var e;return e=null,(0,s._arrayEach)(t.ops,function(t){return t=i._decode(t),e=t._mergeWithPrevious(e)}),e}),i.Set=i._extend({_initialize:function(t){return this._value=t},value:function(){return this._value},toJSON:function(){return(0,a._encode)(this.value())},_mergeWithPrevious:function(t){return this},_estimate:function(t){return this.value()}}),i._UNSET={},i.Unset=i._extend({toJSON:function(){return{__op:"Delete"}},_mergeWithPrevious:function(t){return this},_estimate:function(t){return i._UNSET}}),i._registerDecoder("Delete",function(t){return new i.Unset}),i.Increment=i._extend({_initialize:function(t){return this._amount=t},amount:function(){return this._amount},toJSON:function(){return{__op:"Increment",amount:this._amount}},_mergeWithPrevious:function(t){if(t){if(t instanceof i.Unset)return new i.Set(this.amount());if(t instanceof i.Set)return new i.Set(t.value()+this.amount());if(t instanceof i.Increment)return new i.Increment(this.amount()+t.amount());throw"Atomic is invalid after previous op."}return this},_estimate:function(t){return t?t+this.amount():this.amount()}}),i._registerDecoder("Increment",function(t){return new i.Increment(t.amount)}),i.Add=i._extend({_initialize:function(t){return this._objects=t},objects:function(){return this._objects},toJSON:function(){return{__op:"Add",objects:(0,a._encode)(this.objects())}},_mergeWithPrevious:function(t){if(t){if(t instanceof i.Unset)return new i.Set(this.objects());if(t instanceof i.Set)return new i.Set(this._estimate(t.value()));if(t instanceof i.Add)return new i.Add(t.objects().concat(this.objects()));throw"Atomic is invalid after previous op."}return this},_estimate:function(t){return t?t.concat(this.objects()):v.default.clone(this.objects())}}),i._registerDecoder("Add",function(t){return new i.Add((0,a._decode)(void 0,t.objects))}),i.AddUnique=i._extend({_initialize:function(t){return this._objects=v.default.uniq(t)},objects:function(){return this._objects},toJSON:function(){return{__op:"AddUnique",objects:(0,a._encode)(this.objects())}},_mergeWithPrevious:function(t){if(t){if(t instanceof i.Unset)return new i.Set(this.objects());if(t instanceof i.Set)return new i.Set(this._estimate(t.value()));if(t instanceof i.AddUnique)return new i.AddUnique(this._estimate(t.objects()));throw"Atomic is invalid after previous op."}return this},_estimate:function(t){var e;return t?(e=v.default.clone(t),(0,s._arrayEach)(this.objects(),function(t){var n,r;return t instanceof l.default&&t.id?(r=v.default.find(e,function(e){return e instanceof l.default&&e.id===t.id}),r?(n=v.default.indexOf(e,r),e[n]=t):e.push(t)):v.default.contains(e,t)?void 0:e.push(t)}),e):v.default.clone(this.objects())}}),i._registerDecoder("AddUnique",function(t){return new i.AddUnique((0,a._decode)(void 0,t.objects))}),i.Remove=i._extend({_initialize:function(t){return this._objects=v.default.uniq(t)},objects:function(){return this._objects},toJSON:function(){return{__op:"Remove",objects:(0,a._encode)(this.objects())}},_mergeWithPrevious:function(t){if(t){if(t instanceof i.Unset)return t;if(t instanceof i.Set)return new i.Set(this._estimate(t.value()));if(t instanceof i.Remove)return new i.Remove(v.default.union(t.objects(),this.objects()));throw"Atomic is invalid after previous op."}return this},_estimate:function(t){var e;return t?(e=v.default.difference(t,this.objects()),(0,s._arrayEach)(this.objects(),function(t){if(t instanceof l.default&&t.id)return e=v.default.reject(e,function(e){return e instanceof l.default&&e.id===t.id})}),e):[]}}),i._registerDecoder("Remove",function(t){return new i.Remove((0,a._decode)(void 0,t.objects))}),i.Relation=i._extend({_initialize:function(t,e){var n,r;return this._targetClassName=null,r=this,n=function(t){if(t instanceof l.default){if(!t.id)throw"You can't add an unsaved Nimbu.Object to a relation.";if(r._targetClassName||(r._targetClassName=t.className),r._targetClassName!==t.className)throw"Tried to create a Nimbu.Relation with 2 different types: "+r._targetClassName+" and "+t.className+".";return t.id}return t},this.referencesToAdd=v.default.uniq(v.default.map(t,n)),this.referencesToRemove=v.default.uniq(v.default.map(e,n))},added:function(){var t;return t=this,v.default.map(this.referencesToAdd,function(e){var n;return n=l.default._create(t._targetClassName),n.id=e,n})},removed:function(){var t;return t=this,v.default.map(this.referencesToRemove,function(e){var n;return n=l.default._create(t._targetClassName),n.id=e,n})},toJSON:function(){var t,e,n,r,i;return t=null,r=null,i=this,e=function(t){return{__type:"Reference",className:i._targetClassName,id:t}},n=null,this.referencesToAdd.length>0&&(n=v.default.map(this.referencesToAdd,e),t={__op:"AddReference",objects:n}),this.referencesToRemove.length>0&&(n=v.default.map(this.referencesToRemove,e),r={__op:"RemoveReference",objects:n}),t&&r?{__op:"Batch",changes:[t,r]}:t||r||{}},_mergeWithPrevious:function(t){var e,n,r;if(t){if(t instanceof i.Unset)throw"You can't modify a relation after deleting it.";if(t instanceof i.Relation){if(t._targetClassName&&t._targetClassName!==this._targetClassName)throw"Related object must be of class "+t._targetClassName+", but "+this._targetClassName+" was passed in.";return e=v.default.union(v.default.difference(t.referencesToAdd,this.referencesToRemove),this.referencesToAdd),r=v.default.union(v.default.difference(t.referencesToRemove,this.referencesToAdd),this.referencesToRemove),n=new i.Relation(e,r),n._targetClassName=this._targetClassName,n}throw"Atomic is invalid after previous op."}return this},_estimate:function(t,e,n){var r;if(t){if(t instanceof o.default.Relation){if(this._targetClassName)if(t.targetClassName){if(t.targetClassName!==this._targetClassName)throw"Related object must be a "+t.targetClassName+", but a "+this._targetClassName+" was passed in."}else t.targetClassName=this._targetClassName;return t}throw"Atomic is invalid after previous op."}return r=new o.default.Relation(e,n),r.targetClassName=this._targetClassName,r}}),i._registerDecoder("AddRelation",function(t){return new i.Relation((0,a._decode)(void 0,t.objects),[])}),i._registerDecoder("RemoveRelation",function(t){return new i.Relation([],(0,a._decode)(void 0,t.objects))}),i.Gallery=i._extend({_initialize:function(t,e,n){this._imagesToAdd=v.default.reject(t,function(t){return null!=(null!=t?t.id:void 0)}),this._idsToAdd=v.default.compact(v.default.map(t,function(t){return null!=t?t.id:void 0})),this._idsToRemove=v.default.compact(v.default.map(e,function(t){return null!=t?t.id:void 0})),this._imagesToRemove=v.default.reject(e,function(t){return null!=(null!=t?t.id:void 0)}),this._idsToUpdate=n},_additions:function(){return v.default.map(this._imagesToAdd,function(t){return t.toJSON()})},_removals:function(){return v.default.map(this._idsToRemove,function(t){return{__type:"GalleryImage",id:t,remove:!0}})},_updates:function(){return v.default.map(v.default.pairs(this._idsToUpdate),function(t){return v.default.extend({__type:"GalleryImage",id:t[0]},t[1])})},_images:function(){var t;return t=this._additions(),t=t.concat(this._removals()),t=t.concat(this._updates())},toJSON:function(){return{__type:"Gallery",images:this._images()}},_mergeWithPrevious:function(t){var e;return t?(this._imagesToAdd=v.default.union(v.default.difference(t._imagesToAdd,this._imagesToRemove),this._imagesToAdd),this._idsToRemove=v.default.union(v.default.difference(t._idsToRemove,this._idsToAdd),this._idsToRemove),e={},(0,s._objectEach)(this._idsToUpdate,function(n,r){return null!=t._idsToUpdate[r]?e[r]=v.default.extend(t._idsToUpdate[r],n):e[r]=n}),this._idsToUpdate=e,this._idsToAdd=[],this._imagesToRemove=[],this):this},_estimate:function(t,e,n){var r,i,u;if(t){if(t instanceof d.default)return u=this,i=v.default.map(t._images,function(t){var e;return e=t.attributes,null!=u._idsToUpdate&&null!=u._idsToUpdate[t.id]&&(e=v.default.extend({},e,u._idsToUpdate[t.id])),new _.default(e)}),r=v.default.union(i,this._imagesToAdd),r=v.default.reject(r,function(t){return v.default.contains(this._idsToRemove,t.id)}),new d.default(e,n,r);throw"Atomic is invalid after previous op"}return new d.default(e,n,[].concat(this._imagesToAdd))}}),i.RemoveFile=i._extend({toJSON:function(){return{__type:"File",remove:"1"}},_mergeWithPrevious:function(t){return this},_estimate:function(t){return i._UNSET}}),o.default.Atomic=i},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){var r=n(8),i=n(60),u=n(61),o=Object.defineProperty;e.f=n(15)?Object.defineProperty:function(t,e,n){if(r(t),e=u(e,!0),r(n),i)try{return o(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var r=n(22);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default="1.7.0"},function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0});var n,r,i,u;n=void 0;e.setEngine=function(t){return n=t};u=function(e,r){return null!=n?n.setItem(e,r):t.resolve(localStorage.setItem(e,r))},r=function(e){return null!=n?n.getItem(e):t.resolve(localStorage.getItem(e))},i=function(e){return null!=n?n.removeItem(e):t.resolve(localStorage.removeItem(e))},e.default={setItem:u,getItem:r,removeItem:i}}).call(e,n(38))},function(t,e,n){var r=n(18),i=n(2)("toStringTag"),u="Arguments"==r(function(){return arguments}()),o=function(t,e){try{return t[e]}catch(t){}};t.exports=function(t){var e,n,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=o(e=Object(t),i))?n:u?r(e):"Object"==(a=r(e))&&"function"==typeof e.callee?"Arguments":a}},function(t,e,n){var r=n(11),i=n(3),u=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(t.exports=function(t,e){return u[t]||(u[t]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:n(27)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(t,e){t.exports=!1},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e,n){var r=n(14),i=n(3).document,u=r(i)&&r(i.createElement);t.exports=function(t){return u?i.createElement(t):{}}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){var r=n(69),i=n(31);t.exports=function(t){return r(i(t))}},function(t,e,n){var r=n(26)("keys"),i=n(28);t.exports=function(t){return r[t]||(r[t]=i(t))}},function(t,e,n){var r=n(19).f,i=n(20),u=n(2)("toStringTag");t.exports=function(t,e,n){t&&!i(t=n?t:t.prototype,u)&&r(t,u,{configurable:!0,value:e})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,i=n(0),u=function(t){return t&&t.__esModule?t:{default:t}}(i);e.default=r=function(t,e){return this.id=t,this.value=e},r.prototype={toJSON:function(){return null!=this.id?this.id:this.value}},u.default.SelectOption=r},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u,o,a,s,c=n(0),l=r(c),f=n(6),d=n(17),h=r(d),_=n(5),p=n(1),v=r(p);u=function(t,e,n){var r,i;return!(!n||null!=t.gallery)||(null!=e?(null!=(r=t.gallery)?r.parent:void 0)===(null!=e?e.parent:void 0)&&(null!=(i=t.gallery)?i.key:void 0)===(null!=e?e.key:void 0):null==t.gallery)},a=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t instanceof l.default.GalleryImage&&u(t,e,n)},s=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!!v.default.isObject(t)&&(a(t,e,n)||v.default.isArray(t)&&v.default.all(t,function(t){return a(t,e,n)}))},e.default=i=function(t,e,n){var r;this.parent=t,this.key=e,null!=n?(this._images=n,r=this,v.default.each(this._images,function(t){return t._setGallery(r)})):this._images=[]},i.prototype={_ensureParentAndKey:function(t,e){if(this.parent=this.parent||t,this.key=this.key||e,this.parent!==t)throw"Internal Error. Gallery retrieved from two different Objects.";if(this.key!==e)throw"Internal Error. Gallery retrieved from two different keys."},list:function(){return this._images},add:function(t){var e;if(!s(t,this,!0))throw"You must supply a Nimbu.GalleryImage or array of Nimbu.GalleryImage that don't belong to a gallery yet.";v.default.isArray(t)||(t=[t]),e=new h.default.Gallery(t,[],[]),this.parent.set(this.key,e)},remove:function(t){var e;if(!s(t,this))throw"You must supply a Nimbu.GalleryImage or array of Nimbu.GalleryImage that belong to this gallery.";v.default.isArray(t)||(t=[t]),e=new h.default.Gallery([],t,[]),this.parent.set(this.key,e)},_updateImage:function(t,e){var n,r,i;if(!a(t,this))throw"You must supply a Nimbu.GalleryImage that belongs to this gallery.";r=v.default.indexOf(this._images,t),this._images[r]=new l.default.GalleryImage(t.attributes),i={},i[t.id]=e,n=new h.default.Gallery([],[],i),this.parent.set(this.key,n)},toJSON:function(){return{__type:"Gallery",images:v.default.map(this._images,function(t){return(0,f._encode)(t)})}}},o=["forEach","each","map","reduce","reduceRight","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","sortBy","sortedIndex","toArray","size","first","initial","rest","last","without","indexOf","shuffle","lastIndexOf","isEmpty","groupBy"],(0,_._arrayEach)(o,function(t){return i.prototype[t]=function(){return v.default[t].apply(v.default,[this._images].concat(v.default.toArray(arguments)))}}),l.default.Gallery=i},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(t){if(l===setTimeout)return setTimeout(t,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(t,0);try{return l(t,0)}catch(e){try{return l.call(null,t,0)}catch(e){return l.call(this,t,0)}}}function u(t){if(f===clearTimeout)return clearTimeout(t);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(t);try{return f(t)}catch(e){try{return f.call(null,t)}catch(e){return f.call(this,t)}}}function o(){p&&h&&(p=!1,h.length?_=h.concat(_):v=-1,_.length&&a())}function a(){if(!p){var t=i(o);p=!0;for(var e=_.length;e;){for(h=_,_=[];++v<e;)h&&h[v].run();v=-1,e=_.length}h=null,p=!1,u(t)}}function s(t,e){this.fun=t,this.array=e}function c(){}var l,f,d=t.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:n}catch(t){l=n}try{f="function"==typeof clearTimeout?clearTimeout:r}catch(t){f=r}}();var h,_=[],p=!1,v=-1;d.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];_.push(new s(t,e)),1!==_.length||p||i(a)},s.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.prependListener=c,d.prependOnceListener=c,d.listeners=function(t){return[]},d.binding=function(t){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(t){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},function(t,e,n){n(59),n(63),n(74),n(78),t.exports=n(11).Promise},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){"use strict";var r=n(27),i=n(42),u=n(13),o=n(12),a=n(16),s=n(65),c=n(34),l=n(72),f=n(2)("iterator"),d=!([].keys&&"next"in[].keys()),h=function(){return this};t.exports=function(t,e,n,_,p,v,m){s(n,e,_);var g,y,b,C=function(t){if(!d&&t in O)return O[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},w=e+" Iterator",S="values"==p,A=!1,O=t.prototype,N=O[f]||O["@@iterator"]||p&&O[p],E=N||C(p),j=p?S?C("entries"):E:void 0,x="Array"==e?O.entries||N:N;if(x&&(b=l(x.call(new t)))!==Object.prototype&&b.next&&(c(b,w,!0),r||"function"==typeof b[f]||o(b,f,h)),S&&N&&"values"!==N.name&&(A=!0,E=function(){return N.call(this)}),r&&!m||!d&&!A&&O[f]||o(O,f,E),a[e]=E,a[w]=h,p)if(g={values:S?E:C("values"),keys:v?E:C("keys"),entries:j},m)for(y in g)y in O||u(O,y,g[y]);else i(i.P+i.F*(d||A),e,g);return g}},function(t,e,n){var r=n(3),i=n(11),u=n(12),o=n(13),a=n(21),s=function(t,e,n){var c,l,f,d,h=t&s.F,_=t&s.G,p=t&s.S,v=t&s.P,m=t&s.B,g=_?r:p?r[e]||(r[e]={}):(r[e]||{}).prototype,y=_?i:i[e]||(i[e]={}),b=y.prototype||(y.prototype={});_&&(n=e);for(c in n)l=!h&&g&&void 0!==g[c],f=(l?g:n)[c],d=m&&l?a(f,r):v&&"function"==typeof f?a(Function.call,f):f,g&&o(g,c,f,t&s.U),y[c]!=f&&u(y,c,d),v&&b[c]!=f&&(b[c]=f)};r.core=i,s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,t.exports=s},function(t,e,n){var r=n(68),i=n(45);t.exports=Object.keys||function(t){return r(t,i)}},function(t,e,n){var r=n(30),i=Math.min;t.exports=function(t){return t>0?i(r(t),9007199254740991):0}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,n){var r=n(3).document;t.exports=r&&r.documentElement},function(t,e,n){var r,i,u,o=n(21),a=n(85),s=n(46),c=n(29),l=n(3),f=l.process,d=l.setImmediate,h=l.clearImmediate,_=l.MessageChannel,p=l.Dispatch,v=0,m={},g=function(){var t=+this;if(m.hasOwnProperty(t)){var e=m[t];delete m[t],e()}},y=function(t){g.call(t.data)};d&&h||(d=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return m[++v]=function(){a("function"==typeof t?t:Function(t),e)},r(v),v},h=function(t){delete m[t]},"process"==n(18)(f)?r=function(t){f.nextTick(o(g,t,1))}:p&&p.now?r=function(t){p.now(o(g,t,1))}:_?(i=new _,u=i.port2,i.port1.onmessage=y,r=o(u.postMessage,u,1)):l.addEventListener&&"function"==typeof postMessage&&!l.importScripts?(r=function(t){l.postMessage(t+"","*")},l.addEventListener("message",y,!1)):r="onreadystatechange"in c("script")?function(t){s.appendChild(c("script")).onreadystatechange=function(){s.removeChild(this),g.call(t)}}:function(t){setTimeout(o(g,t,1),0)}),t.exports={set:d,clear:h}},function(t,e,n){"use strict";function r(t){var e,n;this.promise=new t(function(t,r){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=r}),this.resolve=i(e),this.reject=i(n)}var i=n(22);t.exports.f=function(t){return new r(t)}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(1),s=r(a),c=n(35),l=r(c);e.default=i=function(t,e,n){this.parent=t,this.key=e,this._options=null!=n?n:[]},i._decode=function(t,e,n){var r;if("MultiSelect"!==n.__type)throw"Internal Error. Tried to decode a value that isn't a MultiSelect to SelectOptionList";return r=s.default.map(n.ids,function(t,e){return new l.default(t,n.values[e])}),new i(t,e,r)},i.prototype={_ensureParentAndKey:function(t,e){if(this.parent=this.parent||t,this.key=this.key||e,this.parent!==t)throw"Internal Error. SelectOptionList retrieved from two different Objects.";if(this.key!==e)throw"Internal Error. SelectOptionList retrieved from two different keys."},list:function(){return this._options},values:function(){return s.default.map(this._options,function(t){return t.value})},ids:function(){return s.default.map(this._options,function(t){return t.id})},includes:function(t){if(!(t instanceof l.default))throw"You need to provide an instance of Nimbu.SelectOption";return null!=s.default.find(this._options,function(e){return null!=e.id&&e.id===t.id||null!=e.value&&e.value===t.value})},includesValue:function(t){return null!=s.default.find(this._options,function(e){return e.value===t})},includesId:function(t){return null!=s.default.find(this._options,function(e){return e.id===t})},add:function(t){if(!(t instanceof l.default))throw"You need to provide an instance of Nimbu.SelectOption";if(!this.includes(t))return this._options=s.default.union(this._options,[t]),this.parent.set(this.key,this)},addValue:function(t){return this.add(new l.default(null,t))},addId:function(t){return this.add(new l.default(t,null))},remove:function(t){var e;if(!(t instanceof l.default))throw"You need to provide an instance of Nimbu.SelectOption";if(null!=(e=s.default.find(this._options,function(e){return null!=e.id&&e.id===t.id||null!=e.value&&e.value===t.value})))return this._options=s.default.without(this._options,e),this.parent.set(this.key,this)},removeValue:function(t){return this.remove(new l.default(null,t))},removeId:function(t){return this.remove(new l.default(t,null))},toJSON:function(){return s.default.map(this._options,function(t){return t.toJSON()})}},o.default.SelectOptionList=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(17),s=r(a),c=n(1),l=r(c);e.default=i=function(t,e,n){this.parent=t,this.key=e,this.targetClassName=null,this._objects=null!=n?n:[]},i.prototype={_ensureParentAndKey:function(t,e){if(this.parent=this.parent||t,this.key=this.key||e,this.parent!==t)throw"Internal Error. Relation retrieved from two different Objects.";if(this.key!==e)throw"Internal Error. Relation retrieved from two different keys."},list:function(){return this._objects},add:function(t){var e;if(!l.default.isObject(t))throw"You must supply a Nimbu.Object or array of Nimbu.Object";l.default.isArray(t)||(t=[t]),e=new s.default.Relation(t,[]),this.parent.set(this.key,e),this.targetClassName=e._targetClassName},remove:function(t){var e;if(!l.default.isObject(t))throw"You must supply a Nimbu.Object or array of Nimbu.Object";l.default.isArray(t)||(t=[t]),e=new s.default.Relation([],t),this.parent.set(this.key,e),this.targetClassName=e._targetClassName},toJSON:function(){return{__type:"Relation",className:this.targetClassName}}},o.default.Relation=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(6),s=n(1),c=r(s);e.default=i=function(t){this.id=t.id,this.attributes=c.default.clone(t)||{}},i.prototype={_setGallery:function(t){return this.gallery=t},has:function(t){return null!=this.attributes[t]},get:function(t){return this.attributes[t]},set:function(t,e){var n;return null!=this.gallery&&null!=this.id&&(n={},n[t]=e,this.gallery._updateImage(this,n)),this.attributes[t]=e},toJSON:function(){var t;return t={__type:"GalleryImage",id:this.id},this.has("caption")&&(t.caption=this.get("caption")),this.has("position")&&(t.position=this.get("position")),this.has("file")&&(t.file=(0,a._encode)(this.get("file"))),t}},o.default.GalleryImage=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u,o,a,s,c,l,f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d=n(0),h=r(d),_=n(1),p=r(_);u=[],c=u.slice,e.default=i={on:function(t,e,n){var r;return a(this,"on",t,[e,n])&&e?(this._events||(this._events={}),r=this._events[t]||(this._events[t]=[]),r.push({callback:e,context:n,ctx:n||this}),this):this},once:function(t,e,n){var r,i;return a(this,"once",t,[e,n])&&e?(i=this,r=p.default.once(function(){return i.off(t,r),e.apply(this,arguments)}),r._callback=e,this.on(t,r,n)):this},off:function(t,e,n){var r,i,u,o,s,c,l,f;if(f=void 0,r=void 0,i=void 0,l=void 0,u=void 0,c=void 0,o=void 0,s=void 0,!this._events||!a(this,"off",t,[e,n]))return this;if(!t&&!e&&!n)return this._events=void 0,this;for(l=t?[t]:p.default.keys(this._events),u=0,c=l.length;u<c;){if(t=l[u],i=this._events[t]){if(this._events[t]=f=[],e||n)for(o=0,s=i.length;o<s;)r=i[o],(e&&e!==r.callback&&e!==r.callback._callback||n&&n!==r.context)&&f.push(r),o++;f.length||delete this._events[t]}u++}return this},trigger:function(t){var e,n,r;return this._events?(n=c.call(arguments,1),a(this,"trigger",t,n)?(r=this._events[t],e=this._events.all,r&&l(r,n),e&&l(e,arguments),this):this):this},stopListening:function(t,e,n){var r,i,u;if(!(i=this._listeningTo))return this;u=!e&&!n,n||"object"!==(void 0===e?"undefined":f(e))||(n=this),t&&((i={})[t._listenId]=t);for(r in i)t=i[r],t.off(e,n,this),(u||p.default.isEmpty(t._events))&&delete this._listeningTo[r];return this}},o=/\s+/,a=function(t,e,n,r){var i,u,a,s;if(!n)return!0;if("object"===(void 0===n?"undefined":f(n))){for(u in n)t[e].apply(t,[u,n[u]].concat(r));return!1}if(o.test(n)){for(s=n.split(o),i=0,a=s.length;i<a;)t[e].apply(t,[s[i]].concat(r)),i++;return!1}return!0},l=function(t,e){var n,r,i,u,o,a;switch(u=void 0,o=-1,a=t.length,n=e[0],r=e[1],i=e[2],e.length){case 0:for(;++o<a;)(u=t[o]).callback.call(u.ctx);break;case 1:for(;++o<a;)(u=t[o]).callback.call(u.ctx,n);break;case 2:for(;++o<a;)(u=t[o]).callback.call(u.ctx,n,r);break;case 3:for(;++o<a;)(u=t[o]).callback.call(u.ctx,n,r,i);break;default:for(;++o<a;)(u=t[o]).callback.apply(u.ctx,e)}},s={listenTo:"on",listenToOnce:"once"},p.default.each(s,function(t,e){return i[e]=function(e,n,r){var i,u;return u=this._listeningTo||(this._listeningTo={}),i=e._listenId||(e._listenId=p.default.uniqueId("l")),u[i]=e,r||"object"!==(void 0===n?"undefined":f(n))||(r=this),e[t](n,r,this),this}}),i.bind=i.on,i.unbind=i.off,h.default.Events=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u,o,a=n(0),s=r(a),c=n(17),l=r(c),f=n(1),d=r(f);o=function(t){if(t<26)return String.fromCharCode(65+t);if(t<52)return String.fromCharCode(97+t-26);if(t<62)return String.fromCharCode(48+t-52);if(62===t)return"+";if(63===t)return"/";throw"Tried to encode large digit "+t+" in base64."},u=function(t){var e;return e=[],e.length=Math.ceil(t.length/3),d.default.times(e.length,function(n){var r,i,u,a,s;r=t[3*n],i=t[3*n+1]||0,u=t[3*n+2]||0,a=3*n+1<t.length,s=3*n+2<t.length,e[n]=[o(r>>2&63),o(r<<4&48|i>>4&15),a?o(i<<2&60|u>>6&3):"=",s?o(63&u):"="].join("")}),e.join("")},e.default=i=function(t,e){var n,r;if(this.filename=t,null!=e&&d.default.isObject(e)&&null!=e.url)this.url=e.url,this.width=e.width,this.height=e.height,this.content_type=e.content_type,this.version=e.version,this.checksum=e.checksum,this.size=e.size,null!=e.private&&(this.private=e.private,this.permanent_url=e.permanent_url,this.permanent_relative_url=e.permanent_relative_url,this.permanent_backend_url=e.permanent_backend_url);else if(null!=e&&d.default.isObject(e)&&null!=e.base64)r=/^data:([a-zA-Z]*\/[a-zA-Z+.-]*);(charset=[a-zA-Z0-9\-\/\s]*,)?base64,(\S+)/,n=r.exec(e.base64),n&&n.length>0?this._data=4===n.length?n[3]:n[2]:this._data=e.base64;else if(null!=e&&d.default.isArray(e))this._data=u(e);else if(d.default.isString(e))throw"Creating a Nimbu.File from a String is not yet supported."},i.prototype={_ensureParentAndKey:function(t,e){if(this.parent=this.parent||t,this.key=this.key||e,this.parent!==t)throw"Internal Error. File retrieved from two different Objects.";if(this.key!==e)throw"Internal Error. File retrieved from two different keys."},toJSON:function(){var t;return t={__type:"File",filename:this.filename},null!=this._data&&(t.attachment=this._data),null!=this.url&&(t.url=this.url),t},remove:function(){if(null!=this.parent&&null!=this.key)return this.removed=!0,this.parent.set(this.key,new l.default.RemoveFile),!0;throw"Internal Error. Tried to remove a File that is not linked to an Object."}},s.default.File=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u,o=n(0),a=r(o),s=n(23),c=r(s),l=n(6),f=n(4),d=r(f),h=n(7),_=r(h),p=n(9),v=r(p),m=n(93),g=r(m),y=n(10),b=r(y),C=n(5),w=n(1),S=r(w),A=n(24),O=r(A);u=null,e.default=i=d.default.extend("customer",{_isCurrentCustomer:!1,_mergeSystemFields:function(t){return t.session_token&&(this.session_token=t.session_token,delete t.session_token),i.__super__._mergeSystemFields.call(this,t)},_cleanupAuthData:function(){var t;if(this.isCurrent()&&(t=this.get("authData")))return(0,C._objectEach)(this.get("authData"),function(e,n){if(!t[n])return delete t[n]})},_synchronizeAllAuthData:function(){var t;if(this.get("authData"))return t=this,(0,C._objectEach)(this.get("authData"),function(e,n){return t._synchronizeAuthData(n)})},_synchronizeAuthData:function(t){var e,n,r;if(this.isCurrent()&&(n=void 0,S.default.isString(t)?(n=t,t=i._authProviders[n]):n=t.getAuthType(),(e=this.get("authData"))&&t))return r=t.restoreAuthentication(e[n]),r?void 0:this._unlinkFrom(t)},_handleSaveResult:function(t){if(t&&(this._isCurrentCustomer=!0),this._cleanupAuthData(),this._synchronizeAllAuthData(),delete this._serverData.password,this._rebuildEstimatedDataForKey("password"),this._refreshCache(),t||this.isCurrent())return i._saveCurrentCustomer(this)},_linkWith:function(t,e){var n,r,u,o,a;return r=void 0,S.default.isString(t)?(r=t,t=i._authProviders[t]):r=t.getAuthType(),S.default.has(e,"authData")?(n=this.get("authData")||{},n[r]=e.authData,this.set("authData",n),u=S.default.clone(e)||{},u.success=function(t){if(t._handleSaveResult(!0),e.success)return e.success.apply(this,arguments)},this.save({authData:n},u)):(a=this,o=new _.default,t.authenticate({success:function(t,n){return a._linkWith(t,{authData:n,success:e.success,error:e.error}).then(function(){return o.resolve(a)})},error:function(t,n){return e.error&&e.error(a,n),o.reject(n)}}),o)},_unlinkFrom:function(t,e){var n,r;return void 0,S.default.isString(t)?(t,t=i._authProviders[t]):t.getAuthType(),n=S.default.clone(e),r=this,n.authData=null,n.success=function(n){if(r._synchronizeAuthData(t),e.success)return e.success.apply(this,arguments)},this._linkWith(t,n)},_isLinked:function(t){var e,n;return n=void 0,n=S.default.isString(t)?t:t.getAuthType(),e=this.get("authData")||{},!!e[n]},_logOutWithAll:function(){var t;if(this.get("authData"))return t=this,(0,C._objectEach)(this.get("authData"),function(e,n){return t._logOutWith(n)})},_logOutWith:function(t){if(this.isCurrent())return S.default.isString(t)&&(t=i._authProviders[t]),t&&t.deauthenticate?t.deauthenticate():void 0},signUp:function(t,e){var n,r,i,u;return n=void 0,e=e||{},(u=t&&t.username||this.get("username"))&&""!==u?(i=t&&t.password||this.get("password"))&&""!==i?(r=S.default.clone(e),r.success=function(t){if(t._handleSaveResult(!0),e.success)return e.success.apply(this,arguments)},this.save(t,r)):(n=new v.default(v.default.OTHER_CAUSE,"Cannot sign up user with an empty password."),e&&e.error&&e.error(this,n),_.default.error(n)):(n=new v.default(v.default.OTHER_CAUSE,"Cannot sign up user with an empty name."),e&&e.error&&e.error(this,n),_.default.error(n))},logIn:function(t){var e,n;return e=this,t=t||{},n=(0,b.default)({route:"customers",className:"login",method:"POST",data:this.toJSON(),useACL:t.useACL}),n.then(function(t,n,r){var i;return i=e.parse(t,n,r),e._finishFetch(i),e._handleSaveResult(!0),e})._thenRunCallbacks(t,this)},save:function(t,e,n){var r,i,u;return void 0,r=void 0,void 0,u=void 0,void 0,S.default.isObject(t)||S.default.isNull(t)||S.default.isUndefined(t)?(r=t,u=e):(r={},r[t]=e,u=n),u=u||{},i=S.default.clone(u),i.success=function(t){if(t._handleSaveResult(!1),u.success)return u.success.apply(this,arguments)},d.default.prototype.save.call(this,r,i)},fetch:function(t){var e;return e=t?S.default.clone(t):{},e.success=function(e){if(e._handleSaveResult(!1),t&&t.success)return t.success.apply(this,arguments)},d.default.prototype.fetch.call(this,e)},isCurrent:function(){return this._isCurrentCustomer},getCustomername:function(){return this.get("username")},setCustomername:function(t,e){return this.set("username",t,e)},setPassword:function(t,e){return this.set("password",t,e)},getEmail:function(){return this.get("email")},setEmail:function(t,e){return this.set("email",t,e)},authenticated:function(){return!!this.session_token&&i.current()&&i.current().id===this.id},getAutologinToken:function(t){var e;return this.isCurrent()?(e=null,(0,b.default)({path:"customers/me/authentication_token",method:"GET"}).then(function(t,n,r){return e=t.authentication_token})._thenRunCallbacks(t,e)):_.default.error("You can only request the autologin token for the current customer")},validateSession:function(t){var e;return this.isCurrent()?(e=null,(0,b.default)({path:"customers/me",method:"GET"}).fail(function(t){return a.default.Customer.logOut()})._thenRunCallbacks(t,e)):_.default.error("You can validate the login session for the current customer")}},{_currentCustomer:null,_currentCustomerMatchesDisk:!1,_CURRENT_USER_KEY:"currentCustomer",_authProviders:{},_performCustomerRewrite:!0,signUp:function(t,e,n,r){var i;return n=n||{},n.username=t,n.password=e,i=d.default._create("customer"),i.signUp(n,r)},logIn:function(t,e,n){var r;return r=d.default._create("customer"),r._finishFetch({username:t,password:e}),r.logIn(n)},become:function(t,e){var n;return e=e||{},n=d.default._create("customer"),(0,b.default)({route:"customers",className:"me",method:"GET",useACL:e.useACL,sessionToken:t}).then(function(e,r,i){var u;return u=n.parse(e,r,i),u.session_token=t,n._finishFetch(u),n._handleSaveResult(!0),n})._thenRunCallbacks(e,n)},logOut:function(){return null!==i._currentCustomer&&(i._currentCustomer._logOutWithAll(),i._currentCustomer._isCurrentCustomer=!1),i._currentCustomerMatchesDisk=!0,i._currentCustomer=null,O.default.removeItem((0,l._getStoragePath)(i._CURRENT_USER_KEY)),!0},requestPasswordReset:function(t,e){var n;return e=e||{},n=(0,b.default)({route:"customers",className:"password/reset",method:"POST",useACL:e.useACL,data:{email:t}}),n._thenRunCallbacks(e)},validateCurrent:function(t){var e,n,r,o,a,s,f,h,p;if(u=null,(0,l.useSSO)(!0),!l.accessToken)throw"You must specify your accessToken using Nimbu.initialize().";if("undefined"==typeof document||null===document||"undefined"==typeof window||null===window)throw"Nimbu.Customer.validateCurrent() can only be run from within a browser.";for(r=new _.default,a=document.getElementsByTagName("meta"),f=null,o=0;o<a.length;){if("nimbu:sso:current"===a[o].getAttribute("property")){f=a[o].getAttribute("content");break}o++}for(p=null,o=0;o<a.length;){if("nimbu:sso:authorize_url"===a[o].getAttribute("property")){p=a[o].getAttribute("content");break}o++}for(e=null,o=0;o<a.length;){if("csrf-token"===a[o].getAttribute("name")){e=a[o].getAttribute("content");break}o++}if(null==e)throw"Please include the CSRF meta tags in your html header.";if(null!=f&&null!=p)try{h=g.default.dec(decodeURIComponent(f),l.accessToken)}catch(t){t,h="unauthenticated"}return n=i.current(),null==h||"unauthenticated"===h?(i.logOut(),r.resolve(null)):null!=n&&h!==n.id?(i.logOut(),r.resolve(null)):null==h||"unauthenticated"===h||null!=n&&h===n.id?r.resolve(n):(s=(0,b.default)({route:"customers",className:"sso",method:"POST"}),s.then(function(t,n,r){var i;return u=g.default.dec(t.shared_secret,l.accessToken),i={},i._accessToken=l.accessToken,i._clientVersion=c.default,i._installationId=(0,l._getInstallationId)(),i._csrfToken=e,(0,y._ajax)("POST",p,JSON.stringify({}),i)}).then(function(t,e,n){var i,o;return i=d.default._create("customer"),o=i.parse(t,e,n),o.session_token=g.default.dec(o.session_token,u),u=null,i._finishFetch(o),i._handleSaveResult(!0),r.resolve(i)})),r._thenRunCallbacks(t)},current:function(){if(i._currentCustomer||i._currentCustomerMatchesDisk)return i._currentCustomer;throw"You need to call Nimbu.initialize before using the SDK."},_initCurrent:function(){var t;return i._currentCustomer?a.default.Future.as(i._currentCustomer):i._currentCustomerMatchesDisk?a.default.Future.as(i._currentCustomer):(t=new a.default.Future,O.default.getItem((0,l._getStoragePath)(i._CURRENT_USER_KEY)).then(function(e){var n;return e?(i._currentCustomer=d.default._create("customer"),i._currentCustomer._isCurrentCustomer=!0,n=JSON.parse(e),i._currentCustomer.id=n._id,delete n._id,i._currentCustomer.session_token=n.session_token,delete n.session_token,i._currentCustomer.set(n),i._currentCustomer._synchronizeAllAuthData(),i._currentCustomer._refreshCache(),i._currentCustomer._opSetQueue=[{}],i._currentCustomer,i._currentCustomerMatchesDisk=!0,t.resolve(i._currentCustomer)):(i._currentCustomerMatchesDisk=!0,t.resolve(null))}),t)},allowCustomCustomerClass:function(t){return this._performCustomerRewrite=!t},_saveCurrentCustomer:function(t){var e;return i._currentCustomer!==t&&i.logOut(),t._isCurrentCustomer=!0,i._currentCustomer=t,i._currentCustomerMatchesDisk=!0,e=t.toJSON(),e._id=t.id,e.session_token=t.session_token,O.default.setItem((0,l._getStoragePath)(i._CURRENT_USER_KEY),JSON.stringify(e))},_registerAuthenticationProvider:function(t){if(i._authProviders[t.getAuthType()]=t,i.current())return i.current()._synchronizeAuthData(t.getAuthType())},_logInWith:function(t,e){var n;return n=d.default._create("customer"),n._linkWith(t,e)}}),a.default.Customer=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u,o=n(0),a=r(o),s=n(5),c=n(1),l=r(c);e.default=i=function(t,e){if(e=e||{},e.comparator&&(this.comparator=e.comparator),e.model&&(this.model=e.model),e.query&&(this.query=e.query),this._reset(),this.initialize.apply(this,arguments),t)return this.reset(t,{silent:!0,parse:e.parse})},l.default.extend(i.prototype,a.default.Events,{model:a.default.Object,initialize:function(){},toJSON:function(){return this.map(function(t){return t.toJSON()})},add:function(t,e){var n,r,i,u,o,a,c,f;for(i=void 0,a=void 0,c=void 0,f=void 0,n=void 0,u=void 0,r={},o={},e=e||{},t=l.default.isArray(t)?t.slice():[t],i=0,c=t.length;i<c;){if(t[i]=this._prepareModel(t[i],e),!(f=t[i]))throw new Error("Can't add an blank model to a collection");n=f.cid,u=f.id,r[n]||this._byCid[n]||!(0,s._isNullOrUndefined)(u)&&(o[u]||this._byId[u])?(t.splice(i,1),c=t.length):(o[u]=f,r[n]=f,i++)}for(i=0;i<c;)(f=t[i]).on("all",this._onModelEvent,this),this._byCid[f.cid]=f,f.id&&(this._byId[f.id]=f),i++;if(this.length+=c,a=(0,s._isNullOrUndefined)(e.at)?this.models.length:e.at,this.models.splice.apply(this.models,[a,0].concat(t)),this.comparator&&this.sort({silent:!0}),e.silent)return this;for(i=0,c=this.models.length;i<c;)f=this.models[i],r[f.cid]&&(e.index=i,f.trigger("add",f,this,e)),i++;return this},remove:function(t,e){var n,r,i,u;for(n=void 0,i=void 0,r=void 0,u=void 0,e=e||{},t=l.default.isArray(t)?t.slice():[t],n=0,i=t.length;n<i;)(u=this.getByCid(t[n])||this.get(t[n]))&&(delete this._byId[u.id],delete this._byCid[u.cid],r=this.indexOf(u),this.models.splice(r,1),this.length--,e.silent||(e.index=r,u.trigger("remove",u,this,e)),this._removeReference(u),n++);return this},get:function(t){return t&&this._byId[t.id||t]},getByCid:function(t){return t&&this._byCid[t.cid||t]},at:function(t){return this.models[t]},sort:function(t){var e;if(t=t||{},!this.comparator)throw new Error("Cannot sort a set without a comparator");return e=l.default.bind(this.comparator,this),1===this.comparator.length?this.models=this.sortBy(e):this.models.sort(e),t.silent||this.trigger("reset",this,t),this},pluck:function(t){return l.default.map(this.models,function(e){return e.get(t)})},reset:function(t,e){var n;return n=this,t=t||[],e=e||{},(0,s._arrayEach)(this.models,function(t){return n._removeReference(t)}),this._reset(),this.add(t,{silent:!0,parse:e.parse}),e.silent||this.trigger("reset",this,e),this},fetch:function(t){var e,n,r,i;return t=l.default.clone(t)||{},null!=t.parse&&(t.parse=!0),e=this,n=0,i=this.query||new a.default.Query(this.model),r=!1,a.default.Future._continueWhile(function(){return!r},function(){return i.find({useACL:t.useACL}).then(function(u){return t.add||n>0?e.add(u,t):e.reset(u,t),n+=1,i.hasNext()?(null==i._page&&(i._page=1),i.page(i._page+1)):r=!0,e})}).then(function(){return e})._thenRunCallbacks(t,this)},create:function(t,e){var n,r;return n=this,e=e?l.default.clone(e):{},!!(t=this._prepareModel(t,e))&&(e.wait||n.add(t,e),r=e.success,e.success=function(i,u,o){return e.wait&&n.add(i,e),r?r(i,u):i.trigger("sync",t,u,e)},t.save(null,e),t)},parse:function(t,e){return t},chain:function(){return(0,l.default)(this.models).chain()},_reset:function(t){return this.length=0,this.models=[],this._byId={},this._byCid={}},_prepareModel:function(t,e){var n;return t instanceof a.default.Object?t.collection||(t.collection=this):(n=t,e.collection=this,t=new this.model(n,e),t._validate(t.attributes,e)||(t=!1)),t},_removeReference:function(t){return this===t.collection&&delete t.collection,t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,n,r){if("add"!==t&&"remove"!==t||n===this)return"destroy"===t&&this.remove(e,r),e&&"change:objectId"===t&&(delete this._byId[e.previous("objectId")],this._byId[e.id]=e),this.trigger.apply(this,arguments)}}),u=["forEach","each","map","reduce","reduceRight","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","sortBy","sortedIndex","toArray","size","first","initial","rest","last","without","indexOf","shuffle","lastIndexOf","isEmpty","groupBy"],(0,s._arrayEach)(u,function(t){return i.prototype[t]=function(){return l.default[t].apply(l.default,[this.models].concat(l.default.toArray(arguments)))}}),i.extend=s._extend,a.default.Collection=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u,o,a=n(0),s=r(a),c=n(5),l=n(54),f=(r(l),n(1)),d=r(f);o="*",u="users",e.default=i=function(t){var e;if(e=this,e.permissionsById={},d.default.isObject(t)){if(t instanceof s.default.Customer)return e.allowRead(t,!0),e.allowUpdate(t,!0),e.allowDelete(t,!0);if(d.default.isFunction(t))throw"Nimbu.ACL() called with a function?";return(0,c._objectEach)(t,function(t,n){if(!d.default.isString(n))throw"Tried to create an ACL with an invalid customerId.";return e.permissionsById[n]={},(0,c._objectEach)(t,function(t,r){if("read"!==r&&"update"!==r&&"delete"!==r)throw"Tried to create an ACL with an invalid permission type "+r+".";if(!d.default.isBoolean(t))throw"Tried to create an ACL with an invalid permission value.";return e.permissionsById[n][r]=t})})}},i.prototype.toJSON=function(){return d.default.clone(this.permissionsById)},i.prototype._setPermission=function(t,e,n){var r;if(e instanceof s.default.Customer?e="id:"+e.id:e instanceof s.default.Role&&(e="role:"+e.getName()),!d.default.isString(e))throw"customerId must be a string.";if(!d.default.isBoolean(n))throw"allowed must be either true or false.";if(!(r=this.permissionsById[e])){if(!n)return;r={},this.permissionsById[e]=r}return n?this.permissionsById[e][t]=!0:(delete r[t],d.default.isEmpty(r)?delete r[e]:void 0)},i.prototype._getPermission=function(t,e){var n;return e instanceof s.default.Customer?e="id:"+e.id:e instanceof s.default.Role&&(e="role:"+e.getName()),!!(n=this.permissionsById[e])&&!!n[t]},i.prototype.allowRead=function(t,e){return this._setPermission("read",t,e)},i.prototype.getReadAccess=function(t){return this._getPermission("read",t)},i.prototype.allowUpdate=function(t,e){return this._setPermission("update",t,e)},i.prototype.getUpdateAccess=function(t){return this._getPermission("update",t)},i.prototype.allowDelete=function(t,e){return this._setPermission("delete",t,e)},i.prototype.getDeleteAccess=function(t){return this._getPermission("delete",t)},i.prototype.setPublicReadAccess=function(t){return this.allowRead(o,t)},i.prototype.getPublicReadAccess=function(){return this.getReadAccess(o)},i.prototype.setPublicUpdateAccess=function(t){return this.allowUpdate(o,t)},i.prototype.getPublicUpdateAccess=function(){return this.getUpdateAccess(o)},i.prototype.setPublicDeleteAccess=function(t){return this.allowDelete(o,t)},i.prototype.getPublicDeleteAccess=function(){return this.getDeleteAccess(o)},i.prototype.setLoggedInReadAccess=function(t){return this.allowRead(u,t)},i.prototype.getLoggedInReadAccess=function(){return this.getReadAccess(u)},i.prototype.setLoggedInUpdateAccess=function(t){return this.allowUpdate(u,t)},i.prototype.getLoggedInUpdateAccess=function(){return this.getUpdateAccess(u)},i.prototype.setLoggedInDeleteAccess=function(t){return this.allowDelete(u,t)},i.prototype.getLoggedInDeleteAccess=function(){return this.getDeleteAccess(u)},i.prototype.getRoleReadAccess=function(t){if(t instanceof s.default.Role&&(t=t.getName()),d.default.isString(t))return this.getReadAccess("role:"+t);throw"role must be a Nimbu.Role or a String"},i.prototype.getRoleUpdateAccess=function(t){if(t instanceof s.default.Role&&(t=t.getName()),d.default.isString(t))return this.getUpdateAccess("role:"+t);throw"role must be a Nimbu.Role or a String"},i.prototype.getRoleDeleteAccess=function(t){if(t instanceof s.default.Role&&(t=t.getName()),d.default.isString(t))return this.getDeleteAccess("role:"+t);throw"role must be a Nimbu.Role or a String"},i.prototype.setRoleReadAccess=function(t,e){if(t instanceof s.default.Role&&(t=t.getName()),d.default.isString(t))return void this.allowRead("role:"+t,e);throw"role must be a Nimbu.Role or a String"},i.prototype.setRoleUpdateAccess=function(t,e){if(t instanceof s.default.Role&&(t=t.getName()),d.default.isString(t))return void this.allowUpdate("role:"+t,e);throw"role must be a Nimbu.Role or a String"},i.prototype.setRoleDeleteAccess=function(t,e){if(t instanceof s.default.Role&&(t=t.getName()),d.default.isString(t))return void this.allowDelete("role:"+t,e);throw"role must be a Nimbu.Role or a String"},s.default.ACL=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(1),s=r(a),c=n(4),l=r(c),f=n(7),d=r(f);e.default=i=l.default.extend("product_aggregate",{constructor:function(t,e){return null==e&&(e={}),e.parse=!0,l.default.apply(this,[t,e])},getProductId:function(){var t;if(null!=this.id&&(t=this.id.split("-")),(null!=t?t.length:void 0)>=1)return t[0]},getVariantId:function(){var t;if(null!=this.id&&(t=this.id.split("-")),2===(null!=t?t.length:void 0))return t[1]},getProduct:function(){return new o.default.Product({id:this.getProductId()})},save:function(t,e,n){return d.default.error("Product Aggregates are read-only")},fetch:function(t){return d.default.as(this)},destroy:function(t){return d.default.error("Product Aggregates are read-only")},parse:function(t,e,n){var r,i,u;return i=t.product,u=t.variant,s.default.isObject(i)&&(i=i.id),s.default.isObject(u)&&(u=u.id),r=s.default.compact([i,u]).join("-"),null!=r&&(t.id=r),t.product=void 0,t.variant=void 0,l.default.prototype.parse.apply(this,arguments)}}),o.default.ProductAggregate=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(23),u=r(i),o=n(4),a=r(o),s=n(9),c=r(s),l=n(17),f=r(l),d=n(52),h=r(d),_=n(7),p=r(_),v=n(54),m=r(v),g=n(50),y=r(g),b=n(36),C=r(b),w=n(51),S=r(w),A=n(94),O=r(A),N=n(53),E=r(N),j=n(95),x=r(j),T=n(56),I=r(T),R=n(96),k=r(R),P=n(55),D=r(P),M=n(97),L=r(M),U=n(98),F=r(U),G=n(99),J=r(G),q=n(100),z=r(q),V=n(57),B=r(V),K=n(101),W=r(K),Q=n(35),H=r(Q),Y=n(49),Z=r(Y),X=n(24),$=n(1),tt=r($),et=n(6),nt=n(10),rt={VERSION:u.default,_:tt.default.noConflict(),initialize:et.initialize,useACL:et.useACL,useSSO:et.useSSO,getInstallationId:et._getInstallationId,Error:c.default,Atomic:f.default,API:k.default,Events:h.default,Future:p.default,Object:a.default,Relation:y.default,Gallery:C.default,GalleryImage:S.default,Query:O.default,Customer:m.default,ACL:I.default,Role:x.default,File:E.default,Collection:D.default,Coupon:L.default,Device:F.default,Cloud:J.default,Order:z.default,ProductAggregate:B.default,Product:W.default,SelectOption:H.default,SelectOptionList:Z.default,setStorageEngine:X.setEngine,setAjax:nt.setAjax,enableChaos:nt.enableChaos};tt.default.extend(rt,h.default),e.default=rt},function(t,e,n){"use strict";var r=n(25),i={};i[n(2)("toStringTag")]="z",i+""!="[object z]"&&n(13)(Object.prototype,"toString",function(){return"[object "+r(this)+"]"},!0)},function(t,e,n){t.exports=!n(15)&&!n(39)(function(){return 7!=Object.defineProperty(n(29)("div"),"a",{get:function(){return 7}}).a})},function(t,e,n){var r=n(14);t.exports=function(t,e){if(!r(t))return t;var n,i;if(e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;if("function"==typeof(n=t.valueOf)&&!r(i=n.call(t)))return i;if(!e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},function(t,e,n){t.exports=n(26)("native-function-to-string",Function.toString)},function(t,e,n){"use strict";var r=n(64)(!0);n(41)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=r(e,n),this._i+=t.length,{value:t,done:!1})})},function(t,e,n){var r=n(30),i=n(31);t.exports=function(t){return function(e,n){var u,o,a=String(i(e)),s=r(n),c=a.length;return s<0||s>=c?t?"":void 0:(u=a.charCodeAt(s),u<55296||u>56319||s+1===c||(o=a.charCodeAt(s+1))<56320||o>57343?t?a.charAt(s):u:t?a.slice(s,s+2):o-56320+(u-55296<<10)+65536)}}},function(t,e,n){"use strict";var r=n(66),i=n(40),u=n(34),o={};n(12)(o,n(2)("iterator"),function(){return this}),t.exports=function(t,e,n){t.prototype=r(o,{next:i(1,n)}),u(t,e+" Iterator")}},function(t,e,n){var r=n(8),i=n(67),u=n(45),o=n(33)("IE_PROTO"),a=function(){},s=function(){var t,e=n(29)("iframe"),r=u.length;for(e.style.display="none",n(46).appendChild(e),e.src="javascript:",t=e.contentWindow.document,t.open(),t.write("<script>document.F=Object<\/script>"),t.close(),s=t.F;r--;)delete s.prototype[u[r]];return s()};t.exports=Object.create||function(t,e){var n;return null!==t?(a.prototype=r(t),n=new a,a.prototype=null,n[o]=t):n=s(),void 0===e?n:i(n,e)}},function(t,e,n){var r=n(19),i=n(8),u=n(43);t.exports=n(15)?Object.defineProperties:function(t,e){i(t);for(var n,o=u(e),a=o.length,s=0;a>s;)r.f(t,n=o[s++],e[n]);return t}},function(t,e,n){var r=n(20),i=n(32),u=n(70)(!1),o=n(33)("IE_PROTO");t.exports=function(t,e){var n,a=i(t),s=0,c=[];for(n in a)n!=o&&r(a,n)&&c.push(n);for(;e.length>s;)r(a,n=e[s++])&&(~u(c,n)||c.push(n));return c}},function(t,e,n){var r=n(18);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,e,n){var r=n(32),i=n(44),u=n(71);t.exports=function(t){return function(e,n,o){var a,s=r(e),c=i(s.length),l=u(o,c);if(t&&n!=n){for(;c>l;)if((a=s[l++])!=a)return!0}else for(;c>l;l++)if((t||l in s)&&s[l]===n)return t||l||0;return!t&&-1}}},function(t,e,n){var r=n(30),i=Math.max,u=Math.min;t.exports=function(t,e){return t=r(t),t<0?i(t+e,0):u(t,e)}},function(t,e,n){var r=n(20),i=n(73),u=n(33)("IE_PROTO"),o=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=i(t),r(t,u)?t[u]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?o:null}},function(t,e,n){var r=n(31);t.exports=function(t){return Object(r(t))}},function(t,e,n){for(var r=n(75),i=n(43),u=n(13),o=n(3),a=n(12),s=n(16),c=n(2),l=c("iterator"),f=c("toStringTag"),d=s.Array,h={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},_=i(h),p=0;p<_.length;p++){var v,m=_[p],g=h[m],y=o[m],b=y&&y.prototype;if(b&&(b[l]||a(b,l,d),b[f]||a(b,f,m),s[m]=d,g))for(v in r)b[v]||u(b,v,r[v],!0)}},function(t,e,n){"use strict";var r=n(76),i=n(77),u=n(16),o=n(32);t.exports=n(41)(Array,"Array",function(t,e){this._t=o(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,i(1)):"keys"==e?i(0,n):"values"==e?i(0,t[n]):i(0,[n,t[n]])},"values"),u.Arguments=u.Array,r("keys"),r("values"),r("entries")},function(t,e,n){var r=n(2)("unscopables"),i=Array.prototype;void 0==i[r]&&n(12)(i,r,{}),t.exports=function(t){i[r][t]=!0}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,n){"use strict";var r,i,u,o,a=n(27),s=n(3),c=n(21),l=n(25),f=n(42),d=n(14),h=n(22),_=n(79),p=n(80),v=n(84),m=n(47).set,g=n(86)(),y=n(48),b=n(87),C=n(88),w=n(89),S=s.TypeError,A=s.process,O=A&&A.versions,N=O&&O.v8||"",E=s.Promise,j="process"==l(A),x=function(){},T=i=y.f,I=!!function(){try{var t=E.resolve(1),e=(t.constructor={})[n(2)("species")]=function(t){t(x,x)};return(j||"function"==typeof PromiseRejectionEvent)&&t.then(x)instanceof e&&0!==N.indexOf("6.6")&&-1===C.indexOf("Chrome/66")}catch(t){}}(),R=function(t){var e;return!(!d(t)||"function"!=typeof(e=t.then))&&e},k=function(t,e){if(!t._n){t._n=!0;var n=t._c;g(function(){for(var r=t._v,i=1==t._s,u=0;n.length>u;)!function(e){var n,u,o,a=i?e.ok:e.fail,s=e.resolve,c=e.reject,l=e.domain;try{a?(i||(2==t._h&&M(t),t._h=1),!0===a?n=r:(l&&l.enter(),n=a(r),l&&(l.exit(),o=!0)),n===e.promise?c(S("Promise-chain cycle")):(u=R(n))?u.call(n,s,c):s(n)):c(r)}catch(t){l&&!o&&l.exit(),c(t)}}(n[u++]);t._c=[],t._n=!1,e&&!t._h&&P(t)})}},P=function(t){m.call(s,function(){var e,n,r,i=t._v,u=D(t);if(u&&(e=b(function(){j?A.emit("unhandledRejection",i,t):(n=s.onunhandledrejection)?n({promise:t,reason:i}):(r=s.console)&&r.error&&r.error("Unhandled promise rejection",i)}),t._h=j||D(t)?2:1),t._a=void 0,u&&e.e)throw e.v})},D=function(t){return 1!==t._h&&0===(t._a||t._c).length},M=function(t){m.call(s,function(){var e;j?A.emit("rejectionHandled",t):(e=s.onrejectionhandled)&&e({promise:t,reason:t._v})})},L=function(t){var e=this;e._d||(e._d=!0,e=e._w||e,e._v=t,e._s=2,e._a||(e._a=e._c.slice()),k(e,!0))},U=function(t){var e,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===t)throw S("Promise can't be resolved itself");(e=R(t))?g(function(){var r={_w:n,_d:!1};try{e.call(t,c(U,r,1),c(L,r,1))}catch(t){L.call(r,t)}}):(n._v=t,n._s=1,k(n,!1))}catch(t){L.call({_w:n,_d:!1},t)}}};I||(E=function(t){_(this,E,"Promise","_h"),h(t),r.call(this);try{t(c(U,this,1),c(L,this,1))}catch(t){L.call(this,t)}},r=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},r.prototype=n(90)(E.prototype,{then:function(t,e){var n=T(v(this,E));return n.ok="function"!=typeof t||t,n.fail="function"==typeof e&&e,n.domain=j?A.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&k(this,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),u=function(){var t=new r;this.promise=t,this.resolve=c(U,t,1),this.reject=c(L,t,1)},y.f=T=function(t){return t===E||t===o?new u(t):i(t)}),f(f.G+f.W+f.F*!I,{Promise:E}),n(34)(E,"Promise"),n(91)("Promise"),o=n(11).Promise,f(f.S+f.F*!I,"Promise",{reject:function(t){var e=T(this);return(0,e.reject)(t),e.promise}}),f(f.S+f.F*(a||!I),"Promise",{resolve:function(t){return w(a&&this===o?E:this,t)}}),f(f.S+f.F*!(I&&n(92)(function(t){E.all(t).catch(x)})),"Promise",{all:function(t){var e=this,n=T(e),r=n.resolve,i=n.reject,u=b(function(){var n=[],u=0,o=1;p(t,!1,function(t){var a=u++,s=!1;n.push(void 0),o++,e.resolve(t).then(function(t){s||(s=!0,n[a]=t,--o||r(n))},i)}),--o||r(n)});return u.e&&i(u.v),n.promise},race:function(t){var e=this,n=T(e),r=n.reject,i=b(function(){p(t,!1,function(t){e.resolve(t).then(n.resolve,r)})});return i.e&&r(i.v),n.promise}})},function(t,e){t.exports=function(t,e,n,r){if(!(t instanceof e)||void 0!==r&&r in t)throw TypeError(n+": incorrect invocation!");return t}},function(t,e,n){var r=n(21),i=n(81),u=n(82),o=n(8),a=n(44),s=n(83),c={},l={},e=t.exports=function(t,e,n,f,d){var h,_,p,v,m=d?function(){return t}:s(t),g=r(n,f,e?2:1),y=0;if("function"!=typeof m)throw TypeError(t+" is not iterable!");if(u(m)){for(h=a(t.length);h>y;y++)if((v=e?g(o(_=t[y])[0],_[1]):g(t[y]))===c||v===l)return v}else for(p=m.call(t);!(_=p.next()).done;)if((v=i(p,g,_.value,e))===c||v===l)return v};e.BREAK=c,e.RETURN=l},function(t,e,n){var r=n(8);t.exports=function(t,e,n,i){try{return i?e(r(n)[0],n[1]):e(n)}catch(e){var u=t.return;throw void 0!==u&&r(u.call(t)),e}}},function(t,e,n){var r=n(16),i=n(2)("iterator"),u=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||u[i]===t)}},function(t,e,n){var r=n(25),i=n(2)("iterator"),u=n(16);t.exports=n(11).getIteratorMethod=function(t){if(void 0!=t)return t[i]||t["@@iterator"]||u[r(t)]}},function(t,e,n){var r=n(8),i=n(22),u=n(2)("species");t.exports=function(t,e){var n,o=r(t).constructor;return void 0===o||void 0==(n=r(o)[u])?e:i(n)}},function(t,e){t.exports=function(t,e,n){var r=void 0===n;switch(e.length){case 0:return r?t():t.call(n);case 1:return r?t(e[0]):t.call(n,e[0]);case 2:return r?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return r?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return r?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}},function(t,e,n){var r=n(3),i=n(47).set,u=r.MutationObserver||r.WebKitMutationObserver,o=r.process,a=r.Promise,s="process"==n(18)(o);t.exports=function(){var t,e,n,c=function(){var r,i;for(s&&(r=o.domain)&&r.exit();t;){i=t.fn,t=t.next;try{i()}catch(r){throw t?n():e=void 0,r}}e=void 0,r&&r.enter()};if(s)n=function(){o.nextTick(c)};else if(!u||r.navigator&&r.navigator.standalone)if(a&&a.resolve){var l=a.resolve(void 0);n=function(){l.then(c)}}else n=function(){i.call(r,c)};else{var f=!0,d=document.createTextNode("");new u(c).observe(d,{characterData:!0}),n=function(){d.data=f=!f}}return function(r){var i={fn:r,next:void 0};e&&(e.next=i),t||(t=i,n()),e=i}}},function(t,e){t.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},function(t,e,n){var r=n(3),i=r.navigator;t.exports=i&&i.userAgent||""},function(t,e,n){var r=n(8),i=n(14),u=n(48);t.exports=function(t,e){if(r(t),i(e)&&e.constructor===t)return e;var n=u.f(t);return(0,n.resolve)(e),n.promise}},function(t,e,n){var r=n(13);t.exports=function(t,e,n){for(var i in e)r(t,i,e[i],n);return t}},function(t,e,n){"use strict";var r=n(3),i=n(19),u=n(15),o=n(2)("species");t.exports=function(t){var e=r[t];u&&e&&!e[o]&&i.f(e,o,{configurable:!0,get:function(){return this}})}},function(t,e,n){var r=n(2)("iterator"),i=!1;try{var u=[7][r]();u.return=function(){i=!0},Array.from(u,function(){throw 2})}catch(t){}t.exports=function(t,e){if(!e&&!i)return!1;var n=!1;try{var u=[7],o=u[r]();o.next=function(){return{done:n=!0}},u[r]=function(){return o},t(u)}catch(t){}return n}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=/**
|
|
2
2
|
* @license Gibberish-AES
|
|
3
3
|
* A lightweight Javascript Libray for OpenSSL compatible AES CBC encryption.
|
|
4
4
|
*
|
|
@@ -17,4 +17,4 @@ var Nimbu=function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,
|
|
|
17
17
|
* Usage: GibberishAES.enc("secret", "password")
|
|
18
18
|
* Outputs: AES Encrypted text encoded in Base64
|
|
19
19
|
*/
|
|
20
|
-
function(){var t=14,e=8,n=!1,r=function(t){try{return unescape(encodeURIComponent(t))}catch(t){throw"Error on UTF-8 encode"}},i=function(t){try{return decodeURIComponent(escape(t))}catch(t){throw"Bad Key"}},u=function(t){var e,n,r=[];for(t.length<16&&(e=16-t.length,r=[e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e]),n=0;n<t.length;n++)r[n]=t[n];return r},o=function(t,e){var n,r,i="";if(e){if((n=t[15])>16)throw"Decryption error: Maybe bad key";if(16===n)return"";for(r=0;r<16-n;r++)i+=String.fromCharCode(t[r])}else for(r=0;r<16;r++)i+=String.fromCharCode(t[r]);return i},a=function(t){var e,n="";for(e=0;e<t.length;e++)n+=(t[e]<16?"0":"")+t[e].toString(16);return n},s=function(t){var e=[];return t.replace(/(..)/g,function(t){e.push(parseInt(t,16))}),e},c=function(t,e){var n,i=[];for(e||(t=r(t)),n=0;n<t.length;n++)i[n]=t.charCodeAt(n);return i},l=function(n){switch(n){case 128:t=10,e=4;break;case 192:t=12,e=6;break;case 256:t=14,e=8;break;default:throw"Invalid Key Size Specified:"+n}},f=function(t){var e,n=[];for(e=0;e<t;e++)n=n.concat(Math.floor(256*Math.random()));return n},d=function(n,r){var i,u=t>=12?3:2,o=[],a=[],s=[],c=[],l=n.concat(r);for(s[0]=F(l),c=s[0],i=1;i<u;i++)s[i]=F(s[i-1].concat(l)),c=c.concat(s[i]);return o=c.slice(0,4*e),a=c.slice(4*e,4*e+16),{key:o,iv:a}},h=function(t,e,n){e=w(e);var r,i=Math.ceil(t.length/16),o=[],a=[];for(r=0;r<i;r++)o[r]=u(t.slice(16*r,16*r+16));for(t.length%16==0&&(o.push([16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]),i++),r=0;r<o.length;r++)o[r]=0===r?C(o[r],n):C(o[r],a[r-1]),a[r]=p(o[r],e);return a},_=function(t,e,n,r){e=w(e);var u,a=t.length/16,s=[],c=[],l="";for(u=0;u<a;u++)s.push(t.slice(16*u,16*(u+1)));for(u=s.length-1;u>=0;u--)c[u]=v(s[u],e),c[u]=0===u?C(c[u],n):C(c[u],s[u-1]);for(u=0;u<a-1;u++)l+=o(c[u]);return l+=o(c[u],!0),r?l:i(l)},p=function(e,r){n=!1;var i,u=b(e,r,0);for(i=1;i<t+1;i++)u=m(u),u=g(u),i<t&&(u=y(u)),u=b(u,r,i);return u},v=function(e,r){n=!0;var i,u=b(e,r,t);for(i=t-1;i>-1;i--)u=g(u),u=m(u),u=b(u,r,i),i>0&&(u=y(u));return u},m=function(t){var e,r=n?x:j,i=[];for(e=0;e<16;e++)i[e]=r[t[e]];return i},g=function(t){var e,r=[],i=n?[0,13,10,7,4,1,14,11,8,5,2,15,12,9,6,3]:[0,5,10,15,4,9,14,3,8,13,2,7,12,1,6,11];for(e=0;e<16;e++)r[e]=t[i[e]];return r},y=function(t){var e,r=[];if(n)for(e=0;e<4;e++)r[4*e]=M[t[4*e]]^P[t[1+4*e]]^D[t[2+4*e]]^k[t[3+4*e]],r[1+4*e]=k[t[4*e]]^M[t[1+4*e]]^P[t[2+4*e]]^D[t[3+4*e]],r[2+4*e]=D[t[4*e]]^k[t[1+4*e]]^M[t[2+4*e]]^P[t[3+4*e]],r[3+4*e]=P[t[4*e]]^D[t[1+4*e]]^k[t[2+4*e]]^M[t[3+4*e]];else for(e=0;e<4;e++)r[4*e]=I[t[4*e]]^R[t[1+4*e]]^t[2+4*e]^t[3+4*e],r[1+4*e]=t[4*e]^I[t[1+4*e]]^R[t[2+4*e]]^t[3+4*e],r[2+4*e]=t[4*e]^t[1+4*e]^I[t[2+4*e]]^R[t[3+4*e]],r[3+4*e]=R[t[4*e]]^t[1+4*e]^t[2+4*e]^I[t[3+4*e]];return r},b=function(t,e,n){var r,i=[];for(r=0;r<16;r++)i[r]=t[r]^e[n][r];return i},C=function(t,e){var n,r=[];for(n=0;n<16;n++)r[n]=t[n]^e[n];return r},w=function(n){var r,i,u,o,a=[],s=[],c=[];for(r=0;r<e;r++)i=[n[4*r],n[4*r+1],n[4*r+2],n[4*r+3]],a[r]=i;for(r=e;r<4*(t+1);r++){for(a[r]=[],u=0;u<4;u++)s[u]=a[r-1][u];for(r%e==0?(s=S(A(s)),s[0]^=T[r/e-1]):e>6&&r%e==4&&(s=S(s)),u=0;u<4;u++)a[r][u]=a[r-e][u]^s[u]}for(r=0;r<t+1;r++)for(c[r]=[],o=0;o<4;o++)c[r].push(a[4*r+o][0],a[4*r+o][1],a[4*r+o][2],a[4*r+o][3]);return c},S=function(t){for(var e=0;e<4;e++)t[e]=j[t[e]];return t},A=function(t){var e,n=t[0];for(e=0;e<4;e++)t[e]=t[e+1];return t[3]=n,t},O=function(t,e){var n,r=[];for(n=0;n<t.length;n+=e)r[n/e]=parseInt(t.substr(n,e),16);return r},N=function(t,e){var n,r;for(r=0,n=0;n<8;n++)r=1==(1&e)?r^t:r,t=t>127?283^t<<1:t<<1,e>>>=1;return r},E=function(t){var e,n=[];for(e=0;e<256;e++)n[e]=N(t,e);return n},j=O("637c777bf26b6fc53001672bfed7ab76ca82c97dfa5947f0add4a2af9ca472c0b7fd9326363ff7cc34a5e5f171d8311504c723c31896059a071280e2eb27b27509832c1a1b6e5aa0523bd6b329e32f8453d100ed20fcb15b6acbbe394a4c58cfd0efaafb434d338545f9027f503c9fa851a3408f929d38f5bcb6da2110fff3d2cd0c13ec5f974417c4a77e3d645d197360814fdc222a908846eeb814de5e0bdbe0323a0a4906245cc2d3ac629195e479e7c8376d8dd54ea96c56f4ea657aae08ba78252e1ca6b4c6e8dd741f4bbd8b8a703eb5664803f60e613557b986c11d9ee1f8981169d98e949b1e87e9ce5528df8ca1890dbfe6426841992d0fb054bb16",2),x=function(t){var e,n=[];for(e=0;e<t.length;e++)n[t[e]]=e;return n}(j),T=O("01020408102040801b366cd8ab4d9a2f5ebc63c697356ad4b37dfaefc591",2),I=E(2),R=E(3),k=E(9),P=E(11),D=E(13),M=E(14),L=function(t,e,n){var r,i=f(8),u=d(c(e,n),i),o=u.key,a=u.iv,s=[[83,97,108,116,101,100,95,95].concat(i)];return t=c(t,n),r=h(t,o,a),r=s.concat(r),G.encode(r)},U=function(t,e,n){var r=G.decode(t),i=r.slice(8,16),u=d(c(e,n),i),o=u.key,a=u.iv;return r=r.slice(16,r.length),t=_(r,o,a,n)},F=function(t){function e(t,e){return t<<e|t>>>32-e}function n(t,e){var n,r,i,u,o;return i=2147483648&t,u=2147483648&e,n=1073741824&t,r=1073741824&e,o=(1073741823&t)+(1073741823&e),n&r?2147483648^o^i^u:n|r?1073741824&o?3221225472^o^i^u:1073741824^o^i^u:o^i^u}function r(t,e,n){return t&e|~t&n}function i(t,e,n){return t&n|e&~n}function u(t,e,n){return t^e^n}function o(t,e,n){return e^(t|~n)}function a(t,i,u,o,a,s,c){return t=n(t,n(n(r(i,u,o),a),c)),n(e(t,s),i)}function s(t,r,u,o,a,s,c){return t=n(t,n(n(i(r,u,o),a),c)),n(e(t,s),r)}function c(t,r,i,o,a,s,c){return t=n(t,n(n(u(r,i,o),a),c)),n(e(t,s),r)}function l(t,r,i,u,a,s,c){return t=n(t,n(n(o(r,i,u),a),c)),n(e(t,s),r)}function f(t){var e,n,r=[];for(n=0;n<=3;n++)e=t>>>8*n&255,r=r.concat(e);return r}var d,h,_,p,v,m,g,y,b,C=[],w=O("67452301efcdab8998badcfe10325476d76aa478e8c7b756242070dbc1bdceeef57c0faf4787c62aa8304613fd469501698098d88b44f7afffff5bb1895cd7be6b901122fd987193a679438e49b40821f61e2562c040b340265e5a51e9b6c7aad62f105d02441453d8a1e681e7d3fbc821e1cde6c33707d6f4d50d87455a14eda9e3e905fcefa3f8676f02d98d2a4c8afffa39428771f6816d9d6122fde5380ca4beea444bdecfa9f6bb4b60bebfbc70289b7ec6eaa127fad4ef308504881d05d9d4d039e6db99e51fa27cf8c4ac5665f4292244432aff97ab9423a7fc93a039655b59c38f0ccc92ffeff47d85845dd16fa87e4ffe2ce6e0a30143144e0811a1f7537e82bd3af2352ad7d2bbeb86d391",8);for(C=function(t){for(var e,n=t.length,r=n+8,i=(r-r%64)/64,u=16*(i+1),o=[],a=0,s=0;s<n;)e=(s-s%4)/4,a=s%4*8,o[e]=o[e]|t[s]<<a,s++;return e=(s-s%4)/4,a=s%4*8,o[e]=o[e]|128<<a,o[u-2]=n<<3,o[u-1]=n>>>29,o}(t),m=w[0],g=w[1],y=w[2],b=w[3],d=0;d<C.length;d+=16)h=m,_=g,p=y,v=b,m=a(m,g,y,b,C[d+0],7,w[4]),b=a(b,m,g,y,C[d+1],12,w[5]),y=a(y,b,m,g,C[d+2],17,w[6]),g=a(g,y,b,m,C[d+3],22,w[7]),m=a(m,g,y,b,C[d+4],7,w[8]),b=a(b,m,g,y,C[d+5],12,w[9]),y=a(y,b,m,g,C[d+6],17,w[10]),g=a(g,y,b,m,C[d+7],22,w[11]),m=a(m,g,y,b,C[d+8],7,w[12]),b=a(b,m,g,y,C[d+9],12,w[13]),y=a(y,b,m,g,C[d+10],17,w[14]),g=a(g,y,b,m,C[d+11],22,w[15]),m=a(m,g,y,b,C[d+12],7,w[16]),b=a(b,m,g,y,C[d+13],12,w[17]),y=a(y,b,m,g,C[d+14],17,w[18]),g=a(g,y,b,m,C[d+15],22,w[19]),m=s(m,g,y,b,C[d+1],5,w[20]),b=s(b,m,g,y,C[d+6],9,w[21]),y=s(y,b,m,g,C[d+11],14,w[22]),g=s(g,y,b,m,C[d+0],20,w[23]),m=s(m,g,y,b,C[d+5],5,w[24]),b=s(b,m,g,y,C[d+10],9,w[25]),y=s(y,b,m,g,C[d+15],14,w[26]),g=s(g,y,b,m,C[d+4],20,w[27]),m=s(m,g,y,b,C[d+9],5,w[28]),b=s(b,m,g,y,C[d+14],9,w[29]),y=s(y,b,m,g,C[d+3],14,w[30]),g=s(g,y,b,m,C[d+8],20,w[31]),m=s(m,g,y,b,C[d+13],5,w[32]),b=s(b,m,g,y,C[d+2],9,w[33]),y=s(y,b,m,g,C[d+7],14,w[34]),g=s(g,y,b,m,C[d+12],20,w[35]),m=c(m,g,y,b,C[d+5],4,w[36]),b=c(b,m,g,y,C[d+8],11,w[37]),y=c(y,b,m,g,C[d+11],16,w[38]),g=c(g,y,b,m,C[d+14],23,w[39]),m=c(m,g,y,b,C[d+1],4,w[40]),b=c(b,m,g,y,C[d+4],11,w[41]),y=c(y,b,m,g,C[d+7],16,w[42]),g=c(g,y,b,m,C[d+10],23,w[43]),m=c(m,g,y,b,C[d+13],4,w[44]),b=c(b,m,g,y,C[d+0],11,w[45]),y=c(y,b,m,g,C[d+3],16,w[46]),g=c(g,y,b,m,C[d+6],23,w[47]),m=c(m,g,y,b,C[d+9],4,w[48]),b=c(b,m,g,y,C[d+12],11,w[49]),y=c(y,b,m,g,C[d+15],16,w[50]),g=c(g,y,b,m,C[d+2],23,w[51]),m=l(m,g,y,b,C[d+0],6,w[52]),b=l(b,m,g,y,C[d+7],10,w[53]),y=l(y,b,m,g,C[d+14],15,w[54]),g=l(g,y,b,m,C[d+5],21,w[55]),m=l(m,g,y,b,C[d+12],6,w[56]),b=l(b,m,g,y,C[d+3],10,w[57]),y=l(y,b,m,g,C[d+10],15,w[58]),g=l(g,y,b,m,C[d+1],21,w[59]),m=l(m,g,y,b,C[d+8],6,w[60]),b=l(b,m,g,y,C[d+15],10,w[61]),y=l(y,b,m,g,C[d+6],15,w[62]),g=l(g,y,b,m,C[d+13],21,w[63]),m=l(m,g,y,b,C[d+4],6,w[64]),b=l(b,m,g,y,C[d+11],10,w[65]),y=l(y,b,m,g,C[d+2],15,w[66]),g=l(g,y,b,m,C[d+9],21,w[67]),m=n(m,h),g=n(g,_),y=n(y,p),b=n(b,v);return f(m).concat(f(g),f(y),f(b))},G=function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=t.split(""),n=function(t,n){var r,i,u=[],o="";Math.floor(16*t.length/3);for(r=0;r<16*t.length;r++)u.push(t[Math.floor(r/16)][r%16]);for(r=0;r<u.length;r+=3)o+=e[u[r]>>2],o+=e[(3&u[r])<<4|u[r+1]>>4],void 0!==u[r+1]?o+=e[(15&u[r+1])<<2|u[r+2]>>6]:o+="=",void 0!==u[r+2]?o+=e[63&u[r+2]]:o+="=";for(i=o.slice(0,64)+"\n",r=1;r<Math.ceil(o.length/64);r++)i+=o.slice(64*r,64*r+64)+(Math.ceil(o.length/64)===r+1?"":"\n");return i},r=function(e){e=e.replace(/\n/g,"");var n,r=[],i=[],u=[];for(n=0;n<e.length;n+=4)i[0]=t.indexOf(e.charAt(n)),i[1]=t.indexOf(e.charAt(n+1)),i[2]=t.indexOf(e.charAt(n+2)),i[3]=t.indexOf(e.charAt(n+3)),u[0]=i[0]<<2|i[1]>>4,u[1]=(15&i[1])<<4|i[2]>>2,u[2]=(3&i[2])<<6|i[3],r.push(u[0],u[1],u[2]);return r=r.slice(0,r.length-r.length%16)};return"function"==typeof Array.indexOf&&(t=e),{encode:n,decode:r}}();return{size:l,h2a:s,expandKey:w,encryptBlock:p,decryptBlock:v,Decrypt:n,s2a:c,rawEncrypt:h,rawDecrypt:_,dec:U,openSSLKey:d,a2h:a,enc:L,Hash:{MD5:F},Base64:G}}()},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(5),s=n(6),c=n(4),l=r(c),f=n(9),d=r(f),h=n(8),_=r(h),p=n(55),v=r(p),m=n(10),g=r(m),y=n(1),b=r(y);e.default=i=function(t){return b.default.isString(t)&&(t=l.default._getSubclass(t)),this.objectClass=t,null!=t&&(this.className=t.prototype.className),this.pageCount=void 0,this._next=void 0,this._previous=void 0,this._page=void 0,this._per=-1,this._where={},this._resolve=[],this._limit=-1,this._skip=0,this._extraOptions={},!0},i.or=function(){var t,e,n;return e=b.default.toArray(arguments),t=null,(0,a._arrayEach)(e,function(e){if(b.default.isNull(t)&&(t=e.className),t!==e.className)throw"All queries must be for the same class"}),n=new i(t),n._orQuery(e),n},i.prototype={get:function(t,e){var n;return n=this,n.find({id:t}).then(function(t){var e;return t&&b.default.isArray(t)?t[0]:(e=new d.default(d.default.OBJECT_NOT_FOUND,"Object not found."),_.default.error(e))})._thenRunCallbacks(e,null)},toJSON:function(){var t;return t={where:this._where},this._resolve.length>0&&(t.resolve=this._resolve.join(",")),this._only&&(t.only=this._only.join(",")),this._limit>=0&&(t.limit=this._limit),this._page>=0&&(t.page=this._page),this._per_page>=0&&(t.per_page=this._per_page),this._skip>0&&(t.skip=this._skip),null!=this._sort&&(t.sort=this._sort),(0,a._objectEach)(this._extraOptions,function(e,n){return t[n]=e}),t},toQueryString:function(){var t;if(t=this._where,this._resolve.length>0&&(t.resolve=this._resolve.join(",")),this._only&&(t.only=this._only.join(",")),this._limit>=0&&(t.limit=this._limit),this._page>=0&&(t.page=this._page),this._per_page>=0&&(t.per_page=this._per_page),this._skip>0&&(t.skip=this._skip),null!=this._sort&&(t.sort=this._sort),(0,a._objectEach)(this._extraOptions,function(e,n){return t[n]=e}),!b.default.isEmpty(t))return(0,a._toQueryString)(t)},find:function(t){var e,n,r;return r=this,t=t||{},n={route:"objects",className:this.className,method:"GET",useACL:t.useACL,query:this.toQueryString(),forceChannel:t.forceChannel},null!=t.id&&(n.id=t.id),r.pageCount=void 0,e=(0,g.default)(n),e.then(function(t,e,n){var i,u,o;return null!=n&&(i=n.getResponseHeader("Link")),null!=i&&(r._next=/rel=\"next\"/i.test(i),r._prev=/rel=\"prev\"/i.test(i),r._last=/rel=\"last\"/i.test(i),r._next&&(u=/<.*(?:\?|&)page=([0-9]+).*>; rel="next"/,null!=(o=u.exec(i))&&(r._page=parseInt(o[1])-1)),r._prev&&(u=/<.*(?:\?|&)page=([0-9]+).*>; rel="prev"/,null!=(o=u.exec(i))&&(r._page=parseInt(o[1])+1)),r._last&&(u=/<.*(?:\?|&)page=([0-9]+).*>; rel="last"/,null!=(o=u.exec(i))&&(r.pageCount=parseInt(o[1])))),b.default.isArray(t)||(t=[t]),b.default.map(t,function(e){var n;return n=void 0,n=t.className?new l.default(t.className):new r.objectClass,n._finishFetch(e,!0),n})})._thenRunCallbacks(t)},hasNext:function(){return null!=this._next&&this._next},next:function(t){if(this.hasNext())return null==this._page&&(this._page=1),this.page(this._page+1).find(t);throw"No next page for query available"},hasPrevious:function(){return null!=this._prev&&this._prev},prev:function(t){if(this.hasPrevious()&&null!=this._page)return null==this._page&&(this._page=1),this.page(this._page-1).find(t);throw"No previous page for query available"},count:function(t){var e,n;return n=this,t=t||{},e=(0,g.default)({route:"objects",className:n.className,id:"count",method:"GET",query:this.toQueryString(),useACL:t.useACL,forceChannel:t.forceChannel}),e.then(function(t){return t.count})._thenRunCallbacks(t)},findDeleted:function(t){var e,n;return n=this,t=t||{},e=(0,g.default)({route:"objects",className:n.className,id:"deleted",method:"GET",query:this.toQueryString(),useACL:t.useACL,forceChannel:t.forceChannel}),e.then(function(t){return b.default.isArray(t)||(t=[t]),b.default.map(t,function(t){return{id:t.id,deleted_at:(0,s._decode)(t.deleted_at)}})})._thenRunCallbacks(t)},first:function(t){var e,n;return n=this,t=t||{},this._limit=1,e=(0,g.default)({route:"objects",className:this.className,method:"GET",useACL:t.useACL,query:this.toQueryString(),forceChannel:t.forceChannel}),e.then(function(t){return b.default.isArray(t)||(t=[t]),b.default.map(t,function(t){var e;return e=new n.objectClass,e._finishFetch(t,!0),e})[0]})._thenRunCallbacks(t)},collection:function(t,e){return e=e||{},new v.default(t,b.default.extend(e,{model:this.objectClass,query:this}))},skip:function(t){return this._skip=t,this},page:function(t){return this._page=t,this},per:function(t){return this._per_page=t,this},limit:function(t){return this._limit=t,this},equalTo:function(t,e){return b.default.isUndefined(e)?this.doesNotExist(t):(this._where[t]=(0,s._encode)(e),this)},_addCondition:function(t,e,n){return this._where[t+"."+e]=(0,s._encode)(n),this},notEqualTo:function(t,e){return this._addCondition(t,"ne",e),this},lessThan:function(t,e){return this._addCondition(t,"lt",e),this},greaterThan:function(t,e){return this._addCondition(t,"gt",e),this},lessThanOrEqualTo:function(t,e){return this._addCondition(t,"lte",e),this},greaterThanOrEqualTo:function(t,e){return this._addCondition(t,"gte",e),this},containedIn:function(t,e){return this._addCondition(t,"in",e),this},notContainedIn:function(t,e){return this._addCondition(t,"nin",e),this},containsAll:function(t,e){return this._addCondition(t,"all",e),this},exists:function(t){return this._addCondition(t,"exists",!0),this},doesNotExist:function(t){return this._addCondition(t,"exists",!1),this},matches:function(t,e,n){return this._addCondition(t,"regex",e),n||(n=""),e.ignoreCase&&(n+="i"),e.multiline&&(n+="m"),n&&n.length&&this._addCondition(t,"options",n),this},_orQuery:function(t){var e;return e=b.default.map(t,function(t){var e,n,r;r=t.toJSON().where,n=[];for(e in r)r.hasOwnProperty(e)&&n.push(e+": "+JSON.stringify(r[e].toString()));return"("+n.join(" and ")+")"}),this._where.where=e.join(" or "),this},_quote:function(t){return"\\Q"+t.replace("\\E","\\E\\\\E\\Q")+"\\E"},contains:function(t,e){return this._addCondition(t,"contains",e),this},startsWith:function(t,e){return this._addCondition(t,"start",e),this},endsWith:function(t,e){return this._addCondition(t,"end",e),this},geoIntersects:function(t,e){var n;return n=b.default.isString(e)?e:JSON.stringify(e),this._addCondition(t,"geoIntersects",n),this},geoWithin:function(t,e){var n;return n=b.default.isString(e)?e:JSON.stringify(e),this._addCondition(t,"geoWithin",n),this},near:function(t,e,n,r){var i,u,o;return o=b.default.isString(e)?JSON.parse(e):e,i={geometry:o},null!=n&&(i.maxDistance=n),null!=r&&(i.minDistance=r),u=JSON.stringify(i),this._addCondition(t,"near",u),this},nearCoordinates:function(t,e,n,r,i){return this.near(t,{type:"Point",coordinates:[e,n]},r,i)},ascending:function(t){return this._sort=t,this},descending:function(t){return this._sort="-"+t,this},include:function(){var t;return t=this,(0,a._arrayEach)(arguments,function(e){return b.default.isArray(e)?t._resolve=t._resolve.concat(e):t._resolve.push(e)}),this},only:function(){var t;return t=this,this._only=this._only||[],(0,a._arrayEach)(arguments,function(e){return b.default.isArray(e)?t._only=t._only.concat(e):t._only.push(e)}),this},each:function(t,e){var n,r,u;return e=e||{},this._sort||this._skip||this._limit>=0?(n="Cannot iterate on a query with sort, skip, or limit.",_.default.error(n)._thenRunCallbacks(e)):(new _.default,u=new i(this.objectClass),u._limit=e.batchSize||100,u._where=b.default.clone(this._where),u._resolve=b.default.clone(this._resolve),u.ascending("id"),r=!1,_.default._continueWhile(function(){return!r},function(){return u.find().then(function(e){var n;return n=_.default.as(),b.default.each(e,function(e){return n=n.then(function(){return t(e)})}),n.then(function(){return e.length>=u._limit?u.greaterThan("id",e[e.length-1].id):r=!0})})})._thenRunCallbacks(e))}},o.default.Query=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(4),s=r(a),c=n(9),l=r(c),f=n(56),d=r(f),h=n(1),_=r(h);e.default=i=s.default.extend("role",{constructor:function(t,e){return _.default.isString(t)&&e instanceof d.default?(s.default.prototype.constructor.call(this,null,null),this.setName(t),this.setACL(e)):s.default.prototype.constructor.call(this,t,e)},getName:function(){return this.get("name")},setName:function(t,e){return this.set("name",t,e)},getCustomers:function(){return this.relation("customers")},getRoles:function(){return this.relation("roles")},getChildren:function(){return this.relation("children")},getParents:function(){return this.relation("parents")},validate:function(t,e){var n;if("name"in t&&t.name!==this.getName()){if(n=t.name,this.id&&this.id!==t.id)return new l.default(l.default.OTHER_CAUSE,"A role's name can only be set before it has been saved.");if(!_.default.isString(n))return new l.default(l.default.OTHER_CAUSE,"A role's name must be a String.");if(!/^[0-9a-zA-Z\-_ ]+$/.test(n))return new l.default(l.default.OTHER_CAUSE,"A role's name can only contain alphanumeric characters, _, -, and spaces.")}return!!s.default.prototype.validate&&s.default.prototype.validate.call(this,t,e)}}),o.default.Role=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(10),s=r(a);e.default=i={},i.get=function(t,e){return i.request("GET",t,void 0,e)},i.post=function(t,e,n){return i.request("POST",t,e,n)},i.put=function(t,e,n){return i.request("PUT",t,e,n)},i.patch=function(t,e,n){return i.request("PATCH",t,e,n)},i.delete=function(t,e){return i.request("DELETE",t,void 0,e)},i.request=function(t,e,n,r){var i,u;return r||(r={}),"/"===e.charAt(0)&&(e=e.substr(1)),u={path:e,method:t,useACL:r.useACL},"POST"!==t&&"PUT"!==t&&"PATCH"!==t||null===n||(u.data=n),i=(0,s.default)(u),i._thenRunCallbacks(r)},o.default.API=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(1),s=(r(a),n(4)),c=r(s);e.default=i=c.default.extend("coupon",{expire:function(){}}),o.default.Coupon=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(1),s=(r(a),n(4)),c=r(s);e.default=i=c.default.extend("device",{}),o.default.Device=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(1),s=r(a),c=n(10),l=r(c),f=n(6);e.default=i={},s.default.extend(i,{run:function(t,e,n){var r;return n=n||{},r=(0,l.default)({route:"functions",className:t,method:"POST",data:(0,f._encode)(e,null,!0)}),r.then(function(t){return(0,f._decode)(null,t).result})._thenRunCallbacks(n)}}),o.default.Cloud=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(1),s=(r(a),n(4)),c=r(s),l=n(9),f=r(l),d=n(8),h=r(d),_=n(10),p=r(_);e.default=i=c.default.extend("order",{isCurrent:function(){return"current"===this.id},add:function(t,e,n){var r,i,u;return this.isCurrent()?(u=this,r={product:t,quantity:e,extras:n},i=(0,p.default)({path:"orders/"+this.id+"/items",method:"POST",data:r}),i.then(function(t){return u._finishSave(t),u.id="current",u})):h.default.error(new f.default(-1,"You can only add line items to the current order"))},remove:function(t){var e,n;return this.isCurrent()?(n=this,e=(0,p.default)({path:"orders/"+this.id+"/items/"+t.id,method:"DELETE"}),e.then(function(t){return n._finishSave(t),n.id="current",n})):h.default.error(new f.default(-1,"You can only remove items from the current order"))},getItems:function(){return this.get("items")}},{current:function(){return new i({id:"current"})}}),o.default.Order=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(4),s=r(a),c=n(57),l=r(c);e.default=i=s.default.extend("product",{getVariants:function(){return this.get("variants")},hasVariants:function(){return this.get("variantsEnabled")},getSubProducts:function(){return this.relation("subproducts")},addSubProduct:function(t,e){return this.getSubProducts().add(new l.default({product:t,variant:e}))},removeSubProduct:function(t){return this.getSubProducts().remove(t)}}),o.default.Product=i}]).default;
|
|
20
|
+
function(){var t=14,e=8,n=!1,r=function(t){try{return unescape(encodeURIComponent(t))}catch(t){throw"Error on UTF-8 encode"}},i=function(t){try{return decodeURIComponent(escape(t))}catch(t){throw"Bad Key"}},u=function(t){var e,n,r=[];for(t.length<16&&(e=16-t.length,r=[e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e]),n=0;n<t.length;n++)r[n]=t[n];return r},o=function(t,e){var n,r,i="";if(e){if((n=t[15])>16)throw"Decryption error: Maybe bad key";if(16===n)return"";for(r=0;r<16-n;r++)i+=String.fromCharCode(t[r])}else for(r=0;r<16;r++)i+=String.fromCharCode(t[r]);return i},a=function(t){var e,n="";for(e=0;e<t.length;e++)n+=(t[e]<16?"0":"")+t[e].toString(16);return n},s=function(t){var e=[];return t.replace(/(..)/g,function(t){e.push(parseInt(t,16))}),e},c=function(t,e){var n,i=[];for(e||(t=r(t)),n=0;n<t.length;n++)i[n]=t.charCodeAt(n);return i},l=function(n){switch(n){case 128:t=10,e=4;break;case 192:t=12,e=6;break;case 256:t=14,e=8;break;default:throw"Invalid Key Size Specified:"+n}},f=function(t){var e,n=[];for(e=0;e<t;e++)n=n.concat(Math.floor(256*Math.random()));return n},d=function(n,r){var i,u=t>=12?3:2,o=[],a=[],s=[],c=[],l=n.concat(r);for(s[0]=F(l),c=s[0],i=1;i<u;i++)s[i]=F(s[i-1].concat(l)),c=c.concat(s[i]);return o=c.slice(0,4*e),a=c.slice(4*e,4*e+16),{key:o,iv:a}},h=function(t,e,n){e=w(e);var r,i=Math.ceil(t.length/16),o=[],a=[];for(r=0;r<i;r++)o[r]=u(t.slice(16*r,16*r+16));for(t.length%16==0&&(o.push([16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]),i++),r=0;r<o.length;r++)o[r]=0===r?C(o[r],n):C(o[r],a[r-1]),a[r]=p(o[r],e);return a},_=function(t,e,n,r){e=w(e);var u,a=t.length/16,s=[],c=[],l="";for(u=0;u<a;u++)s.push(t.slice(16*u,16*(u+1)));for(u=s.length-1;u>=0;u--)c[u]=v(s[u],e),c[u]=0===u?C(c[u],n):C(c[u],s[u-1]);for(u=0;u<a-1;u++)l+=o(c[u]);return l+=o(c[u],!0),r?l:i(l)},p=function(e,r){n=!1;var i,u=b(e,r,0);for(i=1;i<t+1;i++)u=m(u),u=g(u),i<t&&(u=y(u)),u=b(u,r,i);return u},v=function(e,r){n=!0;var i,u=b(e,r,t);for(i=t-1;i>-1;i--)u=g(u),u=m(u),u=b(u,r,i),i>0&&(u=y(u));return u},m=function(t){var e,r=n?x:j,i=[];for(e=0;e<16;e++)i[e]=r[t[e]];return i},g=function(t){var e,r=[],i=n?[0,13,10,7,4,1,14,11,8,5,2,15,12,9,6,3]:[0,5,10,15,4,9,14,3,8,13,2,7,12,1,6,11];for(e=0;e<16;e++)r[e]=t[i[e]];return r},y=function(t){var e,r=[];if(n)for(e=0;e<4;e++)r[4*e]=M[t[4*e]]^P[t[1+4*e]]^D[t[2+4*e]]^k[t[3+4*e]],r[1+4*e]=k[t[4*e]]^M[t[1+4*e]]^P[t[2+4*e]]^D[t[3+4*e]],r[2+4*e]=D[t[4*e]]^k[t[1+4*e]]^M[t[2+4*e]]^P[t[3+4*e]],r[3+4*e]=P[t[4*e]]^D[t[1+4*e]]^k[t[2+4*e]]^M[t[3+4*e]];else for(e=0;e<4;e++)r[4*e]=I[t[4*e]]^R[t[1+4*e]]^t[2+4*e]^t[3+4*e],r[1+4*e]=t[4*e]^I[t[1+4*e]]^R[t[2+4*e]]^t[3+4*e],r[2+4*e]=t[4*e]^t[1+4*e]^I[t[2+4*e]]^R[t[3+4*e]],r[3+4*e]=R[t[4*e]]^t[1+4*e]^t[2+4*e]^I[t[3+4*e]];return r},b=function(t,e,n){var r,i=[];for(r=0;r<16;r++)i[r]=t[r]^e[n][r];return i},C=function(t,e){var n,r=[];for(n=0;n<16;n++)r[n]=t[n]^e[n];return r},w=function(n){var r,i,u,o,a=[],s=[],c=[];for(r=0;r<e;r++)i=[n[4*r],n[4*r+1],n[4*r+2],n[4*r+3]],a[r]=i;for(r=e;r<4*(t+1);r++){for(a[r]=[],u=0;u<4;u++)s[u]=a[r-1][u];for(r%e==0?(s=S(A(s)),s[0]^=T[r/e-1]):e>6&&r%e==4&&(s=S(s)),u=0;u<4;u++)a[r][u]=a[r-e][u]^s[u]}for(r=0;r<t+1;r++)for(c[r]=[],o=0;o<4;o++)c[r].push(a[4*r+o][0],a[4*r+o][1],a[4*r+o][2],a[4*r+o][3]);return c},S=function(t){for(var e=0;e<4;e++)t[e]=j[t[e]];return t},A=function(t){var e,n=t[0];for(e=0;e<4;e++)t[e]=t[e+1];return t[3]=n,t},O=function(t,e){var n,r=[];for(n=0;n<t.length;n+=e)r[n/e]=parseInt(t.substr(n,e),16);return r},N=function(t,e){var n,r;for(r=0,n=0;n<8;n++)r=1==(1&e)?r^t:r,t=t>127?283^t<<1:t<<1,e>>>=1;return r},E=function(t){var e,n=[];for(e=0;e<256;e++)n[e]=N(t,e);return n},j=O("637c777bf26b6fc53001672bfed7ab76ca82c97dfa5947f0add4a2af9ca472c0b7fd9326363ff7cc34a5e5f171d8311504c723c31896059a071280e2eb27b27509832c1a1b6e5aa0523bd6b329e32f8453d100ed20fcb15b6acbbe394a4c58cfd0efaafb434d338545f9027f503c9fa851a3408f929d38f5bcb6da2110fff3d2cd0c13ec5f974417c4a77e3d645d197360814fdc222a908846eeb814de5e0bdbe0323a0a4906245cc2d3ac629195e479e7c8376d8dd54ea96c56f4ea657aae08ba78252e1ca6b4c6e8dd741f4bbd8b8a703eb5664803f60e613557b986c11d9ee1f8981169d98e949b1e87e9ce5528df8ca1890dbfe6426841992d0fb054bb16",2),x=function(t){var e,n=[];for(e=0;e<t.length;e++)n[t[e]]=e;return n}(j),T=O("01020408102040801b366cd8ab4d9a2f5ebc63c697356ad4b37dfaefc591",2),I=E(2),R=E(3),k=E(9),P=E(11),D=E(13),M=E(14),L=function(t,e,n){var r,i=f(8),u=d(c(e,n),i),o=u.key,a=u.iv,s=[[83,97,108,116,101,100,95,95].concat(i)];return t=c(t,n),r=h(t,o,a),r=s.concat(r),G.encode(r)},U=function(t,e,n){var r=G.decode(t),i=r.slice(8,16),u=d(c(e,n),i),o=u.key,a=u.iv;return r=r.slice(16,r.length),t=_(r,o,a,n)},F=function(t){function e(t,e){return t<<e|t>>>32-e}function n(t,e){var n,r,i,u,o;return i=2147483648&t,u=2147483648&e,n=1073741824&t,r=1073741824&e,o=(1073741823&t)+(1073741823&e),n&r?2147483648^o^i^u:n|r?1073741824&o?3221225472^o^i^u:1073741824^o^i^u:o^i^u}function r(t,e,n){return t&e|~t&n}function i(t,e,n){return t&n|e&~n}function u(t,e,n){return t^e^n}function o(t,e,n){return e^(t|~n)}function a(t,i,u,o,a,s,c){return t=n(t,n(n(r(i,u,o),a),c)),n(e(t,s),i)}function s(t,r,u,o,a,s,c){return t=n(t,n(n(i(r,u,o),a),c)),n(e(t,s),r)}function c(t,r,i,o,a,s,c){return t=n(t,n(n(u(r,i,o),a),c)),n(e(t,s),r)}function l(t,r,i,u,a,s,c){return t=n(t,n(n(o(r,i,u),a),c)),n(e(t,s),r)}function f(t){var e,n,r=[];for(n=0;n<=3;n++)e=t>>>8*n&255,r=r.concat(e);return r}var d,h,_,p,v,m,g,y,b,C=[],w=O("67452301efcdab8998badcfe10325476d76aa478e8c7b756242070dbc1bdceeef57c0faf4787c62aa8304613fd469501698098d88b44f7afffff5bb1895cd7be6b901122fd987193a679438e49b40821f61e2562c040b340265e5a51e9b6c7aad62f105d02441453d8a1e681e7d3fbc821e1cde6c33707d6f4d50d87455a14eda9e3e905fcefa3f8676f02d98d2a4c8afffa39428771f6816d9d6122fde5380ca4beea444bdecfa9f6bb4b60bebfbc70289b7ec6eaa127fad4ef308504881d05d9d4d039e6db99e51fa27cf8c4ac5665f4292244432aff97ab9423a7fc93a039655b59c38f0ccc92ffeff47d85845dd16fa87e4ffe2ce6e0a30143144e0811a1f7537e82bd3af2352ad7d2bbeb86d391",8);for(C=function(t){for(var e,n=t.length,r=n+8,i=(r-r%64)/64,u=16*(i+1),o=[],a=0,s=0;s<n;)e=(s-s%4)/4,a=s%4*8,o[e]=o[e]|t[s]<<a,s++;return e=(s-s%4)/4,a=s%4*8,o[e]=o[e]|128<<a,o[u-2]=n<<3,o[u-1]=n>>>29,o}(t),m=w[0],g=w[1],y=w[2],b=w[3],d=0;d<C.length;d+=16)h=m,_=g,p=y,v=b,m=a(m,g,y,b,C[d+0],7,w[4]),b=a(b,m,g,y,C[d+1],12,w[5]),y=a(y,b,m,g,C[d+2],17,w[6]),g=a(g,y,b,m,C[d+3],22,w[7]),m=a(m,g,y,b,C[d+4],7,w[8]),b=a(b,m,g,y,C[d+5],12,w[9]),y=a(y,b,m,g,C[d+6],17,w[10]),g=a(g,y,b,m,C[d+7],22,w[11]),m=a(m,g,y,b,C[d+8],7,w[12]),b=a(b,m,g,y,C[d+9],12,w[13]),y=a(y,b,m,g,C[d+10],17,w[14]),g=a(g,y,b,m,C[d+11],22,w[15]),m=a(m,g,y,b,C[d+12],7,w[16]),b=a(b,m,g,y,C[d+13],12,w[17]),y=a(y,b,m,g,C[d+14],17,w[18]),g=a(g,y,b,m,C[d+15],22,w[19]),m=s(m,g,y,b,C[d+1],5,w[20]),b=s(b,m,g,y,C[d+6],9,w[21]),y=s(y,b,m,g,C[d+11],14,w[22]),g=s(g,y,b,m,C[d+0],20,w[23]),m=s(m,g,y,b,C[d+5],5,w[24]),b=s(b,m,g,y,C[d+10],9,w[25]),y=s(y,b,m,g,C[d+15],14,w[26]),g=s(g,y,b,m,C[d+4],20,w[27]),m=s(m,g,y,b,C[d+9],5,w[28]),b=s(b,m,g,y,C[d+14],9,w[29]),y=s(y,b,m,g,C[d+3],14,w[30]),g=s(g,y,b,m,C[d+8],20,w[31]),m=s(m,g,y,b,C[d+13],5,w[32]),b=s(b,m,g,y,C[d+2],9,w[33]),y=s(y,b,m,g,C[d+7],14,w[34]),g=s(g,y,b,m,C[d+12],20,w[35]),m=c(m,g,y,b,C[d+5],4,w[36]),b=c(b,m,g,y,C[d+8],11,w[37]),y=c(y,b,m,g,C[d+11],16,w[38]),g=c(g,y,b,m,C[d+14],23,w[39]),m=c(m,g,y,b,C[d+1],4,w[40]),b=c(b,m,g,y,C[d+4],11,w[41]),y=c(y,b,m,g,C[d+7],16,w[42]),g=c(g,y,b,m,C[d+10],23,w[43]),m=c(m,g,y,b,C[d+13],4,w[44]),b=c(b,m,g,y,C[d+0],11,w[45]),y=c(y,b,m,g,C[d+3],16,w[46]),g=c(g,y,b,m,C[d+6],23,w[47]),m=c(m,g,y,b,C[d+9],4,w[48]),b=c(b,m,g,y,C[d+12],11,w[49]),y=c(y,b,m,g,C[d+15],16,w[50]),g=c(g,y,b,m,C[d+2],23,w[51]),m=l(m,g,y,b,C[d+0],6,w[52]),b=l(b,m,g,y,C[d+7],10,w[53]),y=l(y,b,m,g,C[d+14],15,w[54]),g=l(g,y,b,m,C[d+5],21,w[55]),m=l(m,g,y,b,C[d+12],6,w[56]),b=l(b,m,g,y,C[d+3],10,w[57]),y=l(y,b,m,g,C[d+10],15,w[58]),g=l(g,y,b,m,C[d+1],21,w[59]),m=l(m,g,y,b,C[d+8],6,w[60]),b=l(b,m,g,y,C[d+15],10,w[61]),y=l(y,b,m,g,C[d+6],15,w[62]),g=l(g,y,b,m,C[d+13],21,w[63]),m=l(m,g,y,b,C[d+4],6,w[64]),b=l(b,m,g,y,C[d+11],10,w[65]),y=l(y,b,m,g,C[d+2],15,w[66]),g=l(g,y,b,m,C[d+9],21,w[67]),m=n(m,h),g=n(g,_),y=n(y,p),b=n(b,v);return f(m).concat(f(g),f(y),f(b))},G=function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=t.split(""),n=function(t,n){var r,i,u=[],o="";Math.floor(16*t.length/3);for(r=0;r<16*t.length;r++)u.push(t[Math.floor(r/16)][r%16]);for(r=0;r<u.length;r+=3)o+=e[u[r]>>2],o+=e[(3&u[r])<<4|u[r+1]>>4],void 0!==u[r+1]?o+=e[(15&u[r+1])<<2|u[r+2]>>6]:o+="=",void 0!==u[r+2]?o+=e[63&u[r+2]]:o+="=";for(i=o.slice(0,64)+"\n",r=1;r<Math.ceil(o.length/64);r++)i+=o.slice(64*r,64*r+64)+(Math.ceil(o.length/64)===r+1?"":"\n");return i},r=function(e){e=e.replace(/\n/g,"");var n,r=[],i=[],u=[];for(n=0;n<e.length;n+=4)i[0]=t.indexOf(e.charAt(n)),i[1]=t.indexOf(e.charAt(n+1)),i[2]=t.indexOf(e.charAt(n+2)),i[3]=t.indexOf(e.charAt(n+3)),u[0]=i[0]<<2|i[1]>>4,u[1]=(15&i[1])<<4|i[2]>>2,u[2]=(3&i[2])<<6|i[3],r.push(u[0],u[1],u[2]);return r=r.slice(0,r.length-r.length%16)};return"function"==typeof Array.indexOf&&(t=e),{encode:n,decode:r}}();return{size:l,h2a:s,expandKey:w,encryptBlock:p,decryptBlock:v,Decrypt:n,s2a:c,rawEncrypt:h,rawDecrypt:_,dec:U,openSSLKey:d,a2h:a,enc:L,Hash:{MD5:F},Base64:G}}()},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(5),s=n(6),c=n(4),l=r(c),f=n(9),d=r(f),h=n(7),_=r(h),p=n(55),v=r(p),m=n(10),g=r(m),y=n(1),b=r(y);e.default=i=function(t){return b.default.isString(t)&&(t=l.default._getSubclass(t)),this.objectClass=t,null!=t&&(this.className=t.prototype.className),this.pageCount=void 0,this._next=void 0,this._previous=void 0,this._page=void 0,this._per=-1,this._where={},this._resolve=[],this._limit=-1,this._skip=0,this._extraOptions={},!0},i.or=function(){var t,e,n;return e=b.default.toArray(arguments),t=null,(0,a._arrayEach)(e,function(e){if(b.default.isNull(t)&&(t=e.className),t!==e.className)throw"All queries must be for the same class"}),n=new i(t),n._orQuery(e),n},i.prototype={get:function(t,e){var n;return n=this,n.find({id:t}).then(function(t){var e;return t&&b.default.isArray(t)?t[0]:(e=new d.default(d.default.OBJECT_NOT_FOUND,"Object not found."),_.default.error(e))})._thenRunCallbacks(e,null)},toJSON:function(){var t;return t={where:this._where},this._resolve.length>0&&(t.resolve=this._resolve.join(",")),this._only&&(t.only=this._only.join(",")),this._limit>=0&&(t.limit=this._limit),this._page>=0&&(t.page=this._page),this._per_page>=0&&(t.per_page=this._per_page),this._skip>0&&(t.skip=this._skip),null!=this._sort&&(t.sort=this._sort),(0,a._objectEach)(this._extraOptions,function(e,n){return t[n]=e}),t},toQueryString:function(){var t;if(t=this._where,this._resolve.length>0&&(t.resolve=this._resolve.join(",")),this._only&&(t.only=this._only.join(",")),this._limit>=0&&(t.limit=this._limit),this._page>=0&&(t.page=this._page),this._per_page>=0&&(t.per_page=this._per_page),this._skip>0&&(t.skip=this._skip),null!=this._sort&&(t.sort=this._sort),(0,a._objectEach)(this._extraOptions,function(e,n){return t[n]=e}),!b.default.isEmpty(t))return(0,a._toQueryString)(t)},find:function(t){var e,n,r;return r=this,t=t||{},n={route:"objects",className:this.className,method:"GET",useACL:t.useACL,query:this.toQueryString(),forceChannel:t.forceChannel},null!=t.id&&(n.id=t.id),r.pageCount=void 0,e=(0,g.default)(n),e.then(function(t,e,n){var i,u,o;return null!=n&&(i=n.getResponseHeader("Link")),null!=i&&(r._next=/rel=\"next\"/i.test(i),r._prev=/rel=\"prev\"/i.test(i),r._last=/rel=\"last\"/i.test(i),r._next&&(u=/<.*(?:\?|&)page=([0-9]+).*>; rel="next"/,null!=(o=u.exec(i))&&(r._page=parseInt(o[1])-1)),r._prev&&(u=/<.*(?:\?|&)page=([0-9]+).*>; rel="prev"/,null!=(o=u.exec(i))&&(r._page=parseInt(o[1])+1)),r._last&&(u=/<.*(?:\?|&)page=([0-9]+).*>; rel="last"/,null!=(o=u.exec(i))&&(r.pageCount=parseInt(o[1])))),b.default.isArray(t)||(t=[t]),b.default.map(t,function(e){var n;return n=void 0,n=t.className?new l.default(t.className):new r.objectClass,n._finishFetch(e,!0),n})})._thenRunCallbacks(t)},hasNext:function(){return null!=this._next&&this._next},next:function(t){if(this.hasNext())return null==this._page&&(this._page=1),this.page(this._page+1).find(t);throw"No next page for query available"},hasPrevious:function(){return null!=this._prev&&this._prev},prev:function(t){if(this.hasPrevious()&&null!=this._page)return null==this._page&&(this._page=1),this.page(this._page-1).find(t);throw"No previous page for query available"},count:function(t){var e,n;return n=this,t=t||{},e=(0,g.default)({route:"objects",className:n.className,id:"count",method:"GET",query:this.toQueryString(),useACL:t.useACL,forceChannel:t.forceChannel}),e.then(function(t){return t.count})._thenRunCallbacks(t)},findDeleted:function(t){var e,n;return n=this,t=t||{},e=(0,g.default)({route:"objects",className:n.className,id:"deleted",method:"GET",query:this.toQueryString(),useACL:t.useACL,forceChannel:t.forceChannel}),e.then(function(t){return b.default.isArray(t)||(t=[t]),b.default.map(t,function(t){return{id:t.id,deleted_at:(0,s._decode)(t.deleted_at)}})})._thenRunCallbacks(t)},first:function(t){var e,n;return n=this,t=t||{},this._limit=1,e=(0,g.default)({route:"objects",className:this.className,method:"GET",useACL:t.useACL,query:this.toQueryString(),forceChannel:t.forceChannel}),e.then(function(t){return b.default.isArray(t)||(t=[t]),b.default.map(t,function(t){var e;return e=new n.objectClass,e._finishFetch(t,!0),e})[0]})._thenRunCallbacks(t)},collection:function(t,e){return e=e||{},new v.default(t,b.default.extend(e,{model:this.objectClass,query:this}))},skip:function(t){return this._skip=t,this},page:function(t){return this._page=t,this},per:function(t){return this._per_page=t,this},limit:function(t){return this._limit=t,this},equalTo:function(t,e){return b.default.isUndefined(e)?this.doesNotExist(t):(this._where[t]=(0,s._encode)(e),this)},_addCondition:function(t,e,n){return this._where[t+"."+e]=(0,s._encode)(n),this},notEqualTo:function(t,e){return this._addCondition(t,"ne",e),this},lessThan:function(t,e){return this._addCondition(t,"lt",e),this},greaterThan:function(t,e){return this._addCondition(t,"gt",e),this},lessThanOrEqualTo:function(t,e){return this._addCondition(t,"lte",e),this},greaterThanOrEqualTo:function(t,e){return this._addCondition(t,"gte",e),this},containedIn:function(t,e){return this._addCondition(t,"in",e),this},notContainedIn:function(t,e){return this._addCondition(t,"nin",e),this},containsAll:function(t,e){return this._addCondition(t,"all",e),this},exists:function(t){return this._addCondition(t,"exists",!0),this},doesNotExist:function(t){return this._addCondition(t,"exists",!1),this},matches:function(t,e,n){return this._addCondition(t,"regex",e),n||(n=""),e.ignoreCase&&(n+="i"),e.multiline&&(n+="m"),n&&n.length&&this._addCondition(t,"options",n),this},_orQuery:function(t){var e;return e=b.default.map(t,function(t){var e,n,r;r=t.toJSON().where,n=[];for(e in r)r.hasOwnProperty(e)&&n.push(e+": "+JSON.stringify(r[e].toString()));return"("+n.join(" and ")+")"}),this._where.where=e.join(" or "),this},_quote:function(t){return"\\Q"+t.replace("\\E","\\E\\\\E\\Q")+"\\E"},contains:function(t,e){return this._addCondition(t,"contains",e),this},startsWith:function(t,e){return this._addCondition(t,"start",e),this},endsWith:function(t,e){return this._addCondition(t,"end",e),this},geoIntersects:function(t,e){var n;return n=b.default.isString(e)?e:JSON.stringify(e),this._addCondition(t,"geoIntersects",n),this},geoWithin:function(t,e){var n;return n=b.default.isString(e)?e:JSON.stringify(e),this._addCondition(t,"geoWithin",n),this},near:function(t,e,n,r){var i,u,o;return o=b.default.isString(e)?JSON.parse(e):e,i={geometry:o},null!=n&&(i.maxDistance=n),null!=r&&(i.minDistance=r),u=JSON.stringify(i),this._addCondition(t,"near",u),this},nearCoordinates:function(t,e,n,r,i){return this.near(t,{type:"Point",coordinates:[e,n]},r,i)},ascending:function(t){return this._sort=t,this},descending:function(t){return this._sort="-"+t,this},include:function(){var t;return t=this,(0,a._arrayEach)(arguments,function(e){return b.default.isArray(e)?t._resolve=t._resolve.concat(e):t._resolve.push(e)}),this},only:function(){var t;return t=this,this._only=this._only||[],(0,a._arrayEach)(arguments,function(e){return b.default.isArray(e)?t._only=t._only.concat(e):t._only.push(e)}),this},each:function(t,e){var n,r,u;return e=e||{},this._sort||this._skip||this._limit>=0?(n="Cannot iterate on a query with sort, skip, or limit.",_.default.error(n)._thenRunCallbacks(e)):(new _.default,u=new i(this.objectClass),u._limit=e.batchSize||100,u._where=b.default.clone(this._where),u._resolve=b.default.clone(this._resolve),u.ascending("id"),r=!1,_.default._continueWhile(function(){return!r},function(){return u.find().then(function(e){var n;return n=_.default.as(),b.default.each(e,function(e){return n=n.then(function(){return t(e)})}),n.then(function(){return e.length>=u._limit?u.greaterThan("id",e[e.length-1].id):r=!0})})})._thenRunCallbacks(e))}},o.default.Query=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(4),s=r(a),c=n(9),l=r(c),f=n(56),d=r(f),h=n(1),_=r(h);e.default=i=s.default.extend("role",{constructor:function(t,e){return _.default.isString(t)&&e instanceof d.default?(s.default.prototype.constructor.call(this,null,null),this.setName(t),this.setACL(e)):s.default.prototype.constructor.call(this,t,e)},getName:function(){return this.get("name")},setName:function(t,e){return this.set("name",t,e)},getCustomers:function(){return this.relation("customers")},getRoles:function(){return this.relation("roles")},getChildren:function(){return this.relation("children")},getParents:function(){return this.relation("parents")},validate:function(t,e){var n;if("name"in t&&t.name!==this.getName()){if(n=t.name,this.id&&this.id!==t.id)return new l.default(l.default.OTHER_CAUSE,"A role's name can only be set before it has been saved.");if(!_.default.isString(n))return new l.default(l.default.OTHER_CAUSE,"A role's name must be a String.");if(!/^[0-9a-zA-Z\-_ ]+$/.test(n))return new l.default(l.default.OTHER_CAUSE,"A role's name can only contain alphanumeric characters, _, -, and spaces.")}return!!s.default.prototype.validate&&s.default.prototype.validate.call(this,t,e)}}),o.default.Role=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(10),s=r(a);e.default=i={},i.get=function(t,e){return i.request("GET",t,void 0,e)},i.post=function(t,e,n){return i.request("POST",t,e,n)},i.put=function(t,e,n){return i.request("PUT",t,e,n)},i.patch=function(t,e,n){return i.request("PATCH",t,e,n)},i.delete=function(t,e){return i.request("DELETE",t,void 0,e)},i.request=function(t,e,n,r){var i,u;return r||(r={}),"/"===e.charAt(0)&&(e=e.substr(1)),u={path:e,method:t,useACL:r.useACL},"POST"!==t&&"PUT"!==t&&"PATCH"!==t||null===n||(u.data=n),i=(0,s.default)(u),i._thenRunCallbacks(r)},o.default.API=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(1),s=(r(a),n(4)),c=r(s);e.default=i=c.default.extend("coupon",{expire:function(){}}),o.default.Coupon=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(1),s=(r(a),n(4)),c=r(s);e.default=i=c.default.extend("device",{}),o.default.Device=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(1),s=r(a),c=n(10),l=r(c),f=n(7),d=r(f),h=n(6);e.default=i={},s.default.extend(i,{run:function(t,e,n){var r;return n=n||{},r=(0,l.default)({route:"functions",className:t,method:"POST",data:(0,h._encode)(e,null,!0)}),r.then(function(t){return e=(0,h._decode)(null,t),e&&141===e.code?d.default.error(e):e.result})._thenRunCallbacks(n)}}),o.default.Cloud=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(1),s=(r(a),n(4)),c=r(s),l=n(9),f=r(l),d=n(7),h=r(d),_=n(10),p=r(_);e.default=i=c.default.extend("order",{isCurrent:function(){return"current"===this.id},add:function(t,e,n){var r,i,u;return this.isCurrent()?(u=this,r={product:t,quantity:e,extras:n},i=(0,p.default)({path:"orders/"+this.id+"/items",method:"POST",data:r}),i.then(function(t){return u._finishSave(t),u.id="current",u})):h.default.error(new f.default(-1,"You can only add line items to the current order"))},remove:function(t){var e,n;return this.isCurrent()?(n=this,e=(0,p.default)({path:"orders/"+this.id+"/items/"+t.id,method:"DELETE"}),e.then(function(t){return n._finishSave(t),n.id="current",n})):h.default.error(new f.default(-1,"You can only remove items from the current order"))},getItems:function(){return this.get("items")}},{current:function(){return new i({id:"current"})}}),o.default.Order=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(0),o=r(u),a=n(4),s=r(a),c=n(57),l=r(c);e.default=i=s.default.extend("product",{getVariants:function(){return this.get("variants")},hasVariants:function(){return this.get("variantsEnabled")},getSubProducts:function(){return this.relation("subproducts")},addSubProduct:function(t,e){return this.getSubProducts().add(new l.default({product:t,variant:e}))},removeSubProduct:function(t){return this.getSubProducts().remove(t)}}),o.default.Product=i}]).default;
|
package/dist/sdk/functions.js
CHANGED
|
@@ -16,6 +16,10 @@ var _requests = require('./requests');
|
|
|
16
16
|
|
|
17
17
|
var _requests2 = _interopRequireDefault(_requests);
|
|
18
18
|
|
|
19
|
+
var _future = require('./future');
|
|
20
|
+
|
|
21
|
+
var _future2 = _interopRequireDefault(_future);
|
|
22
|
+
|
|
19
23
|
var _global = require('./global');
|
|
20
24
|
|
|
21
25
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -48,7 +52,12 @@ _underscore2.default.extend(Cloud, {
|
|
|
48
52
|
data: (0, _global._encode)(data, null, true)
|
|
49
53
|
});
|
|
50
54
|
return request.then(function (resp) {
|
|
51
|
-
|
|
55
|
+
data = (0, _global._decode)(null, resp);
|
|
56
|
+
if (data && data.code === 141) {
|
|
57
|
+
return _future2.default.error(data);
|
|
58
|
+
} else {
|
|
59
|
+
return data.result;
|
|
60
|
+
}
|
|
52
61
|
})._thenRunCallbacks(options);
|
|
53
62
|
}
|
|
54
63
|
});
|
package/dist/sdk/future.js
CHANGED
|
@@ -63,6 +63,13 @@ _underscore2.default.extend(Future, {
|
|
|
63
63
|
future.resolve.apply(future, arguments);
|
|
64
64
|
return future;
|
|
65
65
|
},
|
|
66
|
+
// add alias similar to native Promise
|
|
67
|
+
resolve: function resolve() {
|
|
68
|
+
var future;
|
|
69
|
+
future = new Future();
|
|
70
|
+
future.resolve.apply(future, arguments);
|
|
71
|
+
return future;
|
|
72
|
+
},
|
|
66
73
|
/*
|
|
67
74
|
Returns a new future that is rejected with a given error.
|
|
68
75
|
@return {Nimbu.Future} the new future.
|
|
@@ -73,10 +80,18 @@ _underscore2.default.extend(Future, {
|
|
|
73
80
|
future.reject.apply(future, arguments);
|
|
74
81
|
return future;
|
|
75
82
|
},
|
|
83
|
+
// add alias similar to native Promise
|
|
84
|
+
reject: function reject() {
|
|
85
|
+
var future;
|
|
86
|
+
future = new Future();
|
|
87
|
+
future.reject.apply(future, arguments);
|
|
88
|
+
return future;
|
|
89
|
+
},
|
|
76
90
|
/*
|
|
77
91
|
Returns a new future that is fulfilled when all of the input futures
|
|
78
92
|
are resolved. If any future in the list fails, then the returned future
|
|
79
|
-
will fail with
|
|
93
|
+
will fail with an array of all the rejected values (null for the futures
|
|
94
|
+
that didn't fail). If they all succeed, then the returned
|
|
80
95
|
future will succeed, with the result being an array with the results of
|
|
81
96
|
all the input futures.
|
|
82
97
|
@param {Array} futures a list of futures to wait for.
|
|
@@ -258,6 +273,9 @@ _underscore2.default.extend(Future.prototype, {
|
|
|
258
273
|
always: function always(callback) {
|
|
259
274
|
return this.then(callback, callback);
|
|
260
275
|
},
|
|
276
|
+
finally: function _finally(callback) {
|
|
277
|
+
return this.then(callback, callback);
|
|
278
|
+
},
|
|
261
279
|
/*
|
|
262
280
|
Add handlers to be called when the Future object is resolved
|
|
263
281
|
*/
|
|
@@ -270,6 +288,10 @@ _underscore2.default.extend(Future.prototype, {
|
|
|
270
288
|
fail: function fail(callback) {
|
|
271
289
|
return this.then(null, callback);
|
|
272
290
|
},
|
|
291
|
+
// alias fail to catch to mimick native Promises
|
|
292
|
+
catch: function _catch(callback) {
|
|
293
|
+
return this.then(null, callback);
|
|
294
|
+
},
|
|
273
295
|
/*
|
|
274
296
|
* Run the given callbacks after this future is fulfilled.
|
|
275
297
|
* @param optionsOrCallback {} A Backbone-style options callback, or a
|
package/dist/sdk/version.js
CHANGED
package/package.json
CHANGED
package/src/sdk/functions.coffee
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Nimbu from './registry'
|
|
2
2
|
import _ from 'underscore'
|
|
3
3
|
import _request from './requests'
|
|
4
|
+
import Future from './future'
|
|
4
5
|
import { _encode, _decode } from './global'
|
|
5
6
|
|
|
6
7
|
export default Cloud = {}
|
|
@@ -27,7 +28,11 @@ _.extend Cloud,
|
|
|
27
28
|
data: _encode(data, null, true)
|
|
28
29
|
)
|
|
29
30
|
request.then((resp) ->
|
|
30
|
-
_decode(null, resp)
|
|
31
|
+
data = _decode(null, resp)
|
|
32
|
+
if data && data.code == 141
|
|
33
|
+
Future.error data
|
|
34
|
+
else
|
|
35
|
+
data.result
|
|
31
36
|
)._thenRunCallbacks options
|
|
32
37
|
|
|
33
38
|
Nimbu.Cloud = Cloud
|
package/src/sdk/future.coffee
CHANGED
|
@@ -48,6 +48,11 @@ _.extend Future,
|
|
|
48
48
|
future.resolve.apply future, arguments
|
|
49
49
|
future
|
|
50
50
|
|
|
51
|
+
# add alias similar to native Promise
|
|
52
|
+
resolve: ->
|
|
53
|
+
future = new Future()
|
|
54
|
+
future.resolve.apply future, arguments
|
|
55
|
+
future
|
|
51
56
|
|
|
52
57
|
###
|
|
53
58
|
Returns a new future that is rejected with a given error.
|
|
@@ -58,11 +63,17 @@ _.extend Future,
|
|
|
58
63
|
future.reject.apply future, arguments
|
|
59
64
|
future
|
|
60
65
|
|
|
66
|
+
# add alias similar to native Promise
|
|
67
|
+
reject: ->
|
|
68
|
+
future = new Future()
|
|
69
|
+
future.reject.apply future, arguments
|
|
70
|
+
future
|
|
61
71
|
|
|
62
72
|
###
|
|
63
73
|
Returns a new future that is fulfilled when all of the input futures
|
|
64
74
|
are resolved. If any future in the list fails, then the returned future
|
|
65
|
-
will fail with
|
|
75
|
+
will fail with an array of all the rejected values (null for the futures
|
|
76
|
+
that didn't fail). If they all succeed, then the returned
|
|
66
77
|
future will succeed, with the result being an array with the results of
|
|
67
78
|
all the input futures.
|
|
68
79
|
@param {Array} futures a list of futures to wait for.
|
|
@@ -227,6 +238,8 @@ _.extend Future::,
|
|
|
227
238
|
always: (callback) ->
|
|
228
239
|
@then callback, callback
|
|
229
240
|
|
|
241
|
+
finally: (callback) ->
|
|
242
|
+
@then callback, callback
|
|
230
243
|
|
|
231
244
|
###
|
|
232
245
|
Add handlers to be called when the Future object is resolved
|
|
@@ -234,13 +247,15 @@ _.extend Future::,
|
|
|
234
247
|
done: (callback) ->
|
|
235
248
|
@then callback
|
|
236
249
|
|
|
237
|
-
|
|
238
250
|
###
|
|
239
251
|
Add handlers to be called when the Future object is rejected
|
|
240
252
|
###
|
|
241
253
|
fail: (callback) ->
|
|
242
254
|
@then null, callback
|
|
243
255
|
|
|
256
|
+
# alias fail to catch to mimick native Promises
|
|
257
|
+
catch: (callback) ->
|
|
258
|
+
@then null, callback
|
|
244
259
|
|
|
245
260
|
###
|
|
246
261
|
# Run the given callbacks after this future is fulfilled.
|