<commit_before><commit_msg>Update project js-data to 1.6.2<commit_after>/*!
* js-data
* @version 1.6.2 - Homepage <http://www.js-data.io/>
* @author <NAME> <<EMAIL>>
* @copyright (c) 2014-2015 <NAME>
* @license MIT <https://github.com/js-data/js-data/blob/master/LICENSE>
*
* @overview Robust framework-agnostic data store.
*/

!function(a,b){"object"==typeof exports&&"object"==typeof module?module.exports=b(require("bluebird"),function(){try{return require("js-data-schema")}catch(a){}}()):"function"==typeof define&&define.amd?define(["bluebird","js-data-schema"],b):"object"==typeof exports?exports.JSData=b(require("bluebird"),function(){try{return require("js-data-schema")}catch(a){}}()):a.JSData=b(a.bluebird,a.Schemator)}(this,function(__WEBPACK_EXTERNAL_MODULE_4__,__WEBPACK_EXTERNAL_MODULE_5__){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="",b(0)}([function(a,b,c){var d=function(a){return a&&a.__esModule?a["default"]:a},e=d(c(1)),f=d(c(2)),g=d(c(3));a.exports={DS:g,createStore:function(a){return new g(a)},DSUtils:e,DSErrors:f,version:{full:"1.6.2",major:parseInt("1",10),minor:parseInt("6",10),patch:parseInt("2",10),alpha:"false",beta:"false"}}},function(a,b,c){function d(a){var b=this.constructor;return this.then(function(c){return b.resolve(a()).then(function(){return c})},function(c){return b.resolve(a()).then(function(){throw c})})}function e(a){var b={};a=a||this,a.on=function(a,c,d){b[a]=b[a]||[],b[a].push({f:c,c:d})},a.off=function(a,c){var d=b[a];if(d)if(c){for(var e=0;e<d.length;e++)if(d[e]===c){d.splice(e,1);break}}else d.splice(0,d.length);else b={}},a.emit=function(){for(var a=arguments.length,c=Array(a),d=0;a>d;d++)c[d]=arguments[d];var e=b[c.shift()]||[];if(e)for(var f=0;f<e.length;f++)e[f].f.apply(e[f].c,c)}}var f=function(a){return a&&a.__esModule?a["default"]:a},g=f(c(2)),h=f(c(9)),i=f(c(10)),j=f(c(14)),k=f(c(11)),l=f(c(15)),m=f(c(19)),n=f(c(12)),o=f(c(16)),p=f(c(13)),q=f(c(20)),r=f(c(6)),s=f(c(21)),t=f(c(22)),u=void 0,v=void 0,w=void 0,x=Object.prototype,y=x.toString;s.polyfill();var z=Array.isArray||function(a){return"[object Array]"==y.call(a)||!1},A=function(a){return"[object RegExp]"==y.call(a)||!1},B=function(a){return a===!0||a===!1||a&&"object"==typeof a&&"[object Boolean]"==y.call(a)||!1},C=function(a){return"string"==typeof a||a&&"object"==typeof a&&"[object String]"==y.call(a)||!1},D=function(a){return"[object Object]"==y.call(a)||!1},E=function(a){return a&&"object"==typeof a&&"[object Date]"==y.call(a)||!1},F=function(a){var b=typeof a;return"number"==b||a&&"object"==b&&"[object Number]"==y.call(a)||!1},G=function(a){return"function"==typeof a||a&&"[object Function]"===y.call(a)||!1},H=function(a){return C(a)||F(a)},I=function(a){return new g.IA('"'+a+'" must be a string or a number!')},J=function(a){return new g.IA('"'+a+'" must be an object!')},K=function(a){return new g.IA('"'+a+'" must be an array!')},L=function(a){if(null==a)return!0;if("string"==typeof a||z(a))return!a.length;if("object"!=typeof a)return!0;var b=function(){var b=!0;return j(a,function(){return b=!1,!1}),{v:b}}();return"object"==typeof b?b.v:void 0},M=function(a,b){if(!a||!b)return[];for(var c=[],d=void 0,e=0,f=a.length;f>e;e++)d=a[e],w.contains(c,d)||w.contains(b,d)&&c.push(d);return c},N=function(a,b,c){var d=[];return h(a,function(a,c,e){b(a,c,e)&&d.push(a)},c),d};try{u=window,u.Promise.prototype["finally"]||(u.Promise.prototype["finally"]=d),v=u.Promise,u={}}catch(O){u=null,v=c(4)}var P=["beforeValidate","validate","afterValidate","beforeCreate","afterCreate","beforeUpdate","afterUpdate","beforeDestroy","afterDestroy"],Q=function(a,b){var c=void 0;if(!b||!b.length)return!1;for(c=0;c<b.length;c++)if(b[c]===a)return!0;return!1},R=function(a,b,c,d,e){if(b){if(a===b)throw new Error("Cannot copy! Source and destination are identical.");if(c=c||[],d=d||[],D(a)){var f=c.indexOf(a);if(-1!==f)return d[f];c.push(a),d.push(b)}var g=void 0;if(z(a)){var i=void 0;for(b.length=0,i=0;i<a.length;i++)g=R(a[i],null,c,d,e),D(a[i])&&(c.push(a[i]),d.push(g)),b.push(g)}else{z(b)?b.length=0:h(b,function(a,c){delete b[c]});for(var j in a)if(a.hasOwnProperty(j)){if(Q(j,e))continue;g=R(a[j],null,c,d,e),D(a[j])&&(c.push(a[j]),d.push(g)),b[j]=g}}}else b=a,a&&(z(a)?b=R(a,[],c,d,e):E(a)?b=new Date(a.getTime()):A(a)?(b=new RegExp(a.source,a.toString().match(/[^\/]*$/)[0]),b.lastIndex=a.lastIndex):D(a)&&(b=R(a,Object.create(Object.getPrototypeOf(a)),c,d,e)));return b},S=function(a,b){if(a===b)return!0;if(null===a||null===b)return!1;if(a!==a&&b!==b)return!0;var c,d,e,f=typeof a,g=typeof b;if(f==g&&"object"==f){if(!z(a)){if(E(a))return E(b)?S(a.getTime(),b.getTime()):!1;if(A(a)&&A(b))return a.toString()==b.toString();if(z(b))return!1;e={};for(d in a)if("$"!==d.charAt(0)&&!G(a[d])){if(!S(a[d],b[d]))return!1;e[d]=!0}for(d in b)if(!e.hasOwnProperty(d)&&"$"!==d.charAt(0)&&void 0!==b[d]&&!G(b[d]))return!1;return!0}if(!z(b))return!1;if((c=a.length)==b.length){for(d=0;c>d;d++)if(!S(a[d],b[d]))return!1;return!0}}return!1},T=function(a,b){return C(b)||F(b)?b:b&&a?b[a.idAttribute]||b:b},U=function(a,b){return a&&(C(b)||F(b))?a.index[b]||b:b},V=function(a){return null!=a&&""!==a},W=function(a,b){return b=b||"",N(a,V).join(b)},X=function(){for(var a=arguments.length,b=Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=W(b,"/");return d.replace(/([^:\/]|^)\/{2,}/g,"$1/")};w={_:function(a,b){var c=this;if(b=b||{},b&&b.constructor===a.constructor)return b;if(!D(b))throw new g.IA('"options" must be an object!');h(P,function(a){"function"==typeof b[a]&&-1===b[a].toString().indexOf("for (var _len = arg")&&(b[a]=c.promisify(b[a]))});var d=function(a){var b=this;j(a,function(a,c){b[c]=a})};return d.prototype=a,d.prototype.orig=function(){var a={};return j(this,function(b,c){a[c]=b}),a},new d(b)},_n:F,_s:C,_sn:H,_snErr:I,_o:D,_oErr:J,_a:z,_aErr:K,compute:function(a,b){var c=this,d=[];h(a.deps,function(a){d.push(c[a])}),c[b]=a[a.length-1].apply(c,d)},contains:k,copy:R,deepMixIn:l,diffObjectFromOldObject:r.diffObjectFromOldObject,BinaryHeap:t,equals:S,Events:e,filter:N,forEach:h,forOwn:j,fromJson:function(a){return C(a)?JSON.parse(a):a},get:c(17),intersection:M,isArray:z,isBoolean:B,isDate:E,isEmpty:L,isFunction:G,isObject:D,isNumber:F,isRegExp:A,isString:C,makePath:X,observe:r,pascalCase:m,pick:o,Promise:v,promisify:function(a,b){var c=this;if(a){if("function"!=typeof a)throw new Error("Can only promisify functions!");return function(){for(var d=arguments.length,e=Array(d),f=0;d>f;f++)e[f]=arguments[f];return new c.Promise(function(c,d){e.push(function(a,b){a?d(a):c(b)});try{var f=a.apply(b||this,e);f&&f.then&&f.then(c,d)}catch(g){d(g)}})}}},remove:n,set:c(18),slice:i,sort:p,toJson:JSON.stringify,updateTimestamp:function(a){var b="function"==typeof Date.now?Date.now():(new Date).getTime();return a&&a>=b?a+1:b},upperCase:q,removeCircular:function(a){var b=[];return function c(a){var d=void 0,e=void 0;if(!("object"!=typeof a||null===a||a instanceof Boolean||a instanceof Date||a instanceof Number||a instanceof RegExp||a instanceof String)){for(d=0;d<b.length;d+=1)if(b[d]===a)return void 0;if(b.push(a),w.isArray(a))for(e=[],d=0;d<a.length;d+=1)e[d]=c(a[d]);else e={},j(a,function(b,d){e[d]=c(a[d])});return e}return a}(a)},resolveItem:U,resolveId:T,w:u},a.exports=w},function(a){var b=function h(a,b,c){var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){var e=Object.getPrototypeOf(a);return null===e?void 0:h(e,b,c)}if("value"in d&&d.writable)return d.value;var f=d.get;return void 0===f?void 0:f.call(c)},c=function(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(a.__proto__=b)},d=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},e=function(a){function e(a){d(this,e),b(Object.getPrototypeOf(e.prototype),"constructor",this).call(this,this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.message=a||"Illegal Argument!"}return c(e,a),e}(Error),f=function(a){function e(a){d(this,e),b(Object.getPrototypeOf(e.prototype),"constructor",this).call(this,this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.message=a||"RuntimeError Error!"}return c(e,a),e}(Error),g=function(a){function e(a){d(this,e),b(Object.getPrototypeOf(e.prototype),"constructor",this).call(this,this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.message=""+a+" is not a registered resource!"}return c(e,a),e}(Error);a.exports={IllegalArgumentError:e,IA:e,RuntimeError:f,R:f,NonexistentResourceError:g,NER:g}},function(a,b,c){function d(a,b,c){c(null,b)}function e(a,b){return b}function f(a,b,c,d){var e=!0;a:for(;e;){e=!1;var f=a,g=b,h=c,i=d;k=l=m=void 0;var k=f[g],l=j.get(h,k[0]),m=j.get(i,k[0]);if(j._s(l)&&(l=j.upperCase(l)),j._s(m)&&(m=j.upperCase(m)),"DESC"===k[1]){if(l>m)return-1;if(m>l)return 1;if(g<f.length-1){a=f,b=g+1,c=h,d=i,e=!0;continue a}return 0}if(m>l)return-1;if(l>m)return 1;if(!(g<f.length-1))return 0;a=f,b=g+1,c=h,d=i,e=!0}}var g=function(a){return a&&a.__esModule?a["default"]:a},h=function(){function a(a,b){for(var c in b){var d=b[c];d.configurable=!0,d.value&&(d.writable=!0)}Object.defineProperties(a,b)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),i=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},j=g(c(1)),k=g(c(2)),l=g(c(7)),m=g(c(8)),n=void 0,o=function(){function a(){i(this,a)}return h(a,{errorFn:{value:function(a,b){if(this.error&&"function"==typeof this.error){try{throw"string"==typeof a?new Error(a):a}catch(c){a=c}this.error(this.name||null,a||null,b||null)}}}}),a}(),p=o.prototype;p.actions={},p.afterCreate=d,p.afterCreateInstance=e,p.afterDestroy=d,p.afterEject=e,p.afterInject=e,p.afterReap=e,p.afterUpdate=d,p.afterValidate=d,p.allowSimpleWhere=!0,p.basePath="",p.beforeCreate=d,p.beforeCreateInstance=e,p.beforeDestroy=d,p.beforeEject=e,p.beforeInject=e,p.beforeReap=e,p.beforeUpdate=d,p.beforeValidate=d,p.bypassCache=!1,p.cacheResponse=!!j.w,p.defaultAdapter="http",p.debug=!0,p.eagerEject=!1,p.eagerInject=!1,p.endpoint="",p.error=console?function(a,b,c){return console["function"==typeof console.error?"error":"log"](a,b,c)}:!1,p.fallbackAdapters=["http"],p.findBelongsTo=!0,p.findHasOne=!0,p.findHasMany=!0,p.findInverseLinks=!0,p.idAttribute="id",p.ignoredChanges=[/\$/],p.ignoreMissing=!1,p.keepChangeHistory=!1,p.loadFromServer=!1,p.log=console?function(a,b,c,d,e){return console["function"==typeof console.info?"info":"log"](a,b,c,d,e)}:!1,p.logFn=function(a,b,c,d){var e=this;e.debug&&e.log&&"function"==typeof e.log&&e.log(e.name||null,a||null,b||null,c||null,d||null)},p.maxAge=!1,p.notify=!!j.w,p.reapAction=j.w?"inject":"none",p.reapInterval=j.w?3e4:!1,p.resetHistoryOnInject=!0,p.strategy="single",p.upsert=!!j.w,p.useClass=!0,p.useFilter=!1,p.validate=d,p.defaultFilter=function(a,b,c,d){var e=a,g=null,h={skip:"",offset:"",where:"",limit:"",orderBy:"",sort:""};c=c||{},d=d||{},g=j._o(c.where)?c.where:{},d.allowSimpleWhere&&j.forOwn(c,function(a,b){b in h||b in g||(g[b]={"==":a})}),j.isEmpty(g)&&(g=null),g&&(e=j.filter(e,function(a){var b=!0,c=!0;return j.forOwn(g,function(d,e){j._s(d)?d={"===":d}:(j._n(d)||j.isBoolean(d))&&(d={"==":d}),j._o(d)&&j.forOwn(d,function(d,f){var g=void 0,h="|"===f[0],i=a[e];f=h?f.substr(1):f,"=="===f?g=i==d:"==="===f?g=i===d:"!="===f?g=i!=d:"!=="===f?g=i!==d:">"===f?g=i>d:">="===f?g=i>=d:"<"===f?g=d>i:"<="===f?g=d>=i:"isectEmpty"===f?g=!j.intersection(i||[],d||[]).length:"isectNotEmpty"===f?g=j.intersection(i||[],d||[]).length:"in"===f?g=j._s(d)?-1!==d.indexOf(i):j.contains(d,i):"notIn"===f?g=j._s(d)?-1===d.indexOf(i):!j.contains(d,i):"contains"===f?g=j._s(i)?-1!==i.indexOf(d):j.contains(i,d):"notContains"===f&&(g=j._s(i)?-1===i.indexOf(d):!j.contains(i,d)),void 0!==g&&(c=b?g:h?c||g:c&&g),b=!1})}),c}));var i=null;j._s(c.orderBy)?i=[[c.orderBy,"ASC"]]:j._a(c.orderBy)&&(i=c.orderBy),!i&&j._s(c.sort)?i=[[c.sort,"ASC"]]:!i&&j._a(c.sort)&&(i=c.sort),i&&!function(){var a=0;j.forEach(i,function(a,c){if(j._s(a))i[c]=[a,"ASC"];else if(!j._a(a))throw new k.IA('DS.filter("'+b+'"[, params][, options]): '+j.toJson(a)+": Must be a string or an array!",{params:{"orderBy[i]":{actual:typeof a,expected:"string|array"}}})}),e=j.sort(e,function(b,c){return f(i,a,b,c)})}();var l=j._n(c.limit)?c.limit:null,m=null;return j._n(c.skip)?m=c.skip:j._n(c.offset)&&(m=c.offset),l&&m?e=j.slice(e,m,Math.min(e.length,m+l)):j._n(l)?e=j.slice(e,0,Math.min(e.length,l)):j._n(m)&&(e=m<e.length?j.slice(e,m):[]),e};var q=function(){function a(b){i(this,a);var d=this;b=b||{};try{n=c(5)}catch(e){}if(!n||"function"!=typeof n)try{n=window.Schemator}catch(e){}n=n||b.schemator,"function"==typeof n&&(d.schemator=new n),d.store={},d.s=d.store,d.definitions={},d.defs=d.definitions,d.adapters={},d.defaults=new o,d.observe=j.observe,j.forOwn(b,function(a,b){d.defaults[b]=a})}return h(a,{getAdapter:{value:function(a){var b=!1;a=a||{},j._s(a)&&(b=!0,a={adapter:a});var c=this.adapters[a.adapter];if(c)return c;if(b)throw new Error(""+a.adapter+" is not a registered adapter!");return this.adapters[a.defaultAdapter]}},registerAdapter:{value:function(a,b,c){var d=this;c=c||{},d.adapters[a]=j.isFunction(b)?new b(c):b,c["default"]&&(d.defaults.defaultAdapter=a)}},is:{value:function(a,b){var c=this.defs[a];if(!c)throw new k.NER(a);return b instanceof c[c["class"]]}}}),a}(),r=q.prototype;r.getAdapter.shorthand=!1,r.registerAdapter.shorthand=!1,r.errors=k,r.utils=j,j.deepMixIn(r,l),j.deepMixIn(r,m),a.exports=q},function(a){a.exports=__WEBPACK_EXTERNAL_MODULE_4__},function(a){if("undefined"==typeof __WEBPACK_EXTERNAL_MODULE_5__){var b=new Error('Cannot find module "undefined"');throw b.code="MODULE_NOT_FOUND",b}a.exports=__WEBPACK_EXTERNAL_MODULE_5__},function(a,b){!function(a){function b(){function a(a){b=a}if("function"!=typeof Object.observe||"function"!=typeof Array.observe)return!1;var b=[],c={},d=[];return Object.observe(c,a),Array.observe(d,a),c.id=1,c.id=2,delete c.id,d.push(1,2),d.length=0,Object.deliverChangeRecords(a),5!==b.length?!1:"add"!=b[0].type||"update"!=b[1].type||"delete"!=b[2].type||"splice"!=b[3].type||"splice"!=b[4].type?!1:(Object.unobserve(c,a),Array.unobserve(d,a),!0)}function c(b){for(var c=0;s>c&&b.check_();)c++;return p&&(a.dirtyCheckCycleCount=c),c>0}function d(a){for(var b in a)return!1;return!0}function e(a){return d(a.added)&&d(a.removed)&&d(a.changed)}function f(a,b){if(!b||!b.length)return!1;for(var c,d=0;d<b.length;d++)if("[object RegExp]"===Object.prototype.toString.call(b[d])&&b[d].test(a)||b[d]===a)return c=a;return!!c}function g(a,b,c,d){var e={},g={},h={};for(var i in b){var j=a[i];f(i,d)||void 0!==j&&(c?c(j,b[i]):j===b[i])||(i in a?(c?c(j,b[i]):j===b[i])||(h[i]=j):g[i]=void 0)}for(var i in a)i in b||f(i,d)||(e[i]=a[i]);return Array.isArray(a)&&a.length!==b.length&&(h.length=a.length),{added:e,removed:g,changed:h}}function h(){if(!t.length)return!1;for(var a=0;a<t.length;a++)t[a]();return t.length=0,!0}function i(){function a(a){b&&b.state_===x&&!d&&b.check_(a)}var b,c,d=!1,e=!0;return{open:function(c){if(b)throw Error("ObservedObject in use");e||Object.deliverChangeRecords(a),b=c,e=!1},observe:function(b,d){c=b,d?Array.observe(c,a):Object.observe(c,a)},deliver:function(b){d=b,Object.deliverChangeRecords(a),d=!1},close:function(){b=void 0,Object.unobserve(c,a),v.push(this)}}}function j(a,b,c){var d=v.pop()||i();return d.open(a),d.observe(b,c),d}function k(){this.state_=w,this.callback_=void 0,this.target_=void 0,this.directObserver_=void 0,this.value_=void 0,this.id_=z++}function l(a){k._allObserversCount++,B&&A.push(a)}function m(){k._allObserversCount--}function n(a){k.call(this),this.value_=a,this.oldObject_=void 0}function o(a,b,c){for(var d={},e={},f=0;f<b.length;f++){var g=b[f];E[g.type]?(g.name in c||(c[g.name]=g.oldValue),"update"!=g.type&&("add"!=g.type?g.name in d?(delete d[g.name],delete c[g.name]):e[g.name]=!0:g.name in e?delete e[g.name]:d[g.name]=!0)):(console.error("Unknown changeRecord type: "+g.type),console.error(g))}for(var h in d)d[h]=a[h];for(var h in e)e[h]=void 0;var i={};for(var h in c)if(!(h in d||h in e)){var j=a[h];c[h]!==j&&(i[h]=j)}return{added:d,removed:e,changed:i}}var p=a.testingExposeCycleCount,q=b(),r="__proto__"in{}?function(a){return a}:function(a){var b=a.__proto__;if(!b)return a;var c=Object.create(b);return Object.getOwnPropertyNames(a).forEach(function(b){Object.defineProperty(c,b,Object.getOwnPropertyDescriptor(a,b))}),c},s=1e3,t=[],u=q?function(){return function(a){return Promise.resolve().then(a)}}():function(){return function(a){t.push(a)}}(),v=[],w=0,x=1,y=2,z=1;k.prototype={open:function(a,b){if(this.state_!=w)throw Error("Observer has already been opened.");return l(this),this.callback_=a,this.target_=b,this.connect_(),this.state_=x,this.value_},close:function(){this.state_==x&&(m(this),this.disconnect_(),this.value_=void 0,this.callback_=void 0,this.target_=void 0,this.state_=y)},deliver:function(){this.state_==x&&c(this)},report_:function(a){try{this.callback_.apply(this.target_,a)}catch(b){k._errorThrownDuringCallback=!0,console.error("Exception caught during observer callback: "+(b.stack||b))}},discardChanges:function(){return this.check_(void 0,!0),this.value_}};var A,B=!q;k._allObserversCount=0,B&&(A=[]);var C=!1;a.Platform=a.Platform||{},a.Platform.performMicrotaskCheckpoint=function(){if(!C&&B){C=!0;var b,c,d=0;do{d++,c=A,A=[],b=!1;for(var e=0;e<c.length;e++){var f=c[e];f.state_==x&&(f.check_()&&(b=!0),A.push(f))}h()&&(b=!0)}while(s>d&&b);p&&(a.dirtyCheckCycleCount=d),C=!1}},B&&(a.Platform.clearObservers=function(){A=[]}),n.prototype=r({__proto__:k.prototype,arrayObserve:!1,connect_:function(){q?this.directObserver_=j(this,this.value_,this.arrayObserve):this.oldObject_=this.copyObject(this.value_)},copyObject:function(a){var b=Array.isArray(a)?[]:{};for(var c in a)b[c]=a[c];return Array.isArray(a)&&(b.length=a.length),b},check_:function(a){var b,c;if(q){if(!a)return!1;c={},b=o(this.value_,a,c)}else c=this.oldObject_,b=g(this.value_,this.oldObject_);return e(b)?!1:(q||(this.oldObject_=this.copyObject(this.value_)),this.report_([b.added||{},b.removed||{},b.changed||{},function(a){return c[a]}]),!0)},disconnect_:function(){q?(this.directObserver_.close(),this.directObserver_=void 0):this.oldObject_=void 0},deliver:function(){this.state_==x&&(q?this.directObserver_.deliver(!1):c(this))},discardChanges:function(){return this.directObserver_?this.directObserver_.deliver(!0):this.oldObject_=this.copyObject(this.value_),this.value_}});var D={},E={add:!0,update:!0,"delete":!0};a.Observer=k,a.Observer.runEOM_=u,a.Observer.observerSentinel_=D,a.Observer.hasObjectObserve=q,a.diffObjectFromOldObject=g,a.ObjectObserver=n}(b)},function(a,b,c){function d(a){return!(f.isEmpty(a.added)&&f.isEmpty(a.removed)&&f.isEmpty(a.changed))}var e=function(a){return a&&a.__esModule?a["default"]:a},f=e(c(1)),g=e(c(2)),h=e(c(31)),i=e(c(32)),j=e(c(33)),k=e(c(34)),l=e(c(35)),m=e(c(36)),n=e(c(37)),o=e(c(38)),p=e(c(39)),q=g.NER,r=g.IA,s=g.R;a.exports={changes:function(a,b,c){var d=this,e=d.defs[a];if(c=c||{},b=f.resolveId(e,b),!e)throw new q(a);if(!f._sn(b))throw f._snErr("id");c=f._(e,c);var g=d.get(a,b);if(g){var h=function(){f.w&&d.s[a].observers[b].deliver();var h=c.ignoredChanges||[];f.forEach(e.relationFields,function(a){return h.push(a)});var i=f.diffObjectFromOldObject(g,d.s[a].previousAttributes[b],f.equals,h);return f.forOwn(i,function(a,b){var c=[];f.forOwn(a,function(a,b){f.isFunction(a)||c.push(b)}),i[b]=f.pick(i[b],c)}),f.forEach(e.relationFields,function(a){delete i.added[a],delete i.removed[a],delete i.changed[a]}),{v:i}}();if("object"==typeof h)return h.v}},changeHistory:function(a,b){var c=this,d=c.defs[a],e=c.s[a];if(b=f.resolveId(d,b),a&&!c.defs[a])throw new q(a);if(b&&!f._sn(b))throw f._snErr("id");if(d.keepChangeHistory){if(!a)return e.changeHistory;var g=c.get(a,b);if(g)return e.changeHistories[b]}else d.errorFn("changeHistory is disabled for this resource!")},compute:function(a,b){var c=this,d=c.defs[a];if(b=f.resolveItem(c.s[a],b),!d)throw new q(a);if(!b)throw new s("Item not in the store!");if(!f._o(b)&&!f._sn(b))throw new r('"instance" must be an object, string or number!');return f.forOwn(d.computed,function(a,c){f.compute.call(b,a,c)}),b},createInstance:function(a,b,c){var d=this.defs[a],e=void 0;if(b=b||{},!d)throw new q(a);if(b&&!f.isObject(b))throw new r('"attrs" must be an object!');if(c=f._(d,c),c.notify&&c.beforeCreateInstance(c,b),c.useClass){var g=d[d["class"]];e=new g}else e={};return f.deepMixIn(e,b),c.notify&&c.afterCreateInstance(c,e),e},defineResource:h,digest:function(){this.observe.Platform.performMicrotaskCheckpoint()},eject:i,ejectAll:j,filter:k,get:function(a,b,c){var d=this,e=d.defs[a];if(!e)throw new q(a);if(!f._sn(b))throw f._snErr("id");c=f._(e,c);var g=d.s[a].index[b];return!g&&c.loadFromServer&&d.find(a,b,c),g},getAll:function(a,b){var c=this,d=c.defs[a],e=c.s[a],g=[];if(!d)throw new q(a);if(b&&!f._a(b))throw f._aErr("ids");if(f._a(b))for(var h=b.length,i=0;h>i;i++)e.index[b[i]]&&g.push(e.index[b[i]]);else g=e.collection.slice();return g},hasChanges:function(a,b){var c=this,e=c.defs[a];if(b=f.resolveId(e,b),!e)throw new q(a);if(!f._sn(b))throw f._snErr("id");return c.get(a,b)?d(c.changes(a,b)):!1},inject:l,lastModified:function(a,b){var c=this.defs[a],d=this.s[a];if(b=f.resolveId(c,b),!c)throw new q(a);return b?(b in d.modified||(d.modified[b]=0),d.modified[b]):d.collectionModified},lastSaved:function(a,b){var c=this.defs[a],d=this.s[a];if(b=f.resolveId(c,b),!c)throw new q(a);return b in d.saved||(d.saved[b]=0),d.saved[b]},link:m,linkAll:n,linkInverse:o,previous:function(a,b){var c=this,d=c.defs[a],e=c.s[a];if(b=f.resolveId(d,b),!d)throw new q(a);if(!f._sn(b))throw f._snErr("id");return e.previousAttributes[b]?f.copy(e.previousAttributes[b]):void 0},unlinkInverse:p}},function(a,b,c){var d=function(a){return a&&a.__esModule?a["default"]:a},e=d(c(40)),f=d(c(41)),g=d(c(42)),h=d(c(43)),i=d(c(44)),j=d(c(45)),k=d(c(46)),l=d(c(47)),m=d(c(48)),n=d(c(49));a.exports={create:e,destroy:f,destroyAll:g,find:h,findAll:i,loadRelations:j,reap:k,refresh:function(a,b,c){var d=this,e=d.utils;return new e.Promise(function(f,g){var h=d.defs[a];b=e.resolveId(d.defs[a],b),h?e._sn(b)?(c=e._(h,c),c.bypassCache=!0,f(d.get(a,b))):g(e._snErr("id")):g(new d.errors.NER(a))}).then(function(e){return e?d.find(a,b,c):e})},save:l,update:m,updateAll:n}},function(a){function b(a,b,c){if(null!=a)for(var d=-1,e=a.length;++d<e&&b.call(c,a[d],d,a)!==!1;);}a.exports=b},function(a){function b(a,b,c){var d=a.length;b=null==b?0:0>b?Math.max(d+b,0):Math.min(b,d),c=null==c?d:0>c?Math.max(d+c,0):Math.min(c,d);for(var e=[];c>b;)e.push(a[b++]);return e}a.exports=b},function(a,b,c){function d(a,b){return-1!==e(a,b)}var e=c(23);a.exports=d},function(a,b,c){function d(a,b){var c=e(a,b);-1!==c&&a.splice(c,1)}var e=c(23);a.exports=d},function(a){function b(a,e){if(null==a)return[];if(a.length<2)return a;null==e&&(e=c);var f,g,h;return f=~~(a.length/2),g=b(a.slice(0,f),e),h=b(a.slice(f,a.length),e),d(g,h,e)}function c(a,b){return b>a?-1:a>b?1:0}function d(a,b,c){for(var d=[];a.length&&b.length;)d.push(c(a[0],b[0])<=0?a.shift():b.shift());return a.length&&d.push.apply(d,a),b.length&&d.push.apply(d,b),d}a.exports=b},function(a,b,c){function d(a,b,c){f(a,function(d,f){return e(a,f)?b.call(c,a[f],f,a):void 0})}var e=c(24),f=c(25);a.exports=d},function(a,b,c){function d(a){for(var b,c=0,d=arguments.length;++c<d;)b=arguments[c],b&&f(b,e,a);return a}function e(a,b){var c=this[b];g(a)&&g(c)?d(c,a):this[b]=a}var f=c(14),g=c(26);a.exports=d},function(a,b,c){function d(a){for(var b,c="string"!=typeof arguments[1]?arguments[1]:e(arguments,1),d={},f=0;b=c[f++];)d[b]=a[b];return d}var e=c(10);a.exports=d},function(a,b,c){function d(a,b){for(var c=b.split("."),d=c.pop();b=c.shift();)if(a=a[b],null==a)return;return a[d]}c(27);a.exports=d},function(a,b,c){function d(a,b,c){var d=/^(.+)\.(.+)$/.exec(b);d?e(a,d[1])[d[2]]=c:a[b]=c}var e=c(28);a.exports=d},function(a,b,c){function d(a){return a=e(a),f(a).replace(/^[a-z]/,g)}var e=c(29),f=c(30),g=c(20);a.exports=d},function(a,b,c){function d(a){return a=e(a),a.toUpperCase()}var e=c(29);a.exports=d},function(a,b,c){var d;(function(a,e,f){(function(){"use strict";function g(a){return"function"==typeof a||"object"==typeof a&&null!==a}function h(a){return"function"==typeof a}function i(a){return"object"==typeof a&&null!==a}function j(){}function k(){return function(){a.nextTick(o)}}function l(){var a=0,b=new R(o),c=document.createTextNode("");return b.observe(c,{characterData:!0}),function(){c.data=a=++a%2}}function m(){var a=new MessageChannel;return a.port1.onmessage=o,function(){a.port2.postMessage(0)}}function n(){return function(){setTimeout(o,1)}}function o(){for(var a=0;O>a;a+=2){var b=T[a],c=T[a+1];b(c),T[a]=void 0,T[a+1]=void 0}O=0}function p(){}function q(){return new TypeError("You cannot resolve a promise with itself")}function r(){return new TypeError("A promises callback cannot return that same promise.")}function s(a){try{return a.then}catch(b){return X.error=b,X}}function t(a,b,c,d){try{a.call(b,c,d)}catch(e){return e}}function u(a,b,c){P(function(a){var d=!1,e=t(c,b,function(c){d||(d=!0,b!==c?x(a,c):z(a,c))},function(b){d||(d=!0,A(a,b))},"Settle: "+(a._label||" unknown promise"));!d&&e&&(d=!0,A(a,e))},a)}function v(a,b){b._state===V?z(a,b._result):a._state===W?A(a,b._result):B(b,void 0,function(b){x(a,b)},function(b){A(a,b)})}function w(a,b){if(b.constructor===a.constructor)v(a,b);else{var c=s(b);c===X?A(a,X.error):void 0===c?z(a,b):h(c)?u(a,b,c):z(a,b)}}function x(a,b){a===b?A(a,q()):g(b)?w(a,b):z(a,b)}function y(a){a._onerror&&a._onerror(a._result),C(a)}function z(a,b){a._state===U&&(a._result=b,a._state=V,0===a._subscribers.length||P(C,a))}function A(a,b){a._state===U&&(a._state=W,a._result=b,P(y,a))}function B(a,b,c,d){var e=a._subscribers,f=e.length;a._onerror=null,e[f]=b,e[f+V]=c,e[f+W]=d,0===f&&a._state&&P(C,a)}function C(a){var b=a._subscribers,c=a._state;if(0!==b.length){for(var d,e,f=a._result,g=0;g<b.length;g+=3)d=b[g],e=b[g+c],d?F(c,d,e,f):e(f);a._subscribers.length=0}}function D(){this.error=null}function E(a,b){try{return a(b)}catch(c){return Y.error=c,Y}}function F(a,b,c,d){var e,f,g,i,j=h(c);if(j){if(e=E(c,d),e===Y?(i=!0,f=e.error,e=null):g=!0,b===e)return void A(b,r())}else e=d,g=!0;b._state!==U||(j&&g?x(b,e):i?A(b,f):a===V?z(b,e):a===W&&A(b,e))}function G(a,b){try{b(function(b){x(a,b)},function(b){A(a,b)})}catch(c){A(a,c)}}function H(a,b,c,d){this._instanceConstructor=a,this.promise=new a(p,d),this._abortOnReject=c,this._validateInput(b)?(this._input=b,this.length=b.length,this._remaining=b.length,this._init(),0===this.length?z(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&z(this.promise,this._result))):A(this.promise,this._validationError())}function I(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function J(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function K(a){this._id=ca++,this._state=void 0,this._result=void 0,this._subscribers=[],p!==a&&(h(a)||I(),this instanceof K||J(),G(this,a))}var L;L=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)};var M,N=L,O=(Date.now||function(){return(new Date).getTime()},Object.create||function(a){if(arguments.length>1)throw new Error("Second argument not supported");if("object"!=typeof a)throw new TypeError("Argument must be an object");return j.prototype=a,new j},0),P=function(a,b){T[O]=a,T[O+1]=b,O+=2,2===O&&M()},Q="undefined"!=typeof window?window:{},R=Q.MutationObserver||Q.WebKitMutationObserver,S="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,T=new Array(1e3);M="undefined"!=typeof a&&"[object process]"==={}.toString.call(a)?k():R?l():S?m():n();var U=void 0,V=1,W=2,X=new D,Y=new D;H.prototype._validateInput=function(a){return N(a)},H.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},H.prototype._init=function(){this._result=new Array(this.length)};var Z=H;H.prototype._enumerate=function(){for(var a=this.length,b=this.promise,c=this._input,d=0;b._state===U&&a>d;d++)this._eachEntry(c[d],d)},H.prototype._eachEntry=function(a,b){var c=this._instanceConstructor;i(a)?a.constructor===c&&a._state!==U?(a._onerror=null,this._settledAt(a._state,b,a._result)):this._willSettleAt(c.resolve(a),b):(this._remaining--,this._result[b]=this._makeResult(V,b,a))},H.prototype._settledAt=function(a,b,c){var d=this.promise;d._state===U&&(this._remaining--,this._abortOnReject&&a===W?A(d,c):this._result[b]=this._makeResult(a,b,c)),0===this._remaining&&z(d,this._result)},H.prototype._makeResult=function(a,b,c){return c},H.prototype._willSettleAt=function(a,b){var c=this;B(a,void 0,function(a){c._settledAt(V,b,a)},function(a){c._settledAt(W,b,a)})};var $=function(a,b){return new Z(this,a,!0,b).promise},_=function(a,b){function c(a){x(f,a)}function d(a){A(f,a)}var e=this,f=new e(p,b);if(!N(a))return A(f,new TypeError("You must pass an array to race.")),f;for(var g=a.length,h=0;f._state===U&&g>h;h++)B(e.resolve(a[h]),void 0,c,d);return f},aa=function(a,b){var c=this;if(a&&"object"==typeof a&&a.constructor===c)return a;var d=new c(p,b);return x(d,a),d},ba=function(a,b){var c=this,d=new c(p,b);return A(d,a),d},ca=0,da=K;K.all=$,K.race=_,K.resolve=aa,K.reject=ba,K.prototype={constructor:K,then:function(a,b){var c=this,d=c._state;if(d===V&&!a||d===W&&!b)return this;var e=new this.constructor(p),f=c._result;if(d){var g=arguments[d-1];P(function(){F(d,e,g,f)})}else B(c,e,a,b);return e},"catch":function(a){return this.then(null,a)}};var ea=function(){var a;a="undefined"!=typeof e?e:"undefined"!=typeof window&&window.document?window:self;var b="Promise"in a&&"resolve"in a.Promise&&"reject"in a.Promise&&"all"in a.Promise&&"race"in a.Promise&&function(){var b;return new a.Promise(function(a){b=a}),h(b)}();b||(a.Promise=da)},fa={Promise:da,polyfill:ea};c(51).amd?(d=function(){return fa}.call(b,c,b,f),!(void 0!==d&&(f.exports=d))):"undefined"!=typeof f&&f.exports?f.exports=fa:"undefined"!=typeof this&&(this.ES6Promise=fa)}).call(this)}).call(b,c(50),function(){return this}(),c(52)(a))},function(a,b){!function(b,c){a.exports=c()}(this,function(){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="",b(0)}([function(a){function b(a,b,c){for(var d=a[c],e=b(d);c>0;){var f=Math.floor((c+1)/2)-1,g=a[f];if(e>=b(g))break;a[f]=d,a[c]=g,c=f}}var c=function(){function a(a,b){for(var c in b){var d=b[c];d.configurable=!0,d.value&&(d.writable=!0)}Object.defineProperties(a,b)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),d=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},e=function(a,b,c){for(var d=a.length,e=a[c],f=b(e);;){var g=2*(c+1),h=g-1,i=null;if(d>h){var j=a[h],k=b(j);f>k&&(i=h)}if(d>g){var l=a[g],m=b(l);m<(null===i?f:b(a[h]))&&(i=g)}if(null===i)break;a[c]=a[i],a[i]=e,c=i}},f=function(){function a(b,c){if(d(this,a),b||(b=function(a){return a}),c||(c=function(a,b){return a===b}),"function"!=typeof b)throw new Error('BinaryHeap([weightFunc][, compareFunc]): "weightFunc" must be a function!');if("function"!=typeof c)throw new Error('BinaryHeap([weightFunc][, compareFunc]): "compareFunc" must be a function!');this.weightFunc=b,this.compareFunc=c,this.heap=[]}return c(a,{push:{value:function(a){this.heap.push(a),b(this.heap,this.weightFunc,this.heap.length-1)}},peek:{value:function(){return this.heap[0]}},pop:{value:function(){var a=this.heap[0],b=this.heap.pop();return this.heap.length>0&&(this.heap[0]=b,
e(this.heap,this.weightFunc,0)),a}},remove:{value:function(a){for(var c=this.heap.length,d=0;c>d;d++)if(this.compareFunc(this.heap[d],a)){var f=this.heap[d],g=this.heap.pop();return d!==c-1&&(this.heap[d]=g,b(this.heap,this.weightFunc,d),e(this.heap,this.weightFunc,d)),f}return null}},removeAll:{value:function(){this.heap=[]}},size:{value:function(){return this.heap.length}}}),a}();a.exports=f}])})},function(a){function b(a,b,c){if(c=c||0,null==a)return-1;for(var d=a.length,e=0>c?d+c:c;d>e;){if(a[e]===b)return e;e++}return-1}a.exports=b},function(a){function b(a,b){return Object.prototype.hasOwnProperty.call(a,b)}a.exports=b},function(a,b,c){function d(){h=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],g=!0;for(var a in{toString:null})g=!1}function e(a,b,c){var e,j=0;null==g&&d();for(e in a)if(f(b,a,e,c)===!1)break;if(g)for(var k=a.constructor,l=!!k&&a===k.prototype;(e=h[j++])&&("constructor"===e&&(l||!i(a,e))||a[e]===Object.prototype[e]||f(b,a,e,c)!==!1););}function f(a,b,c,d){return a.call(d,b[c],c,b)}var g,h,i=c(24);a.exports=e},function(a){function b(a){return!!a&&"object"==typeof a&&a.constructor===Object}a.exports=b},function(a){function b(a){switch(typeof a){case"string":case"number":case"boolean":return!0}return null==a}a.exports=b},function(a,b,c){function d(a,b){return b?(e(b.split("."),function(b){a[b]||(a[b]={}),a=a[b]}),a):a}var e=c(9);a.exports=d},function(a){function b(a){return null==a?"":a.toString()}a.exports=b},function(a,b,c){function d(a){return a=e(a),a=f(a),a=g(a).replace(/[\-_]/g," ").replace(/\s[a-z]/g,h).replace(/\s+/g,"").replace(/^[A-Z]/g,i)}var e=c(29),f=c(53),g=c(54),h=c(20),i=c(55);a.exports=d},function(module,exports,__webpack_require__){function defineResource(definition){var _this=this,definitions=_this.defs;if(DSUtils._s(definition)&&(definition={name:definition.replace(/\s/gi,"")}),!DSUtils._o(definition))throw DSUtils._oErr("definition");if(!DSUtils._s(definition.name))throw new DSErrors.IA('"name" must be a string!');if(_this.s[definition.name])throw new DSErrors.R(""+definition.name+" is already registered!");try{var def,_class,_ret=function(){if(Resource.prototype=_this.defaults,definitions[definition.name]=new Resource(definition),def=definitions[definition.name],def.n=def.name,!DSUtils._s(def.idAttribute))throw new DSErrors.IA('"idAttribute" must be a string!');def.relations&&(def.relationList=[],def.relationFields=[],DSUtils.forOwn(def.relations,function(a,b){DSUtils.forOwn(a,function(c,d){DSUtils._a(c)||(a[d]=[c]),DSUtils.forEach(a[d],function(a){a.type=b,a.relation=d,a.name=def.n,def.relationList.push(a),a.localField&&def.relationFields.push(a.localField)})})}),def.relations.belongsTo&&DSUtils.forOwn(def.relations.belongsTo,function(a,b){DSUtils.forEach(a,function(a){a.parent&&(def.parent=b,def.parentKey=a.localKey,def.parentField=a.localField)})}),"function"==typeof Object.freeze&&(Object.freeze(def.relations),Object.freeze(def.relationList))),def.getResource=function(a){return _this.defs[a]},def.getEndpoint=function(a,b){b.params=b.params||{};var c=void 0,d=def.parentKey,e=b.hasOwnProperty("endpoint")?b.endpoint:def.endpoint,f=def.parentField,g=definitions[def.parent],h=b.params[d];if(h===!1||!d||!g)return h===!1&&delete b.params[d],e;if(delete b.params[d],DSUtils._sn(a)?c=def.get(a):DSUtils._o(a)&&(c=a),c&&(h=h||c[d]||(c[f]?c[f][g.idAttribute]:null)),!h)return e;var i=function(){delete b.endpoint;var a={};return DSUtils.forOwn(b,function(b,c){a[c]=b}),{v:DSUtils.makePath(g.getEndpoint(h,DSUtils._(g,a)),h,e)}}();return"object"==typeof i?i.v:void 0},def.filter&&(def.defaultFilter=def.filter,delete def.filter),_class=def["class"]=DSUtils.pascalCase(def.name);try{"function"==typeof def.useClass?(eval("function "+_class+"() { def.useClass.call(this); }"),def[_class]=eval(_class),def[_class].prototype=function(a){function b(){}return b.prototype=a,new b}(def.useClass.prototype)):(eval("function "+_class+"() {}"),def[_class]=eval(_class))}catch(e){def[_class]=function(){}}def.methods&&DSUtils.deepMixIn(def[_class].prototype,def.methods),def[_class].prototype.set=function(a,b){DSUtils.set(this,a,b);var c=_this.s[def.n].observers[this[def.idAttribute]];return c&&!DSUtils.observe.hasObjectObserve?c.deliver():_this.compute(def.n,this),this},def[_class].prototype.get=function(a){return DSUtils.get(this,a)},def.computed&&DSUtils.forOwn(def.computed,function(a,b){DSUtils.isFunction(a)&&(def.computed[b]=[a],a=def.computed[b]),def.methods&&b in def.methods&&def.errorFn('Computed property "'+b+'" conflicts with previously defined prototype method!');var c;if(1===a.length){var d=a[0].toString().match(/function.*?\(([\s\S]*?)\)/);c=d[1].split(","),def.computed[b]=c.concat(a),a=def.computed[b],c.length&&def.errorFn("Use the computed property array syntax for compatibility with minified code!")}c=a.slice(0,a.length-1),DSUtils.forEach(c,function(a,b){c[b]=a.trim()}),a.deps=DSUtils.filter(c,function(a){return!!a})}),definition.schema&&_this.schemator&&(def.schema=_this.schemator.defineSchema(def.n,definition.schema),definition.hasOwnProperty("validate")||(def.validate=function(a,b,c){def.schema.validate(b,{ignoreMissing:def.ignoreMissing},function(a){return a?c(a):c(null,b)})})),DSUtils.forEach(instanceMethods,function(a){def[_class].prototype["DS"+DSUtils.pascalCase(a)]=function(){for(var b=arguments.length,c=Array(b),d=0;b>d;d++)c[d]=arguments[d];return c.unshift(this[def.idAttribute]||this),c.unshift(def.n),_this[a].apply(_this,c)}}),def[_class].prototype.DSCreate=function(){for(var a=arguments.length,b=Array(a),c=0;a>c;c++)b[c]=arguments[c];return b.unshift(this),b.unshift(def.n),_this.create.apply(_this,b)},_this.s[def.n]={collection:[],expiresHeap:new DSUtils.BinaryHeap(function(a){return a.expires},function(a,b){return a.item===b}),completedQueries:{},queryData:{},pendingQueries:{},index:{},modified:{},saved:{},previousAttributes:{},observers:{},changeHistories:{},changeHistory:[],collectionModified:0},def.reapInterval&&setInterval(function(){return _this.reap(def.n,{isInterval:!0})},def.reapInterval);var fns=["registerAdapter","getAdapter","is"];for(key in _this)"function"==typeof _this[key]&&fns.push(key);DSUtils.forEach(fns,function(a){var b=a;def[b]=_this[b].shorthand!==!1?function(){for(var a=arguments.length,c=Array(a),d=0;a>d;d++)c[d]=arguments[d];return c.unshift(def.n),_this[b].apply(_this,c)}:function(){for(var a=arguments.length,c=Array(a),d=0;a>d;d++)c[d]=arguments[d];return _this[b].apply(_this,c)}}),def.beforeValidate=DSUtils.promisify(def.beforeValidate),def.validate=DSUtils.promisify(def.validate),def.afterValidate=DSUtils.promisify(def.afterValidate),def.beforeCreate=DSUtils.promisify(def.beforeCreate),def.afterCreate=DSUtils.promisify(def.afterCreate),def.beforeUpdate=DSUtils.promisify(def.beforeUpdate),def.afterUpdate=DSUtils.promisify(def.afterUpdate),def.beforeDestroy=DSUtils.promisify(def.beforeDestroy),def.afterDestroy=DSUtils.promisify(def.afterDestroy);var defaultAdapter=void 0;return def.hasOwnProperty("defaultAdapter")&&(defaultAdapter=def.defaultAdapter),DSUtils.forOwn(def.actions,function(a,b){if(def[b]&&!def.actions[b])throw new Error('Cannot override existing method "'+b+'"!');def[b]=function(c){c=c||{};var d=_this.getAdapter(a.adapter||defaultAdapter||"http"),e=DSUtils.deepMixIn({},a);return!c.hasOwnProperty("endpoint")&&e.endpoint&&(c.endpoint=e.endpoint),e.url="function"==typeof c.getEndpoint?c.getEndpoint(def,c):DSUtils.makePath(c.basePath||d.defaults.basePath||def.basePath,def.getEndpoint(null,c),b),e.method=e.method||"GET",DSUtils.deepMixIn(e,c),d.HTTP(e)}}),DSUtils.Events(def),{v:def}}();if("object"==typeof _ret)return _ret.v}catch(err){throw delete definitions[definition.name],delete _this.s[definition.name],err}}var _interopRequire=function(a){return a&&a.__esModule?a["default"]:a},_classCallCheck=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")};module.exports=defineResource;var DSUtils=_interopRequire(__webpack_require__(1)),DSErrors=_interopRequire(__webpack_require__(2)),Resource=function a(b){_classCallCheck(this,a),DSUtils.deepMixIn(this,b),this.endpoint="endpoint"in b?b.endpoint:this.name},instanceMethods=["compute","refresh","save","update","destroy","loadRelations","changeHistory","changes","hasChanges","lastModified","lastSaved","link","linkInverse","previous","unlinkInverse"]},function(a){function b(a,b,c){var d=this,e=d.utils,f=d.defs[a],g=d.s[a],h=void 0,i=!1;if(b=e.resolveId(f,b),!f)throw new d.errors.NER(a);if(!e._sn(b))throw e._snErr("id");c=e._(f,c);for(var j=0;j<g.collection.length;j++)if(g.collection[j][f.idAttribute]==b){h=g.collection[j],g.expiresHeap.remove(h),i=!0;break}if(i){var k=function(){c.notify&&(f.beforeEject(c,h),f.emit("DS.beforeEject",f,h)),d.unlinkInverse(f.n,b),g.collection.splice(j,1),e.w&&g.observers[b].close(),delete g.observers[b],delete g.index[b],delete g.previousAttributes[b],delete g.completedQueries[b],delete g.pendingQueries[b],e.forEach(g.changeHistories[b],function(a){e.remove(g.changeHistory,a)});var a=[];return e.forOwn(g.queryData,function(b,c){b.$$injected&&e.remove(b,h),b.length||a.push(c)}),e.forEach(a,function(a){delete g.completedQueries[a],delete g.queryData[a]}),delete g.changeHistories[b],delete g.modified[b],delete g.saved[b],g.collectionModified=e.updateTimestamp(g.collectionModified),c.notify&&(f.afterEject(c,h),f.emit("DS.afterEject",f,h)),{v:h}}();if("object"==typeof k)return k.v}}a.exports=b},function(a){function b(a,b,c){var d=this,e=d.utils,f=d.defs[a];if(b=b||{},!f)throw new d.errors.NER(a);if(!e._o(b))throw e._oErr("params");var g=d.s[a],h=e.toJson(b),i=d.filter(f.n,b),j=[];return e.isEmpty(b)?g.completedQueries={}:delete g.completedQueries[h],e.forEach(i,function(a){a&&a[f.idAttribute]&&j.push(a[f.idAttribute])}),e.forEach(j,function(a){d.eject(f.n,a,c)}),g.collectionModified=e.updateTimestamp(g.collectionModified),i}a.exports=b},function(a){function b(a,b,c){var d=this,e=d.utils,f=d.defs[a],g=d.s[a];if(!f)throw new d.errors.NER(a);if(b&&!e._o(b))throw e._oErr("params");b=b||{},c=e._(f,c);var h=e.toJson(b);return h in g.completedQueries||!c.loadFromServer||g.pendingQueries[h]||d.findAll(a,b,c),f.defaultFilter.call(d,g.collection,a,b,c)}a.exports=b},function(a,b,c){function d(a,b,c){var d=b.n;return function(e,f,g,h,j){var k=this,l=void 0,m=h&&h(b.idAttribute)?h(b.idAttribute):k[b.idAttribute];if(i.forEach(b.relationFields,function(a){delete e[a],delete f[a],delete g[a]}),(!i.isEmpty(e)||!i.isEmpty(f)||!i.isEmpty(g)||j)&&(l=a.get(d,m),c.modified[m]=i.updateTimestamp(c.modified[m]),c.collectionModified=i.updateTimestamp(c.collectionModified),b.keepChangeHistory)){var n={resourceName:d,target:l,added:e,removed:f,changed:g,timestamp:c.modified[m]};c.changeHistories[m].push(n),c.changeHistory.push(n)}b.computed&&(l=l||a.get(d,m),i.forOwn(b.computed,function(a,b){var c=!1;i.forEach(a.deps,function(a){(a in e||a in f||a in g||!(b in l))&&(c=!0)}),c=c||!a.deps.length,c&&i.compute.call(l,a,b)})),b.relations&&(l=l||a.get(d,m),i.forEach(b.relationList,function(c){l[c.localField]&&(c.localKey in e||c.localKey in f||c.localKey in g)&&a.link(d,l[b.idAttribute],[c.relation])})),b.idAttribute in g&&b.errorFn('Doh! You just changed the primary key of an object! Your data for the "'+d+'" resource is now in an undefined (probably broken) state.')}}function e(a,b,c,f){var g=this,h=d(g,a,b,c,f),k=void 0;if(i._a(c)){k=[];for(var l=0;l<c.length;l++)k.push(e.call(g,a,b,c[l],f))}else{var m=a.computed,n=a.idAttribute;if(m&&m[n]&&!function(){var a=[];i.forEach(m[n].deps,function(b){a.push(c[b])}),c[n]=m[n][m[n].length-1].apply(c,a)}(),!(n in c)){var o=new j.R(""+a.n+'.inject: "attrs" must contain the property specified by "idAttribute"!');throw f.errorFn(o),o}try{i.forEach(a.relationList,function(b){var d=b.relation,e=g.defs[d],h=c[b.localField];if(h){if(!e)throw new j.R(""+a.n+" relation is defined but the resource is not!");if(i._a(h))!function(){var j=[];i.forEach(h,function(h){if(h!==g.s[d].index[h[e.idAttribute]])try{var i=g.inject(d,h,f.orig());b.foreignKey&&(i[b.foreignKey]=c[a.idAttribute]),j.push(i)}catch(k){f.errorFn(k,"Failed to inject "+b.type+' relation: "'+d+'"!')}}),c[b.localField]=j}();else if(h!==g.s[d].index[h[e.idAttribute]])try{c[b.localField]=g.inject(d,c[b.localField],f.orig()),b.foreignKey&&(c[b.localField][b.foreignKey]=c[a.idAttribute])}catch(k){f.errorFn(k,"Failed to inject "+b.type+' relation: "'+d+'"!')}}});var p=c[n],q=g.get(a.n,p),r=q?b.modified[p]:0;q?(i.deepMixIn(q,c),a.resetHistoryOnInject&&(b.previousAttributes[p]=i.copy(q,null,null,null,a.relationFields),b.changeHistories[p].length&&(i.forEach(b.changeHistories[p],function(a){i.remove(b.changeHistory,a)}),b.changeHistories[p].splice(0,b.changeHistories[p].length))),i.w&&b.observers[p].deliver()):(q=f.useClass?c instanceof a[a["class"]]?c:new a[a["class"]]:{},i.deepMixIn(q,c),b.collection.push(q),b.changeHistories[p]=[],i.w&&(b.observers[p]=new g.observe.ObjectObserver(q),b.observers[p].open(h,q)),b.index[p]=q,h.call(q,{},{},{},null,!0),b.previousAttributes[p]=i.copy(q,null,null,null,a.relationFields)),b.modified[p]=r&&b.modified[p]===r?i.updateTimestamp(b.modified[p]):b.modified[p],b.expiresHeap.remove(q);var s=(new Date).getTime();b.expiresHeap.push({item:q,timestamp:s,expires:a.maxAge?s+a.maxAge:Number.MAX_VALUE}),k=q}catch(t){f.errorFn(t,c)}}return k}function f(a,b,c){var d=this;i.forEach(a.relationList,function(e){c.findBelongsTo&&"belongsTo"===e.type&&b[a.idAttribute]?d.link(a.n,b[a.idAttribute],[e.relation]):(c.findHasMany&&"hasMany"===e.type||c.findHasOne&&"hasOne"===e.type)&&d.link(a.n,b[a.idAttribute],[e.relation])})}function g(a,b,c){var d=this,g=d.defs[a],h=d.s[a],k=void 0;if(!g)throw new j.NER(a);if(!i._o(b)&&!i._a(b))throw new j.IA(""+a+'.inject: "attrs" must be an object or an array!');var l=g.n;return c=i._(g,c),c.notify&&(c.beforeInject(c,b),g.emit("DS.beforeInject",g,b)),k=e.call(d,g,h,b,c),h.collectionModified=i.updateTimestamp(h.collectionModified),c.findInverseLinks&&(i._a(k)?k.length&&d.linkInverse(l,k[0][g.idAttribute]):d.linkInverse(l,k[g.idAttribute])),i._a(k)?i.forEach(k,function(a){f.call(d,g,a,c)}):f.call(d,g,k,c),c.notify&&(c.afterInject(c,k),g.emit("DS.afterInject",g,k)),k}var h=function(a){return a&&a.__esModule?a["default"]:a};a.exports=g;var i=h(c(1)),j=h(c(2))},function(a){function b(a,b,c){var d=this,e=d.utils,f=d.defs[a];if(c=c||[],b=e.resolveId(f,b),!f)throw new d.errors.NER(a);if(!e._sn(b))throw e._snErr("id");if(!e._a(c))throw e._aErr("relations");var g=d.get(a,b);return g&&e.forEach(f.relationList,function(a){var b=a.relation;if((!c.length||e.contains(c,b))&&a.localField){var h={};if("belongsTo"===a.type){var i=g[a.localKey]?d.get(b,g[a.localKey]):null;i&&(g[a.localField]=i)}else if("hasMany"===a.type)h[a.foreignKey]=g[f.idAttribute],g[a.localField]=d.defaults.constructor.prototype.defaultFilter.call(d,d.s[b].collection,b,h,{allowSimpleWhere:!0});else if("hasOne"===a.type){h[a.foreignKey]=g[f.idAttribute];var j=d.defaults.constructor.prototype.defaultFilter.call(d,d.s[b].collection,b,h,{allowSimpleWhere:!0});j.length&&(g[a.localField]=j[0])}}}),g}a.exports=b},function(a){function b(a,b,c){var d=this,e=d.utils,f=d.defs[a];if(c=c||[],!f)throw new d.errors.NER(a);if(!e._a(c))throw e._aErr("relations");var g=d.filter(a,b);return g&&e.forEach(f.relationList,function(a){var b=a.relation;c.length&&!e.contains(c,b)||!a.localField||("belongsTo"===a.type?e.forEach(g,function(c){var e=c[a.localKey]?d.get(b,c[a.localKey]):null;e&&(c[a.localField]=e)}):"hasMany"===a.type?e.forEach(g,function(c){var e={};e[a.foreignKey]=c[f.idAttribute],c[a.localField]=d.defaults.constructor.prototype.defaultFilter.call(d,d.s[b].collection,b,e,{allowSimpleWhere:!0})}):"hasOne"===a.type&&e.forEach(g,function(c){var e={};e[a.foreignKey]=c[f.idAttribute];var g=d.defaults.constructor.prototype.defaultFilter.call(d,d.s[b].collection,b,e,{allowSimpleWhere:!0});g.length&&(c[a.localField]=g[0])}))}),g}a.exports=b},function(a){function b(a,b,c){var d=this,e=d.utils,f=d.defs[a];if(c=c||[],b=e.resolveId(f,b),!f)throw new d.errors.NER(a);if(!e._sn(b))throw e._snErr("id");if(!e._a(c))throw e._aErr("relations");var g=d.get(a,b);return g&&e.forOwn(d.defs,function(a){e.forOwn(a.relations,function(b){e.forOwn(b,function(b,g){(!c.length||e.contains(c,a.n))&&f.n===g&&d.linkAll(a.n,{},[f.n])})})}),g}a.exports=b},function(a){function b(a,b,c){var d=this,e=d.utils,f=d.defs[a];if(c=c||[],b=e.resolveId(f,b),!f)throw new d.errors.NER(a);if(!e._sn(b))throw e._snErr("id");if(!e._a(c))throw e._aErr("relations");var g=d.get(a,b);return g&&e.forOwn(d.defs,function(a){e.forOwn(a.relations,function(a){e.forOwn(a,function(a,b){f.n===b&&e.forEach(a,function(a){e.forEach(d.s[a.name].collection,function(b){"hasMany"===a.type&&b[a.localField]?!function(){var c=void 0;e.forEach(b[a.localField],function(a,b){a===g&&(c=b)}),void 0!==c&&b[a.localField].splice(c,1)}():b[a.localField]===g&&delete b[a.localField]})})})})}),g}a.exports=b},function(a){function b(a,b,c){var d=this,e=d.utils,f=d.defs[a];c=c||{},b=b||{};var g=void 0;if(f)if(e._o(b)){if(c=e._(f,c),c.upsert&&e._sn(b[f.idAttribute]))return d.update(a,b[f.idAttribute],b,c)}else g=e._oErr("attrs");else g=new d.errors.NER(a);return new e.Promise(function(a,c){g?c(g):a(b)}).then(function(a){return c.beforeValidate.call(a,c,a)}).then(function(a){return c.validate.call(a,c,a)}).then(function(a){return c.afterValidate.call(a,c,a)}).then(function(a){return c.beforeCreate.call(a,c,a)}).then(function(a){return c.notify&&f.emit("DS.beforeCreate",f,a),d.getAdapter(c).create(f,a,c)}).then(function(a){return c.afterCreate.call(a,c,a)}).then(function(b){if(c.notify&&f.emit("DS.afterCreate",f,b),c.cacheResponse){var g=d.inject(f.n,b,c.orig()),h=g[f.idAttribute],i=d.s[a];return i.completedQueries[h]=(new Date).getTime(),i.saved[h]=e.updateTimestamp(i.saved[h]),g}return d.createInstance(a,b,c)})}a.exports=b},function(a){function b(a,b,c){var d=this,e=d.utils,f=d.defs[a],g=void 0;return new e.Promise(function(h,i){b=e.resolveId(f,b),f?e._sn(b)?(g=d.get(a,b)||{id:b},c=e._(f,c),h(g)):i(e._snErr("id")):i(new d.errors.NER(a))}).then(function(a){return c.beforeDestroy.call(a,c,a)}).then(function(e){return c.notify&&f.emit("DS.beforeDestroy",f,e),c.eagerEject&&d.eject(a,b),d.getAdapter(c).destroy(f,b,c)}).then(function(){return c.afterDestroy.call(g,c,g)}).then(function(e){return c.notify&&f.emit("DS.afterDestroy",f,e),d.eject(a,b),b})["catch"](function(b){return c&&c.eagerEject&&g&&d.inject(a,g,{notify:!1}),e.Promise.reject(b)})}a.exports=b},function(a){function b(a,b,c){var d=this,e=d.utils,f=d.defs[a],g=void 0,h=void 0;return b=b||{},new e.Promise(function(g,h){f?e._o(b)?(c=e._(f,c),g()):h(e._oErr("attrs")):h(new d.errors.NER(a))}).then(function(){return h=d.defaults.defaultFilter.call(d,a,b),c.beforeDestroy(c,h)}).then(function(){return c.notify&&f.emit("DS.beforeDestroy",f,h),c.eagerEject&&(g=d.ejectAll(a,b)),d.getAdapter(c).destroyAll(f,b,c)}).then(function(){return c.afterDestroy(c,h)}).then(function(){return c.notify&&f.emit("DS.afterDestroy",f,h),g||d.ejectAll(a,b)})["catch"](function(b){return c&&c.eagerEject&&g&&d.inject(a,g,{notify:!1}),e.Promise.reject(b)})}a.exports=b},function(a){function b(a,b,c){var d=this,e=d.utils,f=d.defs[a],g=d.s[a];return new e.Promise(function(h,i){f?e._sn(b)?(c=e._(f,c),c.params&&(c.params=e.copy(c.params)),(c.bypassCache||!c.cacheResponse)&&delete g.completedQueries[b],b in g.completedQueries&&d.get(a,b)?h(d.get(a,b)):(delete g.completedQueries[b],h())):i(e._snErr("id")):i(new d.errors.NER(a))}).then(function(h){if(h)return h;if(!(b in g.pendingQueries)){var i=void 0,j=c.findStrategy||c.strategy;"fallback"===j?!function(){var a=function(g){return d.getAdapter((c.findFallbackAdapters||c.fallbackAdapters)[g]).find(f,b,c)["catch"](function(b){return g++,g<c.fallbackAdapters.length?a(g):e.Promise.reject(b)})};i=a(0)}():i=d.getAdapter(c).find(f,b,c),g.pendingQueries[b]=i.then(function(f){if(delete g.pendingQueries[b],c.cacheResponse){var h=d.inject(a,f,c.orig());return g.completedQueries[b]=(new Date).getTime(),g.saved[b]=e.updateTimestamp(g.saved[b]),h}return d.createInstance(a,f,c.orig())})}return g.pendingQueries[b]})["catch"](function(a){return g&&delete g.pendingQueries[b],e.Promise.reject(a)})}a.exports=b},function(a){function b(a,b,c,d){var e=this,f=e.utils,g=e.s[b],h=e.defs[b].idAttribute,i=(new Date).getTime();a=a||[],delete g.pendingQueries[c],g.completedQueries[c]=i,g.collectionModified=f.updateTimestamp(g.collectionModified);var j=e.inject(b,a,d.orig());return f._a(j)?f.forEach(j,function(a){if(a){var b=a[h];b&&(g.completedQueries[b]=i,g.saved[b]=f.updateTimestamp(g.saved[b]))}}):(d.errorFn("response is expected to be an array!"),g.completedQueries[j[h]]=i),j}function c(a,c,d){var e=this,f=e.utils,g=e.defs[a],h=e.s[a],i=void 0;return new f.Promise(function(b,j){c=c||{},e.defs[a]?f._o(c)?(d=f._(g,d),i=f.toJson(c),d.params&&(d.params=f.copy(d.params)),(d.bypassCache||!d.cacheResponse)&&(delete h.completedQueries[i],delete h.queryData[i]),i in h.completedQueries?b(d.useFilter?e.filter(a,c,d.orig()):h.queryData[i]):b()):j(f._oErr("params")):j(new e.errors.NER(a))}).then(function(j){if(i in h.completedQueries)return j;if(!(i in h.pendingQueries)){var k=void 0,l=d.findAllStrategy||d.strategy;"fallback"===l?!function(){var a=function(b){return e.getAdapter((d.findAllFallbackAdapters||d.fallbackAdapters)[b]).findAll(g,c,d)["catch"](function(c){return b++,b<d.fallbackAdapters.length?a(b):Promise.reject(c)})};k=a(0)}():k=e.getAdapter(d).findAll(g,c,d),h.pendingQueries[i]=k.then(function(c){return delete h.pendingQueries[i],d.cacheResponse?(h.queryData[i]=b.call(e,c,a,i,d),h.queryData[i].$$injected=!0,h.queryData[i]):(f.forEach(c,function(b,f){c[f]=e.createInstance(a,b,d.orig())}),c)})}return h.pendingQueries[i]})["catch"](function(a){return h&&delete h.pendingQueries[i],f.Promise.reject(a)})}a.exports=c},function(a){function b(a,b,c,d){var e=this,f=e.utils,g=e.errors,h=e.defs[a],i=[];return new f.Promise(function(j,k){f._sn(b)&&(b=e.get(a,b)),f._s(c)&&(c=[c]),h?f._o(b)?f._a(c)?!function(){var a=f._(h,d);a.hasOwnProperty("findBelongsTo")||(a.findBelongsTo=!0),a.hasOwnProperty("findHasMany")||(a.findHasMany=!0);var g=[];f.forEach(h.relationList,function(a){var j=a.relation,k=h.getResource(j),l=f._(k,d);if(f.contains(c,j)||f.contains(c,a.localField)){var m=void 0,n={};l.allowSimpleWhere?n[a.foreignKey]=b[h.idAttribute]:(n.where={},n.where[a.foreignKey]={"==":b[h.idAttribute]}),"hasMany"===a.type&&n[a.foreignKey]?m=e.findAll(j,n,l.orig()):"hasOne"===a.type?a.localKey&&b[a.localKey]?m=e.find(j,b[a.localKey],l.orig()):a.foreignKey&&n[a.foreignKey]&&(m=e.findAll(j,n,l.orig()).then(function(a){return a.length?a[0]:null})):b[a.localKey]&&(m=e.find(j,b[a.localKey],d)),m&&(g.push(m),i.push(a.localField||!1))}}),j(g)}():k(new g.IA('"relations" must be a string or an array!')):k(new g.IA('"instance(id)" must be a string, number or object!')):k(new g.NER(a))}).then(function(a){return f.Promise.all(a)}).then(function(a){return f.forEach(i,function(c,d){c&&(b[c]=a[d])}),b})}a.exports=b},function(a){function b(a,b){var c=this,d=c.utils,e=c.defs[a],f=c.s[a];return new d.Promise(function(g,h){if(e){b=d._(e,b),b.hasOwnProperty("notify")||(b.notify=!1);for(var i=[],j=(new Date).getTime(),k=void 0;(k=f.expiresHeap.peek())&&k.expires<j;)i.push(k.item),delete k.item,f.expiresHeap.pop();g(i)}else h(new c.errors.NER(a))}).then(function(g){if((b.isInterval||b.notify)&&(e.beforeReap(b,g),e.emit("DS.beforeReap",e,g)),"inject"===b.reapAction)!function(){var a=(new Date).getTime();d.forEach(g,function(b){f.expiresHeap.push({item:b,timestamp:a,expires:e.maxAge?a+e.maxAge:Number.MAX_VALUE})})}();else if("eject"===b.reapAction)d.forEach(g,function(b){c.eject(a,b[e.idAttribute])});else if("refresh"===b.reapAction){var h=function(){var b=[];return d.forEach(g,function(d){b.push(c.refresh(a,d[e.idAttribute]))}),{v:d.Promise.all(b)}}();if("object"==typeof h)return h.v}return g}).then(function(a){return(b.isInterval||b.notify)&&(e.afterReap(b,a),e.emit("DS.afterReap",e,a)),a})}a.exports=b},function(a){function b(a,b,c){var d=this,e=d.utils,f=d.errors,g=d.defs[a],h=void 0,i=void 0;return new e.Promise(function(i,j){b=e.resolveId(g,b),g?e._sn(b)?d.get(a,b)?(h=d.get(a,b),c=e._(g,c),i(h)):j(new f.R('id "'+b+'" not found in cache!')):j(e._snErr("id")):j(new f.NER(a))}).then(function(a){return c.beforeValidate.call(a,c,a)}).then(function(a){return c.validate.call(a,c,a)}).then(function(a){return c.afterValidate.call(a,c,a)}).then(function(a){return c.beforeUpdate.call(a,c,a)}).then(function(f){if(c.notify&&g.emit("DS.beforeUpdate",g,f),c.changesOnly){var h=d.s[a];e.w&&h.observers[b].deliver();var j=[],k=d.changes(a,b);for(var l in k.added)j.push(l);for(l in k.changed)j.push(l);if(k=e.pick(f,j),e.isEmpty(k))return i=!0,f;f=k}return d.getAdapter(c).update(g,b,f,c)}).then(function(a){return c.afterUpdate.call(a,c,a)}).then(function(b){if(c.notify&&g.emit("DS.afterUpdate",g,b),i)return b;if(c.cacheResponse){var f=d.inject(g.n,b,c.orig()),h=d.s[a],j=f[g.idAttribute];return h.saved[j]=e.updateTimestamp(h.saved[j]),g.resetHistoryOnInject||(h.previousAttributes[j]=e.copy(f,null,null,null,g.relationFields)),f}return d.createInstance(a,b,c.orig())})}a.exports=b},function(a){function b(a,b,c,d){var e=this,f=e.utils,g=e.errors,h=e.defs[a];return new f.Promise(function(e,i){b=f.resolveId(h,b),h?f._sn(b)?(d=f._(h,d),e(c)):i(f._snErr("id")):i(new g.NER(a))}).then(function(a){return d.beforeValidate.call(a,d,a)}).then(function(a){return d.validate.call(a,d,a)}).then(function(a){return d.afterValidate.call(a,d,a)}).then(function(a){return d.beforeUpdate.call(a,d,a)}).then(function(a){return d.notify&&h.emit("DS.beforeUpdate",h,a),e.getAdapter(d).update(h,b,a,d)}).then(function(a){return d.afterUpdate.call(a,d,a)}).then(function(b){if(d.notify&&h.emit("DS.afterUpdate",h,b),d.cacheResponse){var c=e.inject(h.n,b,d.orig()),g=e.s[a],i=c[h.idAttribute];return g.saved[i]=f.updateTimestamp(g.saved[i]),h.resetHistoryOnInject||(g.previousAttributes[i]=f.copy(c,null,null,null,h.relationFields)),c}return e.createInstance(a,b,d.orig())})}a.exports=b},function(a){function b(a,b,c,d){var e=this,f=e.utils,g=e.errors,h=e.defs[a];return new f.Promise(function(c,e){h?(d=f._(h,d),c(b)):e(new g.NER(a))}).then(function(a){return d.beforeValidate.call(a,d,a)}).then(function(a){return d.validate.call(a,d,a)}).then(function(a){return d.afterValidate.call(a,d,a)}).then(function(a){return d.beforeUpdate.call(a,d,a)}).then(function(a){return d.notify&&h.emit("DS.beforeUpdate",h,a),e.getAdapter(d).updateAll(h,a,c,d)}).then(function(a){return d.afterUpdate.call(a,d,a)}).then(function(c){d.notify&&h.emit("DS.afterUpdate",h,b);var g=d.orig();if(d.cacheResponse){var i=function(){var b=e.inject(h.n,c,g),d=e.s[a];return f.forEach(b,function(a){var b=a[h.idAttribute];d.saved[b]=f.updateTimestamp(d.saved[b]),h.resetHistoryOnInject||(d.previousAttributes[b]=f.copy(a,null,null,null,h.relationFields))}),{v:b}}();if("object"==typeof i)return i.v}else{var j=function(){var b=[];return f.forEach(c,function(c){b.push(e.createInstance(a,c,g))}),{v:b}}();if("object"==typeof j)return j.v}})}a.exports=b},function(a){function b(){}var c=a.exports={};c.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.MutationObserver,c="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};var d=[];if(b){var e=document.createElement("div"),f=new MutationObserver(function(){var a=d.slice();d.length=0,a.forEach(function(a){a()})});return f.observe(e,{attributes:!0}),function(a){d.length||e.setAttribute("yes","no"),d.push(a)}}return c?(window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),d.length>0)){var c=d.shift();c()}},!0),function(a){d.push(a),window.postMessage("process-tick","*")}):function(a){setTimeout(a,0)}}(),c.title="browser",c.browser=!0,c.env={},c.argv=[],c.on=b,c.addListener=b,c.once=b,c.off=b,c.removeListener=b,c.removeAllListeners=b,c.emit=b,c.binding=function(){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(){throw new Error("process.chdir is not supported")}},function(a){a.exports=function(){throw new Error("define cannot be used indirect")}},function(a){a.exports=function(a){return a.webpackPolyfill||(a.deprecate=function(){},a.paths=[],a.children=[],a.webpackPolyfill=1),a}},function(a,b,c){function d(a){return a=e(a),a.search(/[\xC0-\xFF]/g)>-1&&(a=a.replace(/[\xC0-\xC5]/g,"A").replace(/[\xC6]/g,"AE").replace(/[\xC7]/g,"C").replace(/[\xC8-\xCB]/g,"E").replace(/[\xCC-\xCF]/g,"I").replace(/[\xD0]/g,"D").replace(/[\xD1]/g,"N").replace(/[\xD2-\xD6\xD8]/g,"O").replace(/[\xD9-\xDC]/g,"U").replace(/[\xDD]/g,"Y").replace(/[\xDE]/g,"P").replace(/[\xE0-\xE5]/g,"a").replace(/[\xE6]/g,"ae").replace(/[\xE7]/g,"c").replace(/[\xE8-\xEB]/g,"e").replace(/[\xEC-\xEF]/g,"i").replace(/[\xF1]/g,"n").replace(/[\xF2-\xF6\xF8]/g,"o").replace(/[\xF9-\xFC]/g,"u").replace(/[\xFE]/g,"p").replace(/[\xFD\xFF]/g,"y")),a}var e=c(29);a.exports=d},function(a,b,c){function d(a){return a=e(a),a.replace(f,"")}var e=c(29),f=/[^\x20\x2D0-9A-Z\x5Fa-z\xC0-\xD6\xD8-\xF6\xF8-\xFF]/g;a.exports=d},function(a,b,c){function d(a){return a=e(a),a.toLowerCase()}var e=c(29);a.exports=d}])});
//# sourceMappingURL=js-data.min.map
{'fraction_non_alphanumeric': 0.2874634532443827, 'fraction_numerical': 0.00967580402862358, 'mean_word_length': 14.308605341246292, 'pattern_counts': {'":': 15, '<': 35, '<?xml version=': 0, '>': 53, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5917456', 'n_tokens_mistral': 27319, 'n_tokens_neox': 27168, 'n_words': 1577}