Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

js-data

Package Overview
Dependencies
Maintainers
1
Versions
144
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-data - npm Package Compare versions

Comparing version 1.0.0-alpha.4-1 to 1.0.0-alpha.4-2

2

bower.json
{
"name": "js-data",
"description": "Robust, framework-agnostic in-memory data store.",
"version": "1.0.0-alpha.4-1",
"version": "1.0.0-alpha.4-2",
"homepage": "http://www.js-data.io",

@@ -6,0 +6,0 @@ "repository": {

@@ -0,1 +1,9 @@

##### 1.0.0-alpha.4-2 - 09 November 2014
###### Backwards compatible API changes
- jmdobry/angular-data#227 - Supporting methods on model instances
###### Backwards compatible bug fixes
- jmdobry/angular-data#235 - IE 8 support
##### 1.0.0-alpha.4-1 - 08 November 2014

@@ -2,0 +10,0 @@

/**
* @author Jason Dobry <jason.dobry@gmail.com>
* @file js-data.min.js
* @version 1.0.0-alpha.4-1 - Homepage <http://www.js-data.io/>
* @version 1.0.0-alpha.4-2 - Homepage <http://www.js-data.io/>
* @copyright (c) 2014 Jason Dobry

@@ -10,3 +10,3 @@ * @license MIT <https://github.com/js-data/js-data/blob/master/LICENSE>

*/
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),b.JSData=a()}}(function(){var define,module,exports;return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(require,module,exports){!function(global){"use strict";function detectObjectObserve(){function a(a){b=a}if("function"!=typeof Object.observe||"function"!=typeof Array.observe)return!1;var b=[],c={},d=[];return Object.observe(c,a),Array.observe(d,a),c.id=1,c.id=2,delete c.id,d.push(1,2),d.length=0,Object.deliverChangeRecords(a),5!==b.length?!1:"add"!=b[0].type||"update"!=b[1].type||"delete"!=b[2].type||"splice"!=b[3].type||"splice"!=b[4].type?!1:(Object.unobserve(c,a),Array.unobserve(d,a),!0)}function detectEval(){if("undefined"!=typeof chrome&&chrome.app&&chrome.app.runtime)return!1;try{var a=new Function("","return true;");return a()}catch(b){return!1}}function dirtyCheck(a){for(var b=0;MAX_DIRTY_CHECK_CYCLES>b&&a.check_();)b++;return global.testingExposeCycleCount&&(global.dirtyCheckCycleCount=b),b>0}function objectIsEmpty(a){for(var b in a)return!1;return!0}function diffIsEmpty(a){return objectIsEmpty(a.added)&&objectIsEmpty(a.removed)&&objectIsEmpty(a.changed)}function diffObjectFromOldObject(a,b){var c={},d={},e={};for(var f in b){var g=a[f];(void 0===g||g!==b[f])&&(f in a?g!==b[f]&&(e[f]=g):d[f]=void 0)}for(var f in a)f in b||(c[f]=a[f]);return Array.isArray(a)&&a.length!==b.length&&(e.length=a.length),{added:c,removed:d,changed:e}}function runEOMTasks(){if(!eomTasks.length)return!1;for(var a=0;a<eomTasks.length;a++)eomTasks[a]();return eomTasks.length=0,!0}function newObservedObject(){function a(a){b&&b.state_===OPENED&&!d&&b.check_(a)}var b,c,d=!1,e=!0;return{open:function(c){if(b)throw Error("ObservedObject in use");e||Object.deliverChangeRecords(a),b=c,e=!1},observe:function(b,d){c=b,d?Array.observe(c,a):Object.observe(c,a)},deliver:function(b){d=b,Object.deliverChangeRecords(a),d=!1},close:function(){b=void 0,Object.unobserve(c,a),observedObjectCache.push(this)}}}function getObservedObject(a,b,c){var d=observedObjectCache.pop()||newObservedObject();return d.open(a),d.observe(b,c),d}function Observer(){this.state_=UNOPENED,this.callback_=void 0,this.target_=void 0,this.directObserver_=void 0,this.value_=void 0,this.id_=nextObserverId++}function addToAll(a){Observer._allObserversCount++,collectObservers&&allObservers.push(a)}function removeFromAll(){Observer._allObserversCount--}function ObjectObserver(a){Observer.call(this),this.value_=a,this.oldObject_=void 0}function diffObjectFromChangeRecords(a,b,c){for(var d={},e={},f=0;f<b.length;f++){var g=b[f];expectedRecordTypes[g.type]?(g.name in c||(c[g.name]=g.oldValue),"update"!=g.type&&("add"!=g.type?g.name in d?(delete d[g.name],delete c[g.name]):e[g.name]=!0:g.name in e?delete e[g.name]:d[g.name]=!0)):(console.error("Unknown changeRecord type: "+g.type),console.error(g))}for(var h in d)d[h]=a[h];for(var h in e)e[h]=void 0;var i={};for(var h in c)if(!(h in d||h in e)){var j=a[h];c[h]!==j&&(i[h]=j)}return{added:d,removed:e,changed:i}}var hasObserve=detectObjectObserve(),hasEval=detectEval(),createObject="__proto__"in{}?function(a){return a}:function(a){var b=a.__proto__;if(!b)return a;var c=Object.create(b);return Object.getOwnPropertyNames(a).forEach(function(b){Object.defineProperty(c,b,Object.getOwnPropertyDescriptor(a,b))}),c},MAX_DIRTY_CHECK_CYCLES=1e3,eomTasks=[],runEOM=hasObserve?function(){var a={pingPong:!0},b=!1;return Object.observe(a,function(){runEOMTasks(),b=!1}),function(c){eomTasks.push(c),b||(b=!0,a.pingPong=!a.pingPong)}}():function(){return function(a){eomTasks.push(a)}}(),observedObjectCache=[],UNOPENED=0,OPENED=1,CLOSED=2,nextObserverId=1;Observer.prototype={open:function(a,b){if(this.state_!=UNOPENED)throw Error("Observer has already been opened.");return addToAll(this),this.callback_=a,this.target_=b,this.connect_(),this.state_=OPENED,this.value_},close:function(){this.state_==OPENED&&(removeFromAll(this),this.disconnect_(),this.value_=void 0,this.callback_=void 0,this.target_=void 0,this.state_=CLOSED)},deliver:function(){this.state_==OPENED&&dirtyCheck(this)},report_:function(a){try{this.callback_.apply(this.target_,a)}catch(b){Observer._errorThrownDuringCallback=!0,console.error("Exception caught during observer callback: "+(b.stack||b))}},discardChanges:function(){return this.check_(void 0,!0),this.value_}};var collectObservers=!hasObserve,allObservers;Observer._allObserversCount=0,collectObservers&&(allObservers=[]);var runningMicrotaskCheckpoint=!1,hasDebugForceFullDelivery=hasObserve&&hasEval&&function(){try{return eval("%RunMicrotasks()"),!0}catch(ex){return!1}}();global.Platform=global.Platform||{},global.Platform.performMicrotaskCheckpoint=function(){if(!runningMicrotaskCheckpoint){if(hasDebugForceFullDelivery)return void eval("%RunMicrotasks()");if(collectObservers){runningMicrotaskCheckpoint=!0;var cycles=0,anyChanged,toCheck;do{cycles++,toCheck=allObservers,allObservers=[],anyChanged=!1;for(var i=0;i<toCheck.length;i++){var observer=toCheck[i];observer.state_==OPENED&&(observer.check_()&&(anyChanged=!0),allObservers.push(observer))}runEOMTasks()&&(anyChanged=!0)}while(MAX_DIRTY_CHECK_CYCLES>cycles&&anyChanged);global.testingExposeCycleCount&&(global.dirtyCheckCycleCount=cycles),runningMicrotaskCheckpoint=!1}}},collectObservers&&(global.Platform.clearObservers=function(){allObservers=[]}),ObjectObserver.prototype=createObject({__proto__:Observer.prototype,arrayObserve:!1,connect_:function(){hasObserve?this.directObserver_=getObservedObject(this,this.value_,this.arrayObserve):this.oldObject_=this.copyObject(this.value_)},copyObject:function(a){var b=Array.isArray(a)?[]:{};for(var c in a)b[c]=a[c];return Array.isArray(a)&&(b.length=a.length),b},check_:function(a){var b,c;if(hasObserve){if(!a)return!1;c={},b=diffObjectFromChangeRecords(this.value_,a,c)}else c=this.oldObject_,b=diffObjectFromOldObject(this.value_,this.oldObject_);return diffIsEmpty(b)?!1:(hasObserve||(this.oldObject_=this.copyObject(this.value_)),this.report_([b.added||{},b.removed||{},b.changed||{},function(a){return c[a]}]),!0)},disconnect_:function(){hasObserve?(this.directObserver_.close(),this.directObserver_=void 0):this.oldObject_=void 0},deliver:function(){this.state_==OPENED&&(hasObserve?this.directObserver_.deliver(!1):dirtyCheck(this))},discardChanges:function(){return this.directObserver_?this.directObserver_.deliver(!0):this.oldObject_=this.copyObject(this.value_),this.value_}});var observerSentinel={},expectedRecordTypes={add:!0,update:!0,"delete":!0};global.Observer=Observer,global.Observer.runEOM_=runEOM,global.Observer.observerSentinel_=observerSentinel,global.Observer.hasObjectObserve=hasObserve,global.ObjectObserver=ObjectObserver}(exports)},{}],2:[function(a,b){(function(a,c){(function(){"use strict";function d(a){return"function"==typeof a||"object"==typeof a&&null!==a}function e(a){return"function"==typeof a}function f(a){return"object"==typeof a&&null!==a}function g(){}function h(){return function(){a.nextTick(l)}}function i(){var a=0,b=new O(l),c=document.createTextNode("");return b.observe(c,{characterData:!0}),function(){c.data=a=++a%2}}function j(){var a=new MessageChannel;return a.port1.onmessage=l,function(){a.port2.postMessage(0)}}function k(){return function(){setTimeout(l,1)}}function l(){for(var a=0;L>a;a+=2){var b=Q[a],c=Q[a+1];b(c),Q[a]=void 0,Q[a+1]=void 0}L=0}function m(){}function n(){return new TypeError("You cannot resolve a promise with itself")}function o(){return new TypeError("A promises callback cannot return that same promise.")}function p(a){try{return a.then}catch(b){return U.error=b,U}}function q(a,b,c,d){try{a.call(b,c,d)}catch(e){return e}}function r(a,b,c){M(function(a){var d=!1,e=q(c,b,function(c){d||(d=!0,b!==c?u(a,c):w(a,c))},function(b){d||(d=!0,x(a,b))},"Settle: "+(a._label||" unknown promise"));!d&&e&&(d=!0,x(a,e))},a)}function s(a,b){b._state===S?w(a,b._result):a._state===T?x(a,b._result):y(b,void 0,function(b){u(a,b)},function(b){x(a,b)})}function t(a,b){if(b.constructor===a.constructor)s(a,b);else{var c=p(b);c===U?x(a,U.error):void 0===c?w(a,b):e(c)?r(a,b,c):w(a,b)}}function u(a,b){a===b?x(a,n()):d(b)?t(a,b):w(a,b)}function v(a){a._onerror&&a._onerror(a._result),z(a)}function w(a,b){a._state===R&&(a._result=b,a._state=S,0===a._subscribers.length||M(z,a))}function x(a,b){a._state===R&&(a._state=T,a._result=b,M(v,a))}function y(a,b,c,d){var e=a._subscribers,f=e.length;a._onerror=null,e[f]=b,e[f+S]=c,e[f+T]=d,0===f&&a._state&&M(z,a)}function z(a){var b=a._subscribers,c=a._state;if(0!==b.length){for(var d,e,f=a._result,g=0;g<b.length;g+=3)d=b[g],e=b[g+c],d?C(c,d,e,f):e(f);a._subscribers.length=0}}function A(){this.error=null}function B(a,b){try{return a(b)}catch(c){return V.error=c,V}}function C(a,b,c,d){var f,g,h,i,j=e(c);if(j){if(f=B(c,d),f===V?(i=!0,g=f.error,f=null):h=!0,b===f)return void x(b,o())}else f=d,h=!0;b._state!==R||(j&&h?u(b,f):i?x(b,g):a===S?w(b,f):a===T&&x(b,f))}function D(a,b){try{b(function(b){u(a,b)},function(b){x(a,b)})}catch(c){x(a,c)}}function E(a,b,c,d){this._instanceConstructor=a,this.promise=new a(m,d),this._abortOnReject=c,this._validateInput(b)?(this._input=b,this.length=b.length,this._remaining=b.length,this._init(),0===this.length?w(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&w(this.promise,this._result))):x(this.promise,this._validationError())}function F(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function G(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function H(a,b){this._id=_++,this._label=b,this._state=void 0,this._result=void 0,this._subscribers=[],m!==a&&(e(a)||F(),this instanceof H||G(),D(this,a))}var I;I=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)};var J,K=I,L=(Date.now||function(){return(new Date).getTime()},Object.create||function(a){if(arguments.length>1)throw new Error("Second argument not supported");if("object"!=typeof a)throw new TypeError("Argument must be an object");return g.prototype=a,new g},0),M=function(a,b){Q[L]=a,Q[L+1]=b,L+=2,2===L&&J()},N="undefined"!=typeof window?window:{},O=N.MutationObserver||N.WebKitMutationObserver,P="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,Q=new Array(1e3);J="undefined"!=typeof a&&"[object process]"==={}.toString.call(a)?h():O?i():P?j():k();var R=void 0,S=1,T=2,U=new A,V=new A;E.prototype._validateInput=function(a){return K(a)},E.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},E.prototype._init=function(){this._result=new Array(this.length)};var W=E;E.prototype._enumerate=function(){for(var a=this.length,b=this.promise,c=this._input,d=0;b._state===R&&a>d;d++)this._eachEntry(c[d],d)},E.prototype._eachEntry=function(a,b){var c=this._instanceConstructor;f(a)?a.constructor===c&&a._state!==R?(a._onerror=null,this._settledAt(a._state,b,a._result)):this._willSettleAt(c.resolve(a),b):(this._remaining--,this._result[b]=this._makeResult(S,b,a))},E.prototype._settledAt=function(a,b,c){var d=this.promise;d._state===R&&(this._remaining--,this._abortOnReject&&a===T?x(d,c):this._result[b]=this._makeResult(a,b,c)),0===this._remaining&&w(d,this._result)},E.prototype._makeResult=function(a,b,c){return c},E.prototype._willSettleAt=function(a,b){var c=this;y(a,void 0,function(a){c._settledAt(S,b,a)},function(a){c._settledAt(T,b,a)})};var X=function(a,b){return new W(this,a,!0,b).promise},Y=function(a,b){function c(a){u(f,a)}function d(a){x(f,a)}var e=this,f=new e(m,b);if(!K(a))return x(f,new TypeError("You must pass an array to race.")),f;for(var g=a.length,h=0;f._state===R&&g>h;h++)y(e.resolve(a[h]),void 0,c,d);return f},Z=function(a,b){var c=this;if(a&&"object"==typeof a&&a.constructor===c)return a;var d=new c(m,b);return u(d,a),d},$=function(a,b){var c=this,d=new c(m,b);return x(d,a),d},_=0,ab=H;H.all=X,H.race=Y,H.resolve=Z,H.reject=$,H.prototype={constructor:H,then:function(a,b,c){var d=this,e=d._state;if(e===S&&!a||e===T&&!b)return this;d._onerror=null;var f=new this.constructor(m,c),g=d._result;if(e){var h=arguments[e-1];M(function(){C(e,f,h,g)})}else y(d,f,a,b);return f},"catch":function(a,b){return this.then(null,a,b)}};var bb=function(){var a;a="undefined"!=typeof c?c:"undefined"!=typeof window&&window.document?window:self;var b="Promise"in a&&"resolve"in a.Promise&&"reject"in a.Promise&&"all"in a.Promise&&"race"in a.Promise&&function(){var b;return new a.Promise(function(a){b=a}),e(b)}();b||(a.Promise=ab)},cb={Promise:ab,polyfill:bb};"function"==typeof define&&define.amd?define(function(){return cb}):"undefined"!=typeof b&&b.exports?b.exports=cb:"undefined"!=typeof this&&(this.ES6Promise=cb)}).call(this)}).call(this,a("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:3}],3:[function(a,b){function c(){}var d=b.exports={};d.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.MutationObserver,c="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};var d=[];if(b){var e=document.createElement("div"),f=new MutationObserver(function(){var a=d.slice();d.length=0,a.forEach(function(a){a()})});return f.observe(e,{attributes:!0}),function(a){d.length||e.setAttribute("yes","no"),d.push(a)}}return c?(window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),d.length>0)){var c=d.shift();c()}},!0),function(a){d.push(a),window.postMessage("process-tick","*")}):function(a){setTimeout(a,0)}}(),d.title="browser",d.browser=!0,d.env={},d.argv=[],d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.binding=function(){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(){throw new Error("process.chdir is not supported")}},{}],4:[function(a,b){function c(a,b){return-1!==d(a,b)}var d=a("./indexOf");b.exports=c},{"./indexOf":9}],5:[function(a,b){function c(a,b,c){b=d(b,c);var e=[];if(null==a)return e;for(var f,g=-1,h=a.length;++g<h;)f=a[g],b(f,g,a)&&e.push(f);return e}var d=a("../function/makeIterator_");b.exports=c},{"../function/makeIterator_":16}],6:[function(a,b){function c(a,b,c){var e=d(a,b,c);return e>=0?a[e]:void 0}var d=a("./findIndex");b.exports=c},{"./findIndex":7}],7:[function(a,b){function c(a,b,c){if(b=d(b,c),null==a)return-1;for(var e=-1,f=a.length;++e<f;)if(b(a[e],e,a))return e;return-1}var d=a("../function/makeIterator_");b.exports=c},{"../function/makeIterator_":16}],8:[function(a,b){function c(a,b,c){if(null!=a)for(var d=-1,e=a.length;++d<e&&b.call(c,a[d],d,a)!==!1;);}b.exports=c},{}],9:[function(a,b){function c(a,b,c){if(c=c||0,null==a)return-1;for(var d=a.length,e=0>c?d+c:c;d>e;){if(a[e]===b)return e;e++}return-1}b.exports=c},{}],10:[function(a,b){function c(a){return null!=a&&""!==a}function d(a,b){return b=b||"",e(a,c).join(b)}var e=a("./filter");b.exports=d},{"./filter":5}],11:[function(a,b){function c(a,b){var c=d(a,b);-1!==c&&a.splice(c,1)}var d=a("./indexOf");b.exports=c},{"./indexOf":9}],12:[function(a,b){function c(a,b,c){var d=a.length;b=null==b?0:0>b?Math.max(d+b,0):Math.min(b,d),c=null==c?d:0>c?Math.max(d+c,0):Math.min(c,d);for(var e=[];c>b;)e.push(a[b++]);return e}b.exports=c},{}],13:[function(a,b){function c(a,b){if(null==a)return[];if(a.length<2)return a;null==b&&(b=d);var f,g,h;return f=~~(a.length/2),g=c(a.slice(0,f),b),h=c(a.slice(f,a.length),b),e(g,h,b)}function d(a,b){return b>a?-1:a>b?1:0}function e(a,b,c){for(var d=[];a.length&&b.length;)d.push(c(a[0],b[0])<=0?a.shift():b.shift());return a.length&&d.push.apply(d,a),b.length&&d.push.apply(d,b),d}b.exports=c},{}],14:[function(a,b){function c(a,b){var c={};if(null==a)return c;var e,f=-1,g=a.length;if(d(b))for(;++f<g;)e=a[f],c[b(e)]=e;else for(;++f<g;)e=a[f],c[e[b]]=e;return c}var d=a("../lang/isFunction");b.exports=c},{"../lang/isFunction":23}],15:[function(a,b){function c(a){return a}b.exports=c},{}],16:[function(a,b){function c(a,b){if(null==a)return d;switch(typeof a){case"function":return"undefined"!=typeof b?function(c,d,e){return a.call(b,c,d,e)}:a;case"object":return function(b){return f(b,a)};case"string":case"number":return e(a)}}var d=a("./identity"),e=a("./prop"),f=a("../object/deepMatches");b.exports=c},{"../object/deepMatches":32,"./identity":15,"./prop":17}],17:[function(a,b){function c(a){return function(b){return b[a]}}b.exports=c},{}],18:[function(a,b){function c(a){switch(h(a)){case"Object":return d(a);case"Array":return g(a);case"RegExp":return e(a);case"Date":return f(a);default:return a}}function d(a){return i(a)?j({},a):a}function e(a){var b="";return b+=a.multiline?"m":"",b+=a.global?"g":"",b+=a.ignorecase?"i":"",new RegExp(a.source,b)}function f(a){return new Date(+a)}function g(a){return a.slice()}var h=a("./kindOf"),i=a("./isPlainObject"),j=a("../object/mixIn");b.exports=c},{"../object/mixIn":38,"./isPlainObject":27,"./kindOf":30}],19:[function(a,b){function c(a,b){switch(h(a)){case"Object":return d(a,b);case"Array":return e(a,b);default:return f(a)}}function d(a,b){if(i(a)){var d={};return g(a,function(a,d){this[d]=c(a,b)},d),d}return b?b(a):a}function e(a,b){for(var d=[],e=-1,f=a.length;++e<f;)d[e]=c(a[e],b);return d}var f=a("./clone"),g=a("../object/forOwn"),h=a("./kindOf"),i=a("./isPlainObject");b.exports=c},{"../object/forOwn":35,"./clone":18,"./isPlainObject":27,"./kindOf":30}],20:[function(a,b){var c=a("./isKind"),d=Array.isArray||function(a){return c(a,"Array")};b.exports=d},{"./isKind":24}],21:[function(a,b){function c(a){return d(a,"Boolean")}var d=a("./isKind");b.exports=c},{"./isKind":24}],22:[function(a,b){function c(a){if(null==a)return!0;if("string"==typeof a||e(a))return!a.length;if("object"==typeof a){var b=!0;return d(a,function(){return b=!1,!1}),b}return!0}var d=a("../object/forOwn"),e=a("./isArray");b.exports=c},{"../object/forOwn":35,"./isArray":20}],23:[function(a,b){function c(a){return d(a,"Function")}var d=a("./isKind");b.exports=c},{"./isKind":24}],24:[function(a,b){function c(a,b){return d(a)===b}var d=a("./kindOf");b.exports=c},{"./kindOf":30}],25:[function(a,b){function c(a){return d(a,"Number")}var d=a("./isKind");b.exports=c},{"./isKind":24}],26:[function(a,b){function c(a){return d(a,"Object")}var d=a("./isKind");b.exports=c},{"./isKind":24}],27:[function(a,b){function c(a){return!!a&&"object"==typeof a&&a.constructor===Object}b.exports=c},{}],28:[function(a,b){function c(a){return d(a,"RegExp")}var d=a("./isKind");b.exports=c},{"./isKind":24}],29:[function(a,b){function c(a){return d(a,"String")}var d=a("./isKind");b.exports=c},{"./isKind":24}],30:[function(a,b){function c(a){return null===a?"Null":a===d?"Undefined":e.exec(f.call(a))[1]}var d,e=/^\[object (.*)\]$/,f=Object.prototype.toString;b.exports=c},{}],31:[function(a,b){function c(a){return null==a?"":a.toString()}b.exports=c},{}],32:[function(a,b){function c(a,b){for(var c=-1,d=a.length;++c<d;)if(f(a[c],b))return!0;return!1}function d(a,b){for(var d=-1,e=b.length;++d<e;)if(!c(a,b[d]))return!1;return!0}function e(a,b){var c=!0;return g(b,function(b,d){return f(a[d],b)?void 0:c=!1}),c}function f(a,b){return a&&"object"==typeof a?h(a)&&h(b)?d(a,b):e(a,b):a===b}var g=a("./forOwn"),h=a("../lang/isArray");b.exports=f},{"../lang/isArray":20,"./forOwn":35}],33:[function(a,b){function c(a){for(var b,c=0,f=arguments.length;++c<f;)b=arguments[c],b&&e(b,d,a);return a}function d(a,b){var d=this[b];f(a)&&f(d)?c(d,a):this[b]=a}var e=a("./forOwn"),f=a("../lang/isPlainObject");b.exports=c},{"../lang/isPlainObject":27,"./forOwn":35}],34:[function(a,b){function c(){g=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],f=!0;for(var a in{toString:null})f=!1}function d(a,b,d){var i,j=0;null==f&&c();for(i in a)if(e(b,a,i,d)===!1)break;if(f)for(var k=a.constructor,l=!!k&&a===k.prototype;(i=g[j++])&&("constructor"===i&&(l||!h(a,i))||a[i]===Object.prototype[i]||e(b,a,i,d)!==!1););}function e(a,b,c,d){return a.call(d,b[c],c,b)}var f,g,h=a("./hasOwn");b.exports=d},{"./hasOwn":36}],35:[function(a,b){function c(a,b,c){e(a,function(e,f){return d(a,f)?b.call(c,a[f],f,a):void 0})}var d=a("./hasOwn"),e=a("./forIn");b.exports=c},{"./forIn":34,"./hasOwn":36}],36:[function(a,b){function c(a,b){return Object.prototype.hasOwnProperty.call(a,b)}b.exports=c},{}],37:[function(a,b){function c(){var a,b,g,h,i=1;for(h=e(arguments[0]);g=arguments[i++];)for(a in g)d(g,a)&&(b=g[a],h[a]=f(b)&&f(h[a])?c(h[a],b):e(b));return h}var d=a("./hasOwn"),e=a("../lang/deepClone"),f=a("../lang/isObject");b.exports=c},{"../lang/deepClone":19,"../lang/isObject":26,"./hasOwn":36}],38:[function(a,b){function c(a){for(var b,c=0,f=arguments.length;++c<f;)b=arguments[c],null!=b&&e(b,d,a);return a}function d(a,b){this[b]=a}var e=a("./forOwn");b.exports=c},{"./forOwn":35}],39:[function(a,b){function c(a,b){return b?(d(b.split("."),function(b){a[b]||(a[b]={}),a=a[b]}),a):a}var d=a("../array/forEach");b.exports=c},{"../array/forEach":8}],40:[function(a,b){function c(a){for(var b,c="string"!=typeof arguments[1]?arguments[1]:d(arguments,1),e={},f=0;b=c[f++];)e[b]=a[b];return e}var d=a("../array/slice");b.exports=c},{"../array/slice":12}],41:[function(a,b){function c(a,b,c){var e=/^(.+)\.(.+)$/.exec(b);e?d(a,e[1])[e[2]]=c:a[b]=c}var d=a("./namespace");b.exports=c},{"./namespace":39}],42:[function(a,b){function c(a){return a=d(a),a=e(a),a=f(a).replace(/[\-_]/g," ").replace(/\s[a-z]/g,g).replace(/\s+/g,"").replace(/^[A-Z]/g,h)}var d=a("../lang/toString"),e=a("./replaceAccents"),f=a("./removeNonWord"),g=a("./upperCase"),h=a("./lowerCase");b.exports=c},{"../lang/toString":31,"./lowerCase":43,"./removeNonWord":46,"./replaceAccents":47,"./upperCase":48}],43:[function(a,b){function c(a){return a=d(a),a.toLowerCase()}var d=a("../lang/toString");b.exports=c},{"../lang/toString":31}],44:[function(a,b){function c(){var a=d(e(arguments),"/");return a.replace(/([^:\/]|^)\/{2,}/g,"$1/")}var d=a("../array/join"),e=a("../array/slice");b.exports=c},{"../array/join":10,"../array/slice":12}],45:[function(a,b){function c(a){return a=d(a),e(a).replace(/^[a-z]/,f)}var d=a("../lang/toString"),e=a("./camelCase"),f=a("./upperCase");b.exports=c},{"../lang/toString":31,"./camelCase":42,"./upperCase":48}],46:[function(a,b){function c(a){return a=d(a),a.replace(e,"")}var d=a("../lang/toString"),e=/[^\x20\x2D0-9A-Z\x5Fa-z\xC0-\xD6\xD8-\xF6\xF8-\xFF]/g;b.exports=c},{"../lang/toString":31}],47:[function(a,b){function c(a){return a=d(a),a.search(/[\xC0-\xFF]/g)>-1&&(a=a.replace(/[\xC0-\xC5]/g,"A").replace(/[\xC6]/g,"AE").replace(/[\xC7]/g,"C").replace(/[\xC8-\xCB]/g,"E").replace(/[\xCC-\xCF]/g,"I").replace(/[\xD0]/g,"D").replace(/[\xD1]/g,"N").replace(/[\xD2-\xD6\xD8]/g,"O").replace(/[\xD9-\xDC]/g,"U").replace(/[\xDD]/g,"Y").replace(/[\xDE]/g,"P").replace(/[\xE0-\xE5]/g,"a").replace(/[\xE6]/g,"ae").replace(/[\xE7]/g,"c").replace(/[\xE8-\xEB]/g,"e").replace(/[\xEC-\xEF]/g,"i").replace(/[\xF1]/g,"n").replace(/[\xF2-\xF6\xF8]/g,"o").replace(/[\xF9-\xFC]/g,"u").replace(/[\xFE]/g,"p").replace(/[\xFD\xFF]/g,"y")),a}var d=a("../lang/toString");b.exports=c},{"../lang/toString":31}],48:[function(a,b){function c(a){return a=d(a),a.toUpperCase()}var d=a("../lang/toString");b.exports=c},{"../lang/toString":31}],49:[function(a,b){function c(a,b,c){var f=this,g=f.definitions[a];c=c||{},b=b||{};var h=new d.Promise(function(f,h){g?d.isObject(b)?(c=d._(g,c),f(b)):h(new e.IA('"attrs" must be an object!')):h(new e.NER(a))});return g&&(c.hasOwnProperty("upsert")?c.upsert:g.upsert)&&b[g.idAttribute]?f.update(a,b[g.idAttribute],b,c):h.then(function(b){return c.beforeValidate.call(b,a,b)}).then(function(b){return c.validate.call(b,a,b)}).then(function(b){return c.afterValidate.call(b,a,b)}).then(function(b){return c.beforeCreate.call(b,a,b)}).then(function(a){return c.notify&&f.emit(g,"beforeCreate",d.merge({},a)),f.getAdapter(g,c).create(g,a,c)}).then(function(b){return c.afterCreate.call(b,a,b)}).then(function(b){if(c.notify&&f.emit(g,"afterCreate",d.merge({},b)),c.cacheResponse){var e=f.inject(g.name,b,c),h=e[g.idAttribute];return f.store[a].completedQueries[h]=(new Date).getTime(),e}return f.createInstance(a,b,c)})}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],50:[function(a,b){function c(a,b,c){var f,g=this,h=g.definitions[a];return new d.Promise(function(i,j){b=d.resolveId(h,b),h?d.isString(b)||d.isNumber(b)?g.get(a,b)?(f=g.get(a,b),c=d._(h,c),i(f)):j(new e.R('id "'+b+'" not found in cache!')):j(new e.IA('"id" must be a string or a number!')):j(new e.NER(a))}).then(function(b){return c.beforeDestroy.call(b,a,b)}).then(function(e){return c.notify&&g.emit(h,"beforeDestroy",d.merge({},e)),c.eagerEject&&g.eject(a,b),g.getAdapter(h,c).destroy(h,b,c)}).then(function(){return c.afterDestroy.call(f,a,f)}).then(function(e){return c.notify&&g.emit(h,"afterDestroy",d.merge({},e)),g.eject(a,b),b}).catch(function(b){throw c.eagerEject&&f&&g.inject(a,f,{notify:!1}),b})}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],51:[function(a,b){function c(a,b,c){var f,g,h=this,i=h.definitions[a];return new d.Promise(function(b,f){i?(c=d._(i,c),b()):f(new e.NER(a))}).then(function(){return g=h.defaults.defaultFilter.call(h,a,b),c.beforeDestroy(a,g)}).then(function(){return c.notify&&h.emit(i,"beforeDestroy",g),c.eagerEject&&(f=h.ejectAll(a,b)),h.getAdapter(i,c).destroyAll(i,b,c)}).then(function(){return c.afterDestroy(a,g)}).then(function(){return c.notify&&h.emit(i,"afterDestroy",g),f||h.ejectAll(a,b)}).catch(function(b){throw c.eagerEject&&f&&h.inject(a,f,{notify:!1}),b})}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],52:[function(a,b){function c(a,b,c){var f=this,g=f.definitions[a],h=f.store[a];return new d.Promise(function(i,j){g?d.isString(b)||d.isNumber(b)?(c=d._(g,c),(c.bypassCache||!c.cacheResponse)&&delete h.completedQueries[b],b in h.completedQueries?i(f.get(a,b)):i()):j(new e.IA('"id" must be a string or a number!')):j(new e.NER(a))}).then(function(d){return b in h.completedQueries?d:(b in h.pendingQueries||(h.pendingQueries[b]=f.getAdapter(g,c).find(g,b,c).then(function(d){return delete h.pendingQueries[b],c.cacheResponse?(h.completedQueries[b]=(new Date).getTime(),f.inject(a,d,c)):f.createInstance(a,d,c)})),h.pendingQueries[b])}).catch(function(a){throw delete h.pendingQueries[b],a})}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],53:[function(a,b){function c(a,b,c,d){var f=this,g=f.store[b],h=f.definitions[b].idAttribute,i=(new Date).getTime();a=a||[],delete g.pendingQueries[c],g.completedQueries[c]=i,g.collectionModified=e.updateTimestamp(g.collectionModified);var j=f.inject(b,a,d);return e.isArray(j)?e.forEach(j,function(a){a&&a[h]&&(g.completedQueries[a[h]]=i)}):(console.warn(errorPrefix(b)+"response is expected to be an array!"),g.completedQueries[j[h]]=i),j}function d(a,b,d){var g,h=this,i=h.definitions[a],j=h.store[a];return new e.Promise(function(c,k){b=b||{},h.definitions[a]?e.isObject(b)?(d=e._(i,d),g=e.toJson(b),(d.bypassCache||!d.cacheResponse)&&delete j.completedQueries[g],g in j.completedQueries?c(h.filter(a,b,d)):c()):k(new f.IA('"params" must be an object!')):k(new f.NER(a))}).then(function(f){return g in j.completedQueries?f:(g in j.pendingQueries||(j.pendingQueries[g]=h.getAdapter(i,d).findAll(i,b,d).then(function(b){return delete j.pendingQueries[g],d.cacheResponse?c.call(h,b,a,g,d):(e.forEach(b,function(c,e){b[e]=h.createInstance(a,c,d)}),b)})),j.pendingQueries[g])}).catch(function(a){throw delete j.pendingQueries[g],a})}var e=a("../../utils"),f=a("../../errors");b.exports=d},{"../../errors":70,"../../utils":72}],54:[function(a,b){function c(a,b){var c=this,d=c.definitions[a],f=c.store[a];return new e.Promise(function(g,h){if(d){b=e._(d,b),b.hasOwnProperty("notify")||(b.notify=!1);for(var i,j=[],k=(new Date).getTime();(i=f.expiresHeap.peek())&&i.expires<k;)j.push(i.item),delete i.item,f.expiresHeap.pop();g(j)}else h(new c.errors.NER(a))}).then(function(g){if((b.isInterval||b.notify)&&c.emit(d,"beforeReap",g),"inject"===b.reapAction)e.forEach(g,function(a){var b=a[d.idAttribute];f.expiresHeap.push({item:a,timestamp:f.saved[b],expires:d.maxAge?f.saved[b]+d.maxAge:Number.MAX_VALUE})});else if("eject"===b.reapAction)e.forEach(g,function(b){c.eject(a,b[d.idAttribute])});else if("refresh"===b.reapAction){var h=[];return e.forEach(g,function(b){h.push(c.refresh(a,b[d.idAttribute]))}),e.Promise.all(h)}return g}).then(function(a){return(b.isInterval||b.notify)&&c.emit(d,"afterReap",a),a})}function d(a,b,c){var d=this;return new e.Promise(function(g,h){var i=d.definitions[a];b=e.resolveId(d.definitions[a],b),i?e.isString(b)||e.isNumber(b)?(c=e._(i,c),c.bypassCache=!0,g(d.get(a,b))):h(new f.IA('"id" must be a string or a number!')):h(new d.errors.NER(a))}).then(function(e){return e?d.find(a,b,c):e})}var e=a("../../utils"),f=a("../../errors");b.exports={create:a("./create"),destroy:a("./destroy"),destroyAll:a("./destroyAll"),find:a("./find"),findAll:a("./findAll"),loadRelations:a("./loadRelations"),reap:c,refresh:d,save:a("./save"),update:a("./update"),updateAll:a("./updateAll")}},{"../../errors":70,"../../utils":72,"./create":49,"./destroy":50,"./destroyAll":51,"./find":52,"./findAll":53,"./loadRelations":55,"./save":56,"./update":57,"./updateAll":58}],55:[function(a,b){function c(a,b,c,f){var g=this,h=g.definitions[a],i=[];return new d.Promise(function(j,k){if((d.isString(b)||d.isNumber(b))&&(b=g.get(a,b)),d.isString(c)&&(c=[c]),h)if(d.isObject(b))if(d.isArray(c)){f=d._(h,f),f.hasOwnProperty("findBelongsTo")||(f.findBelongsTo=!0),f.hasOwnProperty("findHasMany")||(f.findHasMany=!0);var l=[];d.forEach(h.relationList,function(a){var e=a.relation;if(d.contains(c,e)){var j,k={};k[a.foreignKey]=b[h.idAttribute],"hasMany"===a.type&&k[a.foreignKey]?j=g.findAll(e,k,f):"hasOne"===a.type?a.localKey&&b[a.localKey]?j=g.find(e,b[a.localKey],f):a.foreignKey&&k[a.foreignKey]&&(j=g.findAll(e,k,f).then(function(a){return a.length?a[0]:null})):b[a.localKey]&&(j=g.find(e,b[a.localKey],f)),j&&(l.push(j),i.push(a.localField))}}),j(l)}else k(new e.IA('"relations" must be a string or an array!'));else k(new e.IA('"instance(id)" must be a string, number or object!'));else k(new e.NER(a))}).then(function(a){return d.Promise.all(a)}).then(function(a){return d.forEach(i,function(c,d){b[c]=a[d]}),b})}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],56:[function(a,b){function c(a,b,c){var f,g=this,h=g.definitions[a];return new d.Promise(function(i,j){b=d.resolveId(h,b),h?d.isString(b)||d.isNumber(b)?g.get(a,b)?(f=g.get(a,b),c=d._(h,c),i(f)):j(new e.R('id "'+b+'" not found in cache!')):j(new e.IA('"id" must be a string or a number!')):j(new e.NER(a))}).then(function(b){return c.beforeValidate.call(b,a,b)}).then(function(b){return c.validate.call(b,a,b)}).then(function(b){return c.afterValidate.call(b,a,b)}).then(function(b){return c.beforeUpdate.call(b,a,b)}).then(function(e){if(c.notify&&g.emit(h,"beforeUpdate",d.merge({},e)),c.changesOnly){var f=g.store[a];
d.w&&f.observers[b].deliver();var i=[],j=g.changes(a,b);for(var k in j.added)i.push(k);for(k in j.changed)i.push(k);if(j=d.pick(e,i),d.isEmpty(j))return e;e=j}return g.getAdapter(h,c).update(h,b,e,c)}).then(function(b){return c.afterUpdate.call(b,a,b)}).then(function(a){return c.notify&&g.emit(h,"afterUpdate",d.merge({},a)),c.cacheResponse?g.inject(h.name,a,c):a})}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],57:[function(a,b){function c(a,b,c,f){var g=this,h=g.definitions[a];return new d.Promise(function(g,i){b=d.resolveId(h,b),h?d.isString(b)||d.isNumber(b)?(f=d._(h,f),g(c)):i(new e.IA('"id" must be a string or a number!')):i(new e.NER(a))}).then(function(b){return f.beforeValidate.call(b,a,b)}).then(function(b){return f.validate.call(b,a,b)}).then(function(b){return f.afterValidate.call(b,a,b)}).then(function(b){return f.beforeUpdate.call(b,a,b)}).then(function(a){return f.notify&&g.emit(h,"beforeUpdate",d.merge({},a)),g.getAdapter(h,f).update(h,b,a,f)}).then(function(b){return f.afterUpdate.call(b,a,b)}).then(function(a){return f.notify&&g.emit(h,"afterUpdate",d.merge({},a)),f.cacheResponse?g.inject(h.name,a,f):a})}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],58:[function(a,b){function c(a,b,c,f){var g=this,h=g.definitions[a];return new d.Promise(function(c,g){h?(f=d._(h,f),c(b)):g(new e.NER(a))}).then(function(b){return f.beforeValidate.call(b,a,b)}).then(function(b){return f.validate.call(b,a,b)}).then(function(b){return f.afterValidate.call(b,a,b)}).then(function(b){return f.beforeUpdate.call(b,a,b)}).then(function(a){return f.notify&&g.emit(h,"beforeUpdate",d.merge({},a)),g.getAdapter(h,f).updateAll(h,a,c,f)}).then(function(b){return f.afterUpdate.call(b,a,b)}).then(function(a){return f.notify&&g.emit(h,"afterUpdate",d.merge({},b)),f.cacheResponse?g.inject(h.name,a,f):a})}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],59:[function(a,b){function c(a,b,c){c(null,b)}function d(a,b){return b}function e(){}function f(b){b=b||{};try{g=a("js-data-schema")}catch(c){}if(!g)try{g=window.Schemator}catch(c){}(g||b.schemator)&&(this.schemator=b.schemator||new g),this.store={},this.definitions={},this.adapters={},this.defaults=new e,this.observe=l,h.deepMixIn(this.defaults,b)}var g,h=a("../utils"),i=a("../errors"),j=a("./sync_methods"),k=a("./async_methods"),l=a("../../lib/observe-js/observe-js");h.deepFreeze(j),h.deepFreeze(k),h.deepFreeze(i),h.deepFreeze(h);var m=e.prototype;m.idAttribute="id",m.basePath="",m.endpoint="",m.useClass=!0,m.keepChangeHistory=!1,m.resetHistoryOnInject=!0,m.eagerEject=!1,m.eagerInject=!1,m.allowSimpleWhere=!0,m.defaultAdapter="http",m.loadFromServer=!1,m.notify=!!h.w,m.upsert=!!h.w,m.cacheResponse=!!h.w,m.bypassCache=!1,m.findInverseLinks=!1,m.findBelongsTo=!1,m.findHasOn=!1,m.findHasMany=!1,m.reapInterval=h.w?3e4:!1,m.reapAction=h.w?"inject":"none",m.maxAge=!1,m.maxAge=!1,m.ignoredChanges=[/\$/],m.beforeValidate=c,m.validate=c,m.afterValidate=c,m.beforeCreate=c,m.afterCreate=c,m.beforeUpdate=c,m.afterUpdate=c,m.beforeDestroy=c,m.afterDestroy=c,m.beforeCreateInstance=d,m.afterCreateInstance=d,m.beforeInject=d,m.afterInject=d,m.beforeEject=d,m.afterEject=d,m.defaultFilter=function(a,b,c,d){var e=this,f=a,g=null,i={skip:"",offset:"",where:"",limit:"",orderBy:"",sort:""};c=c||{},d=d||{},g=h.isObject(c.where)?c.where:{},d.allowSimpleWhere&&h.forOwn(c,function(a,b){b in i||b in g||(g[b]={"==":a})}),h.isEmpty(g)&&(g=null),g&&(f=h.filter(f,function(a){var b=!0,c=!0;return h.forOwn(g,function(d,e){h.isString(d)?d={"===":d}:(h.isNumber(d)||h.isBoolean(d))&&(d={"==":d}),h.isObject(d)&&h.forOwn(d,function(d,f){"=="===f?c=b?a[e]==d:c&&a[e]==d:"==="===f?c=b?a[e]===d:c&&a[e]===d:"!="===f?c=b?a[e]!=d:c&&a[e]!=d:"!=="===f?c=b?a[e]!==d:c&&a[e]!==d:">"===f?c=b?a[e]>d:c&&a[e]>d:">="===f?c=b?a[e]>=d:c&&a[e]>=d:"<"===f?c=b?a[e]<d:c&&a[e]<d:"<="===f?c=b?a[e]<=d:c&&a[e]<=d:"in"===f?c=b?h.contains(d,a[e]):c&&h.contains(d,a[e]):"notIn"===f?c=b?!h.contains(d,a[e]):c&&!h.contains(d,a[e]):"|=="===f?c=b?a[e]==d:c||a[e]==d:"|==="===f?c=b?a[e]===d:c||a[e]===d:"|!="===f?c=b?a[e]!=d:c||a[e]!=d:"|!=="===f?c=b?a[e]!==d:c||a[e]!==d:"|>"===f?c=b?a[e]>d:c||a[e]>d:"|>="===f?c=b?a[e]>=d:c||a[e]>=d:"|<"===f?c=b?a[e]<d:c||a[e]<d:"|<="===f?c=b?a[e]<=d:c||a[e]<=d:"|in"===f?c=b?h.contains(d,a[e]):c||h.contains(d,a[e]):"|notIn"===f&&(c=b?!h.contains(d,a[e]):c||!h.contains(d,a[e])),b=!1})}),c}));var j=null;h.isString(c.orderBy)?j=[[c.orderBy,"ASC"]]:h.isArray(c.orderBy)&&(j=c.orderBy),!j&&h.isString(c.sort)?j=[[c.sort,"ASC"]]:!j&&h.isArray(c.sort)&&(j=c.sort),j&&h.forEach(j,function(a){if(h.isString(a))a=[a,"ASC"];else if(!h.isArray(a))throw new e.errors.IllegalArgumentError("DS.filter(resourceName[, params][, options]): "+h.toJson(a)+": Must be a string or an array!",{params:{"orderBy[i]":{actual:typeof a,expected:"string|array"}}});f=h.sort(f,function(b,c){var d=b[a[0]],e=c[a[0]];return h.isString(d)&&(d=h.upperCase(d)),h.isString(e)&&(e=h.upperCase(e)),"DESC"===a[1]?d>e?-1:e>d?1:0:e>d?-1:d>e?1:0})});var k=h.isNumber(c.limit)?c.limit:null,l=null;return h.isNumber(c.skip)?l=c.skip:h.isNumber(c.offset)&&(l=c.offset),k&&l?f=h.slice(f,l,Math.min(f.length,l+k)):h.isNumber(k)?f=h.slice(f,0,Math.min(f.length,k)):h.isNumber(l)&&(f=l<f.length?h.slice(f,l):[]),f};var n=f.prototype;n.getAdapter=function(a,b){return b=b||{},this.adapters[b.adapter]||this.adapters[a.defaultAdapter]},n.registerAdapter=function(a,b,c){c=c||{},this.adapters[a]=h.isFunction(b)?new b(c):b,c.default&&(this.defaults.defaultAdapter=a)},n.emit=function(a,b){var c=Array.prototype.slice.call(arguments,2);c.unshift(a.name),c.unshift("DS."+b),a.emit.apply(a,c)},n.errors=a("../errors"),n.utils=h,h.deepMixIn(n,j),h.deepMixIn(n,k),b.exports=f},{"../../lib/observe-js/observe-js":1,"../errors":70,"../utils":72,"./async_methods":54,"./sync_methods":64,"js-data-schema":"js-data-schema"}],60:[function(require,module,exports){function Resource(a){DSUtils.deepMixIn(this,a),this.endpoint="endpoint"in a?a.endpoint:this.name}function defineResource(definition){var _this=this,definitions=_this.definitions;if(DSUtils.isString(definition)&&(definition={name:definition.replace(/\s/gi,"")}),!DSUtils.isObject(definition))throw new DSErrors.IA('"definition" must be an object!');if(!DSUtils.isString(definition.name))throw new DSErrors.IA('"name" must be a string!');if(_this.store[definition.name])throw new DSErrors.R(definition.name+" is already registered!");try{Resource.prototype=_this.defaults,definitions[definition.name]=new Resource(definition);var def=definitions[definition.name];if(!DSUtils.isString(def.idAttribute))throw new DSErrors.IA('"idAttribute" must be a string!');def.relations&&(def.relationList=[],def.relationFields=[],DSUtils.forOwn(def.relations,function(a,b){DSUtils.forOwn(a,function(c,d){DSUtils.isArray(c)||(a[d]=[c]),DSUtils.forEach(a[d],function(a){a.type=b,a.relation=d,a.name=def.name,def.relationList.push(a),def.relationFields.push(a.localField)})})}),def.relations.belongsTo&&DSUtils.forOwn(def.relations.belongsTo,function(a,b){DSUtils.forEach(a,function(a){a.parent&&(def.parent=b,def.parentKey=a.localKey)})}),DSUtils.deepFreeze(def.relations),DSUtils.deepFreeze(def.relationList)),def.getEndpoint=function(a,b){b=DSUtils.deepMixIn({},b);var c,d,e=this.parent,f=this.parentKey,g=b.endpoint||this.endpoint,h=definitions[e];return delete b.endpoint,b=b||{},b.params=b.params||{},e&&f&&h&&b.params[f]!==!1&&((DSUtils.isNumber(a)||DSUtils.isString(a))&&(c=_this.get(this.name,a)),DSUtils.isObject(a)&&f in a?(delete b.params[f],d=DSUtils.makePath(h.getEndpoint(a,b),a[f],g)):c&&f in c?(delete b.params[f],d=DSUtils.makePath(h.getEndpoint(a,b),c[f],g)):b&&b.params[f]&&(d=DSUtils.makePath(h.getEndpoint(a,b),b.params[f],g),delete b.params[f])),b.params[f]===!1&&delete b.params[f],d||g},def.filter&&(def.defaultFilter=def.filter,delete def.filter),def.class=DSUtils.pascalCase(definition.name),eval("function "+def.class+"() {}"),def[def.class]=eval(def.class),def.methods&&DSUtils.deepMixIn(def[def.class].prototype,def.methods),def.computed&&DSUtils.forOwn(def.computed,function(a,b){DSUtils.isFunction(a)&&(def.computed[b]=[a],a=def.computed[b]),def.methods&&b in def.methods&&console.warn('Computed property "'+b+'" conflicts with previously defined prototype method!');var c;if(1===a.length){var d=a[0].toString().match(/function.*?\(([\s\S]*?)\)/);c=d[1].split(","),def.computed[b]=c.concat(a),a=def.computed[b],c.length&&console.warn("Use the computed property array syntax for compatibility with minified code!")}c=a.slice(0,a.length-1),DSUtils.forEach(c,function(a,b){c[b]=a.trim()}),a.deps=DSUtils.filter(c,function(a){return!!a})}),definition.schema&&_this.schemator&&(def.schema=_this.schemator.defineSchema(def.name,definition.schema),"validate"in definition||(def.validate=function(a,b,c){def.schema.validate(b,!0,function(a){return a?c(a):c(null,b)})})),DSUtils.forEach(instanceMethods,function(a){def[def.class].prototype["DS"+DSUtils.pascalCase(a)]=function(){var b=Array.prototype.slice.call(arguments);return b.unshift(this),b.unshift(def.name),_this[a].apply(_this,b)}}),_this.store[def.name]={collection:[],expiresHeap:new DSUtils.DSBinaryHeap(function(a){return a.expires},function(a,b){return a.item===b}),completedQueries:{},pendingQueries:{},index:{},modified:{},saved:{},previousAttributes:{},observers:{},changeHistories:{},changeHistory:[],collectionModified:0},def.reapInterval&&setInterval(function(){_this.reap(def.name,{isInterval:!0})},def.reapInterval);for(var key in _this)"function"==typeof _this[key]&&"defineResource"!==key&&!function(a){def[a]=function(){var b=Array.prototype.slice.call(arguments);return b.unshift(def.name),_this[a].apply(_this,b)}}(key);return def.beforeValidate=DSUtils.promisify(def.beforeValidate),def.validate=DSUtils.promisify(def.validate),def.afterValidate=DSUtils.promisify(def.afterValidate),def.beforeCreate=DSUtils.promisify(def.beforeCreate),def.afterCreate=DSUtils.promisify(def.afterCreate),def.beforeUpdate=DSUtils.promisify(def.beforeUpdate),def.afterUpdate=DSUtils.promisify(def.afterUpdate),def.beforeDestroy=DSUtils.promisify(def.beforeDestroy),def.afterDestroy=DSUtils.promisify(def.afterDestroy),DSUtils.Events(def),def}catch(err){throw console.error(err),delete definitions[definition.name],delete _this.store[definition.name],err}}var DSUtils=require("../../utils"),DSErrors=require("../../errors"),instanceMethods=["compute","refresh","save","update"];module.exports=defineResource},{"../../errors":70,"../../utils":72}],61:[function(a,b){function c(a,b,c){var f,g=this,h=g.definitions[a],i=g.store[a],j=!1;if(b=d.resolveId(h,b),!h)throw new e.NER(a);if(!d.isString(b)&&!d.isNumber(b))throw new e.IA('"id" must be a string or a number!');c=d._(h,c);for(var k=0;k<i.collection.length;k++)if(i.collection[k][h.idAttribute]==b){f=i.collection[k],i.expiresHeap.remove(f),j=!0;break}return j?(c.notify&&h.beforeEject(h.name,f),g.unlinkInverse(h.name,b),i.collection.splice(k,1),d.w&&i.observers[b].close(),delete i.observers[b],delete i.index[b],delete i.previousAttributes[b],delete i.completedQueries[b],delete i.pendingQueries[b],d.forEach(i.changeHistories[b],function(a){d.remove(i.changeHistory,a)}),delete i.changeHistories[b],delete i.modified[b],delete i.saved[b],i.collectionModified=d.updateTimestamp(i.collectionModified),c.notify&&(h.afterEject(h.name,f),g.emit(h,"eject",f)),f):void 0}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],62:[function(a,b){function c(a,b,c){var f=this,g=f.definitions[a];if(b=b||{},!g)throw new e.NER(a);if(!d.isObject(b))throw new e.IA('"params" must be an object!');var h=f.store[a];d.isEmpty(b)&&(h.completedQueries={});var i=d.toJson(b),j=f.filter(g.name,b),k=d.toLookup(j,g.idAttribute);return d.forOwn(k,function(a,b){f.eject(g.name,b,c)}),delete h.completedQueries[i],h.collectionModified=d.updateTimestamp(h.collectionModified),j}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],63:[function(a,b){function c(a,b,c){var f=this,g=f.definitions[a],h=f.store[a];if(!g)throw new e.NER(a);if(b&&!d.isObject(b))throw new e.IA('"params" must be an object!');c=d._(g,c),b=b||{};var i=d.toJson(b);return i in h.completedQueries||!c.loadFromServer||h.pendingQueries[i]||f.findAll(a,b,c),g.defaultFilter.call(f,h.collection,a,b,c)}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],64:[function(a,b){function c(a,b,c){var d=this,e=d.definitions[a];if(c=c||{},b=o.resolveId(e,b),!e)throw new q(a);if(!o.isString(b)&&!o.isNumber(b))throw new r('"id" must be a string or a number!');c=o._(e,c);var f=d.get(a,b);if(f){o.w&&d.store[a].observers[b].deliver();var g=o.diffObjectFromOldObject(f,d.store[a].previousAttributes[b],c.ignoredChanges);return o.forOwn(g,function(a,b){var c=[];o.forOwn(a,function(a,b){o.isFunction(a)||c.push(b)}),g[b]=o.pick(g[b],c)}),o.forEach(e.relationFields,function(a){delete g.added[a],delete g.removed[a],delete g.changed[a]}),g}}function d(a,b){var c=this,d=c.definitions[a],e=c.store[a];if(b=o.resolveId(d,b),a&&!c.definitions[a])throw new q(a);if(b&&!o.isString(b)&&!o.isNumber(b))throw new r('"id" must be a string or a number!');if(d.keepChangeHistory){if(!a)return e.changeHistory;var f=c.get(a,b);if(f)return e.changeHistories[b]}else console.warn("changeHistory is disabled for this resource!")}function e(a,b){var c=this,d=c.definitions[a];if(b=o.resolveItem(c.store[a],b),!d)throw new q(a);if(!o.isObject(b)&&!o.isString(b)&&!o.isNumber(b))throw new r('"instance" must be an object, string or number!');return(o.isString(b)||o.isNumber(b))&&(b=c.get(a,b)),o.forOwn(d.computed,function(a,c){o.compute.call(b,a,c,o)}),b}function f(a,b,c){var d,e=this.definitions[a];if(b=b||{},!e)throw new q(a);if(b&&!o.isObject(b))throw new r('"attrs" must be an object!');if(c=o._(e,c),c.notify&&c.beforeCreateInstance(a,b),c.useClass){var f=e[e.class];d=new f}else d={};return o.deepMixIn(d,b),c.notify&&c.afterCreateInstance(a,b),d}function g(a){return!(o.isEmpty(a.added)&&o.isEmpty(a.removed)&&o.isEmpty(a.changed))}function h(){this.observe.Platform.performMicrotaskCheckpoint()}function i(a,b,c){var d=this,e=d.definitions[a];if(!e)throw new q(a);if(!o.isString(b)&&!o.isNumber(b))throw new r('"id" must be a string or a number!');c=o._(e,c);var f=d.store[a].index[b];return!f&&c.loadFromServer&&d.find(a,b,c),f}function j(a,b){var c=this,d=c.store[a],e=[];if(!c.definitions[a])throw new q(a);if(b&&!o.isArray(b))throw new r('"ids" must be an array!');if(o.isArray(b))for(var f=b.length,g=0;f>g;g++)d.index[b[g]]&&e.push(d.index[b[g]]);else e=d.collection.slice();return e}function k(a,b){var c=this;if(b=o.resolveId(c.definitions[a],b),!c.definitions[a])throw new q(a);return c.get(a,b)?g(c.changes(a,b)):!1}function l(a,b){var c=this.definitions[a],d=this.store[a];if(b=o.resolveId(c,b),!c)throw new q(a);return b?(b in d.modified||(d.modified[b]=0),d.modified[b]):d.collectionModified}function m(a,b){var c=this.definitions[a],d=this.store[a];if(b=o.resolveId(c,b),!c)throw new q(a);return b in d.saved||(d.saved[b]=0),d.saved[b]}function n(a,b){var c=this,d=c.definitions[a],e=c.store[a];if(b=o.resolveId(d,b),!d)throw new q(a);if(!o.isString(b)&&!o.isNumber(b))throw new r('"id" must be a string or a number!');return e.previousAttributes[b]?o.merge({},e.previousAttributes[b]):void 0}var o=a("../../utils"),p=a("../../errors"),q=p.NER,r=p.IA;b.exports={changes:c,changeHistory:d,compute:e,createInstance:f,defineResource:a("./defineResource"),digest:h,eject:a("./eject"),ejectAll:a("./ejectAll"),filter:a("./filter"),get:i,getAll:j,hasChanges:k,inject:a("./inject"),lastModified:l,lastSaved:m,link:a("./link"),linkAll:a("./linkAll"),linkInverse:a("./linkInverse"),previous:n,unlinkInverse:a("./unlinkInverse")}},{"../../errors":70,"../../utils":72,"./defineResource":60,"./eject":61,"./ejectAll":62,"./filter":63,"./inject":65,"./link":66,"./linkAll":67,"./linkInverse":68,"./unlinkInverse":69}],65:[function(a,b){function c(a,b,c){var d=this;h.forEach(a.relationList,function(e){var f=e.relation,g=d.definitions[f];if(b[e.localField]){if(!g)throw new i.R(a.name+" relation is defined, but the resource is not!");try{b[e.localField]=d.inject(f,b[e.localField],c)}catch(h){console.error(a.name+": Failed to inject "+e.type+' relation: "'+f+'"!',h)}}})}function d(a,b,c){return function(d,e,f,g,i){var j,k=this,l=g&&g(b.idAttribute)?g(b.idAttribute):k[b.idAttribute];if(h.forEach(b.relationFields,function(a){delete d[a],delete e[a],delete f[a]}),(!h.isEmpty(d)||!h.isEmpty(e)||!h.isEmpty(f)||i)&&(j=a.get(b.name,l),c.modified[l]=h.updateTimestamp(c.modified[l]),c.collectionModified=h.updateTimestamp(c.collectionModified),b.keepChangeHistory)){var m={resourceName:b.name,target:j,added:d,removed:e,changed:f,timestamp:c.modified[l]};c.changeHistories[l].push(m),c.changeHistory.push(m)}b.computed&&(j=j||a.get(b.name,l),h.forOwn(b.computed,function(a,b){var c=!1;h.forEach(a.deps,function(a){(a in d||a in e||a in f||!(b in j))&&(c=!0)}),c=c||!a.deps.length,c&&h.compute.call(j,a,b,h)})),b.relations&&(j=j||a.get(b.name,l),h.forEach(b.relationList,function(c){j[c.localField]&&(c.localKey in d||c.localKey in e||c.localKey in f)&&a.link(b.name,j[b.idAttribute],[c.relation])})),b.idAttribute in f&&console.error("Doh! You just changed the primary key of an object! I don't know how to handle this yet, so your data for the \""+b.name+'" resource is now in an undefined (probably broken) state.')}}function e(a,b,f,g){var j,k=this,l=d(k,a,b,f,g);if(h.isArray(f)){j=[];for(var m=0;m<f.length;m++)j.push(e.call(k,a,b,f[m],g))}else{var n=a.computed,o=a.idAttribute;if(n&&n[o]){var p=[];h.forEach(n[o].deps,function(a){p.push(f[a])}),f[o]=n[o][n[o].length-1].apply(f,p)}if(!(o in f)){var q=new i.R(a.name+'.inject: "attrs" must contain the property specified by `idAttribute`!');throw console.error(q),q}try{var r=f[o],s=k.get(a.name,r),t=s?b.modified[r]:0;s?(h.deepMixIn(s,f),a.resetHistoryOnInject&&(b.previousAttributes[r]={},h.deepMixIn(b.previousAttributes[r],f),b.changeHistories[r].length&&(h.forEach(b.changeHistories[r],function(a){h.remove(b.changeHistory,a)}),b.changeHistories[r].splice(0,b.changeHistories[r].length))),h.w&&b.observers[r].deliver()):(s=g.useClass?f instanceof a[a.class]?f:new a[a.class]:{},b.previousAttributes[r]={},h.deepMixIn(s,f),h.deepMixIn(b.previousAttributes[r],f),b.collection.push(s),b.changeHistories[r]=[],h.w&&(b.observers[r]=new k.observe.ObjectObserver(s),b.observers[r].open(l,s)),b.index[r]=s,l.call(s,{},{},{},null,!0),a.relations&&c.call(k,a,s,g)),b.saved[r]=h.updateTimestamp(b.saved[r]),b.modified[r]=t&&b.modified[r]===t?h.updateTimestamp(b.modified[r]):b.modified[r],b.expiresHeap.remove(s),b.expiresHeap.push({item:s,timestamp:b.saved[r],expires:a.maxAge?b.saved[r]+a.maxAge:Number.MAX_VALUE}),j=s}catch(u){console.error(u.stack),console.error("inject failed!",a.name,f)}}return j}function f(a,b,c){var d=this;h.forEach(a.relationList,function(e){c.findBelongsTo&&"belongsTo"===e.type&&b[a.idAttribute]?d.link(a.name,b[a.idAttribute],[e.relation]):(c.findHasMany&&"hasMany"===e.type||c.findHasOne&&"hasOne"===e.type)&&d.link(a.name,b[a.idAttribute],[e.relation])})}function g(a,b,c){var d,g=this,j=g.definitions[a],k=g.store[a];if(!j)throw new i.NER(a);if(!h.isObject(b)&&!h.isArray(b))throw new i.IA(a+'.inject: "attrs" must be an object or an array!');return c=h._(j,c),c.notify&&c.beforeInject(j.name,b),d=e.call(g,j,k,b,c),k.collectionModified=h.updateTimestamp(k.collectionModified),c.findInverseLinks&&(h.isArray(d)?d.length&&g.linkInverse(j.name,d[0][j.idAttribute]):g.linkInverse(j.name,d[j.idAttribute])),h.isArray(d)?h.forEach(d,function(a){f.call(g,j,a,c)}):f.call(g,j,d,c),c.notify&&(c.afterInject(j.name,d),g.emit(j,"inject",d)),d}var h=a("../../utils"),i=a("../../errors");b.exports=g},{"../../errors":70,"../../utils":72}],66:[function(a,b){function c(a,b,c){var f=this,g=f.definitions[a];if(c=c||[],b=d.resolveId(g,b),!g)throw new e.NER(a);if(!d.isString(b)&&!d.isNumber(b))throw new e.IA('"id" must be a string or a number!');if(!d.isArray(c))throw new e.IA('"relations" must be an array!');var h=f.get(a,b);return h&&d.forEach(g.relationList,function(a){var b=a.relation;if(!c.length||d.contains(c,b)){var e={};if("belongsTo"===a.type){var i=h[a.localKey]?f.get(b,h[a.localKey]):null;i&&(h[a.localField]=i)}else if("hasMany"===a.type)e[a.foreignKey]=h[g.idAttribute],h[a.localField]=f.defaults.constructor.prototype.defaultFilter.call(f,f.store[b].collection,b,e,{allowSimpleWhere:!0});else if("hasOne"===a.type){e[a.foreignKey]=h[g.idAttribute];var j=f.defaults.constructor.prototype.defaultFilter.call(f,f.store[b].collection,b,e,{allowSimpleWhere:!0});j.length&&(h[a.localField]=j[0])}}}),h}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],67:[function(a,b){function c(a,b,c){var f=this,g=f.definitions[a];if(c=c||[],!g)throw new e.NER(a);if(!d.isArray(c))throw new e.IA('"relations" must be an array!');var h=f.filter(a,b);return h&&d.forEach(g.relationList,function(a){var b=a.relation;(!c.length||d.contains(c,b))&&("belongsTo"===a.type?d.forEach(h,function(c){var d=c[a.localKey]?f.get(b,c[a.localKey]):null;d&&(c[a.localField]=d)}):"hasMany"===a.type?d.forEach(h,function(c){var d={};d[a.foreignKey]=c[g.idAttribute],c[a.localField]=f.defaults.constructor.prototype.defaultFilter.call(f,f.store[b].collection,b,d,{allowSimpleWhere:!0})}):"hasOne"===a.type&&d.forEach(h,function(c){var d={};d[a.foreignKey]=c[g.idAttribute];var e=f.defaults.constructor.prototype.defaultFilter.call(f,f.store[b].collection,b,d,{allowSimpleWhere:!0});e.length&&(c[a.localField]=e[0])}))}),h}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],68:[function(a,b){function c(a,b,c){var f=this,g=f.definitions[a];if(c=c||[],b=d.resolveId(g,b),!g)throw new e.NER(a);if(!d.isString(b)&&!d.isNumber(b))throw new e.IA('"id" must be a string or a number!');if(!d.isArray(c))throw new e.IA('"relations" must be an array!');var h=f.get(a,b);return h&&d.forOwn(f.definitions,function(a){d.forOwn(a.relations,function(b){d.forOwn(b,function(b,e){(!c.length||d.contains(c,a.name))&&g.name===e&&f.linkAll(a.name,{},[g.name])})})}),h}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],69:[function(a,b){function c(a,b,c){var f=this,g=f.definitions[a];if(c=c||[],b=d.resolveId(g,b),!g)throw new e.NER(a);if(!d.isString(b)&&!d.isNumber(b))throw new e.IA('"id" must be a string or a number!');if(!d.isArray(c))throw new e.IA('"relations" must be an array!');var h=f.get(a,b);return h&&d.forOwn(f.definitions,function(a){d.forOwn(a.relations,function(a){d.forOwn(a,function(a,b){g.name===b&&d.forEach(a,function(a){d.forEach(f.store[a.name].collection,function(b){if("hasMany"===a.type&&b[a.localField]){var c;d.forEach(b[a.localField],function(a,b){a===h&&(c=b)}),b[a.localField].splice(c,1)}else b[a.localField]===h&&delete b[a.localField]})})})})}),h}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],70:[function(a,b){function c(a){Error.call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.message=a||"Illegal Argument!"}function d(a){Error.call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.message=a||"RuntimeError Error!"}function e(a){Error.call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.message=(a||"")+" is not a registered resource!"}c.prototype=Object.create(Error.prototype),c.prototype.constructor=c,d.prototype=Object.create(Error.prototype),d.prototype.constructor=d,e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,b.exports={IllegalArgumentError:c,IA:c,RuntimeError:d,R:d,NonexistentResourceError:e,NER:e}},{}],71:[function(a,b){var c=a("./datastore");b.exports={DS:c,createStore:function(a){return new c(a)},DSUtils:a("./utils"),DSErrors:a("./errors")}},{"./datastore":59,"./errors":70,"./utils":72}],72:[function(a,b){(function(c){function d(a){var b=this.constructor;return this.then(function(c){return b.resolve(a()).then(function(){return c})},function(c){return b.resolve(a()).then(function(){throw c})})}function e(a){var b="function"==typeof Date.now?Date.now():(new Date).getTime();return a&&a>=b?a+1:b}function f(a){var b={};a=a||this,a.on=function(a,c,d){b[a]=b[a]||[],b[a].push({f:c,c:d})},a.off=function(a,c){var d=b[a];if(d)if(c){for(var e=0;e<d.length;e++)if(d[e]===c){d.splice(e,1);break}}else d.splice(0,d.length);else b={}},a.emit=function(){var a=Array.prototype.slice.call(arguments),c=b[a.shift()]||[];if(c)for(var d=0;d<c.length;d++)c[d].f.apply(c[d].c,a)}}function g(a,b,c){for(var d=a[c],e=b(d);c>0;){var f=Math.floor((c+1)/2)-1,g=a[f];if(e>=b(g))break;a[f]=d,a[c]=g,c=f}}function h(a,b,c){for(var d=a.length,e=a[c],f=b(e);;){var g=2*(c+1),h=g-1,i=null;if(d>h){var j=a[h],k=b(j);f>k&&(i=h)}if(d>g){var l=a[g],m=b(l);m<(null===i?f:b(a[h]))&&(i=g)}if(null===i)break;a[c]=a[i],a[i]=e,c=i}}function i(a,b){if(a&&!n(a))throw new Error("DSBinaryHeap(weightFunc): weightFunc: must be a function!");a=a||function(a){return a},b=b||function(a,b){return a===b},this.weightFunc=a,this.compareFunc=b,this.heap=[]}function j(a,b){if(!b||!b.length)return!1;var c=s(b,function(b){return t(b)&&b.test(a)||b===a?a:void 0});return!!c}var k,l,m=a("./errors"),n=a("mout/lang/isFunction"),o=a("es6-promise");o.polyfill();try{k=window,k.Promise.prototype["finally"]||(k.Promise.prototype["finally"]=d),l=k.Promise,k={}}catch(p){k=null,c.Promise.prototype["finally"]||(c.Promise.prototype["finally"]=d),l=c.Promise}var q=i.prototype;q.push=function(a){this.heap.push(a),g(this.heap,this.weightFunc,this.heap.length-1)},q.peek=function(){return this.heap[0]},q.pop=function(){var a=this.heap[0],b=this.heap.pop();return this.heap.length>0&&(this.heap[0]=b,h(this.heap,this.weightFunc,0)),a},q.remove=function(a){for(var b=this.heap.length,c=0;b>c;c++)if(this.compareFunc(this.heap[c],a)){var d=this.heap[c],e=this.heap.pop();return c!==b-1&&(this.heap[c]=e,g(this.heap,this.weightFunc,c),h(this.heap,this.weightFunc,c)),d}return null},q.removeAll=function(){this.heap=[]},q.size=function(){return this.heap.length};var r=["beforeValidate","validate","afterValidate","beforeCreate","afterCreate","beforeUpdate","afterUpdate","beforeDestroy","afterDestroy"],s=a("mout/array/find"),t=a("mout/lang/isRegExp");b.exports={w:k,DSBinaryHeap:i,isBoolean:a("mout/lang/isBoolean"),isString:a("mout/lang/isString"),isArray:a("mout/lang/isArray"),isObject:a("mout/lang/isObject"),isNumber:a("mout/lang/isNumber"),isFunction:n,isEmpty:a("mout/lang/isEmpty"),isRegExp:t,toJson:JSON.stringify,fromJson:JSON.parse,makePath:a("mout/string/makePath"),upperCase:a("mout/string/upperCase"),pascalCase:a("mout/string/pascalCase"),deepMixIn:a("mout/object/deepMixIn"),mixIn:a("mout/object/mixIn"),forOwn:a("mout/object/forOwn"),forEach:a("mout/array/forEach"),pick:a("mout/object/pick"),set:a("mout/object/set"),merge:a("mout/object/merge"),contains:a("mout/array/contains"),filter:a("mout/array/filter"),find:s,toLookup:a("mout/array/toLookup"),remove:a("mout/array/remove"),slice:a("mout/array/slice"),sort:a("mout/array/sort"),_:function(a,b){var c=this;if(b=b||{},b&&b.constructor===a.constructor)return b;if(!c.isObject(b))throw new m.IA('"options" must be an object!');c.forEach(r,function(a){"function"==typeof b[a]&&-1===b[a].toString().indexOf("var args = Array")&&(b[a]=c.promisify(b[a]))});var d=function(a){c.mixIn(this,a)};return d.prototype=a,new d(b)},resolveItem:function(a,b){return a&&(this.isString(b)||this.isNumber(b))?a.index[b]||b:b},resolveId:function(a,b){return this.isString(b)||this.isNumber(b)?b:b&&a?b[a.idAttribute]||b:b},updateTimestamp:e,Promise:l,deepFreeze:function u(a){if("function"==typeof Object.freeze&&"function"==typeof Object.isFrozen){var b,c;Object.freeze(a);for(c in a)b=a[c],b&&a.hasOwnProperty(c)&&"object"==typeof b&&!Object.isFrozen(b)&&u(b)}},compute:function(a,b,c){var d=this,e=[];c.forEach(a.deps,function(a){e.push(d[a])}),this[b]=a[a.length-1].apply(this,e)},diffObjectFromOldObject:function(a,b,c){var d={},e={},f={};c=c||[];for(var g in b){var h=a[g];j(g,c)||(void 0===h||h!==b[g])&&(g in a?h!==b[g]&&(f[g]=h):e[g]=void 0)}for(var i in a)i in b||j(i,c)||(d[i]=a[i]);return{added:d,removed:e,changed:f}},promisify:function(a,b){var c=this.Promise;if(a){if("function"!=typeof a)throw new Error("Can only promisify functions!");return function(){var d=Array.prototype.slice.apply(arguments);return new c(function(c,e){d.push(function(a,b){a?e(a):c(b)});try{var f=a.apply(b||this,d);f&&f.then&&f.then(c,e)}catch(g){e(g)}})}}},Events:f}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./errors":70,"es6-promise":2,"mout/array/contains":4,"mout/array/filter":5,"mout/array/find":6,"mout/array/forEach":8,"mout/array/remove":11,"mout/array/slice":12,"mout/array/sort":13,"mout/array/toLookup":14,"mout/lang/isArray":20,"mout/lang/isBoolean":21,"mout/lang/isEmpty":22,"mout/lang/isFunction":23,"mout/lang/isNumber":25,"mout/lang/isObject":26,"mout/lang/isRegExp":28,"mout/lang/isString":29,"mout/object/deepMixIn":33,"mout/object/forOwn":35,"mout/object/merge":37,"mout/object/mixIn":38,"mout/object/pick":40,"mout/object/set":41,"mout/string/makePath":44,"mout/string/pascalCase":45,"mout/string/upperCase":48}]},{},[71])(71)});
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),b.JSData=a()}}(function(){var define,module,exports;return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(require,module,exports){!function(global){"use strict";function detectObjectObserve(){function a(a){b=a}if("function"!=typeof Object.observe||"function"!=typeof Array.observe)return!1;var b=[],c={},d=[];return Object.observe(c,a),Array.observe(d,a),c.id=1,c.id=2,delete c.id,d.push(1,2),d.length=0,Object.deliverChangeRecords(a),5!==b.length?!1:"add"!=b[0].type||"update"!=b[1].type||"delete"!=b[2].type||"splice"!=b[3].type||"splice"!=b[4].type?!1:(Object.unobserve(c,a),Array.unobserve(d,a),!0)}function detectEval(){if("undefined"!=typeof chrome&&chrome.app&&chrome.app.runtime)return!1;try{var a=new Function("","return true;");return a()}catch(b){return!1}}function dirtyCheck(a){for(var b=0;MAX_DIRTY_CHECK_CYCLES>b&&a.check_();)b++;return global.testingExposeCycleCount&&(global.dirtyCheckCycleCount=b),b>0}function objectIsEmpty(a){for(var b in a)return!1;return!0}function diffIsEmpty(a){return objectIsEmpty(a.added)&&objectIsEmpty(a.removed)&&objectIsEmpty(a.changed)}function diffObjectFromOldObject(a,b){var c={},d={},e={};for(var f in b){var g=a[f];(void 0===g||g!==b[f])&&(f in a?g!==b[f]&&(e[f]=g):d[f]=void 0)}for(var f in a)f in b||(c[f]=a[f]);return Array.isArray(a)&&a.length!==b.length&&(e.length=a.length),{added:c,removed:d,changed:e}}function runEOMTasks(){if(!eomTasks.length)return!1;for(var a=0;a<eomTasks.length;a++)eomTasks[a]();return eomTasks.length=0,!0}function newObservedObject(){function a(a){b&&b.state_===OPENED&&!d&&b.check_(a)}var b,c,d=!1,e=!0;return{open:function(c){if(b)throw Error("ObservedObject in use");e||Object.deliverChangeRecords(a),b=c,e=!1},observe:function(b,d){c=b,d?Array.observe(c,a):Object.observe(c,a)},deliver:function(b){d=b,Object.deliverChangeRecords(a),d=!1},close:function(){b=void 0,Object.unobserve(c,a),observedObjectCache.push(this)}}}function getObservedObject(a,b,c){var d=observedObjectCache.pop()||newObservedObject();return d.open(a),d.observe(b,c),d}function Observer(){this.state_=UNOPENED,this.callback_=void 0,this.target_=void 0,this.directObserver_=void 0,this.value_=void 0,this.id_=nextObserverId++}function addToAll(a){Observer._allObserversCount++,collectObservers&&allObservers.push(a)}function removeFromAll(){Observer._allObserversCount--}function ObjectObserver(a){Observer.call(this),this.value_=a,this.oldObject_=void 0}function diffObjectFromChangeRecords(a,b,c){for(var d={},e={},f=0;f<b.length;f++){var g=b[f];expectedRecordTypes[g.type]?(g.name in c||(c[g.name]=g.oldValue),"update"!=g.type&&("add"!=g.type?g.name in d?(delete d[g.name],delete c[g.name]):e[g.name]=!0:g.name in e?delete e[g.name]:d[g.name]=!0)):(console.error("Unknown changeRecord type: "+g.type),console.error(g))}for(var h in d)d[h]=a[h];for(var h in e)e[h]=void 0;var i={};for(var h in c)if(!(h in d||h in e)){var j=a[h];c[h]!==j&&(i[h]=j)}return{added:d,removed:e,changed:i}}var hasObserve=detectObjectObserve(),hasEval=detectEval(),createObject="__proto__"in{}?function(a){return a}:function(a){var b=a.__proto__;if(!b)return a;var c=Object.create(b);return Object.getOwnPropertyNames(a).forEach(function(b){Object.defineProperty(c,b,Object.getOwnPropertyDescriptor(a,b))}),c},MAX_DIRTY_CHECK_CYCLES=1e3,eomTasks=[],runEOM=hasObserve?function(){var a={pingPong:!0},b=!1;return Object.observe(a,function(){runEOMTasks(),b=!1}),function(c){eomTasks.push(c),b||(b=!0,a.pingPong=!a.pingPong)}}():function(){return function(a){eomTasks.push(a)}}(),observedObjectCache=[],UNOPENED=0,OPENED=1,CLOSED=2,nextObserverId=1;Observer.prototype={open:function(a,b){if(this.state_!=UNOPENED)throw Error("Observer has already been opened.");return addToAll(this),this.callback_=a,this.target_=b,this.connect_(),this.state_=OPENED,this.value_},close:function(){this.state_==OPENED&&(removeFromAll(this),this.disconnect_(),this.value_=void 0,this.callback_=void 0,this.target_=void 0,this.state_=CLOSED)},deliver:function(){this.state_==OPENED&&dirtyCheck(this)},report_:function(a){try{this.callback_.apply(this.target_,a)}catch(b){Observer._errorThrownDuringCallback=!0,console.error("Exception caught during observer callback: "+(b.stack||b))}},discardChanges:function(){return this.check_(void 0,!0),this.value_}};var collectObservers=!hasObserve,allObservers;Observer._allObserversCount=0,collectObservers&&(allObservers=[]);var runningMicrotaskCheckpoint=!1,hasDebugForceFullDelivery=hasObserve&&hasEval&&function(){try{return eval("%RunMicrotasks()"),!0}catch(ex){return!1}}();global.Platform=global.Platform||{},global.Platform.performMicrotaskCheckpoint=function(){if(!runningMicrotaskCheckpoint){if(hasDebugForceFullDelivery)return void eval("%RunMicrotasks()");if(collectObservers){runningMicrotaskCheckpoint=!0;var cycles=0,anyChanged,toCheck;do{cycles++,toCheck=allObservers,allObservers=[],anyChanged=!1;for(var i=0;i<toCheck.length;i++){var observer=toCheck[i];observer.state_==OPENED&&(observer.check_()&&(anyChanged=!0),allObservers.push(observer))}runEOMTasks()&&(anyChanged=!0)}while(MAX_DIRTY_CHECK_CYCLES>cycles&&anyChanged);global.testingExposeCycleCount&&(global.dirtyCheckCycleCount=cycles),runningMicrotaskCheckpoint=!1}}},collectObservers&&(global.Platform.clearObservers=function(){allObservers=[]}),ObjectObserver.prototype=createObject({__proto__:Observer.prototype,arrayObserve:!1,connect_:function(){hasObserve?this.directObserver_=getObservedObject(this,this.value_,this.arrayObserve):this.oldObject_=this.copyObject(this.value_)},copyObject:function(a){var b=Array.isArray(a)?[]:{};for(var c in a)b[c]=a[c];return Array.isArray(a)&&(b.length=a.length),b},check_:function(a){var b,c;if(hasObserve){if(!a)return!1;c={},b=diffObjectFromChangeRecords(this.value_,a,c)}else c=this.oldObject_,b=diffObjectFromOldObject(this.value_,this.oldObject_);return diffIsEmpty(b)?!1:(hasObserve||(this.oldObject_=this.copyObject(this.value_)),this.report_([b.added||{},b.removed||{},b.changed||{},function(a){return c[a]}]),!0)},disconnect_:function(){hasObserve?(this.directObserver_.close(),this.directObserver_=void 0):this.oldObject_=void 0},deliver:function(){this.state_==OPENED&&(hasObserve?this.directObserver_.deliver(!1):dirtyCheck(this))},discardChanges:function(){return this.directObserver_?this.directObserver_.deliver(!0):this.oldObject_=this.copyObject(this.value_),this.value_}});var observerSentinel={},expectedRecordTypes={add:!0,update:!0,"delete":!0};global.Observer=Observer,global.Observer.runEOM_=runEOM,global.Observer.observerSentinel_=observerSentinel,global.Observer.hasObjectObserve=hasObserve,global.ObjectObserver=ObjectObserver}(exports)},{}],2:[function(a,b){(function(a,c){(function(){"use strict";function d(a){return"function"==typeof a||"object"==typeof a&&null!==a}function e(a){return"function"==typeof a}function f(a){return"object"==typeof a&&null!==a}function g(){}function h(){return function(){a.nextTick(l)}}function i(){var a=0,b=new O(l),c=document.createTextNode("");return b.observe(c,{characterData:!0}),function(){c.data=a=++a%2}}function j(){var a=new MessageChannel;return a.port1.onmessage=l,function(){a.port2.postMessage(0)}}function k(){return function(){setTimeout(l,1)}}function l(){for(var a=0;L>a;a+=2){var b=Q[a],c=Q[a+1];b(c),Q[a]=void 0,Q[a+1]=void 0}L=0}function m(){}function n(){return new TypeError("You cannot resolve a promise with itself")}function o(){return new TypeError("A promises callback cannot return that same promise.")}function p(a){try{return a.then}catch(b){return U.error=b,U}}function q(a,b,c,d){try{a.call(b,c,d)}catch(e){return e}}function r(a,b,c){M(function(a){var d=!1,e=q(c,b,function(c){d||(d=!0,b!==c?u(a,c):w(a,c))},function(b){d||(d=!0,x(a,b))},"Settle: "+(a._label||" unknown promise"));!d&&e&&(d=!0,x(a,e))},a)}function s(a,b){b._state===S?w(a,b._result):a._state===T?x(a,b._result):y(b,void 0,function(b){u(a,b)},function(b){x(a,b)})}function t(a,b){if(b.constructor===a.constructor)s(a,b);else{var c=p(b);c===U?x(a,U.error):void 0===c?w(a,b):e(c)?r(a,b,c):w(a,b)}}function u(a,b){a===b?x(a,n()):d(b)?t(a,b):w(a,b)}function v(a){a._onerror&&a._onerror(a._result),z(a)}function w(a,b){a._state===R&&(a._result=b,a._state=S,0===a._subscribers.length||M(z,a))}function x(a,b){a._state===R&&(a._state=T,a._result=b,M(v,a))}function y(a,b,c,d){var e=a._subscribers,f=e.length;a._onerror=null,e[f]=b,e[f+S]=c,e[f+T]=d,0===f&&a._state&&M(z,a)}function z(a){var b=a._subscribers,c=a._state;if(0!==b.length){for(var d,e,f=a._result,g=0;g<b.length;g+=3)d=b[g],e=b[g+c],d?C(c,d,e,f):e(f);a._subscribers.length=0}}function A(){this.error=null}function B(a,b){try{return a(b)}catch(c){return V.error=c,V}}function C(a,b,c,d){var f,g,h,i,j=e(c);if(j){if(f=B(c,d),f===V?(i=!0,g=f.error,f=null):h=!0,b===f)return void x(b,o())}else f=d,h=!0;b._state!==R||(j&&h?u(b,f):i?x(b,g):a===S?w(b,f):a===T&&x(b,f))}function D(a,b){try{b(function(b){u(a,b)},function(b){x(a,b)})}catch(c){x(a,c)}}function E(a,b,c,d){this._instanceConstructor=a,this.promise=new a(m,d),this._abortOnReject=c,this._validateInput(b)?(this._input=b,this.length=b.length,this._remaining=b.length,this._init(),0===this.length?w(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&w(this.promise,this._result))):x(this.promise,this._validationError())}function F(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function G(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function H(a,b){this._id=_++,this._label=b,this._state=void 0,this._result=void 0,this._subscribers=[],m!==a&&(e(a)||F(),this instanceof H||G(),D(this,a))}var I;I=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)};var J,K=I,L=(Date.now||function(){return(new Date).getTime()},Object.create||function(a){if(arguments.length>1)throw new Error("Second argument not supported");if("object"!=typeof a)throw new TypeError("Argument must be an object");return g.prototype=a,new g},0),M=function(a,b){Q[L]=a,Q[L+1]=b,L+=2,2===L&&J()},N="undefined"!=typeof window?window:{},O=N.MutationObserver||N.WebKitMutationObserver,P="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,Q=new Array(1e3);J="undefined"!=typeof a&&"[object process]"==={}.toString.call(a)?h():O?i():P?j():k();var R=void 0,S=1,T=2,U=new A,V=new A;E.prototype._validateInput=function(a){return K(a)},E.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},E.prototype._init=function(){this._result=new Array(this.length)};var W=E;E.prototype._enumerate=function(){for(var a=this.length,b=this.promise,c=this._input,d=0;b._state===R&&a>d;d++)this._eachEntry(c[d],d)},E.prototype._eachEntry=function(a,b){var c=this._instanceConstructor;f(a)?a.constructor===c&&a._state!==R?(a._onerror=null,this._settledAt(a._state,b,a._result)):this._willSettleAt(c.resolve(a),b):(this._remaining--,this._result[b]=this._makeResult(S,b,a))},E.prototype._settledAt=function(a,b,c){var d=this.promise;d._state===R&&(this._remaining--,this._abortOnReject&&a===T?x(d,c):this._result[b]=this._makeResult(a,b,c)),0===this._remaining&&w(d,this._result)},E.prototype._makeResult=function(a,b,c){return c},E.prototype._willSettleAt=function(a,b){var c=this;y(a,void 0,function(a){c._settledAt(S,b,a)},function(a){c._settledAt(T,b,a)})};var X=function(a,b){return new W(this,a,!0,b).promise},Y=function(a,b){function c(a){u(f,a)}function d(a){x(f,a)}var e=this,f=new e(m,b);if(!K(a))return x(f,new TypeError("You must pass an array to race.")),f;for(var g=a.length,h=0;f._state===R&&g>h;h++)y(e.resolve(a[h]),void 0,c,d);return f},Z=function(a,b){var c=this;if(a&&"object"==typeof a&&a.constructor===c)return a;var d=new c(m,b);return u(d,a),d},$=function(a,b){var c=this,d=new c(m,b);return x(d,a),d},_=0,ab=H;H.all=X,H.race=Y,H.resolve=Z,H.reject=$,H.prototype={constructor:H,then:function(a,b,c){var d=this,e=d._state;if(e===S&&!a||e===T&&!b)return this;d._onerror=null;var f=new this.constructor(m,c),g=d._result;if(e){var h=arguments[e-1];M(function(){C(e,f,h,g)})}else y(d,f,a,b);return f},"catch":function(a,b){return this.then(null,a,b)}};var bb=function(){var a;a="undefined"!=typeof c?c:"undefined"!=typeof window&&window.document?window:self;var b="Promise"in a&&"resolve"in a.Promise&&"reject"in a.Promise&&"all"in a.Promise&&"race"in a.Promise&&function(){var b;return new a.Promise(function(a){b=a}),e(b)}();b||(a.Promise=ab)},cb={Promise:ab,polyfill:bb};"function"==typeof define&&define.amd?define(function(){return cb}):"undefined"!=typeof b&&b.exports?b.exports=cb:"undefined"!=typeof this&&(this.ES6Promise=cb)}).call(this)}).call(this,a("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:3}],3:[function(a,b){function c(){}var d=b.exports={};d.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.MutationObserver,c="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};var d=[];if(b){var e=document.createElement("div"),f=new MutationObserver(function(){var a=d.slice();d.length=0,a.forEach(function(a){a()})});return f.observe(e,{attributes:!0}),function(a){d.length||e.setAttribute("yes","no"),d.push(a)}}return c?(window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),d.length>0)){var c=d.shift();c()}},!0),function(a){d.push(a),window.postMessage("process-tick","*")}):function(a){setTimeout(a,0)}}(),d.title="browser",d.browser=!0,d.env={},d.argv=[],d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.binding=function(){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(){throw new Error("process.chdir is not supported")}},{}],4:[function(a,b){function c(a,b){return-1!==d(a,b)}var d=a("./indexOf");b.exports=c},{"./indexOf":9}],5:[function(a,b){function c(a,b,c){b=d(b,c);var e=[];if(null==a)return e;for(var f,g=-1,h=a.length;++g<h;)f=a[g],b(f,g,a)&&e.push(f);return e}var d=a("../function/makeIterator_");b.exports=c},{"../function/makeIterator_":16}],6:[function(a,b){function c(a,b,c){var e=d(a,b,c);return e>=0?a[e]:void 0}var d=a("./findIndex");b.exports=c},{"./findIndex":7}],7:[function(a,b){function c(a,b,c){if(b=d(b,c),null==a)return-1;for(var e=-1,f=a.length;++e<f;)if(b(a[e],e,a))return e;return-1}var d=a("../function/makeIterator_");b.exports=c},{"../function/makeIterator_":16}],8:[function(a,b){function c(a,b,c){if(null!=a)for(var d=-1,e=a.length;++d<e&&b.call(c,a[d],d,a)!==!1;);}b.exports=c},{}],9:[function(a,b){function c(a,b,c){if(c=c||0,null==a)return-1;for(var d=a.length,e=0>c?d+c:c;d>e;){if(a[e]===b)return e;e++}return-1}b.exports=c},{}],10:[function(a,b){function c(a){return null!=a&&""!==a}function d(a,b){return b=b||"",e(a,c).join(b)}var e=a("./filter");b.exports=d},{"./filter":5}],11:[function(a,b){function c(a,b){var c=d(a,b);-1!==c&&a.splice(c,1)}var d=a("./indexOf");b.exports=c},{"./indexOf":9}],12:[function(a,b){function c(a,b,c){var d=a.length;b=null==b?0:0>b?Math.max(d+b,0):Math.min(b,d),c=null==c?d:0>c?Math.max(d+c,0):Math.min(c,d);for(var e=[];c>b;)e.push(a[b++]);return e}b.exports=c},{}],13:[function(a,b){function c(a,b){if(null==a)return[];if(a.length<2)return a;null==b&&(b=d);var f,g,h;return f=~~(a.length/2),g=c(a.slice(0,f),b),h=c(a.slice(f,a.length),b),e(g,h,b)}function d(a,b){return b>a?-1:a>b?1:0}function e(a,b,c){for(var d=[];a.length&&b.length;)d.push(c(a[0],b[0])<=0?a.shift():b.shift());return a.length&&d.push.apply(d,a),b.length&&d.push.apply(d,b),d}b.exports=c},{}],14:[function(a,b){function c(a,b){var c={};if(null==a)return c;var e,f=-1,g=a.length;if(d(b))for(;++f<g;)e=a[f],c[b(e)]=e;else for(;++f<g;)e=a[f],c[e[b]]=e;return c}var d=a("../lang/isFunction");b.exports=c},{"../lang/isFunction":23}],15:[function(a,b){function c(a){return a}b.exports=c},{}],16:[function(a,b){function c(a,b){if(null==a)return d;switch(typeof a){case"function":return"undefined"!=typeof b?function(c,d,e){return a.call(b,c,d,e)}:a;case"object":return function(b){return f(b,a)};case"string":case"number":return e(a)}}var d=a("./identity"),e=a("./prop"),f=a("../object/deepMatches");b.exports=c},{"../object/deepMatches":32,"./identity":15,"./prop":17}],17:[function(a,b){function c(a){return function(b){return b[a]}}b.exports=c},{}],18:[function(a,b){function c(a){switch(h(a)){case"Object":return d(a);case"Array":return g(a);case"RegExp":return e(a);case"Date":return f(a);default:return a}}function d(a){return i(a)?j({},a):a}function e(a){var b="";return b+=a.multiline?"m":"",b+=a.global?"g":"",b+=a.ignorecase?"i":"",new RegExp(a.source,b)}function f(a){return new Date(+a)}function g(a){return a.slice()}var h=a("./kindOf"),i=a("./isPlainObject"),j=a("../object/mixIn");b.exports=c},{"../object/mixIn":38,"./isPlainObject":27,"./kindOf":30}],19:[function(a,b){function c(a,b){switch(h(a)){case"Object":return d(a,b);case"Array":return e(a,b);default:return f(a)}}function d(a,b){if(i(a)){var d={};return g(a,function(a,d){this[d]=c(a,b)},d),d}return b?b(a):a}function e(a,b){for(var d=[],e=-1,f=a.length;++e<f;)d[e]=c(a[e],b);return d}var f=a("./clone"),g=a("../object/forOwn"),h=a("./kindOf"),i=a("./isPlainObject");b.exports=c},{"../object/forOwn":35,"./clone":18,"./isPlainObject":27,"./kindOf":30}],20:[function(a,b){var c=a("./isKind"),d=Array.isArray||function(a){return c(a,"Array")};b.exports=d},{"./isKind":24}],21:[function(a,b){function c(a){return d(a,"Boolean")}var d=a("./isKind");b.exports=c},{"./isKind":24}],22:[function(a,b){function c(a){if(null==a)return!0;if("string"==typeof a||e(a))return!a.length;if("object"==typeof a){var b=!0;return d(a,function(){return b=!1,!1}),b}return!0}var d=a("../object/forOwn"),e=a("./isArray");b.exports=c},{"../object/forOwn":35,"./isArray":20}],23:[function(a,b){function c(a){return d(a,"Function")}var d=a("./isKind");b.exports=c},{"./isKind":24}],24:[function(a,b){function c(a,b){return d(a)===b}var d=a("./kindOf");b.exports=c},{"./kindOf":30}],25:[function(a,b){function c(a){return d(a,"Number")}var d=a("./isKind");b.exports=c},{"./isKind":24}],26:[function(a,b){function c(a){return d(a,"Object")}var d=a("./isKind");b.exports=c},{"./isKind":24}],27:[function(a,b){function c(a){return!!a&&"object"==typeof a&&a.constructor===Object}b.exports=c},{}],28:[function(a,b){function c(a){return d(a,"RegExp")}var d=a("./isKind");b.exports=c},{"./isKind":24}],29:[function(a,b){function c(a){return d(a,"String")}var d=a("./isKind");b.exports=c},{"./isKind":24}],30:[function(a,b){function c(a){return null===a?"Null":a===d?"Undefined":e.exec(f.call(a))[1]}var d,e=/^\[object (.*)\]$/,f=Object.prototype.toString;b.exports=c},{}],31:[function(a,b){function c(a){return null==a?"":a.toString()}b.exports=c},{}],32:[function(a,b){function c(a,b){for(var c=-1,d=a.length;++c<d;)if(f(a[c],b))return!0;return!1}function d(a,b){for(var d=-1,e=b.length;++d<e;)if(!c(a,b[d]))return!1;return!0}function e(a,b){var c=!0;return g(b,function(b,d){return f(a[d],b)?void 0:c=!1}),c}function f(a,b){return a&&"object"==typeof a?h(a)&&h(b)?d(a,b):e(a,b):a===b}var g=a("./forOwn"),h=a("../lang/isArray");b.exports=f},{"../lang/isArray":20,"./forOwn":35}],33:[function(a,b){function c(a){for(var b,c=0,f=arguments.length;++c<f;)b=arguments[c],b&&e(b,d,a);return a}function d(a,b){var d=this[b];f(a)&&f(d)?c(d,a):this[b]=a}var e=a("./forOwn"),f=a("../lang/isPlainObject");b.exports=c},{"../lang/isPlainObject":27,"./forOwn":35}],34:[function(a,b){function c(){g=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],f=!0;for(var a in{toString:null})f=!1}function d(a,b,d){var i,j=0;null==f&&c();for(i in a)if(e(b,a,i,d)===!1)break;if(f)for(var k=a.constructor,l=!!k&&a===k.prototype;(i=g[j++])&&("constructor"===i&&(l||!h(a,i))||a[i]===Object.prototype[i]||e(b,a,i,d)!==!1););}function e(a,b,c,d){return a.call(d,b[c],c,b)}var f,g,h=a("./hasOwn");b.exports=d},{"./hasOwn":36}],35:[function(a,b){function c(a,b,c){e(a,function(e,f){return d(a,f)?b.call(c,a[f],f,a):void 0})}var d=a("./hasOwn"),e=a("./forIn");b.exports=c},{"./forIn":34,"./hasOwn":36}],36:[function(a,b){function c(a,b){return Object.prototype.hasOwnProperty.call(a,b)}b.exports=c},{}],37:[function(a,b){function c(){var a,b,g,h,i=1;for(h=e(arguments[0]);g=arguments[i++];)for(a in g)d(g,a)&&(b=g[a],h[a]=f(b)&&f(h[a])?c(h[a],b):e(b));return h}var d=a("./hasOwn"),e=a("../lang/deepClone"),f=a("../lang/isObject");b.exports=c},{"../lang/deepClone":19,"../lang/isObject":26,"./hasOwn":36}],38:[function(a,b){function c(a){for(var b,c=0,f=arguments.length;++c<f;)b=arguments[c],null!=b&&e(b,d,a);return a}function d(a,b){this[b]=a}var e=a("./forOwn");b.exports=c},{"./forOwn":35}],39:[function(a,b){function c(a,b){return b?(d(b.split("."),function(b){a[b]||(a[b]={}),a=a[b]}),a):a}var d=a("../array/forEach");b.exports=c},{"../array/forEach":8}],40:[function(a,b){function c(a){for(var b,c="string"!=typeof arguments[1]?arguments[1]:d(arguments,1),e={},f=0;b=c[f++];)e[b]=a[b];return e}var d=a("../array/slice");b.exports=c},{"../array/slice":12}],41:[function(a,b){function c(a,b,c){var e=/^(.+)\.(.+)$/.exec(b);e?d(a,e[1])[e[2]]=c:a[b]=c}var d=a("./namespace");b.exports=c},{"./namespace":39}],42:[function(a,b){function c(a){return a=d(a),a=e(a),a=f(a).replace(/[\-_]/g," ").replace(/\s[a-z]/g,g).replace(/\s+/g,"").replace(/^[A-Z]/g,h)}var d=a("../lang/toString"),e=a("./replaceAccents"),f=a("./removeNonWord"),g=a("./upperCase"),h=a("./lowerCase");b.exports=c},{"../lang/toString":31,"./lowerCase":43,"./removeNonWord":46,"./replaceAccents":47,"./upperCase":48}],43:[function(a,b){function c(a){return a=d(a),a.toLowerCase()}var d=a("../lang/toString");b.exports=c},{"../lang/toString":31}],44:[function(a,b){function c(){var a=d(e(arguments),"/");return a.replace(/([^:\/]|^)\/{2,}/g,"$1/")}var d=a("../array/join"),e=a("../array/slice");b.exports=c},{"../array/join":10,"../array/slice":12}],45:[function(a,b){function c(a){return a=d(a),e(a).replace(/^[a-z]/,f)}var d=a("../lang/toString"),e=a("./camelCase"),f=a("./upperCase");b.exports=c},{"../lang/toString":31,"./camelCase":42,"./upperCase":48}],46:[function(a,b){function c(a){return a=d(a),a.replace(e,"")}var d=a("../lang/toString"),e=/[^\x20\x2D0-9A-Z\x5Fa-z\xC0-\xD6\xD8-\xF6\xF8-\xFF]/g;b.exports=c},{"../lang/toString":31}],47:[function(a,b){function c(a){return a=d(a),a.search(/[\xC0-\xFF]/g)>-1&&(a=a.replace(/[\xC0-\xC5]/g,"A").replace(/[\xC6]/g,"AE").replace(/[\xC7]/g,"C").replace(/[\xC8-\xCB]/g,"E").replace(/[\xCC-\xCF]/g,"I").replace(/[\xD0]/g,"D").replace(/[\xD1]/g,"N").replace(/[\xD2-\xD6\xD8]/g,"O").replace(/[\xD9-\xDC]/g,"U").replace(/[\xDD]/g,"Y").replace(/[\xDE]/g,"P").replace(/[\xE0-\xE5]/g,"a").replace(/[\xE6]/g,"ae").replace(/[\xE7]/g,"c").replace(/[\xE8-\xEB]/g,"e").replace(/[\xEC-\xEF]/g,"i").replace(/[\xF1]/g,"n").replace(/[\xF2-\xF6\xF8]/g,"o").replace(/[\xF9-\xFC]/g,"u").replace(/[\xFE]/g,"p").replace(/[\xFD\xFF]/g,"y")),a}var d=a("../lang/toString");b.exports=c},{"../lang/toString":31}],48:[function(a,b){function c(a){return a=d(a),a.toUpperCase()}var d=a("../lang/toString");b.exports=c},{"../lang/toString":31}],49:[function(a,b){function c(a,b,c){var f=this,g=f.definitions[a];c=c||{},b=b||{};var h=new d.Promise(function(f,h){g?d.isObject(b)?(c=d._(g,c),f(b)):h(new e.IA('"attrs" must be an object!')):h(new e.NER(a))});return g&&(c.hasOwnProperty("upsert")?c.upsert:g.upsert)&&b[g.idAttribute]?f.update(a,b[g.idAttribute],b,c):h.then(function(b){return c.beforeValidate.call(b,a,b)}).then(function(b){return c.validate.call(b,a,b)}).then(function(b){return c.afterValidate.call(b,a,b)}).then(function(b){return c.beforeCreate.call(b,a,b)}).then(function(a){return c.notify&&f.emit(g,"beforeCreate",d.merge({},a)),f.getAdapter(g,c).create(g,a,c)}).then(function(b){return c.afterCreate.call(b,a,b)}).then(function(b){if(c.notify&&f.emit(g,"afterCreate",d.merge({},b)),c.cacheResponse){var e=f.inject(g.name,b,c),h=e[g.idAttribute];return f.store[a].completedQueries[h]=(new Date).getTime(),e}return f.createInstance(a,b,c)})}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],50:[function(a,b){function c(a,b,c){var f,g=this,h=g.definitions[a];return new d.Promise(function(i,j){b=d.resolveId(h,b),h?d.isString(b)||d.isNumber(b)?g.get(a,b)?(f=g.get(a,b),c=d._(h,c),i(f)):j(new e.R('id "'+b+'" not found in cache!')):j(new e.IA('"id" must be a string or a number!')):j(new e.NER(a))}).then(function(b){return c.beforeDestroy.call(b,a,b)}).then(function(e){return c.notify&&g.emit(h,"beforeDestroy",d.merge({},e)),c.eagerEject&&g.eject(a,b),g.getAdapter(h,c).destroy(h,b,c)}).then(function(){return c.afterDestroy.call(f,a,f)}).then(function(e){return c.notify&&g.emit(h,"afterDestroy",d.merge({},e)),g.eject(a,b),b})["catch"](function(b){throw c.eagerEject&&f&&g.inject(a,f,{notify:!1}),b})}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],51:[function(a,b){function c(a,b,c){var f,g,h=this,i=h.definitions[a];return b=b||{},new d.Promise(function(f,g){i?d.isObject(b)?(c=d._(i,c),f()):g(new e.IA('"params" must be an object!')):g(new e.NER(a))}).then(function(){return g=h.defaults.defaultFilter.call(h,a,b),c.beforeDestroy(a,g)}).then(function(){return c.notify&&h.emit(i,"beforeDestroy",g),c.eagerEject&&(f=h.ejectAll(a,b)),h.getAdapter(i,c).destroyAll(i,b,c)}).then(function(){return c.afterDestroy(a,g)}).then(function(){return c.notify&&h.emit(i,"afterDestroy",g),f||h.ejectAll(a,b)})["catch"](function(b){throw c.eagerEject&&f&&h.inject(a,f,{notify:!1}),b})}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],52:[function(a,b){function c(a,b,c){var f=this,g=f.definitions[a],h=f.store[a];return new d.Promise(function(i,j){g?d.isString(b)||d.isNumber(b)?(c=d._(g,c),(c.bypassCache||!c.cacheResponse)&&delete h.completedQueries[b],b in h.completedQueries?i(f.get(a,b)):i()):j(new e.IA('"id" must be a string or a number!')):j(new e.NER(a))}).then(function(d){return b in h.completedQueries?d:(b in h.pendingQueries||(h.pendingQueries[b]=f.getAdapter(g,c).find(g,b,c).then(function(d){return delete h.pendingQueries[b],c.cacheResponse?(h.completedQueries[b]=(new Date).getTime(),f.inject(a,d,c)):f.createInstance(a,d,c)})),h.pendingQueries[b])})["catch"](function(a){throw delete h.pendingQueries[b],a})}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],53:[function(a,b){function c(a,b,c,d){var f=this,g=f.store[b],h=f.definitions[b].idAttribute,i=(new Date).getTime();a=a||[],delete g.pendingQueries[c],g.completedQueries[c]=i,g.collectionModified=e.updateTimestamp(g.collectionModified);var j=f.inject(b,a,d);return e.isArray(j)?e.forEach(j,function(a){a&&a[h]&&(g.completedQueries[a[h]]=i)}):(console.warn(errorPrefix(b)+"response is expected to be an array!"),g.completedQueries[j[h]]=i),j}function d(a,b,d){var g,h=this,i=h.definitions[a],j=h.store[a];return new e.Promise(function(c,k){b=b||{},h.definitions[a]?e.isObject(b)?(d=e._(i,d),g=e.toJson(b),(d.bypassCache||!d.cacheResponse)&&delete j.completedQueries[g],g in j.completedQueries?c(h.filter(a,b,d)):c()):k(new f.IA('"params" must be an object!')):k(new f.NER(a))}).then(function(f){return g in j.completedQueries?f:(g in j.pendingQueries||(j.pendingQueries[g]=h.getAdapter(i,d).findAll(i,b,d).then(function(b){return delete j.pendingQueries[g],d.cacheResponse?c.call(h,b,a,g,d):(e.forEach(b,function(c,e){b[e]=h.createInstance(a,c,d)}),b)})),j.pendingQueries[g])})["catch"](function(a){throw delete j.pendingQueries[g],a})}var e=a("../../utils"),f=a("../../errors");b.exports=d},{"../../errors":70,"../../utils":72}],54:[function(a,b){function c(a,b){var c=this,d=c.definitions[a],f=c.store[a];return new e.Promise(function(g,h){if(d){b=e._(d,b),b.hasOwnProperty("notify")||(b.notify=!1);for(var i,j=[],k=(new Date).getTime();(i=f.expiresHeap.peek())&&i.expires<k;)j.push(i.item),delete i.item,f.expiresHeap.pop();g(j)}else h(new c.errors.NER(a))}).then(function(g){if((b.isInterval||b.notify)&&c.emit(d,"beforeReap",g),"inject"===b.reapAction)e.forEach(g,function(a){var b=a[d.idAttribute];f.expiresHeap.push({item:a,timestamp:f.saved[b],expires:d.maxAge?f.saved[b]+d.maxAge:Number.MAX_VALUE})});else if("eject"===b.reapAction)e.forEach(g,function(b){c.eject(a,b[d.idAttribute])});else if("refresh"===b.reapAction){var h=[];return e.forEach(g,function(b){h.push(c.refresh(a,b[d.idAttribute]))}),e.Promise.all(h)}return g}).then(function(a){return(b.isInterval||b.notify)&&c.emit(d,"afterReap",a),a})}function d(a,b,c){var d=this;return new e.Promise(function(g,h){var i=d.definitions[a];b=e.resolveId(d.definitions[a],b),i?e.isString(b)||e.isNumber(b)?(c=e._(i,c),c.bypassCache=!0,g(d.get(a,b))):h(new f.IA('"id" must be a string or a number!')):h(new d.errors.NER(a))}).then(function(e){return e?d.find(a,b,c):e})}var e=a("../../utils"),f=a("../../errors");b.exports={create:a("./create"),destroy:a("./destroy"),destroyAll:a("./destroyAll"),find:a("./find"),findAll:a("./findAll"),loadRelations:a("./loadRelations"),reap:c,refresh:d,save:a("./save"),update:a("./update"),updateAll:a("./updateAll")}},{"../../errors":70,"../../utils":72,"./create":49,"./destroy":50,"./destroyAll":51,"./find":52,"./findAll":53,"./loadRelations":55,"./save":56,"./update":57,"./updateAll":58}],55:[function(a,b){function c(a,b,c,f){var g=this,h=g.definitions[a],i=[];return new d.Promise(function(j,k){if((d.isString(b)||d.isNumber(b))&&(b=g.get(a,b)),d.isString(c)&&(c=[c]),h)if(d.isObject(b))if(d.isArray(c)){f=d._(h,f),f.hasOwnProperty("findBelongsTo")||(f.findBelongsTo=!0),f.hasOwnProperty("findHasMany")||(f.findHasMany=!0);var l=[];d.forEach(h.relationList,function(a){var e=a.relation;if(d.contains(c,e)){var j,k={};k[a.foreignKey]=b[h.idAttribute],"hasMany"===a.type&&k[a.foreignKey]?j=g.findAll(e,k,f):"hasOne"===a.type?a.localKey&&b[a.localKey]?j=g.find(e,b[a.localKey],f):a.foreignKey&&k[a.foreignKey]&&(j=g.findAll(e,k,f).then(function(a){return a.length?a[0]:null})):b[a.localKey]&&(j=g.find(e,b[a.localKey],f)),j&&(l.push(j),i.push(a.localField))}}),j(l)}else k(new e.IA('"relations" must be a string or an array!'));else k(new e.IA('"instance(id)" must be a string, number or object!'));else k(new e.NER(a))}).then(function(a){return d.Promise.all(a)}).then(function(a){return d.forEach(i,function(c,d){b[c]=a[d]}),b})}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],56:[function(a,b){function c(a,b,c){var f,g=this,h=g.definitions[a];return new d.Promise(function(i,j){b=d.resolveId(h,b),h?d.isString(b)||d.isNumber(b)?g.get(a,b)?(f=g.get(a,b),c=d._(h,c),i(f)):j(new e.R('id "'+b+'" not found in cache!')):j(new e.IA('"id" must be a string or a number!')):j(new e.NER(a))}).then(function(b){return c.beforeValidate.call(b,a,b)}).then(function(b){return c.validate.call(b,a,b)}).then(function(b){return c.afterValidate.call(b,a,b)}).then(function(b){return c.beforeUpdate.call(b,a,b)
}).then(function(e){if(c.notify&&g.emit(h,"beforeUpdate",d.merge({},e)),c.changesOnly){var f=g.store[a];d.w&&f.observers[b].deliver();var i=[],j=g.changes(a,b);for(var k in j.added)i.push(k);for(k in j.changed)i.push(k);if(j=d.pick(e,i),d.isEmpty(j))return e;e=j}return g.getAdapter(h,c).update(h,b,e,c)}).then(function(b){return c.afterUpdate.call(b,a,b)}).then(function(a){return c.notify&&g.emit(h,"afterUpdate",d.merge({},a)),c.cacheResponse?g.inject(h.name,a,c):a})}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],57:[function(a,b){function c(a,b,c,f){var g=this,h=g.definitions[a];return new d.Promise(function(g,i){b=d.resolveId(h,b),h?d.isString(b)||d.isNumber(b)?(f=d._(h,f),g(c)):i(new e.IA('"id" must be a string or a number!')):i(new e.NER(a))}).then(function(b){return f.beforeValidate.call(b,a,b)}).then(function(b){return f.validate.call(b,a,b)}).then(function(b){return f.afterValidate.call(b,a,b)}).then(function(b){return f.beforeUpdate.call(b,a,b)}).then(function(a){return f.notify&&g.emit(h,"beforeUpdate",d.merge({},a)),g.getAdapter(h,f).update(h,b,a,f)}).then(function(b){return f.afterUpdate.call(b,a,b)}).then(function(a){return f.notify&&g.emit(h,"afterUpdate",d.merge({},a)),f.cacheResponse?g.inject(h.name,a,f):a})}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],58:[function(a,b){function c(a,b,c,f){var g=this,h=g.definitions[a];return new d.Promise(function(c,g){h?(f=d._(h,f),c(b)):g(new e.NER(a))}).then(function(b){return f.beforeValidate.call(b,a,b)}).then(function(b){return f.validate.call(b,a,b)}).then(function(b){return f.afterValidate.call(b,a,b)}).then(function(b){return f.beforeUpdate.call(b,a,b)}).then(function(a){return f.notify&&g.emit(h,"beforeUpdate",d.merge({},a)),g.getAdapter(h,f).updateAll(h,a,c,f)}).then(function(b){return f.afterUpdate.call(b,a,b)}).then(function(a){return f.notify&&g.emit(h,"afterUpdate",d.merge({},b)),f.cacheResponse?g.inject(h.name,a,f):a})}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],59:[function(a,b){function c(a,b,c){c(null,b)}function d(a,b){return b}function e(){}function f(b){b=b||{};try{g=a("js-data-schema")}catch(c){}if(!g)try{g=window.Schemator}catch(c){}(g||b.schemator)&&(this.schemator=b.schemator||new g),this.store={},this.definitions={},this.adapters={},this.defaults=new e,this.observe=l,h.deepMixIn(this.defaults,b)}var g,h=a("../utils"),i=a("../errors"),j=a("./sync_methods"),k=a("./async_methods"),l=a("../../lib/observe-js/observe-js");h.deepFreeze(j),h.deepFreeze(k),h.deepFreeze(i),h.deepFreeze(h);var m=e.prototype;m.idAttribute="id",m.basePath="",m.endpoint="",m.useClass=!0,m.keepChangeHistory=!1,m.resetHistoryOnInject=!0,m.eagerEject=!1,m.eagerInject=!1,m.allowSimpleWhere=!0,m.defaultAdapter="http",m.loadFromServer=!1,m.notify=!!h.w,m.upsert=!!h.w,m.cacheResponse=!!h.w,m.bypassCache=!1,m.findInverseLinks=!1,m.findBelongsTo=!1,m.findHasOn=!1,m.findHasMany=!1,m.reapInterval=h.w?3e4:!1,m.reapAction=h.w?"inject":"none",m.maxAge=!1,m.maxAge=!1,m.ignoredChanges=[/\$/],m.beforeValidate=c,m.validate=c,m.afterValidate=c,m.beforeCreate=c,m.afterCreate=c,m.beforeUpdate=c,m.afterUpdate=c,m.beforeDestroy=c,m.afterDestroy=c,m.beforeCreateInstance=d,m.afterCreateInstance=d,m.beforeInject=d,m.afterInject=d,m.beforeEject=d,m.afterEject=d,m.defaultFilter=function(a,b,c,d){var e=this,f=a,g=null,i={skip:"",offset:"",where:"",limit:"",orderBy:"",sort:""};c=c||{},d=d||{},g=h.isObject(c.where)?c.where:{},d.allowSimpleWhere&&h.forOwn(c,function(a,b){b in i||b in g||(g[b]={"==":a})}),h.isEmpty(g)&&(g=null),g&&(f=h.filter(f,function(a){var b=!0,c=!0;return h.forOwn(g,function(d,e){h.isString(d)?d={"===":d}:(h.isNumber(d)||h.isBoolean(d))&&(d={"==":d}),h.isObject(d)&&h.forOwn(d,function(d,f){"=="===f?c=b?a[e]==d:c&&a[e]==d:"==="===f?c=b?a[e]===d:c&&a[e]===d:"!="===f?c=b?a[e]!=d:c&&a[e]!=d:"!=="===f?c=b?a[e]!==d:c&&a[e]!==d:">"===f?c=b?a[e]>d:c&&a[e]>d:">="===f?c=b?a[e]>=d:c&&a[e]>=d:"<"===f?c=b?a[e]<d:c&&a[e]<d:"<="===f?c=b?a[e]<=d:c&&a[e]<=d:"in"===f?c=b?h.contains(d,a[e]):c&&h.contains(d,a[e]):"notIn"===f?c=b?!h.contains(d,a[e]):c&&!h.contains(d,a[e]):"|=="===f?c=b?a[e]==d:c||a[e]==d:"|==="===f?c=b?a[e]===d:c||a[e]===d:"|!="===f?c=b?a[e]!=d:c||a[e]!=d:"|!=="===f?c=b?a[e]!==d:c||a[e]!==d:"|>"===f?c=b?a[e]>d:c||a[e]>d:"|>="===f?c=b?a[e]>=d:c||a[e]>=d:"|<"===f?c=b?a[e]<d:c||a[e]<d:"|<="===f?c=b?a[e]<=d:c||a[e]<=d:"|in"===f?c=b?h.contains(d,a[e]):c||h.contains(d,a[e]):"|notIn"===f&&(c=b?!h.contains(d,a[e]):c||!h.contains(d,a[e])),b=!1})}),c}));var j=null;h.isString(c.orderBy)?j=[[c.orderBy,"ASC"]]:h.isArray(c.orderBy)&&(j=c.orderBy),!j&&h.isString(c.sort)?j=[[c.sort,"ASC"]]:!j&&h.isArray(c.sort)&&(j=c.sort),j&&h.forEach(j,function(a){if(h.isString(a))a=[a,"ASC"];else if(!h.isArray(a))throw new e.errors.IllegalArgumentError("DS.filter(resourceName[, params][, options]): "+h.toJson(a)+": Must be a string or an array!",{params:{"orderBy[i]":{actual:typeof a,expected:"string|array"}}});f=h.sort(f,function(b,c){var d=b[a[0]],e=c[a[0]];return h.isString(d)&&(d=h.upperCase(d)),h.isString(e)&&(e=h.upperCase(e)),"DESC"===a[1]?d>e?-1:e>d?1:0:e>d?-1:d>e?1:0})});var k=h.isNumber(c.limit)?c.limit:null,l=null;return h.isNumber(c.skip)?l=c.skip:h.isNumber(c.offset)&&(l=c.offset),k&&l?f=h.slice(f,l,Math.min(f.length,l+k)):h.isNumber(k)?f=h.slice(f,0,Math.min(f.length,k)):h.isNumber(l)&&(f=l<f.length?h.slice(f,l):[]),f};var n=f.prototype;n.getAdapter=function(a,b){return b=b||{},this.adapters[b.adapter]||this.adapters[a.defaultAdapter]},n.registerAdapter=function(a,b,c){c=c||{},this.adapters[a]=h.isFunction(b)?new b(c):b,c.default&&(this.defaults.defaultAdapter=a)},n.emit=function(a,b){var c=Array.prototype.slice.call(arguments,2);c.unshift(a.name),c.unshift("DS."+b),a.emit.apply(a,c)},n.errors=a("../errors"),n.utils=h,h.deepMixIn(n,j),h.deepMixIn(n,k),b.exports=f},{"../../lib/observe-js/observe-js":1,"../errors":70,"../utils":72,"./async_methods":54,"./sync_methods":64,"js-data-schema":"js-data-schema"}],60:[function(require,module,exports){function Resource(a){DSUtils.deepMixIn(this,a),this.endpoint="endpoint"in a?a.endpoint:this.name}function defineResource(definition){var _this=this,definitions=_this.definitions;if(DSUtils.isString(definition)&&(definition={name:definition.replace(/\s/gi,"")}),!DSUtils.isObject(definition))throw new DSErrors.IA('"definition" must be an object!');if(!DSUtils.isString(definition.name))throw new DSErrors.IA('"name" must be a string!');if(_this.store[definition.name])throw new DSErrors.R(definition.name+" is already registered!");try{Resource.prototype=_this.defaults,definitions[definition.name]=new Resource(definition);var def=definitions[definition.name];if(!DSUtils.isString(def.idAttribute))throw new DSErrors.IA('"idAttribute" must be a string!');def.relations&&(def.relationList=[],def.relationFields=[],DSUtils.forOwn(def.relations,function(a,b){DSUtils.forOwn(a,function(c,d){DSUtils.isArray(c)||(a[d]=[c]),DSUtils.forEach(a[d],function(a){a.type=b,a.relation=d,a.name=def.name,def.relationList.push(a),def.relationFields.push(a.localField)})})}),def.relations.belongsTo&&DSUtils.forOwn(def.relations.belongsTo,function(a,b){DSUtils.forEach(a,function(a){a.parent&&(def.parent=b,def.parentKey=a.localKey)})}),DSUtils.deepFreeze(def.relations),DSUtils.deepFreeze(def.relationList)),def.getEndpoint=function(a,b){b=DSUtils.deepMixIn({},b);var c,d,e=this.parent,f=this.parentKey,g=b.endpoint||this.endpoint,h=definitions[e];return delete b.endpoint,b=b||{},b.params=b.params||{},e&&f&&h&&b.params[f]!==!1&&((DSUtils.isNumber(a)||DSUtils.isString(a))&&(c=_this.get(this.name,a)),DSUtils.isObject(a)&&f in a?(delete b.params[f],d=DSUtils.makePath(h.getEndpoint(a,b),a[f],g)):c&&f in c?(delete b.params[f],d=DSUtils.makePath(h.getEndpoint(a,b),c[f],g)):b&&b.params[f]&&(d=DSUtils.makePath(h.getEndpoint(a,b),b.params[f],g),delete b.params[f])),b.params[f]===!1&&delete b.params[f],d||g},def.filter&&(def.defaultFilter=def.filter,delete def.filter),def["class"]=DSUtils.pascalCase(definition.name),eval("function "+def["class"]+"() {}"),def[def["class"]]=eval(def["class"]),def.methods&&DSUtils.deepMixIn(def[def["class"]].prototype,def.methods),def.computed&&DSUtils.forOwn(def.computed,function(a,b){DSUtils.isFunction(a)&&(def.computed[b]=[a],a=def.computed[b]),def.methods&&b in def.methods&&console.warn('Computed property "'+b+'" conflicts with previously defined prototype method!');var c;if(1===a.length){var d=a[0].toString().match(/function.*?\(([\s\S]*?)\)/);c=d[1].split(","),def.computed[b]=c.concat(a),a=def.computed[b],c.length&&console.warn("Use the computed property array syntax for compatibility with minified code!")}c=a.slice(0,a.length-1),DSUtils.forEach(c,function(a,b){c[b]=a.trim()}),a.deps=DSUtils.filter(c,function(a){return!!a})}),definition.schema&&_this.schemator&&(def.schema=_this.schemator.defineSchema(def.name,definition.schema),"validate"in definition||(def.validate=function(a,b,c){def.schema.validate(b,!0,function(a){return a?c(a):c(null,b)})})),DSUtils.forEach(instanceMethods,function(a){def[def["class"]].prototype["DS"+DSUtils.pascalCase(a)]=function(){var b=Array.prototype.slice.call(arguments);return b.unshift(this[def.idAttribute]||this),b.unshift(def.name),_this[a].apply(_this,b)}}),_this.store[def.name]={collection:[],expiresHeap:new DSUtils.DSBinaryHeap(function(a){return a.expires},function(a,b){return a.item===b}),completedQueries:{},pendingQueries:{},index:{},modified:{},saved:{},previousAttributes:{},observers:{},changeHistories:{},changeHistory:[],collectionModified:0},def.reapInterval&&setInterval(function(){_this.reap(def.name,{isInterval:!0})},def.reapInterval);for(var key in _this)"function"==typeof _this[key]&&"defineResource"!==key&&!function(a){def[a]=function(){var b=Array.prototype.slice.call(arguments);return b.unshift(def.name),_this[a].apply(_this,b)}}(key);return def.beforeValidate=DSUtils.promisify(def.beforeValidate),def.validate=DSUtils.promisify(def.validate),def.afterValidate=DSUtils.promisify(def.afterValidate),def.beforeCreate=DSUtils.promisify(def.beforeCreate),def.afterCreate=DSUtils.promisify(def.afterCreate),def.beforeUpdate=DSUtils.promisify(def.beforeUpdate),def.afterUpdate=DSUtils.promisify(def.afterUpdate),def.beforeDestroy=DSUtils.promisify(def.beforeDestroy),def.afterDestroy=DSUtils.promisify(def.afterDestroy),DSUtils.Events(def),def}catch(err){throw console.error(err),delete definitions[definition.name],delete _this.store[definition.name],err}}var DSUtils=require("../../utils"),DSErrors=require("../../errors"),instanceMethods=["compute","refresh","save","update","destroy","loadRelations","changeHistory","changes","hasChanges","lastModified","lastSaved","link","linkInverse","previous","unlinkInverse"];module.exports=defineResource},{"../../errors":70,"../../utils":72}],61:[function(a,b){function c(a,b,c){var f,g=this,h=g.definitions[a],i=g.store[a],j=!1;if(b=d.resolveId(h,b),!h)throw new e.NER(a);if(!d.isString(b)&&!d.isNumber(b))throw new e.IA('"id" must be a string or a number!');c=d._(h,c);for(var k=0;k<i.collection.length;k++)if(i.collection[k][h.idAttribute]==b){f=i.collection[k],i.expiresHeap.remove(f),j=!0;break}return j?(c.notify&&h.beforeEject(h.name,f),g.unlinkInverse(h.name,b),i.collection.splice(k,1),d.w&&i.observers[b].close(),delete i.observers[b],delete i.index[b],delete i.previousAttributes[b],delete i.completedQueries[b],delete i.pendingQueries[b],d.forEach(i.changeHistories[b],function(a){d.remove(i.changeHistory,a)}),delete i.changeHistories[b],delete i.modified[b],delete i.saved[b],i.collectionModified=d.updateTimestamp(i.collectionModified),c.notify&&(h.afterEject(h.name,f),g.emit(h,"eject",f)),f):void 0}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],62:[function(a,b){function c(a,b,c){var f=this,g=f.definitions[a];if(b=b||{},!g)throw new e.NER(a);if(!d.isObject(b))throw new e.IA('"params" must be an object!');var h=f.store[a];d.isEmpty(b)&&(h.completedQueries={});var i=d.toJson(b),j=f.filter(g.name,b),k=d.toLookup(j,g.idAttribute);return d.forOwn(k,function(a,b){f.eject(g.name,b,c)}),delete h.completedQueries[i],h.collectionModified=d.updateTimestamp(h.collectionModified),j}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],63:[function(a,b){function c(a,b,c){var f=this,g=f.definitions[a],h=f.store[a];if(!g)throw new e.NER(a);if(b&&!d.isObject(b))throw new e.IA('"params" must be an object!');c=d._(g,c),b=b||{};var i=d.toJson(b);return i in h.completedQueries||!c.loadFromServer||h.pendingQueries[i]||f.findAll(a,b,c),g.defaultFilter.call(f,h.collection,a,b,c)}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],64:[function(a,b){function c(a,b,c){var d=this,e=d.definitions[a];if(c=c||{},b=o.resolveId(e,b),!e)throw new q(a);if(!o.isString(b)&&!o.isNumber(b))throw new r('"id" must be a string or a number!');c=o._(e,c);var f=d.get(a,b);if(f){o.w&&d.store[a].observers[b].deliver();var g=o.diffObjectFromOldObject(f,d.store[a].previousAttributes[b],c.ignoredChanges);return o.forOwn(g,function(a,b){var c=[];o.forOwn(a,function(a,b){o.isFunction(a)||c.push(b)}),g[b]=o.pick(g[b],c)}),o.forEach(e.relationFields,function(a){delete g.added[a],delete g.removed[a],delete g.changed[a]}),g}}function d(a,b){var c=this,d=c.definitions[a],e=c.store[a];if(b=o.resolveId(d,b),a&&!c.definitions[a])throw new q(a);if(b&&!o.isString(b)&&!o.isNumber(b))throw new r('"id" must be a string or a number!');if(d.keepChangeHistory){if(!a)return e.changeHistory;var f=c.get(a,b);if(f)return e.changeHistories[b]}else console.warn("changeHistory is disabled for this resource!")}function e(a,b){var c=this,d=c.definitions[a];if(b=o.resolveItem(c.store[a],b),!d)throw new q(a);if(!o.isObject(b)&&!o.isString(b)&&!o.isNumber(b))throw new r('"instance" must be an object, string or number!');return(o.isString(b)||o.isNumber(b))&&(b=c.get(a,b)),o.forOwn(d.computed,function(a,c){o.compute.call(b,a,c,o)}),b}function f(a,b,c){var d,e=this.definitions[a];if(b=b||{},!e)throw new q(a);if(b&&!o.isObject(b))throw new r('"attrs" must be an object!');if(c=o._(e,c),c.notify&&c.beforeCreateInstance(a,b),c.useClass){var f=e[e.class];d=new f}else d={};return o.deepMixIn(d,b),c.notify&&c.afterCreateInstance(a,b),d}function g(a){return!(o.isEmpty(a.added)&&o.isEmpty(a.removed)&&o.isEmpty(a.changed))}function h(){this.observe.Platform.performMicrotaskCheckpoint()}function i(a,b,c){var d=this,e=d.definitions[a];if(!e)throw new q(a);if(!o.isString(b)&&!o.isNumber(b))throw new r('"id" must be a string or a number!');c=o._(e,c);var f=d.store[a].index[b];return!f&&c.loadFromServer&&d.find(a,b,c),f}function j(a,b){var c=this,d=c.store[a],e=[];if(!c.definitions[a])throw new q(a);if(b&&!o.isArray(b))throw new r('"ids" must be an array!');if(o.isArray(b))for(var f=b.length,g=0;f>g;g++)d.index[b[g]]&&e.push(d.index[b[g]]);else e=d.collection.slice();return e}function k(a,b){var c=this;if(b=o.resolveId(c.definitions[a],b),!c.definitions[a])throw new q(a);if(!o.isString(b)&&!o.isNumber(b))throw new r('"id" must be a string or a number!');return c.get(a,b)?g(c.changes(a,b)):!1}function l(a,b){var c=this.definitions[a],d=this.store[a];if(b=o.resolveId(c,b),!c)throw new q(a);return b?(b in d.modified||(d.modified[b]=0),d.modified[b]):d.collectionModified}function m(a,b){var c=this.definitions[a],d=this.store[a];if(b=o.resolveId(c,b),!c)throw new q(a);return b in d.saved||(d.saved[b]=0),d.saved[b]}function n(a,b){var c=this,d=c.definitions[a],e=c.store[a];if(b=o.resolveId(d,b),!d)throw new q(a);if(!o.isString(b)&&!o.isNumber(b))throw new r('"id" must be a string or a number!');return e.previousAttributes[b]?o.merge({},e.previousAttributes[b]):void 0}var o=a("../../utils"),p=a("../../errors"),q=p.NER,r=p.IA;b.exports={changes:c,changeHistory:d,compute:e,createInstance:f,defineResource:a("./defineResource"),digest:h,eject:a("./eject"),ejectAll:a("./ejectAll"),filter:a("./filter"),get:i,getAll:j,hasChanges:k,inject:a("./inject"),lastModified:l,lastSaved:m,link:a("./link"),linkAll:a("./linkAll"),linkInverse:a("./linkInverse"),previous:n,unlinkInverse:a("./unlinkInverse")}},{"../../errors":70,"../../utils":72,"./defineResource":60,"./eject":61,"./ejectAll":62,"./filter":63,"./inject":65,"./link":66,"./linkAll":67,"./linkInverse":68,"./unlinkInverse":69}],65:[function(a,b){function c(a,b,c){var d=this;h.forEach(a.relationList,function(e){var f=e.relation,g=d.definitions[f];if(b[e.localField]){if(!g)throw new i.R(a.name+" relation is defined, but the resource is not!");try{b[e.localField]=d.inject(f,b[e.localField],c)}catch(h){console.error(a.name+": Failed to inject "+e.type+' relation: "'+f+'"!',h)}}})}function d(a,b,c){return function(d,e,f,g,i){var j,k=this,l=g&&g(b.idAttribute)?g(b.idAttribute):k[b.idAttribute];if(h.forEach(b.relationFields,function(a){delete d[a],delete e[a],delete f[a]}),(!h.isEmpty(d)||!h.isEmpty(e)||!h.isEmpty(f)||i)&&(j=a.get(b.name,l),c.modified[l]=h.updateTimestamp(c.modified[l]),c.collectionModified=h.updateTimestamp(c.collectionModified),b.keepChangeHistory)){var m={resourceName:b.name,target:j,added:d,removed:e,changed:f,timestamp:c.modified[l]};c.changeHistories[l].push(m),c.changeHistory.push(m)}b.computed&&(j=j||a.get(b.name,l),h.forOwn(b.computed,function(a,b){var c=!1;h.forEach(a.deps,function(a){(a in d||a in e||a in f||!(b in j))&&(c=!0)}),c=c||!a.deps.length,c&&h.compute.call(j,a,b,h)})),b.relations&&(j=j||a.get(b.name,l),h.forEach(b.relationList,function(c){j[c.localField]&&(c.localKey in d||c.localKey in e||c.localKey in f)&&a.link(b.name,j[b.idAttribute],[c.relation])})),b.idAttribute in f&&console.error("Doh! You just changed the primary key of an object! I don't know how to handle this yet, so your data for the \""+b.name+'" resource is now in an undefined (probably broken) state.')}}function e(a,b,f,g){var j,k=this,l=d(k,a,b,f,g);if(h.isArray(f)){j=[];for(var m=0;m<f.length;m++)j.push(e.call(k,a,b,f[m],g))}else{var n=a.computed,o=a.idAttribute;if(n&&n[o]){var p=[];h.forEach(n[o].deps,function(a){p.push(f[a])}),f[o]=n[o][n[o].length-1].apply(f,p)}if(!(o in f)){var q=new i.R(a.name+'.inject: "attrs" must contain the property specified by `idAttribute`!');throw console.error(q),q}try{var r=f[o],s=k.get(a.name,r),t=s?b.modified[r]:0;s?(h.deepMixIn(s,f),a.resetHistoryOnInject&&(b.previousAttributes[r]={},h.deepMixIn(b.previousAttributes[r],f),b.changeHistories[r].length&&(h.forEach(b.changeHistories[r],function(a){h.remove(b.changeHistory,a)}),b.changeHistories[r].splice(0,b.changeHistories[r].length))),h.w&&b.observers[r].deliver()):(s=g.useClass?f instanceof a[a["class"]]?f:new a[a["class"]]:{},b.previousAttributes[r]={},h.deepMixIn(s,f),h.deepMixIn(b.previousAttributes[r],f),b.collection.push(s),b.changeHistories[r]=[],h.w&&(b.observers[r]=new k.observe.ObjectObserver(s),b.observers[r].open(l,s)),b.index[r]=s,l.call(s,{},{},{},null,!0),a.relations&&c.call(k,a,s,g)),b.saved[r]=h.updateTimestamp(b.saved[r]),b.modified[r]=t&&b.modified[r]===t?h.updateTimestamp(b.modified[r]):b.modified[r],b.expiresHeap.remove(s),b.expiresHeap.push({item:s,timestamp:b.saved[r],expires:a.maxAge?b.saved[r]+a.maxAge:Number.MAX_VALUE}),j=s}catch(u){console.error(u.stack),console.error("inject failed!",a.name,f)}}return j}function f(a,b,c){var d=this;h.forEach(a.relationList,function(e){c.findBelongsTo&&"belongsTo"===e.type&&b[a.idAttribute]?d.link(a.name,b[a.idAttribute],[e.relation]):(c.findHasMany&&"hasMany"===e.type||c.findHasOne&&"hasOne"===e.type)&&d.link(a.name,b[a.idAttribute],[e.relation])})}function g(a,b,c){var d,g=this,j=g.definitions[a],k=g.store[a];if(!j)throw new i.NER(a);if(!h.isObject(b)&&!h.isArray(b))throw new i.IA(a+'.inject: "attrs" must be an object or an array!');return c=h._(j,c),c.notify&&c.beforeInject(j.name,b),d=e.call(g,j,k,b,c),k.collectionModified=h.updateTimestamp(k.collectionModified),c.findInverseLinks&&(h.isArray(d)?d.length&&g.linkInverse(j.name,d[0][j.idAttribute]):g.linkInverse(j.name,d[j.idAttribute])),h.isArray(d)?h.forEach(d,function(a){f.call(g,j,a,c)}):f.call(g,j,d,c),c.notify&&(c.afterInject(j.name,d),g.emit(j,"inject",d)),d}var h=a("../../utils"),i=a("../../errors");b.exports=g},{"../../errors":70,"../../utils":72}],66:[function(a,b){function c(a,b,c){var f=this,g=f.definitions[a];if(c=c||[],b=d.resolveId(g,b),!g)throw new e.NER(a);if(!d.isString(b)&&!d.isNumber(b))throw new e.IA('"id" must be a string or a number!');if(!d.isArray(c))throw new e.IA('"relations" must be an array!');var h=f.get(a,b);return h&&d.forEach(g.relationList,function(a){var b=a.relation;if(!c.length||d.contains(c,b)){var e={};if("belongsTo"===a.type){var i=h[a.localKey]?f.get(b,h[a.localKey]):null;i&&(h[a.localField]=i)}else if("hasMany"===a.type)e[a.foreignKey]=h[g.idAttribute],h[a.localField]=f.defaults.constructor.prototype.defaultFilter.call(f,f.store[b].collection,b,e,{allowSimpleWhere:!0});else if("hasOne"===a.type){e[a.foreignKey]=h[g.idAttribute];var j=f.defaults.constructor.prototype.defaultFilter.call(f,f.store[b].collection,b,e,{allowSimpleWhere:!0});j.length&&(h[a.localField]=j[0])}}}),h}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],67:[function(a,b){function c(a,b,c){var f=this,g=f.definitions[a];if(c=c||[],!g)throw new e.NER(a);if(!d.isArray(c))throw new e.IA('"relations" must be an array!');var h=f.filter(a,b);return h&&d.forEach(g.relationList,function(a){var b=a.relation;(!c.length||d.contains(c,b))&&("belongsTo"===a.type?d.forEach(h,function(c){var d=c[a.localKey]?f.get(b,c[a.localKey]):null;d&&(c[a.localField]=d)}):"hasMany"===a.type?d.forEach(h,function(c){var d={};d[a.foreignKey]=c[g.idAttribute],c[a.localField]=f.defaults.constructor.prototype.defaultFilter.call(f,f.store[b].collection,b,d,{allowSimpleWhere:!0})}):"hasOne"===a.type&&d.forEach(h,function(c){var d={};d[a.foreignKey]=c[g.idAttribute];var e=f.defaults.constructor.prototype.defaultFilter.call(f,f.store[b].collection,b,d,{allowSimpleWhere:!0});e.length&&(c[a.localField]=e[0])}))}),h}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],68:[function(a,b){function c(a,b,c){var f=this,g=f.definitions[a];if(c=c||[],b=d.resolveId(g,b),!g)throw new e.NER(a);if(!d.isString(b)&&!d.isNumber(b))throw new e.IA('"id" must be a string or a number!');if(!d.isArray(c))throw new e.IA('"relations" must be an array!');var h=f.get(a,b);return h&&d.forOwn(f.definitions,function(a){d.forOwn(a.relations,function(b){d.forOwn(b,function(b,e){(!c.length||d.contains(c,a.name))&&g.name===e&&f.linkAll(a.name,{},[g.name])})})}),h}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],69:[function(a,b){function c(a,b,c){var f=this,g=f.definitions[a];if(c=c||[],b=d.resolveId(g,b),!g)throw new e.NER(a);if(!d.isString(b)&&!d.isNumber(b))throw new e.IA('"id" must be a string or a number!');if(!d.isArray(c))throw new e.IA('"relations" must be an array!');var h=f.get(a,b);return h&&d.forOwn(f.definitions,function(a){d.forOwn(a.relations,function(a){d.forOwn(a,function(a,b){g.name===b&&d.forEach(a,function(a){d.forEach(f.store[a.name].collection,function(b){if("hasMany"===a.type&&b[a.localField]){var c;d.forEach(b[a.localField],function(a,b){a===h&&(c=b)}),b[a.localField].splice(c,1)}else b[a.localField]===h&&delete b[a.localField]})})})})}),h}var d=a("../../utils"),e=a("../../errors");b.exports=c},{"../../errors":70,"../../utils":72}],70:[function(a,b){function c(a){Error.call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.message=a||"Illegal Argument!"}function d(a){Error.call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.message=a||"RuntimeError Error!"}function e(a){Error.call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.message=(a||"")+" is not a registered resource!"}c.prototype=new Error,c.prototype.constructor=c,d.prototype=new Error,d.prototype.constructor=d,e.prototype=new Error,e.prototype.constructor=e,b.exports={IllegalArgumentError:c,IA:c,RuntimeError:d,R:d,NonexistentResourceError:e,NER:e}},{}],71:[function(a,b){var c=a("./datastore");b.exports={DS:c,createStore:function(a){return new c(a)},DSUtils:a("./utils"),DSErrors:a("./errors")}},{"./datastore":59,"./errors":70,"./utils":72}],72:[function(a,b){(function(c){function d(a){var b=this.constructor;return this.then(function(c){return b.resolve(a()).then(function(){return c})},function(c){return b.resolve(a()).then(function(){throw c})})}function e(a){var b="function"==typeof Date.now?Date.now():(new Date).getTime();return a&&a>=b?a+1:b}function f(a){var b={};a=a||this,a.on=function(a,c,d){b[a]=b[a]||[],b[a].push({f:c,c:d})},a.off=function(a,c){var d=b[a];if(d)if(c){for(var e=0;e<d.length;e++)if(d[e]===c){d.splice(e,1);break}}else d.splice(0,d.length);else b={}},a.emit=function(){var a=Array.prototype.slice.call(arguments),c=b[a.shift()]||[];if(c)for(var d=0;d<c.length;d++)c[d].f.apply(c[d].c,a)}}function g(a,b,c){for(var d=a[c],e=b(d);c>0;){var f=Math.floor((c+1)/2)-1,g=a[f];if(e>=b(g))break;a[f]=d,a[c]=g,c=f}}function h(a,b,c){for(var d=a.length,e=a[c],f=b(e);;){var g=2*(c+1),h=g-1,i=null;if(d>h){var j=a[h],k=b(j);f>k&&(i=h)}if(d>g){var l=a[g],m=b(l);m<(null===i?f:b(a[h]))&&(i=g)}if(null===i)break;a[c]=a[i],a[i]=e,c=i}}function i(a,b){if(a&&!n(a))throw new Error("DSBinaryHeap(weightFunc): weightFunc: must be a function!");a=a||function(a){return a},b=b||function(a,b){return a===b},this.weightFunc=a,this.compareFunc=b,this.heap=[]}function j(a,b){if(!b||!b.length)return!1;var c=s(b,function(b){return t(b)&&b.test(a)||b===a?a:void 0});return!!c}var k,l,m=a("./errors"),n=a("mout/lang/isFunction"),o=a("es6-promise");o.polyfill();try{k=window,k.Promise.prototype["finally"]||(k.Promise.prototype["finally"]=d),l=k.Promise,k={}}catch(p){k=null,c.Promise.prototype["finally"]||(c.Promise.prototype["finally"]=d),l=c.Promise}var q=i.prototype;q.push=function(a){this.heap.push(a),g(this.heap,this.weightFunc,this.heap.length-1)},q.peek=function(){return this.heap[0]},q.pop=function(){var a=this.heap[0],b=this.heap.pop();return this.heap.length>0&&(this.heap[0]=b,h(this.heap,this.weightFunc,0)),a},q.remove=function(a){for(var b=this.heap.length,c=0;b>c;c++)if(this.compareFunc(this.heap[c],a)){var d=this.heap[c],e=this.heap.pop();return c!==b-1&&(this.heap[c]=e,g(this.heap,this.weightFunc,c),h(this.heap,this.weightFunc,c)),d}return null},q.removeAll=function(){this.heap=[]},q.size=function(){return this.heap.length};var r=["beforeValidate","validate","afterValidate","beforeCreate","afterCreate","beforeUpdate","afterUpdate","beforeDestroy","afterDestroy"],s=a("mout/array/find"),t=a("mout/lang/isRegExp");b.exports={w:k,DSBinaryHeap:i,isBoolean:a("mout/lang/isBoolean"),isString:a("mout/lang/isString"),isArray:a("mout/lang/isArray"),isObject:a("mout/lang/isObject"),isNumber:a("mout/lang/isNumber"),isFunction:n,isEmpty:a("mout/lang/isEmpty"),isRegExp:t,toJson:JSON.stringify,fromJson:JSON.parse,makePath:a("mout/string/makePath"),upperCase:a("mout/string/upperCase"),pascalCase:a("mout/string/pascalCase"),deepMixIn:a("mout/object/deepMixIn"),mixIn:a("mout/object/mixIn"),forOwn:a("mout/object/forOwn"),forEach:a("mout/array/forEach"),pick:a("mout/object/pick"),set:a("mout/object/set"),merge:a("mout/object/merge"),contains:a("mout/array/contains"),filter:a("mout/array/filter"),find:s,toLookup:a("mout/array/toLookup"),remove:a("mout/array/remove"),slice:a("mout/array/slice"),sort:a("mout/array/sort"),_:function(a,b){var c=this;if(b=b||{},b&&b.constructor===a.constructor)return b;if(!c.isObject(b))throw new m.IA('"options" must be an object!');c.forEach(r,function(a){"function"==typeof b[a]&&-1===b[a].toString().indexOf("var args = Array")&&(b[a]=c.promisify(b[a]))});var d=function(a){c.mixIn(this,a)};return d.prototype=a,new d(b)},resolveItem:function(a,b){return a&&(this.isString(b)||this.isNumber(b))?a.index[b]||b:b},resolveId:function(a,b){return this.isString(b)||this.isNumber(b)?b:b&&a?b[a.idAttribute]||b:b},updateTimestamp:e,Promise:l,deepFreeze:function u(a){if("function"==typeof Object.freeze&&"function"==typeof Object.isFrozen){var b,c;Object.freeze(a);for(c in a)b=a[c],b&&a.hasOwnProperty(c)&&"object"==typeof b&&!Object.isFrozen(b)&&u(b)}},compute:function(a,b,c){var d=this,e=[];c.forEach(a.deps,function(a){e.push(d[a])}),this[b]=a[a.length-1].apply(this,e)},diffObjectFromOldObject:function(a,b,c){var d={},e={},f={};c=c||[];for(var g in b){var h=a[g];j(g,c)||(void 0===h||h!==b[g])&&(g in a?h!==b[g]&&(f[g]=h):e[g]=void 0)}for(var i in a)i in b||j(i,c)||(d[i]=a[i]);return{added:d,removed:e,changed:f}},promisify:function(a,b){var c=this.Promise;if(a){if("function"!=typeof a)throw new Error("Can only promisify functions!");return function(){var d=Array.prototype.slice.apply(arguments);return new c(function(c,e){d.push(function(a,b){a?e(a):c(b)});try{var f=a.apply(b||this,d);f&&f.then&&f.then(c,e)}catch(g){e(g)}})}}},Events:f}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./errors":70,"es6-promise":2,"mout/array/contains":4,"mout/array/filter":5,"mout/array/find":6,"mout/array/forEach":8,"mout/array/remove":11,"mout/array/slice":12,"mout/array/sort":13,"mout/array/toLookup":14,"mout/lang/isArray":20,"mout/lang/isBoolean":21,"mout/lang/isEmpty":22,"mout/lang/isFunction":23,"mout/lang/isNumber":25,"mout/lang/isObject":26,"mout/lang/isRegExp":28,"mout/lang/isString":29,"mout/object/deepMixIn":33,"mout/object/forOwn":35,"mout/object/merge":37,"mout/object/mixIn":38,"mout/object/pick":40,"mout/object/set":41,"mout/string/makePath":44,"mout/string/pascalCase":45,"mout/string/upperCase":48}]},{},[71])(71)});

@@ -19,2 +19,3 @@ // Copyright 2012 Google Inc.

// Summary of modifications:
// Fixed use of "delete" keyword for IE8 compatibility
// Removed all code related to:

@@ -517,3 +518,3 @@ // - ArrayObserver

update: true,
delete: true
'delete': true
};

@@ -520,0 +521,0 @@

{
"name": "js-data",
"description": "Robust, framework-agnostic in-memory data store.",
"version": "1.0.0-alpha.4-1",
"version": "1.0.0-alpha.4-2",
"homepage": "http://www.js-data.io",

@@ -6,0 +6,0 @@ "repository": {

@@ -13,3 +13,3 @@ <img src="https://raw.githubusercontent.com/js-data/js-data/master/js-data.png" alt="js-data logo" title="js-data" align="right" width="64" height="64" />

__Latest Release:__ [1.0.0-alpha.4-1](https://github.com/js-data/js-data/releases/tag/1.0.0-alpha.4-1)
__Latest Release:__ [1.0.0-alpha.4-2](https://github.com/js-data/js-data/releases/tag/1.0.0-alpha.4-2)

@@ -16,0 +16,0 @@ js-data is pre-release. The API is subject to change, though the current api is well tested.

@@ -44,3 +44,3 @@ var DSUtils = require('../../utils');

return id;
}).catch(function (err) {
})['catch'](function (err) {
if (options.eagerEject && item) {

@@ -47,0 +47,0 @@ _this.inject(resourceName, item, { notify: false });

@@ -9,5 +9,9 @@ var DSUtils = require('../../utils');

params = params || {};
return new DSUtils.Promise(function (resolve, reject) {
if (!definition) {
reject(new DSErrors.NER(resourceName));
} else if (!DSUtils.isObject(params)) {
reject(new DSErrors.IA('"params" must be an object!'));
} else {

@@ -35,3 +39,3 @@ options = DSUtils._(definition, options);

return ejected || _this.ejectAll(resourceName, params);
}).catch(function (err) {
})['catch'](function (err) {
if (options.eagerEject && ejected) {

@@ -38,0 +42,0 @@ _this.inject(resourceName, ejected, { notify: false });

@@ -44,3 +44,3 @@ var DSUtils = require('../../utils');

}
}).catch(function (err) {
})['catch'](function (err) {
delete resource.pendingQueries[id];

@@ -47,0 +47,0 @@ throw err;

@@ -84,3 +84,3 @@ var DSUtils = require('../../utils');

}
}).catch(function (err) {
})['catch'](function (err) {
delete resource.pendingQueries[queryHash];

@@ -87,0 +87,0 @@ throw err;

@@ -20,3 +20,14 @@ /*jshint evil:true, loopfunc:true*/

'save',
'update'
'update',
'destroy',
'loadRelations',
'changeHistory',
'changes',
'hasChanges',
'lastModified',
'lastSaved',
'link',
'linkInverse',
'previous',
'unlinkInverse'
];

@@ -124,9 +135,9 @@

// Create the wrapper class for the new resource
def.class = DSUtils.pascalCase(definition.name);
eval('function ' + def.class + '() {}');
def[def.class] = eval(def.class);
def['class'] = DSUtils.pascalCase(definition.name);
eval('function ' + def['class'] + '() {}');
def[def['class']] = eval(def['class']);
// Apply developer-defined methods
if (def.methods) {
DSUtils.deepMixIn(def[def.class].prototype, def.methods);
DSUtils.deepMixIn(def[def['class']].prototype, def.methods);
}

@@ -181,5 +192,5 @@

DSUtils.forEach(instanceMethods, function (name) {
def[def.class].prototype['DS' + DSUtils.pascalCase(name)] = function () {
def[def['class']].prototype['DS' + DSUtils.pascalCase(name)] = function () {
var args = Array.prototype.slice.call(arguments);
args.unshift(this);
args.unshift(this[def.idAttribute] || this);
args.unshift(def.name);

@@ -186,0 +197,0 @@ return _this[name].apply(_this, args);

@@ -181,5 +181,9 @@ var DSUtils = require('../../utils');

var _this = this;
id = DSUtils.resolveId(_this.definitions[resourceName], id);
if (!_this.definitions[resourceName]) {
throw new NER(resourceName);
} else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) {
throw new IA('"id" must be a string or a number!');
}

@@ -186,0 +190,0 @@

@@ -120,6 +120,6 @@ var DSUtils = require('../../utils');

if (options.useClass) {
if (attrs instanceof definition[definition.class]) {
if (attrs instanceof definition[definition['class']]) {
item = attrs;
} else {
item = new definition[definition.class]();
item = new definition[definition['class']]();
}

@@ -126,0 +126,0 @@ } else {

@@ -10,3 +10,3 @@ function IllegalArgumentError(message) {

IllegalArgumentError.prototype = Object.create(Error.prototype);
IllegalArgumentError.prototype = new Error();
IllegalArgumentError.prototype.constructor = IllegalArgumentError;

@@ -23,3 +23,3 @@

RuntimeError.prototype = Object.create(Error.prototype);
RuntimeError.prototype = new Error();
RuntimeError.prototype.constructor = RuntimeError;

@@ -36,3 +36,3 @@

NonexistentResourceError.prototype = Object.create(Error.prototype);
NonexistentResourceError.prototype = new Error();
NonexistentResourceError.prototype.constructor = NonexistentResourceError;

@@ -39,0 +39,0 @@

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc