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 2.0.0-beta.7 to 2.0.0-beta.8

5

CHANGELOG.md

@@ -0,1 +1,6 @@

##### 2.0.0-beta.8 - 22 June 2015
###### Backwards compatible API changes
- #160 - Add "DS.change" events, fired on Resources and instances
##### 2.0.0-beta.7 - 09 June 2015

@@ -2,0 +7,0 @@

6

dist/js-data.min.js
/*!
* js-data
* @version 2.0.0-beta.7 - Homepage <http://www.js-data.io/>
* @version 2.0.0-beta.8 - Homepage <http://www.js-data.io/>
* @author Jason Dobry <jason.dobry@gmail.com>

@@ -11,5 +11,5 @@ * @copyright (c) 2014-2015 Jason Dobry

!function(a,b){"object"==typeof exports&&"object"==typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):"object"==typeof exports?exports.JSData=b():a.JSData=b()}(this,function(){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="",b(0)}([function(a,b,c){var d=c(1),e=c(2),f=c(3);a.exports={DS:d["default"],DSUtils:e["default"],DSErrors:f["default"],createStore:function(a){return new d["default"](a)},version:{full:"2.0.0-beta.7",major:parseInt("2",10),minor:parseInt("0",10),patch:parseInt("0",10),alpha:"false",beta:"7"}}},function(a,b,c){function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b,c){c(null,b)}function f(a,b){return b}function g(a,b,c,d){var e=!0;a:for(;e;){var f=a,g=b,h=c,i=d;k=l=m=void 0,e=!1;var k=f[g],l=j["default"].get(h,k[0]),m=j["default"].get(i,k[0]);if(j["default"]._s(l)&&(l=j["default"].upperCase(l)),j["default"]._s(m)&&(m=j["default"].upperCase(m)),"DESC"===k[1]){if(l>m)return-1;if(m>l)return 1;if(g<f.length-1){a=f,b=g+1,c=h,d=i,e=!0;continue a}return 0}if(m>l)return-1;if(l>m)return 1;if(!(g<f.length-1))return 0;a=f,b=g+1,c=h,d=i,e=!0}}function h(a,b){j["default"].forOwn(b,function(b,c){a[c]=b,a[c].before=function(b){var d=a[c];a[c]=function(){for(var a=arguments.length,c=Array(a),e=0;a>e;e++)c[e]=arguments[e];return d.apply(this,b.apply(this,c)||c)}}})}var i=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),j=c(2),k=c(3),l=c(4),m=c(5),n=function(){function a(){d(this,a)}return i(a,[{key:"errorFn",value:function(a,b){if(this.error&&"function"==typeof this.error){try{throw"string"==typeof a?new Error(a):a}catch(c){a=c}this.error(this.name||null,a||null,b||null)}}}]),a}(),o=n.prototype;o.actions={},o.afterCreate=e,o.afterCreateCollection=f,o.afterCreateInstance=f,o.afterDestroy=e,o.afterEject=f,o.afterInject=f,o.afterReap=f,o.afterUpdate=e,o.afterValidate=e,o.allowSimpleWhere=!0,o.basePath="",o.beforeCreate=e,o.beforeCreateCollection=f,o.beforeCreateInstance=f,o.beforeDestroy=e,o.beforeEject=f,o.beforeInject=f,o.beforeReap=f,o.beforeUpdate=e,o.beforeValidate=e,o.bypassCache=!1,o.cacheResponse=!!j["default"].w,o.clearEmptyQueries=!0,o.computed={},o.defaultAdapter="http",o.debug=!1,o.defaultValues={},o.eagerEject=!1,o.eagerInject=!1,o.endpoint="",o.error=console?function(a,b,c){return console["function"==typeof console.error?"error":"log"](a,b,c)}:!1,o.fallbackAdapters=["http"],o.findStrictCache=!1,o.idAttribute="id",o.ignoredChanges=[/\$/],o.ignoreMissing=!1,o.keepChangeHistory=!1,o.linkRelations=!0,o.log=console?function(a,b,c,d,e){return console["function"==typeof console.info?"info":"log"](a,b,c,d,e)}:!1,o.logFn=function(a,b,c,d){var e=this;e.debug&&e.log&&"function"==typeof e.log&&e.log(e.name||null,a||null,b||null,c||null,d||null)},o.maxAge=!1,o.methods={},o.notify=!!j["default"].w,o.reapAction=j["default"].w?"inject":"none",o.reapInterval=j["default"].w?3e4:!1,o.relationsEnumerable=!1,o.resetHistoryOnInject=!0,o.strategy="single",o.upsert=!!j["default"].w,o.useClass=!0,o.useFilter=!1,o.validate=e,o.defaultFilter=function(a,b,c,d){var e=a,f=null,h={skip:"",offset:"",where:"",limit:"",orderBy:"",sort:""};c=c||{},d=d||{},f=j["default"]._o(c.where)?c.where:{},d.allowSimpleWhere&&j["default"].forOwn(c,function(a,b){b in h||b in f||(f[b]={"==":a})}),j["default"].isEmpty(f)&&(f=null),f&&(e=j["default"].filter(e,function(a){var b=!0,c=!0;return j["default"].forOwn(f,function(d,e){j["default"]._s(d)?d={"===":d}:(j["default"]._n(d)||j["default"].isBoolean(d))&&(d={"==":d}),j["default"]._o(d)&&j["default"].forOwn(d,function(d,f){var g=void 0,h="|"===f[0],i=j["default"].get(a,e);f=h?f.substr(1):f,"=="===f?g=i==d:"==="===f?g=i===d:"!="===f?g=i!=d:"!=="===f?g=i!==d:">"===f?g=i>d:">="===f?g=i>=d:"<"===f?g=d>i:"<="===f?g=d>=i:"isectEmpty"===f?g=!j["default"].intersection(i||[],d||[]).length:"isectNotEmpty"===f?g=j["default"].intersection(i||[],d||[]).length:"in"===f?g=j["default"]._s(d)?-1!==d.indexOf(i):j["default"].contains(d,i):"notIn"===f?g=j["default"]._s(d)?-1===d.indexOf(i):!j["default"].contains(d,i):"contains"===f?g=j["default"]._s(i)?-1!==i.indexOf(d):j["default"].contains(i,d):"notContains"===f&&(g=j["default"]._s(i)?-1===i.indexOf(d):!j["default"].contains(i,d)),void 0!==g&&(c=b?g:h?c||g:c&&g),b=!1})}),c}));var i=null;j["default"]._s(c.orderBy)?i=[[c.orderBy,"ASC"]]:j["default"]._a(c.orderBy)&&(i=c.orderBy),!i&&j["default"]._s(c.sort)?i=[[c.sort,"ASC"]]:!i&&j["default"]._a(c.sort)&&(i=c.sort),i&&!function(){var a=0;j["default"].forEach(i,function(a,c){if(j["default"]._s(a))i[c]=[a,"ASC"];else if(!j["default"]._a(a))throw new k["default"].IA('DS.filter("'+b+'"[, params][, options]): '+j["default"].toJson(a)+": Must be a string or an array!",{params:{"orderBy[i]":{actual:typeof a,expected:"string|array"}}})}),e=j["default"].sort(e,function(b,c){return g(i,a,b,c)})}();var l=j["default"]._n(c.limit)?c.limit:null,m=null;return j["default"]._n(c.skip)?m=c.skip:j["default"]._n(c.offset)&&(m=c.offset),l&&m?e=j["default"].slice(e,m,Math.min(e.length,m+l)):j["default"]._n(l)?e=j["default"].slice(e,0,Math.min(e.length,l)):j["default"]._n(m)&&(e=m<e.length?j["default"].slice(e,m):[]),e};var p=function(){function a(b){d(this,a);var c=this;b=b||{},c.store={},c.s=c.store,c.definitions={},c.defs=c.definitions,c.adapters={},c.defaults=new n,c.observe=j["default"].observe,j["default"].forOwn(b,function(a,b){c.defaults[b]=a})}return i(a,[{key:"getAdapter",value:function(a){var b=!1;a=a||{},j["default"]._s(a)&&(b=!0,a={adapter:a});var c=this.adapters[a.adapter];if(c)return c;if(b)throw new Error(""+a.adapter+" is not a registered adapter!");return this.adapters[a.defaultAdapter]}},{key:"registerAdapter",value:function(a,b,c){var d=this;c=c||{},j["default"].isFunction(b)?d.adapters[a]=new b(c):d.adapters[a]=b,c["default"]&&(d.defaults.defaultAdapter=a)}},{key:"is",value:function(a,b){var c=this.defs[a];if(!c)throw new k["default"].NER(a);return b instanceof c[c["class"]]}}]),a}(),q=p.prototype;q.getAdapter.shorthand=!1,q.registerAdapter.shorthand=!1,q.errors=k["default"],q.utils=j["default"],h(q,l["default"]),h(q,m["default"]),b["default"]=p},function(a,b,c){function d(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0})}function e(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(){for(var a=arguments.length,c=Array(a),d=0;a>d;d++)c[d]=arguments[d];var e=b[c.shift()]||[];if(e)for(var f=0;f<e.length;f++)e[f].f.apply(e[f].c,c)}}var f=c(3),g=c(7),h=c(8),i=c(9),j=c(13),k=c(10),l=c(14),m=c(18),n=c(11),o=c(15),p=c(12),q=c(19),r=c(16),s=c(17),t=c(6),u=void 0,v=Object.prototype,w=v.toString,x=void 0;try{x=Promise}catch(y){console.error("js-data requires a global Promise constructor!")}var z=Array.isArray||function(a){return"[object Array]"==w.call(a)||!1},A=function(a){return"[object RegExp]"==w.call(a)||!1},B=function(a){return a===!0||a===!1||a&&"object"==typeof a&&"[object Boolean]"==w.call(a)||!1},C=function(a){return"string"==typeof a||a&&"object"==typeof a&&"[object String]"==w.call(a)||!1},D=function(a){return"[object Object]"==w.call(a)||!1},E=function(a){return a&&"object"==typeof a&&"[object Date]"==w.call(a)||!1},F=function(a){var b=typeof a;return"number"==b||a&&"object"==b&&"[object Number]"==w.call(a)||!1},G=function(a){return"function"==typeof a||a&&"[object Function]"===w.call(a)||!1},H=function(a){return C(a)||F(a)},I=function(a){return new f["default"].IA('"'+a+'" must be a string or a number!')},J=function(a){return new f["default"].IA('"'+a+'" must be an object!')},K=function(a){return new f["default"].IA('"'+a+'" must be an array!')},L=function(a){if(null==a)return!0;if("string"==typeof a||z(a))return!a.length;if("object"!=typeof a)return!0;var b=function(){var b=!0;return j(a,function(){return b=!1,!1}),{v:b}}();return"object"==typeof b?b.v:void 0},M=function(a,b){if(!a||!b)return[];for(var c=[],d=void 0,e=0,f=a.length;f>e;e++)d=a[e],k(c,d)||k(b,d)&&c.push(d);return c},N=function(a,b,c){var d=[];return h(a,function(a,c,e){b(a,c,e)&&d.push(a)},c),d};try{u=window,u={}}catch(O){u=null}var P=["beforeValidate","validate","afterValidate","beforeCreate","afterCreate","beforeUpdate","afterUpdate","beforeDestroy","afterDestroy"],Q=function(a,b){var c=void 0;if(!b||!b.length)return!1;for(c=0;c<b.length;c++)if(b[c]===a)return!0;return!1},R=function Y(a,b,c,d,e){if(b){if(a===b)throw new Error("Cannot copy! Source and destination are identical.");if(c=c||[],d=d||[],D(a)){var f=c.indexOf(a);if(-1!==f)return d[f];c.push(a),d.push(b)}var g=void 0;if(z(a)){var i=void 0;for(b.length=0,i=0;i<a.length;i++)g=Y(a[i],null,c,d,e),D(a[i])&&(c.push(a[i]),d.push(g)),b.push(g)}else{z(b)?b.length=0:h(b,function(a,c){delete b[c]});for(var j in a)if(a.hasOwnProperty(j)){if(Q(j,e))continue;g=Y(a[j],null,c,d,e),D(a[j])&&(c.push(a[j]),d.push(g)),b[j]=g}}}else b=a,a&&(z(a)?b=Y(a,[],c,d,e):E(a)?b=new Date(a.getTime()):A(a)?(b=new RegExp(a.source,a.toString().match(/[^\/]*$/)[0]),b.lastIndex=a.lastIndex):D(a)&&(b=Y(a,Object.create(Object.getPrototypeOf(a)),c,d,e)));return b},S=function Z(a,b){var c=!0;a:for(;c;){var d=a,e=b;if(i=j=f=g=h=void 0,c=!1,d===e)return!0;if(null===d||null===e)return!1;if(d!==d&&e!==e)return!0;var f,g,h,i=typeof d,j=typeof e;if(i==j&&"object"==i){if(!z(d)){if(E(d)){if(!E(e))return!1;a=d.getTime(),b=e.getTime(),c=!0;continue a}if(A(d)&&A(e))return d.toString()==e.toString();if(z(e))return!1;h={};for(g in d)if("$"!==g.charAt(0)&&!G(d[g])){if(!Z(d[g],e[g]))return!1;h[g]=!0}for(g in e)if(!h.hasOwnProperty(g)&&"$"!==g.charAt(0)&&void 0!==e[g]&&!G(e[g]))return!1;return!0}if(!z(e))return!1;if((f=d.length)==e.length){for(g=0;f>g;g++)if(!Z(d[g],e[g]))return!1;return!0}}return!1}},T=function(a,b){return C(b)||F(b)?b:b&&a?b[a.idAttribute]||b:b},U=function(a,b){return a&&(C(b)||F(b))?a.index[b]||b:b},V=function(a){return null!=a&&""!==a},W=function(a,b){return b=b||"",N(a,V).join(b)},X=function(){for(var a=arguments.length,b=Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=W(b,"/");return d.replace(/([^:\/]|^)\/{2,}/g,"$1/")};b["default"]={Promise:x,_:function(a,b){var c=this;if(b=b||{},b&&b.constructor===a.constructor)return b;if(!D(b))throw new f["default"].IA('"options" must be an object!');h(P,function(a){"function"==typeof b[a]&&-1===b[a].toString().indexOf("for (var _len = arg")&&(b[a]=c.promisify(b[a]))});var d=function(a){var b=this;j(a,function(a,c){b[c]=a})};return d.prototype=a,d.prototype.orig=function(){var a={};return j(this,function(b,c){a[c]=b}),a},new d(b)},_n:F,_s:C,_sn:H,_snErr:I,_o:D,_oErr:J,_a:z,_aErr:K,compute:function(a,b){var c=this,d=[];h(a.deps,function(a){d.push(r(c,a))}),s(c,b,a[a.length-1].apply(c,d))},contains:k,copy:R,deepMixIn:l,diffObjectFromOldObject:t.diffObjectFromOldObject,BinaryHeap:g,equals:S,Events:e,filter:N,fillIn:function(a,b){return j(b,function(b,c){c in a||(a[c]=b)}),a},forEach:h,forOwn:j,fromJson:function(a){return C(a)?JSON.parse(a):a},get:r,intersection:M,isArray:z,isBoolean:B,isDate:E,isEmpty:L,isFunction:G,isObject:D,isNumber:F,isRegExp:A,isString:C,makePath:X,observe:t,pascalCase:m,pick:o,promisify:function(a,b){var c=this;if(a){if("function"!=typeof a)throw new Error("Can only promisify functions!");return function(){for(var d=arguments.length,e=Array(d),f=0;d>f;f++)e[f]=arguments[f];return new c.Promise(function(c,d){e.push(function(a,b){a?d(a):c(b)});try{var f=a.apply(b||this,e);f&&f.then&&f.then(c,d)}catch(g){d(g)}})}}},remove:n,set:s,slice:i,sort:p,toJson:JSON.stringify,updateTimestamp:function(a){var b="function"==typeof Date.now?Date.now():(new Date).getTime();return a&&a>=b?a+1:b},upperCase:q,removeCircular:function(a){return function b(a,c){var d=void 0,e=void 0;if(!("object"!=typeof a||null===a||a instanceof Boolean||a instanceof Date||a instanceof Number||a instanceof RegExp||a instanceof String)){for(var f=c.current,g=c.context;g;){if(g.current===f)return void 0;g=g.context}if(z(a))for(e=[],d=0;d<a.length;d+=1)e[d]=b(a[d],{context:c,current:a[d]});else e={},j(a,function(d,f){e[f]=b(a[f],{context:c,current:a[f]})});return e}return a}(a,{context:null,current:a})},resolveItem:U,resolveId:T,w:u,applyRelationGettersToTarget:function(a,b,c){this.forEach(b.relationList,function(e){var f=e.relation,g="boolean"==typeof e.enumerable?e.enumerable:!!b.relationsEnumerable;("boolean"==typeof e.link?e.link:!!b.linkRelations)&&(delete c[e.localField],"belongsTo"===e.type?Object.defineProperty(c,e.localField,{enumerable:g,get:function(){return this[e.localKey]?b.getResource(f).get(this[e.localKey]):void 0},set:function(){}}):"hasMany"===e.type?Object.defineProperty(c,e.localField,{enumerable:g,get:function(){var c={};return e.foreignKey?(c[e.foreignKey]=this[b.idAttribute],b.getResource(f).defaultFilter.call(a,a.s[f].collection,f,c,{allowSimpleWhere:!0})):e.localKeys?(c.where=d({},b.getResource(f).idAttribute,{"in":this[e.localKeys]}),b.getResource(f).defaultFilter.call(a,a.s[f].collection,f,c)):void 0},set:function(){}}):"hasOne"===e.type&&(e.localKey?Object.defineProperty(c,e.localField,{enumerable:g,get:function(){return this[e.localKey]?b.getResource(f).get(this[e.localKey]):void 0},set:function(){}}):Object.defineProperty(c,e.localField,{enumerable:g,get:function(){var c={};c[e.foreignKey]=this[b.idAttribute];var d=c[e.foreignKey]?b.getResource(f).defaultFilter.call(a,a.s[f].collection,f,c,{allowSimpleWhere:!0}):[];return d.length?d[0]:void 0},set:function(){}})))})}}},function(a,b,c){function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(a.__proto__=b)}var f=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;h=j=i=void 0,d=!1;var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;return void 0===i?void 0:i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return void 0;a=j,b=f,c=g,d=!0}},g=function(a){function b(a){d(this,b),f(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.message=a||"Illegal Argument!"}return e(b,a),b}(Error),h=function(a){function b(a){d(this,b),f(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.message=a||"RuntimeError Error!"}return e(b,a),b}(Error),i=function(a){function b(a){d(this,b),f(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.message=""+a+" is not a registered resource!"}return e(b,a),b}(Error);b["default"]={IllegalArgumentError:g,IA:g,RuntimeError:h,R:h,NonexistentResourceError:i,NER:i}},function(a,b,c){function d(a){return!(e["default"].isEmpty(a.added)&&e["default"].isEmpty(a.removed)&&e["default"].isEmpty(a.changed))}var e=c(2),f=c(3),g=c(24),h=c(25),i=c(26),j=c(27),k=c(28),l=f["default"].NER,m=f["default"].IA,n=f["default"].R;b["default"]={changes:function(a,b,c){var d=this,f=d.defs[a];if(c=c||{},b=e["default"].resolveId(f,b),!f)throw new l(a);if(!e["default"]._sn(b))throw e["default"]._snErr("id");c=e["default"]._(f,c);var g=f.get(b);if(g){var h=function(){e["default"].w&&d.s[a].observers[b].deliver();var h=c.ignoredChanges||[];e["default"].forEach(f.relationFields,function(a){e["default"].contains(h,a)||h.push(a)});var i=e["default"].diffObjectFromOldObject(g,d.s[a].previousAttributes[b],e["default"].equals,h);return e["default"].forOwn(i,function(a,b){var c=[];e["default"].forOwn(a,function(a,b){e["default"].isFunction(a)||c.push(b)}),i[b]=e["default"].pick(i[b],c)}),e["default"].forEach(f.relationFields,function(a){delete i.added[a],delete i.removed[a],delete i.changed[a]}),{v:i}}();if("object"==typeof h)return h.v}},changeHistory:function(a,b){var c=this,d=c.defs[a],f=c.s[a];if(b=e["default"].resolveId(d,b),a&&!c.defs[a])throw new l(a);if(b&&!e["default"]._sn(b))throw e["default"]._snErr("id");if(d.keepChangeHistory){if(!a)return f.changeHistory;var g=d.get(b);if(g)return f.changeHistories[b]}else d.errorFn("changeHistory is disabled for this resource!")},compute:function(a,b){var c=this,d=c.defs[a];if(b=e["default"].resolveItem(c.s[a],b),!d)throw new l(a);if(!b)throw new n("Item not in the store!");if(!e["default"]._o(b)&&!e["default"]._sn(b))throw new m('"instance" must be an object, string or number!');return e["default"].forOwn(d.computed,function(a,c){e["default"].compute.call(b,a,c)}),b},createInstance:function(a,b,c){var d=this.defs[a],f=void 0;if(b=b||{},!d)throw new l(a);if(b&&!e["default"].isObject(b))throw new m('"attrs" must be an object!');c=e["default"]._(d,c),c.beforeCreateInstance(c,b);var g=d[d["class"]];return f=new g,c.defaultValues&&e["default"].deepMixIn(f,c.defaultValues),e["default"].deepMixIn(f,b),d.computed&&d.compute(f),c.afterCreateInstance(c,f),f},createCollection:function(a,b,c,d){var f=this,g=f.defs[a];if(b=b||[],c=c||{},!g)throw new l(a);if(b&&!e["default"].isArray(b))throw new m('"arr" must be an array!');return d=e["default"]._(g,d),d.beforeCreateCollection(d,b),Object.defineProperties(b,{fetch:{value:function(b,c){var d=this;return d.params=b||d.params,g.findAll(d.params,c).then(function(b){return b===d?d:(b.unshift(d.length),b.unshift(0),d.splice.apply(d,b),b.shift(),b.shift(),b.$$injected&&(f.s[a].queryData[e["default"].toJson(d.params)]=d,d.$$injected=!0),d)})}},params:{value:c,writable:!0},resourceName:{value:a}}),d.afterCreateCollection(d,b),b},defineResource:g["default"],digest:function(){this.observe.Platform.performMicrotaskCheckpoint()},eject:h["default"],ejectAll:i["default"],filter:j["default"],get:function(a,b,c){var d=this,f=d.defs[a];if(!f)throw new l(a);if(!e["default"]._sn(b))throw e["default"]._snErr("id");return c=e["default"]._(f,c),d.s[a].index[b]},getAll:function(a,b){var c=this,d=c.defs[a],f=c.s[a],g=[];if(!d)throw new l(a);if(b&&!e["default"]._a(b))throw e["default"]._aErr("ids");if(e["default"]._a(b))for(var h=b.length,i=0;h>i;i++)f.index[b[i]]&&g.push(f.index[b[i]]);else g=f.collection.slice();return g},hasChanges:function(a,b){var c=this,f=c.defs[a];if(b=e["default"].resolveId(f,b),!f)throw new l(a);if(!e["default"]._sn(b))throw e["default"]._snErr("id");return f.get(b)?d(f.changes(b)):!1},inject:k["default"],lastModified:function(a,b){var c=this.defs[a],d=this.s[a];if(b=e["default"].resolveId(c,b),!c)throw new l(a);return b?(b in d.modified||(d.modified[b]=0),d.modified[b]):d.collectionModified},lastSaved:function(a,b){var c=this.defs[a],d=this.s[a];if(b=e["default"].resolveId(c,b),!c)throw new l(a);return b in d.saved||(d.saved[b]=0),d.saved[b]},previous:function(a,b){var c=this,d=c.defs[a],f=c.s[a];if(b=e["default"].resolveId(d,b),!d)throw new l(a);if(!e["default"]._sn(b))throw e["default"]._snErr("id");return f.previousAttributes[b]?e["default"].copy(f.previousAttributes[b]):void 0}}},function(a,b,c){var d=c(33),e=c(34),f=c(35),g=c(36),h=c(37),i=c(38),j=c(39),k=c(40),l=c(41),m=c(42);b["default"]={create:d["default"],destroy:e["default"],destroyAll:f["default"],find:g["default"],findAll:h["default"],loadRelations:i["default"],reap:j["default"],refresh:function(a,b,c){var d=this,e=d.utils;return new e.Promise(function(f,g){var h=d.defs[a];b=e.resolveId(d.defs[a],b),h?e._sn(b)?(c=e._(h,c),c.bypassCache=!0,f(d.get(a,b))):g(e._snErr("id")):g(new d.errors.NER(a))}).then(function(e){return e?d.find(a,b,c):e})},save:k["default"],update:l["default"],updateAll:m["default"]}},function(a,b,c){!function(a){function b(){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 c(b){for(var c=0;s>c&&b.check_();)c++;return p&&(a.dirtyCheckCycleCount=c),c>0}function d(a){for(var b in a)return!1;return!0}function e(a){return d(a.added)&&d(a.removed)&&d(a.changed)}function f(a,b){if(!b||!b.length)return!1;for(var c,d=0;d<b.length;d++)if("[object RegExp]"===Object.prototype.toString.call(b[d])&&b[d].test(a)||b[d]===a)return c=a;return!!c}function g(a,b,c,d){var e={},g={},h={};for(var i in b){var j=a[i];f(i,d)||void 0!==j&&(c?c(j,b[i]):j===b[i])||(i in a?(c?c(j,b[i]):j===b[i])||(h[i]=j):g[i]=void 0)}for(var i in a)i in b||f(i,d)||(e[i]=a[i]);return Array.isArray(a)&&a.length!==b.length&&(h.length=a.length),{added:e,removed:g,changed:h}}function h(){if(!t.length)return!1;for(var a=0;a<t.length;a++)t[a]();return t.length=0,!0}function i(){function a(a){b&&b.state_===x&&!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),v.push(this)}}}function j(a,b,c){var d=v.pop()||i();return d.open(a),d.observe(b,c),d}function k(){this.state_=w,this.callback_=void 0,this.target_=void 0,this.directObserver_=void 0,this.value_=void 0,this.id_=z++}function l(a){k._allObserversCount++,B&&A.push(a)}function m(a){k._allObserversCount--}function n(a){k.call(this),this.value_=a,this.oldObject_=void 0}function o(a,b,c){for(var d={},e={},f=0;f<b.length;f++){var g=b[f];E[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 p=a.testingExposeCycleCount,q=b(),r="__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},s=1e3,t=[],u=q?function(){return function(a){return Promise.resolve().then(a)}}():function(){return function(a){t.push(a)}}(),v=[],w=0,x=1,y=2,z=1;k.prototype={open:function(a,b){if(this.state_!=w)throw Error("Observer has already been opened.");return l(this),this.callback_=a,this.target_=b,this.connect_(),this.state_=x,this.value_},close:function(){this.state_==x&&(m(this),this.disconnect_(),this.value_=void 0,this.callback_=void 0,this.target_=void 0,this.state_=y)},deliver:function(){this.state_==x&&c(this)},report_:function(a){try{this.callback_.apply(this.target_,a)}catch(b){k._errorThrownDuringCallback=!0,console.error("Exception caught during observer callback: "+(b.stack||b))}},discardChanges:function(){return this.check_(void 0,!0),this.value_}};var A,B=!q;k._allObserversCount=0,B&&(A=[]);var C=!1;a.Platform=a.Platform||{},a.Platform.performMicrotaskCheckpoint=function(){if(!C&&B){C=!0;var b,c,d=0;do{d++,c=A,A=[],b=!1;for(var e=0;e<c.length;e++){var f=c[e];f.state_==x&&(f.check_()&&(b=!0),A.push(f))}h()&&(b=!0)}while(s>d&&b);p&&(a.dirtyCheckCycleCount=d),C=!1}},B&&(a.Platform.clearObservers=function(){A=[]}),n.prototype=r({__proto__:k.prototype,arrayObserve:!1,connect_:function(a,b){q?this.directObserver_=j(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,b){var c,d;if(q){if(!a)return!1;d={},c=o(this.value_,a,d)}else d=this.oldObject_,c=g(this.value_,this.oldObject_);return e(c)?!1:(q||(this.oldObject_=this.copyObject(this.value_)),this.report_([c.added||{},c.removed||{},c.changed||{},function(a){return d[a]}]),!0)},disconnect_:function(){q?(this.directObserver_.close(),this.directObserver_=void 0):this.oldObject_=void 0},deliver:function(){this.state_==x&&(q?this.directObserver_.deliver(!1):c(this))},discardChanges:function(){return this.directObserver_?this.directObserver_.deliver(!0):this.oldObject_=this.copyObject(this.value_),this.value_}});var D={},E={add:!0,update:!0,"delete":!0};a.Observer=k,a.Observer.runEOM_=u,a.Observer.observerSentinel_=D,a.Observer.hasObjectObserve=q,a.diffObjectFromOldObject=g,a.ObjectObserver=n}(b)},function(a,b,c){!function(b,c){a.exports=c()}(this,function(){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="",b(0)}([function(a,b,c){function d(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}}var e=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},f=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();Object.defineProperty(b,"__esModule",{value:!0});var g=function(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}},h=function(){function a(b,c){if(e(this,a),b||(b=function(a){return a}),c||(c=function(a,b){return a===b}),"function"!=typeof b)throw new Error('BinaryHeap([weightFunc][, compareFunc]): "weightFunc" must be a function!');if("function"!=typeof c)throw new Error('BinaryHeap([weightFunc][, compareFunc]): "compareFunc" must be a function!');this.weightFunc=b,this.compareFunc=c,this.heap=[]}return f(a,[{key:"push",value:function(a){this.heap.push(a),d(this.heap,this.weightFunc,this.heap.length-1)}},{key:"peek",value:function(){return this.heap[0]}},{key:"pop",value:function(){var a=this.heap[0],b=this.heap.pop();return this.heap.length>0&&(this.heap[0]=b,g(this.heap,this.weightFunc,0)),a}},{key:"remove",value:function(a){for(var b=this.heap.length,c=0;b>c;c++)if(this.compareFunc(this.heap[c],a)){var e=this.heap[c],f=this.heap.pop();return c!==b-1&&(this.heap[c]=f,d(this.heap,this.weightFunc,c),g(this.heap,this.weightFunc,c)),e}return null}},{key:"removeAll",value:function(){this.heap=[]}},{key:"size",value:function(){return this.heap.length}}]),a}();b["default"]=h,a.exports=b["default"]}])})},function(a,b,c){function d(a,b,c){if(null!=a)for(var d=-1,e=a.length;++d<e&&b.call(c,a[d],d,a)!==!1;);}a.exports=d},function(a,b,c){function d(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}a.exports=d},function(a,b,c){function d(a,b){return-1!==e(a,b)}var e=c(20);a.exports=d},function(a,b,c){function d(a,b){var c=e(a,b);-1!==c&&a.splice(c,1)}var e=c(20);a.exports=d},function(a,b,c){function d(a,b){if(null==a)return[];if(a.length<2)return a;null==b&&(b=e);var c,g,h;return c=~~(a.length/2),g=d(a.slice(0,c),b),h=d(a.slice(c,a.length),b),f(g,h,b)}function e(a,b){return b>a?-1:a>b?1:0}function f(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}a.exports=d},function(a,b,c){function d(a,b,c){f(a,function(d,f){return e(a,f)?b.call(c,a[f],f,a):void 0})}var e=c(21),f=c(22);a.exports=d},function(a,b,c){function d(a,b){for(var c,d=0,g=arguments.length;++d<g;)c=arguments[d],c&&f(c,e,a);return a}function e(a,b){var c=this[b];g(a)&&g(c)?d(c,a):this[b]=a}var f=c(13),g=c(23);a.exports=d},function(a,b,c){function d(a,b){for(var c,d="string"!=typeof arguments[1]?arguments[1]:e(arguments,1),f={},g=0;c=d[g++];)f[c]=a[c];return f}var e=c(9);a.exports=d},function(a,b,c){function d(a,b){for(var c=b.split("."),d=c.pop();b=c.shift();)if(a=a[b],null==a)return;return a[d]}c(29);a.exports=d},function(a,b,c){function d(a,b,c){var d=/^(.+)\.(.+)$/.exec(b);d?e(a,d[1])[d[2]]=c:a[b]=c}var e=c(30);a.exports=d},function(a,b,c){function d(a){return a=e(a),f(a).replace(/^[a-z]/,g)}var e=c(31),f=c(32),g=c(19);a.exports=d},function(a,b,c){function d(a){return a=e(a),a.toUpperCase()}var e=c(31);a.exports=d},function(a,b,c){function d(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}a.exports=d},function(a,b,c){function d(a,b){return Object.prototype.hasOwnProperty.call(a,b)}a.exports=d},function(a,b,c){function d(){h=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],g=!0;for(var a in{toString:null})g=!1}function e(a,b,c){var e,j=0;null==g&&d();for(e in a)if(f(b,a,e,c)===!1)break;if(g)for(var k=a.constructor,l=!!k&&a===k.prototype;(e=h[j++])&&("constructor"===e&&(l||!i(a,e))||a[e]===Object.prototype[e]||f(b,a,e,c)!==!1););}function f(a,b,c,d){return a.call(d,b[c],c,b)}var g,h,i=c(21);a.exports=e},function(a,b,c){function d(a){return!!a&&"object"==typeof a&&a.constructor===Object}a.exports=d},function(module,exports,__webpack_require__){function defineResource(definition){function Resource(a){this.defaultValues={},this.methods={},this.computed={},_utils["default"].deepMixIn(this,a);var b=_this.defaults;definition["extends"]&&definitions[definition["extends"]]&&(b=definitions[definition["extends"]]),_utils["default"].fillIn(this.defaultValues,b.defaultValues),_utils["default"].fillIn(this.methods,b.methods),_utils["default"].fillIn(this.computed,b.computed),this.endpoint="endpoint"in a?a.endpoint:this.name}var _this=this,definitions=_this.defs;if(_utils["default"]._s(definition)&&(definition={name:definition.replace(/\s/gi,"")}),!_utils["default"]._o(definition))throw _utils["default"]._oErr("definition");if(!_utils["default"]._s(definition.name))throw new _errors["default"].IA('"name" must be a string!');if(_this.s[definition.name])throw new _errors["default"].R(""+definition.name+" is already registered!");try{var def,_class,_ret=function(){if(definition["extends"]&&definitions[definition["extends"]]?Resource.prototype=definitions[definition["extends"]]:Resource.prototype=_this.defaults,definitions[definition.name]=new Resource(definition),def=definitions[definition.name],!_utils["default"]._s(def.idAttribute))throw new _errors["default"].IA('"idAttribute" must be a string!');def.relations&&(def.relationList=[],def.relationFields=[],_utils["default"].forOwn(def.relations,function(a,b){_utils["default"].forOwn(a,function(c,d){_utils["default"]._a(c)||(a[d]=[c]),_utils["default"].forEach(a[d],function(a){a.type=b,a.relation=d,a.name=def.name,def.relationList.push(a),a.localField&&def.relationFields.push(a.localField)})})}),def.relations.belongsTo&&_utils["default"].forOwn(def.relations.belongsTo,function(a,b){_utils["default"].forEach(a,function(a){a.parent&&(def.parent=b,def.parentKey=a.localKey,def.parentField=a.localField)})}),"function"==typeof Object.freeze&&(Object.freeze(def.relations),Object.freeze(def.relationList))),def.getResource=function(a){return _this.defs[a];
!function(a,b){"object"==typeof exports&&"object"==typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):"object"==typeof exports?exports.JSData=b():a.JSData=b()}(this,function(){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="",b(0)}([function(a,b,c){var d=c(1),e=c(2),f=c(3);a.exports={DS:d["default"],DSUtils:e["default"],DSErrors:f["default"],createStore:function(a){return new d["default"](a)},version:{full:"2.0.0-beta.8",major:parseInt("2",10),minor:parseInt("0",10),patch:parseInt("0",10),alpha:"false",beta:"8"}}},function(a,b,c){function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b,c){c(null,b)}function f(a,b){return b}function g(a,b,c,d){var e=!0;a:for(;e;){var f=a,g=b,h=c,i=d;k=l=m=void 0,e=!1;var k=f[g],l=j["default"].get(h,k[0]),m=j["default"].get(i,k[0]);if(j["default"]._s(l)&&(l=j["default"].upperCase(l)),j["default"]._s(m)&&(m=j["default"].upperCase(m)),"DESC"===k[1]){if(l>m)return-1;if(m>l)return 1;if(g<f.length-1){a=f,b=g+1,c=h,d=i,e=!0;continue a}return 0}if(m>l)return-1;if(l>m)return 1;if(!(g<f.length-1))return 0;a=f,b=g+1,c=h,d=i,e=!0}}function h(a,b){j["default"].forOwn(b,function(b,c){a[c]=b,a[c].before=function(b){var d=a[c];a[c]=function(){for(var a=arguments.length,c=Array(a),e=0;a>e;e++)c[e]=arguments[e];return d.apply(this,b.apply(this,c)||c)}}})}var i=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),j=c(2),k=c(3),l=c(4),m=c(5),n=function(){function a(){d(this,a)}return i(a,[{key:"errorFn",value:function(a,b){if(this.error&&"function"==typeof this.error){try{throw"string"==typeof a?new Error(a):a}catch(c){a=c}this.error(this.name||null,a||null,b||null)}}}]),a}(),o=n.prototype;o.actions={},o.afterCreate=e,o.afterCreateCollection=f,o.afterCreateInstance=f,o.afterDestroy=e,o.afterEject=f,o.afterInject=f,o.afterReap=f,o.afterUpdate=e,o.afterValidate=e,o.allowSimpleWhere=!0,o.basePath="",o.beforeCreate=e,o.beforeCreateCollection=f,o.beforeCreateInstance=f,o.beforeDestroy=e,o.beforeEject=f,o.beforeInject=f,o.beforeReap=f,o.beforeUpdate=e,o.beforeValidate=e,o.bypassCache=!1,o.cacheResponse=!!j["default"].w,o.clearEmptyQueries=!0,o.computed={},o.defaultAdapter="http",o.debug=!1,o.defaultValues={},o.eagerEject=!1,o.eagerInject=!1,o.endpoint="",o.error=console?function(a,b,c){return console["function"==typeof console.error?"error":"log"](a,b,c)}:!1,o.instanceEvents=!!j["default"].w,o.fallbackAdapters=["http"],o.findStrictCache=!1,o.idAttribute="id",o.ignoredChanges=[/\$/],o.ignoreMissing=!1,o.keepChangeHistory=!1,o.linkRelations=!0,o.log=console?function(a,b,c,d,e){return console["function"==typeof console.info?"info":"log"](a,b,c,d,e)}:!1,o.logFn=function(a,b,c,d){var e=this;e.debug&&e.log&&"function"==typeof e.log&&e.log(e.name||null,a||null,b||null,c||null,d||null)},o.maxAge=!1,o.methods={},o.notify=!!j["default"].w,o.reapAction=j["default"].w?"inject":"none",o.reapInterval=j["default"].w?3e4:!1,o.relationsEnumerable=!1,o.resetHistoryOnInject=!0,o.strategy="single",o.upsert=!!j["default"].w,o.useClass=!0,o.useFilter=!1,o.validate=e,o.defaultFilter=function(a,b,c,d){var e=a,f=null,h={skip:"",offset:"",where:"",limit:"",orderBy:"",sort:""};c=c||{},d=d||{},f=j["default"]._o(c.where)?c.where:{},d.allowSimpleWhere&&j["default"].forOwn(c,function(a,b){b in h||b in f||(f[b]={"==":a})}),j["default"].isEmpty(f)&&(f=null),f&&(e=j["default"].filter(e,function(a){var b=!0,c=!0;return j["default"].forOwn(f,function(d,e){j["default"]._s(d)?d={"===":d}:(j["default"]._n(d)||j["default"].isBoolean(d))&&(d={"==":d}),j["default"]._o(d)&&j["default"].forOwn(d,function(d,f){var g=void 0,h="|"===f[0],i=j["default"].get(a,e);f=h?f.substr(1):f,"=="===f?g=i==d:"==="===f?g=i===d:"!="===f?g=i!=d:"!=="===f?g=i!==d:">"===f?g=i>d:">="===f?g=i>=d:"<"===f?g=d>i:"<="===f?g=d>=i:"isectEmpty"===f?g=!j["default"].intersection(i||[],d||[]).length:"isectNotEmpty"===f?g=j["default"].intersection(i||[],d||[]).length:"in"===f?g=j["default"]._s(d)?-1!==d.indexOf(i):j["default"].contains(d,i):"notIn"===f?g=j["default"]._s(d)?-1===d.indexOf(i):!j["default"].contains(d,i):"contains"===f?g=j["default"]._s(i)?-1!==i.indexOf(d):j["default"].contains(i,d):"notContains"===f&&(g=j["default"]._s(i)?-1===i.indexOf(d):!j["default"].contains(i,d)),void 0!==g&&(c=b?g:h?c||g:c&&g),b=!1})}),c}));var i=null;j["default"]._s(c.orderBy)?i=[[c.orderBy,"ASC"]]:j["default"]._a(c.orderBy)&&(i=c.orderBy),!i&&j["default"]._s(c.sort)?i=[[c.sort,"ASC"]]:!i&&j["default"]._a(c.sort)&&(i=c.sort),i&&!function(){var a=0;j["default"].forEach(i,function(a,c){if(j["default"]._s(a))i[c]=[a,"ASC"];else if(!j["default"]._a(a))throw new k["default"].IA('DS.filter("'+b+'"[, params][, options]): '+j["default"].toJson(a)+": Must be a string or an array!",{params:{"orderBy[i]":{actual:typeof a,expected:"string|array"}}})}),e=j["default"].sort(e,function(b,c){return g(i,a,b,c)})}();var l=j["default"]._n(c.limit)?c.limit:null,m=null;return j["default"]._n(c.skip)?m=c.skip:j["default"]._n(c.offset)&&(m=c.offset),l&&m?e=j["default"].slice(e,m,Math.min(e.length,m+l)):j["default"]._n(l)?e=j["default"].slice(e,0,Math.min(e.length,l)):j["default"]._n(m)&&(e=m<e.length?j["default"].slice(e,m):[]),e};var p=function(){function a(b){d(this,a);var c=this;b=b||{},c.store={},c.s=c.store,c.definitions={},c.defs=c.definitions,c.adapters={},c.defaults=new n,c.observe=j["default"].observe,j["default"].forOwn(b,function(a,b){c.defaults[b]=a})}return i(a,[{key:"getAdapter",value:function(a){var b=!1;a=a||{},j["default"]._s(a)&&(b=!0,a={adapter:a});var c=this.adapters[a.adapter];if(c)return c;if(b)throw new Error(""+a.adapter+" is not a registered adapter!");return this.adapters[a.defaultAdapter]}},{key:"registerAdapter",value:function(a,b,c){var d=this;c=c||{},j["default"].isFunction(b)?d.adapters[a]=new b(c):d.adapters[a]=b,c["default"]&&(d.defaults.defaultAdapter=a)}},{key:"is",value:function(a,b){var c=this.defs[a];if(!c)throw new k["default"].NER(a);return b instanceof c[c["class"]]}}]),a}(),q=p.prototype;q.getAdapter.shorthand=!1,q.registerAdapter.shorthand=!1,q.errors=k["default"],q.utils=j["default"],h(q,l["default"]),h(q,m["default"]),b["default"]=p},function(a,b,c){function d(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0})}function e(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(){for(var a=arguments.length,c=Array(a),d=0;a>d;d++)c[d]=arguments[d];var e=b[c.shift()]||[];if(e)for(var f=0;f<e.length;f++)e[f].f.apply(e[f].c,c)}}var f=c(3),g=c(7),h=c(8),i=c(9),j=c(13),k=c(10),l=c(14),m=c(18),n=c(11),o=c(15),p=c(12),q=c(19),r=c(16),s=c(17),t=c(6),u=void 0,v=Object.prototype,w=v.toString,x=void 0;try{x=Promise}catch(y){console.error("js-data requires a global Promise constructor!")}var z=Array.isArray||function(a){return"[object Array]"==w.call(a)||!1},A=function(a){return"[object RegExp]"==w.call(a)||!1},B=function(a){return a===!0||a===!1||a&&"object"==typeof a&&"[object Boolean]"==w.call(a)||!1},C=function(a){return"string"==typeof a||a&&"object"==typeof a&&"[object String]"==w.call(a)||!1},D=function(a){return"[object Object]"==w.call(a)||!1},E=function(a){return a&&"object"==typeof a&&"[object Date]"==w.call(a)||!1},F=function(a){var b=typeof a;return"number"==b||a&&"object"==b&&"[object Number]"==w.call(a)||!1},G=function(a){return"function"==typeof a||a&&"[object Function]"===w.call(a)||!1},H=function(a){return C(a)||F(a)},I=function(a){return new f["default"].IA('"'+a+'" must be a string or a number!')},J=function(a){return new f["default"].IA('"'+a+'" must be an object!')},K=function(a){return new f["default"].IA('"'+a+'" must be an array!')},L=function(a){if(null==a)return!0;if("string"==typeof a||z(a))return!a.length;if("object"!=typeof a)return!0;var b=function(){var b=!0;return j(a,function(){return b=!1,!1}),{v:b}}();return"object"==typeof b?b.v:void 0},M=function(a,b){if(!a||!b)return[];for(var c=[],d=void 0,e=0,f=a.length;f>e;e++)d=a[e],k(c,d)||k(b,d)&&c.push(d);return c},N=function(a,b,c){var d=[];return h(a,function(a,c,e){b(a,c,e)&&d.push(a)},c),d};try{u=window,u={}}catch(O){u=null}var P=["beforeValidate","validate","afterValidate","beforeCreate","afterCreate","beforeUpdate","afterUpdate","beforeDestroy","afterDestroy"],Q=function(a,b){var c=void 0;if(!b||!b.length)return!1;for(c=0;c<b.length;c++)if(b[c]===a)return!0;return!1},R=function Y(a,b,c,d,e){if(b){if(a===b)throw new Error("Cannot copy! Source and destination are identical.");if(c=c||[],d=d||[],D(a)){var f=c.indexOf(a);if(-1!==f)return d[f];c.push(a),d.push(b)}var g=void 0;if(z(a)){var i=void 0;for(b.length=0,i=0;i<a.length;i++)g=Y(a[i],null,c,d,e),D(a[i])&&(c.push(a[i]),d.push(g)),b.push(g)}else{z(b)?b.length=0:h(b,function(a,c){delete b[c]});for(var j in a)if(a.hasOwnProperty(j)){if(Q(j,e))continue;g=Y(a[j],null,c,d,e),D(a[j])&&(c.push(a[j]),d.push(g)),b[j]=g}}}else b=a,a&&(z(a)?b=Y(a,[],c,d,e):E(a)?b=new Date(a.getTime()):A(a)?(b=new RegExp(a.source,a.toString().match(/[^\/]*$/)[0]),b.lastIndex=a.lastIndex):D(a)&&(b=Y(a,Object.create(Object.getPrototypeOf(a)),c,d,e)));return b},S=function Z(a,b){var c=!0;a:for(;c;){var d=a,e=b;if(i=j=f=g=h=void 0,c=!1,d===e)return!0;if(null===d||null===e)return!1;if(d!==d&&e!==e)return!0;var f,g,h,i=typeof d,j=typeof e;if(i==j&&"object"==i){if(!z(d)){if(E(d)){if(!E(e))return!1;a=d.getTime(),b=e.getTime(),c=!0;continue a}if(A(d)&&A(e))return d.toString()==e.toString();if(z(e))return!1;h={};for(g in d)if("$"!==g.charAt(0)&&!G(d[g])){if(!Z(d[g],e[g]))return!1;h[g]=!0}for(g in e)if(!h.hasOwnProperty(g)&&"$"!==g.charAt(0)&&void 0!==e[g]&&!G(e[g]))return!1;return!0}if(!z(e))return!1;if((f=d.length)==e.length){for(g=0;f>g;g++)if(!Z(d[g],e[g]))return!1;return!0}}return!1}},T=function(a,b){return C(b)||F(b)?b:b&&a?b[a.idAttribute]||b:b},U=function(a,b){return a&&(C(b)||F(b))?a.index[b]||b:b},V=function(a){return null!=a&&""!==a},W=function(a,b){return b=b||"",N(a,V).join(b)},X=function(){for(var a=arguments.length,b=Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=W(b,"/");return d.replace(/([^:\/]|^)\/{2,}/g,"$1/")};b["default"]={Promise:x,_:function(a,b){var c=this;if(b=b||{},b&&b.constructor===a.constructor)return b;if(!D(b))throw new f["default"].IA('"options" must be an object!');h(P,function(a){"function"==typeof b[a]&&-1===b[a].toString().indexOf("for (var _len = arg")&&(b[a]=c.promisify(b[a]))});var d=function(a){var b=this;j(a,function(a,c){b[c]=a})};return d.prototype=a,d.prototype.orig=function(){var a={};return j(this,function(b,c){a[c]=b}),a},new d(b)},_n:F,_s:C,_sn:H,_snErr:I,_o:D,_oErr:J,_a:z,_aErr:K,compute:function(a,b){var c=this,d=[];h(a.deps,function(a){d.push(r(c,a))}),s(c,b,a[a.length-1].apply(c,d))},contains:k,copy:R,deepMixIn:l,diffObjectFromOldObject:t.diffObjectFromOldObject,BinaryHeap:g,equals:S,Events:e,filter:N,fillIn:function(a,b){return j(b,function(b,c){c in a||(a[c]=b)}),a},forEach:h,forOwn:j,fromJson:function(a){return C(a)?JSON.parse(a):a},get:r,intersection:M,isArray:z,isBoolean:B,isDate:E,isEmpty:L,isFunction:G,isObject:D,isNumber:F,isRegExp:A,isString:C,makePath:X,observe:t,pascalCase:m,pick:o,promisify:function(a,b){var c=this;if(a){if("function"!=typeof a)throw new Error("Can only promisify functions!");return function(){for(var d=arguments.length,e=Array(d),f=0;d>f;f++)e[f]=arguments[f];return new c.Promise(function(c,d){e.push(function(a,b){a?d(a):c(b)});try{var f=a.apply(b||this,e);f&&f.then&&f.then(c,d)}catch(g){d(g)}})}}},remove:n,set:s,slice:i,sort:p,toJson:JSON.stringify,updateTimestamp:function(a){var b="function"==typeof Date.now?Date.now():(new Date).getTime();return a&&a>=b?a+1:b},upperCase:q,removeCircular:function(a){return function b(a,c){var d=void 0,e=void 0;if(!("object"!=typeof a||null===a||a instanceof Boolean||a instanceof Date||a instanceof Number||a instanceof RegExp||a instanceof String)){for(var f=c.current,g=c.context;g;){if(g.current===f)return void 0;g=g.context}if(z(a))for(e=[],d=0;d<a.length;d+=1)e[d]=b(a[d],{context:c,current:a[d]});else e={},j(a,function(d,f){e[f]=b(a[f],{context:c,current:a[f]})});return e}return a}(a,{context:null,current:a})},resolveItem:U,resolveId:T,w:u,applyRelationGettersToTarget:function(a,b,c){this.forEach(b.relationList,function(e){var f=e.relation,g="boolean"==typeof e.enumerable?e.enumerable:!!b.relationsEnumerable;("boolean"==typeof e.link?e.link:!!b.linkRelations)&&(delete c[e.localField],"belongsTo"===e.type?Object.defineProperty(c,e.localField,{enumerable:g,get:function(){return this[e.localKey]?b.getResource(f).get(this[e.localKey]):void 0},set:function(){}}):"hasMany"===e.type?Object.defineProperty(c,e.localField,{enumerable:g,get:function(){var c={};return e.foreignKey?(c[e.foreignKey]=this[b.idAttribute],b.getResource(f).defaultFilter.call(a,a.s[f].collection,f,c,{allowSimpleWhere:!0})):e.localKeys?(c.where=d({},b.getResource(f).idAttribute,{"in":this[e.localKeys]}),b.getResource(f).defaultFilter.call(a,a.s[f].collection,f,c)):void 0},set:function(){}}):"hasOne"===e.type&&(e.localKey?Object.defineProperty(c,e.localField,{enumerable:g,get:function(){return this[e.localKey]?b.getResource(f).get(this[e.localKey]):void 0},set:function(){}}):Object.defineProperty(c,e.localField,{enumerable:g,get:function(){var c={};c[e.foreignKey]=this[b.idAttribute];var d=c[e.foreignKey]?b.getResource(f).defaultFilter.call(a,a.s[f].collection,f,c,{allowSimpleWhere:!0}):[];return d.length?d[0]:void 0},set:function(){}})))})}}},function(a,b,c){function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(a.__proto__=b)}var f=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;h=j=i=void 0,d=!1;var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;return void 0===i?void 0:i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return void 0;a=j,b=f,c=g,d=!0}},g=function(a){function b(a){d(this,b),f(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.message=a||"Illegal Argument!"}return e(b,a),b}(Error),h=function(a){function b(a){d(this,b),f(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.message=a||"RuntimeError Error!"}return e(b,a),b}(Error),i=function(a){function b(a){d(this,b),f(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.message=""+a+" is not a registered resource!"}return e(b,a),b}(Error);b["default"]={IllegalArgumentError:g,IA:g,RuntimeError:h,R:h,NonexistentResourceError:i,NER:i}},function(a,b,c){function d(a){return!(e["default"].isEmpty(a.added)&&e["default"].isEmpty(a.removed)&&e["default"].isEmpty(a.changed))}var e=c(2),f=c(3),g=c(25),h=c(26),i=c(27),j=c(28),k=c(29),l=f["default"].NER,m=f["default"].IA,n=f["default"].R;b["default"]={changes:function(a,b,c){var d=this,f=d.defs[a];if(c=c||{},b=e["default"].resolveId(f,b),!f)throw new l(a);if(!e["default"]._sn(b))throw e["default"]._snErr("id");c=e["default"]._(f,c);var g=f.get(b);if(g){var h=function(){e["default"].w&&d.s[a].observers[b].deliver();var h=c.ignoredChanges||[];e["default"].forEach(f.relationFields,function(a){e["default"].contains(h,a)||h.push(a)});var i=e["default"].diffObjectFromOldObject(g,d.s[a].previousAttributes[b],e["default"].equals,h);return e["default"].forOwn(i,function(a,b){var c=[];e["default"].forOwn(a,function(a,b){e["default"].isFunction(a)||c.push(b)}),i[b]=e["default"].pick(i[b],c)}),e["default"].forEach(f.relationFields,function(a){delete i.added[a],delete i.removed[a],delete i.changed[a]}),{v:i}}();if("object"==typeof h)return h.v}},changeHistory:function(a,b){var c=this,d=c.defs[a],f=c.s[a];if(b=e["default"].resolveId(d,b),a&&!c.defs[a])throw new l(a);if(b&&!e["default"]._sn(b))throw e["default"]._snErr("id");if(d.keepChangeHistory){if(!a)return f.changeHistory;var g=d.get(b);if(g)return f.changeHistories[b]}else d.errorFn("changeHistory is disabled for this resource!")},compute:function(a,b){var c=this,d=c.defs[a];if(b=e["default"].resolveItem(c.s[a],b),!d)throw new l(a);if(!b)throw new n("Item not in the store!");if(!e["default"]._o(b)&&!e["default"]._sn(b))throw new m('"instance" must be an object, string or number!');return e["default"].forOwn(d.computed,function(a,c){e["default"].compute.call(b,a,c)}),b},createInstance:function(a,b,c){var d=this.defs[a],f=void 0;if(b=b||{},!d)throw new l(a);if(b&&!e["default"].isObject(b))throw new m('"attrs" must be an object!');c=e["default"]._(d,c),c.beforeCreateInstance(c,b);var g=d[d["class"]];return f=new g,c.defaultValues&&e["default"].deepMixIn(f,c.defaultValues),e["default"].deepMixIn(f,b),d.computed&&d.compute(f),c.afterCreateInstance(c,f),f},createCollection:function(a,b,c,d){var f=this,g=f.defs[a];if(b=b||[],c=c||{},!g)throw new l(a);if(b&&!e["default"].isArray(b))throw new m('"arr" must be an array!');return d=e["default"]._(g,d),d.beforeCreateCollection(d,b),Object.defineProperties(b,{fetch:{value:function(b,c){var d=this;return d.params=b||d.params,g.findAll(d.params,c).then(function(b){return b===d?d:(b.unshift(d.length),b.unshift(0),d.splice.apply(d,b),b.shift(),b.shift(),b.$$injected&&(f.s[a].queryData[e["default"].toJson(d.params)]=d,d.$$injected=!0),d)})}},params:{value:c,writable:!0},resourceName:{value:a}}),d.afterCreateCollection(d,b),b},defineResource:g["default"],digest:function(){this.observe.Platform.performMicrotaskCheckpoint()},eject:h["default"],ejectAll:i["default"],filter:j["default"],get:function(a,b,c){var d=this,f=d.defs[a];if(!f)throw new l(a);if(!e["default"]._sn(b))throw e["default"]._snErr("id");return c=e["default"]._(f,c),d.s[a].index[b]},getAll:function(a,b){var c=this,d=c.defs[a],f=c.s[a],g=[];if(!d)throw new l(a);if(b&&!e["default"]._a(b))throw e["default"]._aErr("ids");if(e["default"]._a(b))for(var h=b.length,i=0;h>i;i++)f.index[b[i]]&&g.push(f.index[b[i]]);else g=f.collection.slice();return g},hasChanges:function(a,b){var c=this,f=c.defs[a];if(b=e["default"].resolveId(f,b),!f)throw new l(a);if(!e["default"]._sn(b))throw e["default"]._snErr("id");return f.get(b)?d(f.changes(b)):!1},inject:k["default"],lastModified:function(a,b){var c=this.defs[a],d=this.s[a];if(b=e["default"].resolveId(c,b),!c)throw new l(a);return b?(b in d.modified||(d.modified[b]=0),d.modified[b]):d.collectionModified},lastSaved:function(a,b){var c=this.defs[a],d=this.s[a];if(b=e["default"].resolveId(c,b),!c)throw new l(a);return b in d.saved||(d.saved[b]=0),d.saved[b]},previous:function(a,b){var c=this,d=c.defs[a],f=c.s[a];if(b=e["default"].resolveId(d,b),!d)throw new l(a);if(!e["default"]._sn(b))throw e["default"]._snErr("id");return f.previousAttributes[b]?e["default"].copy(f.previousAttributes[b]):void 0}}},function(a,b,c){var d=c(33),e=c(34),f=c(35),g=c(36),h=c(37),i=c(38),j=c(39),k=c(40),l=c(41),m=c(42);b["default"]={create:d["default"],destroy:e["default"],destroyAll:f["default"],find:g["default"],findAll:h["default"],loadRelations:i["default"],reap:j["default"],refresh:function(a,b,c){var d=this,e=d.utils;return new e.Promise(function(f,g){var h=d.defs[a];b=e.resolveId(d.defs[a],b),h?e._sn(b)?(c=e._(h,c),c.bypassCache=!0,f(d.get(a,b))):g(e._snErr("id")):g(new d.errors.NER(a))}).then(function(e){return e?d.find(a,b,c):e})},save:k["default"],update:l["default"],updateAll:m["default"]}},function(a,b,c){!function(a){function b(){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 c(b){for(var c=0;s>c&&b.check_();)c++;return p&&(a.dirtyCheckCycleCount=c),c>0}function d(a){for(var b in a)return!1;return!0}function e(a){return d(a.added)&&d(a.removed)&&d(a.changed)}function f(a,b){if(!b||!b.length)return!1;for(var c,d=0;d<b.length;d++)if("[object RegExp]"===Object.prototype.toString.call(b[d])&&b[d].test(a)||b[d]===a)return c=a;return!!c}function g(a,b,c,d){var e={},g={},h={};for(var i in b){var j=a[i];f(i,d)||void 0!==j&&(c?c(j,b[i]):j===b[i])||(i in a?(c?c(j,b[i]):j===b[i])||(h[i]=j):g[i]=void 0)}for(var i in a)i in b||f(i,d)||(e[i]=a[i]);return Array.isArray(a)&&a.length!==b.length&&(h.length=a.length),{added:e,removed:g,changed:h}}function h(){if(!t.length)return!1;for(var a=0;a<t.length;a++)t[a]();return t.length=0,!0}function i(){function a(a){b&&b.state_===x&&!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),v.push(this)}}}function j(a,b,c){var d=v.pop()||i();return d.open(a),d.observe(b,c),d}function k(){this.state_=w,this.callback_=void 0,this.target_=void 0,this.directObserver_=void 0,this.value_=void 0,this.id_=z++}function l(a){k._allObserversCount++,B&&A.push(a)}function m(a){k._allObserversCount--}function n(a){k.call(this),this.value_=a,this.oldObject_=void 0}function o(a,b,c){for(var d={},e={},f=0;f<b.length;f++){var g=b[f];E[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 p=a.testingExposeCycleCount,q=b(),r="__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},s=1e3,t=[],u=q?function(){return function(a){return Promise.resolve().then(a)}}():function(){return function(a){t.push(a)}}(),v=[],w=0,x=1,y=2,z=1;k.prototype={open:function(a,b){if(this.state_!=w)throw Error("Observer has already been opened.");return l(this),this.callback_=a,this.target_=b,this.connect_(),this.state_=x,this.value_},close:function(){this.state_==x&&(m(this),this.disconnect_(),this.value_=void 0,this.callback_=void 0,this.target_=void 0,this.state_=y)},deliver:function(){this.state_==x&&c(this)},report_:function(a){try{this.callback_.apply(this.target_,a)}catch(b){k._errorThrownDuringCallback=!0,console.error("Exception caught during observer callback: "+(b.stack||b))}},discardChanges:function(){return this.check_(void 0,!0),this.value_}};var A,B=!q;k._allObserversCount=0,B&&(A=[]);var C=!1;a.Platform=a.Platform||{},a.Platform.performMicrotaskCheckpoint=function(){if(!C&&B){C=!0;var b,c,d=0;do{d++,c=A,A=[],b=!1;for(var e=0;e<c.length;e++){var f=c[e];f.state_==x&&(f.check_()&&(b=!0),A.push(f))}h()&&(b=!0)}while(s>d&&b);p&&(a.dirtyCheckCycleCount=d),C=!1}},B&&(a.Platform.clearObservers=function(){A=[]}),n.prototype=r({__proto__:k.prototype,arrayObserve:!1,connect_:function(a,b){q?this.directObserver_=j(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,b){var c,d;if(q){if(!a)return!1;d={},c=o(this.value_,a,d)}else d=this.oldObject_,c=g(this.value_,this.oldObject_);return e(c)?!1:(q||(this.oldObject_=this.copyObject(this.value_)),this.report_([c.added||{},c.removed||{},c.changed||{},function(a){return d[a]}]),!0)},disconnect_:function(){q?(this.directObserver_.close(),this.directObserver_=void 0):this.oldObject_=void 0},deliver:function(){this.state_==x&&(q?this.directObserver_.deliver(!1):c(this))},discardChanges:function(){return this.directObserver_?this.directObserver_.deliver(!0):this.oldObject_=this.copyObject(this.value_),this.value_}});var D={},E={add:!0,update:!0,"delete":!0};a.Observer=k,a.Observer.runEOM_=u,a.Observer.observerSentinel_=D,a.Observer.hasObjectObserve=q,a.diffObjectFromOldObject=g,a.ObjectObserver=n}(b)},function(a,b,c){!function(b,c){a.exports=c()}(this,function(){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="",b(0)}([function(a,b,c){function d(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}}var e=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},f=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();Object.defineProperty(b,"__esModule",{value:!0});var g=function(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}},h=function(){function a(b,c){if(e(this,a),b||(b=function(a){return a}),c||(c=function(a,b){return a===b}),"function"!=typeof b)throw new Error('BinaryHeap([weightFunc][, compareFunc]): "weightFunc" must be a function!');if("function"!=typeof c)throw new Error('BinaryHeap([weightFunc][, compareFunc]): "compareFunc" must be a function!');this.weightFunc=b,this.compareFunc=c,this.heap=[]}return f(a,[{key:"push",value:function(a){this.heap.push(a),d(this.heap,this.weightFunc,this.heap.length-1)}},{key:"peek",value:function(){return this.heap[0]}},{key:"pop",value:function(){var a=this.heap[0],b=this.heap.pop();return this.heap.length>0&&(this.heap[0]=b,g(this.heap,this.weightFunc,0)),a}},{key:"remove",value:function(a){for(var b=this.heap.length,c=0;b>c;c++)if(this.compareFunc(this.heap[c],a)){var e=this.heap[c],f=this.heap.pop();return c!==b-1&&(this.heap[c]=f,d(this.heap,this.weightFunc,c),g(this.heap,this.weightFunc,c)),e}return null}},{key:"removeAll",value:function(){this.heap=[]}},{key:"size",value:function(){return this.heap.length}}]),a}();b["default"]=h,a.exports=b["default"]}])})},function(a,b,c){function d(a,b,c){if(null!=a)for(var d=-1,e=a.length;++d<e&&b.call(c,a[d],d,a)!==!1;);}a.exports=d},function(a,b,c){function d(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}a.exports=d},function(a,b,c){function d(a,b){return-1!==e(a,b)}var e=c(20);a.exports=d},function(a,b,c){function d(a,b){var c=e(a,b);-1!==c&&a.splice(c,1)}var e=c(20);a.exports=d},function(a,b,c){function d(a,b){if(null==a)return[];if(a.length<2)return a;null==b&&(b=e);var c,g,h;return c=~~(a.length/2),g=d(a.slice(0,c),b),h=d(a.slice(c,a.length),b),f(g,h,b)}function e(a,b){return b>a?-1:a>b?1:0}function f(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}a.exports=d},function(a,b,c){function d(a,b,c){f(a,function(d,f){return e(a,f)?b.call(c,a[f],f,a):void 0})}var e=c(21),f=c(22);a.exports=d},function(a,b,c){function d(a,b){for(var c,d=0,g=arguments.length;++d<g;)c=arguments[d],c&&f(c,e,a);return a}function e(a,b){var c=this[b];g(a)&&g(c)?d(c,a):this[b]=a}var f=c(13),g=c(23);a.exports=d},function(a,b,c){function d(a,b){for(var c,d="string"!=typeof arguments[1]?arguments[1]:e(arguments,1),f={},g=0;c=d[g++];)f[c]=a[c];return f}var e=c(9);a.exports=d},function(a,b,c){function d(a,b){for(var c=b.split("."),d=c.pop();b=c.shift();)if(a=a[b],null==a)return;return a[d]}c(24);a.exports=d},function(a,b,c){function d(a,b,c){var d=/^(.+)\.(.+)$/.exec(b);d?e(a,d[1])[d[2]]=c:a[b]=c}var e=c(30);a.exports=d},function(a,b,c){function d(a){return a=e(a),f(a).replace(/^[a-z]/,g)}var e=c(31),f=c(32),g=c(19);a.exports=d},function(a,b,c){function d(a){return a=e(a),a.toUpperCase()}var e=c(31);a.exports=d},function(a,b,c){function d(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}a.exports=d},function(a,b,c){function d(a,b){return Object.prototype.hasOwnProperty.call(a,b)}a.exports=d},function(a,b,c){function d(){h=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],g=!0;for(var a in{toString:null})g=!1}function e(a,b,c){var e,j=0;null==g&&d();for(e in a)if(f(b,a,e,c)===!1)break;if(g)for(var k=a.constructor,l=!!k&&a===k.prototype;(e=h[j++])&&("constructor"===e&&(l||!i(a,e))||a[e]===Object.prototype[e]||f(b,a,e,c)!==!1););}function f(a,b,c,d){return a.call(d,b[c],c,b)}var g,h,i=c(21);a.exports=e},function(a,b,c){function d(a){return!!a&&"object"==typeof a&&a.constructor===Object}a.exports=d},function(a,b,c){function d(a){switch(typeof a){case"string":case"number":case"boolean":return!0}return null==a}a.exports=d},function(module,exports,__webpack_require__){function defineResource(definition){function Resource(a){this.defaultValues={},this.methods={},this.computed={},_utils["default"].deepMixIn(this,a);var b=_this.defaults;definition["extends"]&&definitions[definition["extends"]]&&(b=definitions[definition["extends"]]),_utils["default"].fillIn(this.defaultValues,b.defaultValues),_utils["default"].fillIn(this.methods,b.methods),_utils["default"].fillIn(this.computed,b.computed),this.endpoint="endpoint"in a?a.endpoint:this.name}var _this=this,definitions=_this.defs;if(_utils["default"]._s(definition)&&(definition={name:definition.replace(/\s/gi,"")}),!_utils["default"]._o(definition))throw _utils["default"]._oErr("definition");if(!_utils["default"]._s(definition.name))throw new _errors["default"].IA('"name" must be a string!');if(definitions[definition.name])throw new _errors["default"].R(""+definition.name+" is already registered!");try{var def,_class,_ret=function(){if(definition["extends"]&&definitions[definition["extends"]]?Resource.prototype=definitions[definition["extends"]]:Resource.prototype=_this.defaults,definitions[definition.name]=new Resource(definition),def=definitions[definition.name],!_utils["default"]._s(def.idAttribute))throw new _errors["default"].IA('"idAttribute" must be a string!');def.relations&&(def.relationList=[],def.relationFields=[],_utils["default"].forOwn(def.relations,function(a,b){_utils["default"].forOwn(a,function(c,d){_utils["default"]._a(c)||(a[d]=[c]),_utils["default"].forEach(a[d],function(a){a.type=b,a.relation=d,a.name=def.name,def.relationList.push(a),a.localField&&def.relationFields.push(a.localField)})})}),def.relations.belongsTo&&_utils["default"].forOwn(def.relations.belongsTo,function(a,b){_utils["default"].forEach(a,function(a){a.parent&&(def.parent=b,def.parentKey=a.localKey,def.parentField=a.localField);
},def.getEndpoint=function(a,b){b=b||{},b.params=b.params||{};var c=void 0,d=def.parentKey,e=b.hasOwnProperty("endpoint")?b.endpoint:def.endpoint,f=def.parentField,g=definitions[def.parent],h=b.params[d];if(h===!1||!d||!g)return h===!1&&delete b.params[d],e;if(delete b.params[d],_utils["default"]._sn(a)?c=def.get(a):_utils["default"]._o(a)&&(c=a),c&&(h=h||c[d]||(c[f]?c[f][g.idAttribute]:null)),!h)return e;var i=function(){delete b.endpoint;var a={};return _utils["default"].forOwn(b,function(b,c){a[c]=b}),{v:_utils["default"].makePath(g.getEndpoint(h,_utils["default"]._(g,a)),h,e)}}();return"object"==typeof i?i.v:void 0},_class=def["class"]=_utils["default"].pascalCase(def.name);try{"function"==typeof def.useClass?(eval("function "+_class+"() { def.useClass.call(this); }"),def[_class]=eval(_class),def[_class].prototype=function(a){function b(){}return b.prototype=a,new b}(def.useClass.prototype)):(eval("function "+_class+"() {}"),def[_class]=eval(_class))}catch(e){def[_class]=function(){}}_utils["default"].forOwn(def.methods,function(a,b){def[_class].prototype[b]=a}),def[_class].prototype.set=function(a,b){return _utils["default"].set(this,a,b),def.compute(this),this},def[_class].prototype.get=function(a){return _utils["default"].get(this,a)},_utils["default"].applyRelationGettersToTarget(_this,def,def[_class].prototype),_utils["default"].forOwn(def.computed,function(a,b){_utils["default"].isFunction(a)&&(def.computed[b]=[a],a=def.computed[b]),def.methods&&b in def.methods&&def.errorFn('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&&def.errorFn("Use the computed property array syntax for compatibility with minified code!")}c=a.slice(0,a.length-1),_utils["default"].forEach(c,function(a,b){c[b]=a.trim()}),a.deps=_utils["default"].filter(c,function(a){return!!a})}),_utils["default"].forEach(instanceMethods,function(a){def[_class].prototype["DS"+_utils["default"].pascalCase(a)]=function(){for(var b=arguments.length,c=Array(b),d=0;b>d;d++)c[d]=arguments[d];return c.unshift(this[def.idAttribute]||this),c.unshift(def.name),_this[a].apply(_this,c)}}),def[_class].prototype.DSCreate=function(){for(var a=arguments.length,b=Array(a),c=0;a>c;c++)b[c]=arguments[c];return b.unshift(this),b.unshift(def.name),_this.create.apply(_this,b)},_this.s[def.name]={collection:[],expiresHeap:new _utils["default"].BinaryHeap(function(a){return a.expires},function(a,b){return a.item===b}),completedQueries:{},queryData:{},pendingQueries:{},index:{},modified:{},saved:{},previousAttributes:{},observers:{},changeHistories:{},changeHistory:[],collectionModified:0},def.reapInterval&&setInterval(function(){return def.reap()},def.reapInterval);var fns=["registerAdapter","getAdapter","is"];for(key in _this)"function"==typeof _this[key]&&fns.push(key);_utils["default"].forEach(fns,function(a){var b=a;_this[b].shorthand!==!1?(def[b]=function(){for(var a=arguments.length,c=Array(a),d=0;a>d;d++)c[d]=arguments[d];return c.unshift(def.name),_this[b].apply(_this,c)},def[b].before=function(a){var c=def[b];def[b]=function(){for(var b=arguments.length,d=Array(b),e=0;b>e;e++)d[e]=arguments[e];return c.apply(def,a.apply(def,d)||d)}}):def[b]=function(){for(var a=arguments.length,c=Array(a),d=0;a>d;d++)c[d]=arguments[d];return _this[b].apply(_this,c)}}),def.beforeValidate=_utils["default"].promisify(def.beforeValidate),def.validate=_utils["default"].promisify(def.validate),def.afterValidate=_utils["default"].promisify(def.afterValidate),def.beforeCreate=_utils["default"].promisify(def.beforeCreate),def.afterCreate=_utils["default"].promisify(def.afterCreate),def.beforeUpdate=_utils["default"].promisify(def.beforeUpdate),def.afterUpdate=_utils["default"].promisify(def.afterUpdate),def.beforeDestroy=_utils["default"].promisify(def.beforeDestroy),def.afterDestroy=_utils["default"].promisify(def.afterDestroy);var defaultAdapter=void 0;return def.hasOwnProperty("defaultAdapter")&&(defaultAdapter=def.defaultAdapter),_utils["default"].forOwn(def.actions,function(a,b){if(def[b]&&!def.actions[b])throw new Error('Cannot override existing method "'+b+'"!');a.request=a.request||function(a){return a},a.response=a.response||function(a){return a},a.responseError=a.responseError||function(a){return _utils["default"].Promise.reject(a)},def[b]=function(c,d){_utils["default"]._o(c)&&(d=c),d=d||{};var e=def.getAdapter(a.adapter||defaultAdapter||"http"),f=_utils["default"].deepMixIn({},a);if(!d.hasOwnProperty("endpoint")&&f.endpoint&&(d.endpoint=f.endpoint),"function"==typeof d.getEndpoint)f.url=d.getEndpoint(def,d);else{var g=[d.basePath||e.defaults.basePath||def.basePath,def.getEndpoint(_utils["default"]._sn(c)?c:null,d)];_utils["default"]._sn(c)&&g.push(c),g.push(a.pathname||b),f.url=_utils["default"].makePath.apply(null,g)}return f.method=f.method||"GET",_utils["default"].deepMixIn(f,d),new _utils["default"].Promise(function(a){return a(f)}).then(d.request||a.request).then(function(a){return e.HTTP(a)}).then(d.response||a.response,d.responseError||a.responseError)}}),_utils["default"].Events(def),{v:def}}();if("object"==typeof _ret)return _ret.v}catch(err){throw delete definitions[definition.name],delete _this.s[definition.name],err}}exports["default"]=defineResource;var _utils=__webpack_require__(2),_errors=__webpack_require__(3),instanceMethods=["compute","eject","refresh","save","update","destroy","loadRelations","changeHistory","changes","hasChanges","lastModified","lastSaved","previous"]},function(a,b,c){function d(a,b,c){var d=this,e=d.utils,f=d.defs[a],g=d.s[a],h=void 0,i=!1;if(b=e.resolveId(f,b),!f)throw new d.errors.NER(a);if(!e._sn(b))throw e._snErr("id");c=e._(f,c);for(var j=0;j<g.collection.length;j++)if(g.collection[j][f.idAttribute]==b){h=g.collection[j],g.expiresHeap.remove(h),i=!0;break}if(i){var k=function(){f.beforeEject(c,h),c.notify&&f.emit("DS.beforeEject",f,h);var a=[];return e.forOwn(g.queryData,function(b,d){b.$$injected&&e.remove(b,h),!b.length&&c.clearEmptyQueries&&a.push(d)}),e.forEach(g.changeHistories[b],function(a){e.remove(g.changeHistory,a)}),e.forEach(a,function(a){delete g.completedQueries[a],delete g.queryData[a]}),e.w&&g.observers[b].close(),delete g.observers[b],delete g.index[b],delete g.previousAttributes[b],delete g.completedQueries[b],delete g.pendingQueries[b],delete g.changeHistories[b],delete g.modified[b],delete g.saved[b],g.collection.splice(j,1),g.collectionModified=e.updateTimestamp(g.collectionModified),f.afterEject(c,h),c.notify&&f.emit("DS.afterEject",f,h),{v:h}}();if("object"==typeof k)return k.v}}b["default"]=d},function(a,b,c){function d(a,b,c){var d=this,e=d.utils,f=d.defs[a];if(b=b||{},!f)throw new d.errors.NER(a);if(!e._o(b))throw e._oErr("params");var g=d.s[a],h=e.toJson(b),i=f.filter(b),j=[];return e.isEmpty(b)?g.completedQueries={}:delete g.completedQueries[h],e.forEach(i,function(a){a&&a[f.idAttribute]&&j.push(a[f.idAttribute])}),e.forEach(j,function(a){f.eject(a,c)}),g.collectionModified=e.updateTimestamp(g.collectionModified),i}b["default"]=d},function(a,b,c){function d(a,b,c){var d=this,e=d.utils,f=d.defs[a];if(!f)throw new d.errors.NER(a);if(b&&!e._o(b))throw e._oErr("params");return b=b||{},c=e._(f,c),f.defaultFilter.call(d,d.s[a].collection,a,b,c)}b["default"]=d},function(a,b,c){function d(a,b){var c=this,d=a.name;return function(e,f,h,i,j){var k=this,l=void 0,m=i&&i(a.idAttribute)?i(a.idAttribute):k[a.idAttribute];if(g["default"].forEach(a.relationFields,function(a){delete e[a],delete f[a],delete h[a]}),(!g["default"].isEmpty(e)||!g["default"].isEmpty(f)||!g["default"].isEmpty(h)||j)&&(l=c.get(d,m),b.modified[m]=g["default"].updateTimestamp(b.modified[m]),b.collectionModified=g["default"].updateTimestamp(b.collectionModified),a.keepChangeHistory)){var n={resourceName:d,target:l,added:e,removed:f,changed:h,timestamp:b.modified[m]};b.changeHistories[m].push(n),b.changeHistory.push(n)}a.computed&&(l=l||c.get(d,m),g["default"].forOwn(a.computed,function(a,b){var c=!1;g["default"].forEach(a.deps,function(a){(a in e||a in f||a in h||!(b in l))&&(c=!0)}),c=c||!a.deps.length,c&&g["default"].compute.call(l,a,b)})),a.idAttribute in h&&a.errorFn('Doh! You just changed the primary key of an object! Your data for the "'+d+'" resource is now in an undefined (probably broken) state.')}}function e(a,b,c,f){var i=this,j=void 0;if(g["default"]._a(c)){j=[];for(var k=0;k<c.length;k++)j.push(e.call(i,a,b,c[k],f))}else{var l=d.call(i,a,b),m=a.computed,n=a.idAttribute;if(m&&m[n]&&!function(){var a=[];g["default"].forEach(m[n].deps,function(b){a.push(c[b])}),c[n]=m[n][m[n].length-1].apply(c,a)}(),!(n in c)){var o=new h["default"].R(""+a.name+'.inject: "attrs" must contain the property specified by "idAttribute"!');throw f.errorFn(o),o}try{g["default"].forEach(a.relationList,function(b){var d=b.relation,e=i.defs[d],j=c[b.localField];if(j){if(!e)throw new h["default"].R(""+a.name+" relation is defined but the resource is not!");if(g["default"]._a(j))!function(){var h=[];g["default"].forEach(j,function(g){if(g!==i.s[d].index[g[e.idAttribute]])try{var j=e.inject(g,f.orig());b.foreignKey&&(j[b.foreignKey]=c[a.idAttribute]),h.push(j)}catch(k){f.errorFn(k,"Failed to inject "+b.type+' relation: "'+d+'"!')}})}();else if(j!==i.s[d].index[j[e.idAttribute]])try{var k=e.inject(c[b.localField],f.orig());b.foreignKey&&(k[b.foreignKey]=c[a.idAttribute])}catch(l){f.errorFn(l,"Failed to inject "+b.type+' relation: "'+d+'"!')}}});var p=c[n],q=a.get(p),r=q?b.modified[p]:0;q?(g["default"].deepMixIn(q,c),a.resetHistoryOnInject&&(b.previousAttributes[p]=g["default"].copy(q,null,null,null,a.relationFields),b.changeHistories[p].length&&(g["default"].forEach(b.changeHistories[p],function(a){g["default"].remove(b.changeHistory,a)}),b.changeHistories[p].splice(0,b.changeHistories[p].length))),g["default"].w&&b.observers[p].deliver()):(q=c instanceof a[a["class"]]?c:new a[a["class"]],g["default"].forEach(a.relationList,function(a){delete c[a.localField]}),g["default"].deepMixIn(q,c),b.collection.push(q),b.changeHistories[p]=[],g["default"].w&&(b.observers[p]=new i.observe.ObjectObserver(q),b.observers[p].open(l,q)),b.index[p]=q,l.call(q,{},{},{},null,!0),b.previousAttributes[p]=g["default"].copy(q,null,null,null,a.relationFields)),b.modified[p]=r&&b.modified[p]===r?g["default"].updateTimestamp(b.modified[p]):b.modified[p],b.expiresHeap.remove(q);var s=(new Date).getTime();b.expiresHeap.push({item:q,timestamp:s,expires:a.maxAge?s+a.maxAge:Number.MAX_VALUE}),j=q}catch(t){f.errorFn(t,c)}}return j}function f(a,b,c){var d=this,f=d.defs[a],i=d.s[a],j=void 0;if(!f)throw new h["default"].NER(a);if(!g["default"]._o(b)&&!g["default"]._a(b))throw new h["default"].IA(""+a+'.inject: "attrs" must be an object or an array!');return c=g["default"]._(f,c),c.beforeInject(c,b),c.notify&&f.emit("DS.beforeInject",f,b),j=e.call(d,f,i,b,c),i.collectionModified=g["default"].updateTimestamp(i.collectionModified),c.afterInject(c,j),c.notify&&f.emit("DS.afterInject",f,j),j}b["default"]=f;var g=c(2),h=c(3)},function(a,b,c){function d(a){switch(typeof a){case"string":case"number":case"boolean":return!0}return null==a}a.exports=d},function(a,b,c){function d(a,b){return b?(e(b.split("."),function(b){a[b]||(a[b]={}),a=a[b]}),a):a}var e=c(8);a.exports=d},function(a,b,c){function d(a){return null==a?"":a.toString()}a.exports=d},function(a,b,c){function d(a){return a=e(a),a=f(a),a=g(a).replace(/[\-_]/g," ").replace(/\s[a-z]/g,h).replace(/\s+/g,"").replace(/^[A-Z]/g,i)}var e=c(31),f=c(43),g=c(44),h=c(19),i=c(45);a.exports=d},function(a,b,c){function d(a,b,c){var d=this,e=d.utils,f=d.defs[a];c=c||{},b=b||{};var g=void 0;if(f)if(e._o(b)){if(c=e._(f,c),c.upsert&&e._sn(b[f.idAttribute]))return d.update(a,b[f.idAttribute],b,c)}else g=e._oErr("attrs");else g=new d.errors.NER(a);return new e.Promise(function(a,c){g?c(g):a(b)}).then(function(a){return c.beforeValidate.call(a,c,a)}).then(function(a){return c.validate.call(a,c,a)}).then(function(a){return c.afterValidate.call(a,c,a)}).then(function(a){return c.beforeCreate.call(a,c,a)}).then(function(a){return c.notify&&f.emit("DS.beforeCreate",f,a),d.getAdapter(c).create(f,a,c)}).then(function(a){return c.afterCreate.call(a,c,a)}).then(function(b){if(c.notify&&f.emit("DS.afterCreate",f,b),c.cacheResponse){var g=d.inject(f.name,b,c.orig()),h=g[f.idAttribute],i=d.s[a];return i.completedQueries[h]=(new Date).getTime(),i.saved[h]=e.updateTimestamp(i.saved[h]),g}return d.createInstance(a,b,c)})}b["default"]=d},function(a,b,c){function d(a,b,c){var d=this,e=d.utils,f=d.defs[a],g=void 0;return new e.Promise(function(h,i){b=e.resolveId(f,b),f?e._sn(b)?(g=f.get(b)||{id:b},c=e._(f,c),h(g)):i(e._snErr("id")):i(new d.errors.NER(a))}).then(function(a){return c.beforeDestroy.call(a,c,a)}).then(function(a){return c.notify&&f.emit("DS.beforeDestroy",f,a),c.eagerEject&&f.eject(b),f.getAdapter(c).destroy(f,b,c)}).then(function(){return c.afterDestroy.call(g,c,g)}).then(function(a){return c.notify&&f.emit("DS.afterDestroy",f,a),f.eject(b),b})["catch"](function(a){return c&&c.eagerEject&&g&&f.inject(g,{notify:!1}),e.Promise.reject(a)})}b["default"]=d},function(a,b,c){function d(a,b,c){var d=this,e=d.utils,f=d.defs[a],g=void 0,h=void 0;return b=b||{},new e.Promise(function(g,h){f?e._o(b)?(c=e._(f,c),g()):h(e._oErr("attrs")):h(new d.errors.NER(a))}).then(function(){return h=f.defaultFilter.call(d,a,b),c.beforeDestroy(c,h)}).then(function(){return c.notify&&f.emit("DS.beforeDestroy",f,h),c.eagerEject&&(g=f.ejectAll(b)),f.getAdapter(c).destroyAll(f,b,c)}).then(function(){return c.afterDestroy(c,h)}).then(function(){return c.notify&&f.emit("DS.afterDestroy",f,h),g||f.ejectAll(b)})["catch"](function(a){return c&&c.eagerEject&&g&&f.inject(g,{notify:!1}),e.Promise.reject(a)})}b["default"]=d},function(a,b,c){function d(a,b,c){var d=this,e=d.utils,f=d.defs[a],g=d.s[a];return new e.Promise(function(h,i){f?e._sn(b)?(c=e._(f,c),c.params&&(c.params=e.copy(c.params)),(c.bypassCache||!c.cacheResponse)&&delete g.completedQueries[b],(!c.findStrictCache||b in g.completedQueries)&&f.get(b)&&!c.bypassCache?h(f.get(b)):(delete g.completedQueries[b],h())):i(e._snErr("id")):i(new d.errors.NER(a))}).then(function(a){if(a)return a;if(!(b in g.pendingQueries)){var d=void 0,h=c.findStrategy||c.strategy;"fallback"===h?!function(){var a=function(d){return f.getAdapter((c.findFallbackAdapters||c.fallbackAdapters)[d]).find(f,b,c)["catch"](function(b){return d++,d<c.fallbackAdapters.length?a(d):e.Promise.reject(b)})};d=a(0)}():d=f.getAdapter(c).find(f,b,c),g.pendingQueries[b]=d.then(function(a){if(delete g.pendingQueries[b],c.cacheResponse){var d=f.inject(a,c.orig());return g.completedQueries[b]=(new Date).getTime(),g.saved[b]=e.updateTimestamp(g.saved[b]),d}return f.createInstance(a,c.orig())})}return g.pendingQueries[b]})["catch"](function(a){return g&&delete g.pendingQueries[b],e.Promise.reject(a)})}b["default"]=d},function(a,b,c){function d(a,b,c,d){var e=this,f=e.utils,g=e.defs[b],h=e.s[b],i=e.defs[b].idAttribute,j=(new Date).getTime();a=a||[],delete h.pendingQueries[c],h.completedQueries[c]=j,h.collectionModified=f.updateTimestamp(h.collectionModified);var k=g.inject(a,d.orig());return f._a(k)?f.forEach(k,function(a){if(a){var b=a[i];b&&(h.completedQueries[b]=j,h.saved[b]=f.updateTimestamp(h.saved[b]))}}):(d.errorFn("response is expected to be an array!"),h.completedQueries[k[i]]=j),k}function e(a,b,c){var e=this,f=e.utils,g=e.defs[a],h=e.s[a],i=void 0;return new f.Promise(function(d,j){b=b||{},e.defs[a]?f._o(b)?(c=f._(g,c),i=f.toJson(b),c.params&&(c.params=f.copy(c.params)),(c.bypassCache||!c.cacheResponse)&&(delete h.completedQueries[i],delete h.queryData[i]),i in h.completedQueries?d(c.useFilter?g.filter(b,c.orig()):h.queryData[i]):d()):j(f._oErr("params")):j(new e.errors.NER(a))}).then(function(j){if(i in h.completedQueries)return j;if(!(i in h.pendingQueries)){var k=void 0,l=c.findAllStrategy||c.strategy;"fallback"===l?!function(){var a=function(d){return g.getAdapter((c.findAllFallbackAdapters||c.fallbackAdapters)[d]).findAll(g,b,c)["catch"](function(b){return d++,d<c.fallbackAdapters.length?a(d):f.Promise.reject(b)})};k=a(0)}():k=g.getAdapter(c).findAll(g,b,c),h.pendingQueries[i]=k.then(function(b){return delete h.pendingQueries[i],c.cacheResponse?(h.queryData[i]=d.call(e,b,a,i,c),h.queryData[i].$$injected=!0,h.queryData[i]):(f.forEach(b,function(a,d){b[d]=g.createInstance(a,c.orig())}),b)})}return h.pendingQueries[i]})["catch"](function(a){return h&&delete h.pendingQueries[i],f.Promise.reject(a)})}b["default"]=e},function(a,b,c){function d(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0})}function e(a,b,c,e){var f=this,g=f.utils,h=f.errors,i=f.defs[a];return new g.Promise(function(f,j){g._sn(b)&&(b=i.get(b)),g._s(c)&&(c=[c]),i?g._o(b)?g._a(c)?!function(){var a=(g._(i,e),[]);g.forEach(i.relationList,function(f){var h=f.relation,j=i.getResource(h),k=g._(j,e);if(g.contains(c,h)||g.contains(c,f.localField)){var l=void 0,m={};k.allowSimpleWhere?m[f.foreignKey]=b[i.idAttribute]:(m.where={},m.where[f.foreignKey]={"==":b[i.idAttribute]}),"hasMany"===f.type?(f.localKeys&&(delete m[f.foreignKey],m.where=d({},j.idAttribute,{"in":b[f.localKeys]})),l=j.findAll(m,k.orig())):"hasOne"===f.type?f.localKey&&b[f.localKey]?l=j.find(b[f.localKey],k.orig()):f.foreignKey&&(l=j.findAll(m,k.orig()).then(function(a){return a.length?a[0]:null})):b[f.localKey]&&(l=j.find(b[f.localKey],k.orig())),l&&a.push(l)}}),f(a)}():j(new h.IA('"relations" must be a string or an array!')):j(new h.IA('"instance(id)" must be a string, number or object!')):j(new h.NER(a))}).then(function(a){return g.Promise.all(a)}).then(function(){return b})}b["default"]=e},function(a,b,c){function d(a,b){var c=this,d=c.utils,e=c.defs[a],f=c.s[a];return new d.Promise(function(g,h){if(e){b=d._(e,b),b.hasOwnProperty("notify")||(b.notify=!1);for(var i=[],j=(new Date).getTime(),k=void 0;(k=f.expiresHeap.peek())&&k.expires<j;)i.push(k.item),delete k.item,f.expiresHeap.pop();g(i)}else h(new c.errors.NER(a))}).then(function(a){if(a.length&&(e.beforeReap(b,a),b.notify&&e.emit("DS.beforeReap",e,a)),"inject"===b.reapAction)!function(){var b=(new Date).getTime();d.forEach(a,function(a){f.expiresHeap.push({item:a,timestamp:b,expires:e.maxAge?b+e.maxAge:Number.MAX_VALUE})})}();else if("eject"===b.reapAction)d.forEach(a,function(a){e.eject(a[e.idAttribute])});else if("refresh"===b.reapAction){var c=function(){var b=[];return d.forEach(a,function(a){b.push(e.refresh(a[e.idAttribute]))}),{v:d.Promise.all(b)}}();if("object"==typeof c)return c.v}return a}).then(function(a){return a.length&&(e.afterReap(b,a),b.notify&&e.emit("DS.afterReap",e,a)),a})}b["default"]=d},function(a,b,c){function d(a,b,c){var d=this,e=d.utils,f=d.errors,g=d.defs[a],h=d.s[a],i=void 0,j=void 0;return new e.Promise(function(d,h){b=e.resolveId(g,b),g?e._sn(b)?g.get(b)?(i=g.get(b),c=e._(g,c),d(i)):h(new f.R('id "'+b+'" not found in cache!')):h(e._snErr("id")):h(new f.NER(a))}).then(function(a){return c.beforeValidate.call(a,c,a)}).then(function(a){return c.validate.call(a,c,a)}).then(function(a){return c.afterValidate.call(a,c,a)}).then(function(a){return c.beforeUpdate.call(a,c,a)}).then(function(a){if(c.notify&&g.emit("DS.beforeUpdate",g,a),c.changesOnly){e.w&&h.observers[b].deliver();var d=[],f=g.changes(b);for(var i in f.added)d.push(i);for(i in f.changed)d.push(i);if(f=e.pick(a,d),e.isEmpty(f))return j=!0,a;a=f}return g.getAdapter(c).update(g,b,a,c)}).then(function(a){return c.afterUpdate.call(a,c,a)}).then(function(a){if(c.notify&&g.emit("DS.afterUpdate",g,a),j)return a;if(c.cacheResponse){var b=g.inject(a,c.orig()),d=b[g.idAttribute];return h.saved[d]=e.updateTimestamp(h.saved[d]),g.resetHistoryOnInject||(h.previousAttributes[d]=e.copy(b,null,null,null,g.relationFields)),b}return g.createInstance(a,c.orig())})}b["default"]=d},function(a,b,c){function d(a,b,c,d){var e=this,f=e.utils,g=e.errors,h=e.defs[a];return new f.Promise(function(e,i){b=f.resolveId(h,b),h?f._sn(b)?(d=f._(h,d),e(c)):i(f._snErr("id")):i(new g.NER(a))}).then(function(a){return d.beforeValidate.call(a,d,a)}).then(function(a){return d.validate.call(a,d,a)}).then(function(a){return d.afterValidate.call(a,d,a)}).then(function(a){return d.beforeUpdate.call(a,d,a)}).then(function(a){return d.notify&&h.emit("DS.beforeUpdate",h,a),h.getAdapter(d).update(h,b,a,d)}).then(function(a){return d.afterUpdate.call(a,d,a)}).then(function(b){if(d.notify&&h.emit("DS.afterUpdate",h,b),d.cacheResponse){var c=h.inject(b,d.orig()),g=e.s[a],i=c[h.idAttribute];return g.saved[i]=f.updateTimestamp(g.saved[i]),h.resetHistoryOnInject||(g.previousAttributes[i]=f.copy(c,null,null,null,h.relationFields)),c}return h.createInstance(b,d.orig())})}b["default"]=d},function(a,b,c){function d(a,b,c,d){var e=this,f=e.utils,g=e.errors,h=e.defs[a];return new f.Promise(function(c,e){h?(d=f._(h,d),c(b)):e(new g.NER(a))}).then(function(a){return d.beforeValidate.call(a,d,a)}).then(function(a){return d.validate.call(a,d,a)}).then(function(a){return d.afterValidate.call(a,d,a)}).then(function(a){return d.beforeUpdate.call(a,d,a)}).then(function(a){return d.notify&&h.emit("DS.beforeUpdate",h,a),h.getAdapter(d).updateAll(h,a,c,d)}).then(function(a){return d.afterUpdate.call(a,d,a)}).then(function(c){d.notify&&h.emit("DS.afterUpdate",h,b);var g=d.orig();if(d.cacheResponse){var i=function(){var b=h.inject(c,g),d=e.s[a];return f.forEach(b,function(a){var b=a[h.idAttribute];d.saved[b]=f.updateTimestamp(d.saved[b]),h.resetHistoryOnInject||(d.previousAttributes[b]=f.copy(a,null,null,null,h.relationFields))}),{v:b}}();if("object"==typeof i)return i.v}else{var j=function(){var a=[];return f.forEach(c,function(b){a.push(h.createInstance(b,g))}),{v:a}}();if("object"==typeof j)return j.v}})}b["default"]=d},function(a,b,c){function d(a){return a=e(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 e=c(31);a.exports=d},function(a,b,c){function d(a){return a=e(a),a.replace(f,"")}var e=c(31),f=/[^\x20\x2D0-9A-Z\x5Fa-z\xC0-\xD6\xD8-\xF6\xF8-\xFF]/g;a.exports=d},function(a,b,c){function d(a){return a=e(a),a.toLowerCase()}var e=c(31);a.exports=d}])});
})}),"function"==typeof Object.freeze&&(Object.freeze(def.relations),Object.freeze(def.relationList))),def.getResource=function(a){return _this.defs[a]},def.getEndpoint=function(a,b){b=b||{},b.params=b.params||{};var c=void 0,d=def.parentKey,e=b.hasOwnProperty("endpoint")?b.endpoint:def.endpoint,f=def.parentField,g=definitions[def.parent],h=b.params[d];if(h===!1||!d||!g)return h===!1&&delete b.params[d],e;if(delete b.params[d],_utils["default"]._sn(a)?c=def.get(a):_utils["default"]._o(a)&&(c=a),c&&(h=h||c[d]||(c[f]?c[f][g.idAttribute]:null)),!h)return e;var i=function(){delete b.endpoint;var a={};return _utils["default"].forOwn(b,function(b,c){a[c]=b}),{v:_utils["default"].makePath(g.getEndpoint(h,_utils["default"]._(g,a)),h,e)}}();return"object"==typeof i?i.v:void 0},_class=def["class"]=_utils["default"].pascalCase(def.name);try{"function"==typeof def.useClass?(eval("function "+_class+"() { def.useClass.call(this); }"),def[_class]=eval(_class),def[_class].prototype=function(a){function b(){}return b.prototype=a,new b}(def.useClass.prototype)):(eval("function "+_class+"() {}"),def[_class]=eval(_class))}catch(e){def[_class]=function(){}}_utils["default"].forOwn(def.methods,function(a,b){def[_class].prototype[b]=a}),def[_class].prototype.set=function(a,b){var c=this;return _utils["default"].set(this,a,b),def.compute(this),def.instanceEvents&&setTimeout(function(){c.emit("DS.change",def,c)},0),def.handleChange(this),this},def[_class].prototype.get=function(a){return _utils["default"].get(this,a)},def.instanceEvents&&_utils["default"].Events(def[_class].prototype),_utils["default"].applyRelationGettersToTarget(_this,def,def[_class].prototype),_utils["default"].forOwn(def.computed,function(a,b){_utils["default"].isFunction(a)&&(def.computed[b]=[a],a=def.computed[b]),def.methods&&b in def.methods&&def.errorFn('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&&def.errorFn("Use the computed property array syntax for compatibility with minified code!")}c=a.slice(0,a.length-1),_utils["default"].forEach(c,function(a,b){c[b]=a.trim()}),a.deps=_utils["default"].filter(c,function(a){return!!a})}),_utils["default"].forEach(instanceMethods,function(a){def[_class].prototype["DS"+_utils["default"].pascalCase(a)]=function(){for(var b=arguments.length,c=Array(b),d=0;b>d;d++)c[d]=arguments[d];return c.unshift(this[def.idAttribute]||this),c.unshift(def.name),_this[a].apply(_this,c)}}),def[_class].prototype.DSCreate=function(){for(var a=arguments.length,b=Array(a),c=0;a>c;c++)b[c]=arguments[c];return b.unshift(this),b.unshift(def.name),_this.create.apply(_this,b)},_this.s[def.name]={collection:[],expiresHeap:new _utils["default"].BinaryHeap(function(a){return a.expires},function(a,b){return a.item===b}),completedQueries:{},queryData:{},pendingQueries:{},index:{},modified:{},saved:{},previousAttributes:{},observers:{},changeHistories:{},changeHistory:[],collectionModified:0};var resource=_this.s[def.name];def.reapInterval&&setInterval(function(){return def.reap()},def.reapInterval);var fns=["registerAdapter","getAdapter","is"];for(key in _this)"function"==typeof _this[key]&&fns.push(key);_utils["default"].forEach(fns,function(a){var b=a;_this[b].shorthand!==!1?(def[b]=function(){for(var a=arguments.length,c=Array(a),d=0;a>d;d++)c[d]=arguments[d];return c.unshift(def.name),_this[b].apply(_this,c)},def[b].before=function(a){var c=def[b];def[b]=function(){for(var b=arguments.length,d=Array(b),e=0;b>e;e++)d[e]=arguments[e];return c.apply(def,a.apply(def,d)||d)}}):def[b]=function(){for(var a=arguments.length,c=Array(a),d=0;a>d;d++)c[d]=arguments[d];return _this[b].apply(_this,c)}}),def.beforeValidate=_utils["default"].promisify(def.beforeValidate),def.validate=_utils["default"].promisify(def.validate),def.afterValidate=_utils["default"].promisify(def.afterValidate),def.beforeCreate=_utils["default"].promisify(def.beforeCreate),def.afterCreate=_utils["default"].promisify(def.afterCreate),def.beforeUpdate=_utils["default"].promisify(def.beforeUpdate),def.afterUpdate=_utils["default"].promisify(def.afterUpdate),def.beforeDestroy=_utils["default"].promisify(def.beforeDestroy),def.afterDestroy=_utils["default"].promisify(def.afterDestroy);var defaultAdapter=void 0;return def.hasOwnProperty("defaultAdapter")&&(defaultAdapter=def.defaultAdapter),_utils["default"].forOwn(def.actions,function(a,b){if(def[b]&&!def.actions[b])throw new Error('Cannot override existing method "'+b+'"!');a.request=a.request||function(a){return a},a.response=a.response||function(a){return a},a.responseError=a.responseError||function(a){return _utils["default"].Promise.reject(a)},def[b]=function(c,d){_utils["default"]._o(c)&&(d=c),d=d||{};var e=def.getAdapter(a.adapter||defaultAdapter||"http"),f=_utils["default"].deepMixIn({},a);if(!d.hasOwnProperty("endpoint")&&f.endpoint&&(d.endpoint=f.endpoint),"function"==typeof d.getEndpoint)f.url=d.getEndpoint(def,d);else{var g=[d.basePath||e.defaults.basePath||def.basePath,def.getEndpoint(_utils["default"]._sn(c)?c:null,d)];_utils["default"]._sn(c)&&g.push(c),g.push(a.pathname||b),f.url=_utils["default"].makePath.apply(null,g)}return f.method=f.method||"GET",_utils["default"].deepMixIn(f,d),new _utils["default"].Promise(function(a){return a(f)}).then(d.request||a.request).then(function(a){return e.HTTP(a)}).then(d.response||a.response,d.responseError||a.responseError)}}),_utils["default"].Events(def),def.handleChange=function(a){resource.collectionModified=_utils["default"].updateTimestamp(resource.collectionModified),def.notify&&setTimeout(function(){def.emit("DS.change",def,a)},0)},{v:def}}();if("object"==typeof _ret)return _ret.v}catch(err){throw delete definitions[definition.name],delete _this.s[definition.name],err}}exports["default"]=defineResource;var _utils=__webpack_require__(2),_errors=__webpack_require__(3),instanceMethods=["compute","eject","refresh","save","update","destroy","loadRelations","changeHistory","changes","hasChanges","lastModified","lastSaved","previous"]},function(a,b,c){function d(a,b,c){var d=this,e=d.utils,f=d.defs[a],g=d.s[a],h=void 0,i=!1;if(b=e.resolveId(f,b),!f)throw new d.errors.NER(a);if(!e._sn(b))throw e._snErr("id");c=e._(f,c);for(var j=0;j<g.collection.length;j++)if(g.collection[j][f.idAttribute]==b){h=g.collection[j],g.expiresHeap.remove(h),i=!0;break}if(i){var k=function(){f.beforeEject(c,h),c.notify&&f.emit("DS.beforeEject",f,h);var a=[];return e.forOwn(g.queryData,function(b,d){b.$$injected&&e.remove(b,h),!b.length&&c.clearEmptyQueries&&a.push(d)}),e.forEach(g.changeHistories[b],function(a){e.remove(g.changeHistory,a)}),e.forEach(a,function(a){delete g.completedQueries[a],delete g.queryData[a]}),e.w&&g.observers[b].close(),delete g.observers[b],delete g.index[b],delete g.previousAttributes[b],delete g.completedQueries[b],delete g.pendingQueries[b],delete g.changeHistories[b],delete g.modified[b],delete g.saved[b],g.collection.splice(j,1),f.handleChange(h),f.afterEject(c,h),c.notify&&f.emit("DS.afterEject",f,h),{v:h}}();if("object"==typeof k)return k.v}}b["default"]=d},function(a,b,c){function d(a,b,c){var d=this,e=d.utils,f=d.defs[a];if(b=b||{},!f)throw new d.errors.NER(a);if(!e._o(b))throw e._oErr("params");var g=d.s[a],h=e.toJson(b),i=f.filter(b),j=[];return e.isEmpty(b)?g.completedQueries={}:delete g.completedQueries[h],e.forEach(i,function(a){a&&a[f.idAttribute]&&j.push(a[f.idAttribute])}),e.forEach(j,function(a){f.eject(a,c)}),f.handleChange(i),i}b["default"]=d},function(a,b,c){function d(a,b,c){var d=this,e=d.utils,f=d.defs[a];if(!f)throw new d.errors.NER(a);if(b&&!e._o(b))throw e._oErr("params");return b=b||{},c=e._(f,c),f.defaultFilter.call(d,d.s[a].collection,a,b,c)}b["default"]=d},function(a,b,c){function d(a,b){var c=this,d=a.name;return function(e,f,h,i,j){var k=this,l=void 0,m=i&&i(a.idAttribute)?i(a.idAttribute):k[a.idAttribute];if(g["default"].forEach(a.relationFields,function(a){delete e[a],delete f[a],delete h[a]}),(!g["default"].isEmpty(e)||!g["default"].isEmpty(f)||!g["default"].isEmpty(h)||j)&&(l=c.get(d,m),b.modified[m]=g["default"].updateTimestamp(b.modified[m]),l&&a.instanceEvents&&setTimeout(function(){l.emit("DS.change",a,l)},0),a.handleChange(l),a.keepChangeHistory)){var n={resourceName:d,target:l,added:e,removed:f,changed:h,timestamp:b.modified[m]};b.changeHistories[m].push(n),b.changeHistory.push(n)}a.computed&&(l=l||c.get(d,m),g["default"].forOwn(a.computed,function(a,b){var c=!1;g["default"].forEach(a.deps,function(a){(a in e||a in f||a in h||!(b in l))&&(c=!0)}),c=c||!a.deps.length,c&&g["default"].compute.call(l,a,b)})),a.idAttribute in h&&a.errorFn('Doh! You just changed the primary key of an object! Your data for the "'+d+'" resource is now in an undefined (probably broken) state.')}}function e(a,b,c,f){var i=this,j=void 0;if(g["default"]._a(c)){j=[];for(var k=0;k<c.length;k++)j.push(e.call(i,a,b,c[k],f))}else{var l=d.call(i,a,b),m=a.computed,n=a.idAttribute;if(m&&m[n]&&!function(){var a=[];g["default"].forEach(m[n].deps,function(b){a.push(c[b])}),c[n]=m[n][m[n].length-1].apply(c,a)}(),!(n in c)){var o=new h["default"].R(""+a.name+'.inject: "attrs" must contain the property specified by "idAttribute"!');throw f.errorFn(o),o}try{g["default"].forEach(a.relationList,function(b){var d=b.relation,e=i.defs[d],j=c[b.localField];if(j){if(!e)throw new h["default"].R(""+a.name+" relation is defined but the resource is not!");if(g["default"]._a(j))!function(){var h=[];g["default"].forEach(j,function(g){if(g!==i.s[d].index[g[e.idAttribute]])try{var j=e.inject(g,f.orig());b.foreignKey&&(j[b.foreignKey]=c[a.idAttribute]),h.push(j)}catch(k){f.errorFn(k,"Failed to inject "+b.type+' relation: "'+d+'"!')}})}();else if(j!==i.s[d].index[j[e.idAttribute]])try{var k=e.inject(c[b.localField],f.orig());b.foreignKey&&(k[b.foreignKey]=c[a.idAttribute])}catch(l){f.errorFn(l,"Failed to inject "+b.type+' relation: "'+d+'"!')}}});var p=c[n],q=a.get(p),r=q?b.modified[p]:0;q?(g["default"].deepMixIn(q,c),a.resetHistoryOnInject&&(b.previousAttributes[p]=g["default"].copy(q,null,null,null,a.relationFields),b.changeHistories[p].length&&(g["default"].forEach(b.changeHistories[p],function(a){g["default"].remove(b.changeHistory,a)}),b.changeHistories[p].splice(0,b.changeHistories[p].length))),g["default"].w&&b.observers[p].deliver()):(q=c instanceof a[a["class"]]?c:new a[a["class"]],g["default"].forEach(a.relationList,function(a){delete c[a.localField]}),g["default"].deepMixIn(q,c),b.collection.push(q),b.changeHistories[p]=[],g["default"].w&&(b.observers[p]=new i.observe.ObjectObserver(q),b.observers[p].open(l,q)),b.index[p]=q,l.call(q,{},{},{},null,!0),b.previousAttributes[p]=g["default"].copy(q,null,null,null,a.relationFields)),b.modified[p]=r&&b.modified[p]===r?g["default"].updateTimestamp(b.modified[p]):b.modified[p],b.expiresHeap.remove(q);var s=(new Date).getTime();b.expiresHeap.push({item:q,timestamp:s,expires:a.maxAge?s+a.maxAge:Number.MAX_VALUE}),j=q}catch(t){f.errorFn(t,c)}}return j}function f(a,b,c){var d=this,f=d.defs[a],i=d.s[a],j=void 0;if(!f)throw new h["default"].NER(a);if(!g["default"]._o(b)&&!g["default"]._a(b))throw new h["default"].IA(""+a+'.inject: "attrs" must be an object or an array!');return c=g["default"]._(f,c),c.beforeInject(c,b),c.notify&&f.emit("DS.beforeInject",f,b),j=e.call(d,f,i,b,c),f.handleChange(j),c.afterInject(c,j),c.notify&&f.emit("DS.afterInject",f,j),j}b["default"]=f;var g=c(2),h=c(3)},function(a,b,c){function d(a,b){return b?(e(b.split("."),function(b){a[b]||(a[b]={}),a=a[b]}),a):a}var e=c(8);a.exports=d},function(a,b,c){function d(a){return null==a?"":a.toString()}a.exports=d},function(a,b,c){function d(a){return a=e(a),a=f(a),a=g(a).replace(/[\-_]/g," ").replace(/\s[a-z]/g,h).replace(/\s+/g,"").replace(/^[A-Z]/g,i)}var e=c(31),f=c(43),g=c(44),h=c(19),i=c(45);a.exports=d},function(a,b,c){function d(a,b,c){var d=this,e=d.utils,f=d.defs[a];c=c||{},b=b||{};var g=void 0;if(f)if(e._o(b)){if(c=e._(f,c),c.upsert&&e._sn(b[f.idAttribute]))return d.update(a,b[f.idAttribute],b,c)}else g=e._oErr("attrs");else g=new d.errors.NER(a);return new e.Promise(function(a,c){g?c(g):a(b)}).then(function(a){return c.beforeValidate.call(a,c,a)}).then(function(a){return c.validate.call(a,c,a)}).then(function(a){return c.afterValidate.call(a,c,a)}).then(function(a){return c.beforeCreate.call(a,c,a)}).then(function(a){return c.notify&&f.emit("DS.beforeCreate",f,a),d.getAdapter(c).create(f,a,c)}).then(function(a){return c.afterCreate.call(a,c,a)}).then(function(b){if(c.notify&&f.emit("DS.afterCreate",f,b),c.cacheResponse){var g=d.inject(f.name,b,c.orig()),h=g[f.idAttribute],i=d.s[a];return i.completedQueries[h]=(new Date).getTime(),i.saved[h]=e.updateTimestamp(i.saved[h]),g}return d.createInstance(a,b,c)})}b["default"]=d},function(a,b,c){function d(a,b,c){var d=this,e=d.utils,f=d.defs[a],g=void 0;return new e.Promise(function(h,i){b=e.resolveId(f,b),f?e._sn(b)?(g=f.get(b)||{id:b},c=e._(f,c),h(g)):i(e._snErr("id")):i(new d.errors.NER(a))}).then(function(a){return c.beforeDestroy.call(a,c,a)}).then(function(a){return c.notify&&f.emit("DS.beforeDestroy",f,a),c.eagerEject&&f.eject(b),f.getAdapter(c).destroy(f,b,c)}).then(function(){return c.afterDestroy.call(g,c,g)}).then(function(a){return c.notify&&f.emit("DS.afterDestroy",f,a),f.eject(b),b})["catch"](function(a){return c&&c.eagerEject&&g&&f.inject(g,{notify:!1}),e.Promise.reject(a)})}b["default"]=d},function(a,b,c){function d(a,b,c){var d=this,e=d.utils,f=d.defs[a],g=void 0,h=void 0;return b=b||{},new e.Promise(function(g,h){f?e._o(b)?(c=e._(f,c),g()):h(e._oErr("attrs")):h(new d.errors.NER(a))}).then(function(){return h=f.defaultFilter.call(d,a,b),c.beforeDestroy(c,h)}).then(function(){return c.notify&&f.emit("DS.beforeDestroy",f,h),c.eagerEject&&(g=f.ejectAll(b)),f.getAdapter(c).destroyAll(f,b,c)}).then(function(){return c.afterDestroy(c,h)}).then(function(){return c.notify&&f.emit("DS.afterDestroy",f,h),g||f.ejectAll(b)})["catch"](function(a){return c&&c.eagerEject&&g&&f.inject(g,{notify:!1}),e.Promise.reject(a)})}b["default"]=d},function(a,b,c){function d(a,b,c){var d=this,e=d.utils,f=d.defs[a],g=d.s[a];return new e.Promise(function(h,i){f?e._sn(b)?(c=e._(f,c),c.params&&(c.params=e.copy(c.params)),(c.bypassCache||!c.cacheResponse)&&delete g.completedQueries[b],(!c.findStrictCache||b in g.completedQueries)&&f.get(b)&&!c.bypassCache?h(f.get(b)):(delete g.completedQueries[b],h())):i(e._snErr("id")):i(new d.errors.NER(a))}).then(function(a){if(a)return a;if(!(b in g.pendingQueries)){var d=void 0,h=c.findStrategy||c.strategy;"fallback"===h?!function(){var a=function(d){return f.getAdapter((c.findFallbackAdapters||c.fallbackAdapters)[d]).find(f,b,c)["catch"](function(b){return d++,d<c.fallbackAdapters.length?a(d):e.Promise.reject(b)})};d=a(0)}():d=f.getAdapter(c).find(f,b,c),g.pendingQueries[b]=d.then(function(a){if(delete g.pendingQueries[b],c.cacheResponse){var d=f.inject(a,c.orig());return g.completedQueries[b]=(new Date).getTime(),g.saved[b]=e.updateTimestamp(g.saved[b]),d}return f.createInstance(a,c.orig())})}return g.pendingQueries[b]})["catch"](function(a){return g&&delete g.pendingQueries[b],e.Promise.reject(a)})}b["default"]=d},function(a,b,c){function d(a,b,c,d){var e=this,f=e.utils,g=e.defs[b],h=e.s[b],i=e.defs[b].idAttribute,j=(new Date).getTime();a=a||[],delete h.pendingQueries[c],h.completedQueries[c]=j;var k=g.inject(a,d.orig());return f._a(k)?f.forEach(k,function(a){if(a){var b=a[i];b&&(h.completedQueries[b]=j,h.saved[b]=f.updateTimestamp(h.saved[b]))}}):(d.errorFn("response is expected to be an array!"),h.completedQueries[k[i]]=j),k}function e(a,b,c){var e=this,f=e.utils,g=e.defs[a],h=e.s[a],i=void 0;return new f.Promise(function(d,j){b=b||{},e.defs[a]?f._o(b)?(c=f._(g,c),i=f.toJson(b),c.params&&(c.params=f.copy(c.params)),(c.bypassCache||!c.cacheResponse)&&(delete h.completedQueries[i],delete h.queryData[i]),i in h.completedQueries?d(c.useFilter?g.filter(b,c.orig()):h.queryData[i]):d()):j(f._oErr("params")):j(new e.errors.NER(a))}).then(function(j){if(i in h.completedQueries)return j;if(!(i in h.pendingQueries)){var k=void 0,l=c.findAllStrategy||c.strategy;"fallback"===l?!function(){var a=function(d){return g.getAdapter((c.findAllFallbackAdapters||c.fallbackAdapters)[d]).findAll(g,b,c)["catch"](function(b){return d++,d<c.fallbackAdapters.length?a(d):f.Promise.reject(b)})};k=a(0)}():k=g.getAdapter(c).findAll(g,b,c),h.pendingQueries[i]=k.then(function(b){return delete h.pendingQueries[i],c.cacheResponse?(h.queryData[i]=d.call(e,b,a,i,c),h.queryData[i].$$injected=!0,h.queryData[i]):(f.forEach(b,function(a,d){b[d]=g.createInstance(a,c.orig())}),b)})}return h.pendingQueries[i]})["catch"](function(a){return h&&delete h.pendingQueries[i],f.Promise.reject(a)})}b["default"]=e},function(a,b,c){function d(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0})}function e(a,b,c,e){var f=this,g=f.utils,h=f.errors,i=f.defs[a];return new g.Promise(function(f,j){g._sn(b)&&(b=i.get(b)),g._s(c)&&(c=[c]),i?g._o(b)?g._a(c)?!function(){var a=(g._(i,e),[]);g.forEach(i.relationList,function(f){var h=f.relation,j=i.getResource(h),k=g._(j,e);if(g.contains(c,h)||g.contains(c,f.localField)){var l=void 0,m={};k.allowSimpleWhere?m[f.foreignKey]=b[i.idAttribute]:(m.where={},m.where[f.foreignKey]={"==":b[i.idAttribute]}),"hasMany"===f.type?(f.localKeys&&(delete m[f.foreignKey],m.where=d({},j.idAttribute,{"in":b[f.localKeys]})),l=j.findAll(m,k.orig())):"hasOne"===f.type?f.localKey&&b[f.localKey]?l=j.find(b[f.localKey],k.orig()):f.foreignKey&&(l=j.findAll(m,k.orig()).then(function(a){return a.length?a[0]:null})):b[f.localKey]&&(l=j.find(b[f.localKey],k.orig())),l&&a.push(l)}}),f(a)}():j(new h.IA('"relations" must be a string or an array!')):j(new h.IA('"instance(id)" must be a string, number or object!')):j(new h.NER(a))}).then(function(a){return g.Promise.all(a)}).then(function(){return b})}b["default"]=e},function(a,b,c){function d(a,b){var c=this,d=c.utils,e=c.defs[a],f=c.s[a];return new d.Promise(function(g,h){if(e){b=d._(e,b),b.hasOwnProperty("notify")||(b.notify=!1);for(var i=[],j=(new Date).getTime(),k=void 0;(k=f.expiresHeap.peek())&&k.expires<j;)i.push(k.item),delete k.item,f.expiresHeap.pop();g(i)}else h(new c.errors.NER(a))}).then(function(a){if(a.length&&(e.beforeReap(b,a),b.notify&&e.emit("DS.beforeReap",e,a)),"inject"===b.reapAction)!function(){var b=(new Date).getTime();d.forEach(a,function(a){f.expiresHeap.push({item:a,timestamp:b,expires:e.maxAge?b+e.maxAge:Number.MAX_VALUE})})}();else if("eject"===b.reapAction)d.forEach(a,function(a){e.eject(a[e.idAttribute])});else if("refresh"===b.reapAction){var c=function(){var b=[];return d.forEach(a,function(a){b.push(e.refresh(a[e.idAttribute]))}),{v:d.Promise.all(b)}}();if("object"==typeof c)return c.v}return a}).then(function(a){return a.length&&(e.afterReap(b,a),b.notify&&e.emit("DS.afterReap",e,a)),a})}b["default"]=d},function(a,b,c){function d(a,b,c){var d=this,e=d.utils,f=d.errors,g=d.defs[a],h=d.s[a],i=void 0,j=void 0;return new e.Promise(function(d,h){b=e.resolveId(g,b),g?e._sn(b)?g.get(b)?(i=g.get(b),c=e._(g,c),d(i)):h(new f.R('id "'+b+'" not found in cache!')):h(e._snErr("id")):h(new f.NER(a))}).then(function(a){return c.beforeValidate.call(a,c,a)}).then(function(a){return c.validate.call(a,c,a)}).then(function(a){return c.afterValidate.call(a,c,a)}).then(function(a){return c.beforeUpdate.call(a,c,a)}).then(function(a){if(c.notify&&g.emit("DS.beforeUpdate",g,a),c.changesOnly){e.w&&h.observers[b].deliver();var d=[],f=g.changes(b);for(var i in f.added)d.push(i);for(i in f.changed)d.push(i);if(f=e.pick(a,d),e.isEmpty(f))return j=!0,a;a=f}return g.getAdapter(c).update(g,b,a,c)}).then(function(a){return c.afterUpdate.call(a,c,a)}).then(function(a){if(c.notify&&g.emit("DS.afterUpdate",g,a),j)return a;if(c.cacheResponse){var b=g.inject(a,c.orig()),d=b[g.idAttribute];return h.saved[d]=e.updateTimestamp(h.saved[d]),g.resetHistoryOnInject||(h.previousAttributes[d]=e.copy(b,null,null,null,g.relationFields)),b}return g.createInstance(a,c.orig())})}b["default"]=d},function(a,b,c){function d(a,b,c,d){var e=this,f=e.utils,g=e.errors,h=e.defs[a];return new f.Promise(function(e,i){b=f.resolveId(h,b),h?f._sn(b)?(d=f._(h,d),e(c)):i(f._snErr("id")):i(new g.NER(a))}).then(function(a){return d.beforeValidate.call(a,d,a)}).then(function(a){return d.validate.call(a,d,a)}).then(function(a){return d.afterValidate.call(a,d,a)}).then(function(a){return d.beforeUpdate.call(a,d,a)}).then(function(a){return d.notify&&h.emit("DS.beforeUpdate",h,a),h.getAdapter(d).update(h,b,a,d)}).then(function(a){return d.afterUpdate.call(a,d,a)}).then(function(b){if(d.notify&&h.emit("DS.afterUpdate",h,b),d.cacheResponse){var c=h.inject(b,d.orig()),g=e.s[a],i=c[h.idAttribute];return g.saved[i]=f.updateTimestamp(g.saved[i]),h.resetHistoryOnInject||(g.previousAttributes[i]=f.copy(c,null,null,null,h.relationFields)),c}return h.createInstance(b,d.orig())})}b["default"]=d},function(a,b,c){function d(a,b,c,d){var e=this,f=e.utils,g=e.errors,h=e.defs[a];return new f.Promise(function(c,e){h?(d=f._(h,d),c(b)):e(new g.NER(a))}).then(function(a){return d.beforeValidate.call(a,d,a)}).then(function(a){return d.validate.call(a,d,a)}).then(function(a){return d.afterValidate.call(a,d,a)}).then(function(a){return d.beforeUpdate.call(a,d,a)}).then(function(a){return d.notify&&h.emit("DS.beforeUpdate",h,a),h.getAdapter(d).updateAll(h,a,c,d)}).then(function(a){return d.afterUpdate.call(a,d,a)}).then(function(c){d.notify&&h.emit("DS.afterUpdate",h,b);var g=d.orig();if(d.cacheResponse){var i=function(){var b=h.inject(c,g),d=e.s[a];return f.forEach(b,function(a){var b=a[h.idAttribute];d.saved[b]=f.updateTimestamp(d.saved[b]),h.resetHistoryOnInject||(d.previousAttributes[b]=f.copy(a,null,null,null,h.relationFields))}),{v:b}}();if("object"==typeof i)return i.v}else{var j=function(){var a=[];return f.forEach(c,function(b){a.push(h.createInstance(b,g))}),{v:a}}();if("object"==typeof j)return j.v}})}b["default"]=d},function(a,b,c){function d(a){return a=e(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 e=c(31);a.exports=d},function(a,b,c){function d(a){return a=e(a),a.replace(f,"")}var e=c(31),f=/[^\x20\x2D0-9A-Z\x5Fa-z\xC0-\xD6\xD8-\xF6\xF8-\xFF]/g;a.exports=d},function(a,b,c){function d(a){return a=e(a),a.toLowerCase()}var e=c(31);a.exports=d}])});
//# sourceMappingURL=js-data.min.map
{
"name": "js-data",
"description": "Robust, framework-agnostic in-memory data store.",
"version": "2.0.0-beta.7",
"version": "2.0.0-beta.8",
"homepage": "http://www.js-data.io",

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

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

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

Sorry, the diff of this file is not supported yet

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