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.8.1 to 2.8.2

5

CHANGELOG.md

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

##### 2.8.2 - 04 November 2015
###### Backwards compatible bug fixes
- #258 - CSP violations due to use of new Function()
##### 2.8.1 - 02 November 2015

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

6

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

@@ -10,4 +10,4 @@ * @copyright (c) 2014-2015 Jason Dobry

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