From 456fa5afee0e991fdb48d480caf03ad756a2d516 Mon Sep 17 00:00:00 2001 From: Kia King Ishii Date: Mon, 8 Jul 2019 22:32:23 +0900 Subject: [PATCH] [Release] 0.5.1 --- dist/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index e48ce91..cde0ab5 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,8 +1,8 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["vuex-orm-axios"]=e():t["vuex-orm-axios"]=e()}(global,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=210)}([function(t,e,n){"use strict";var r=n(56),o=n(181),i=Object.prototype.toString;function s(t){return"[object Array]"===i.call(t)}function a(t){return null!==t&&"object"==typeof t}function u(t){return"[object Function]"===i.call(t)}function c(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),s(t))for(var n=0,r=t.length;n-1&&t%1==0&&t-1&&t%1==0&&t<=n}},function(t,e){var n=Object.prototype;t.exports=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||n)}},function(t,e,n){var r=n(1),o=n(16),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;t.exports=function(t,e){if(r(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!o(t))||s.test(t)||!i.test(t)||null!=e&&t in Object(e)}},function(t,e,n){var r=n(52);t.exports=function(t,e,n){"__proto__"==e&&r?r(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}},function(t,e,n){"use strict";var r=n(0),o=n(183),i={"Content-Type":"application/x-www-form-urlencoded"};function s(t,e){!r.isUndefined(t)&&r.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var a,u={adapter:("undefined"!=typeof XMLHttpRequest?a=n(184):"undefined"!=typeof process&&(a=n(189)),a),transformRequest:[function(t,e){return o(e,"Content-Type"),r.isFormData(t)||r.isArrayBuffer(t)||r.isBuffer(t)||r.isStream(t)||r.isFile(t)||r.isBlob(t)?t:r.isArrayBufferView(t)?t.buffer:r.isURLSearchParams(t)?(s(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):r.isObject(t)?(s(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(t){return t>=200&&t<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},r.forEach(["delete","get","head"],function(t){u.headers[t]={}}),r.forEach(["post","put","patch"],function(t){u.headers[t]=r.merge(i)}),t.exports=u},function(t,e,n){"use strict";var r=n(58);t.exports=function(t,e,n,o,i){var s=new Error(t);return r(s,e,n,o,i)}},function(t,e){t.exports=function(t,e){for(var n=-1,r=null==t?0:t.length,o=Array(r);++nl))return!1;var d=f.get(t);if(d&&f.get(e))return d==e;var y=-1,v=!0,m=n&a?new r:void 0;for(f.set(t,e),f.set(e,t);++y=300&&t.statusCode<400){if(this._currentRequest.removeAllListeners(),this._currentRequest.on("error",v),this._currentRequest.abort(),++this._redirectCount>this._options.maxRedirects)return void this.emit("error",new Error("Max redirects exceeded."));var n,o=this._options.headers;if(307!==t.statusCode&&!(this._options.method in f))for(n in this._options.method="GET",this._requestBodyBuffers=[],o)/^content-/i.test(n)&&delete o[n];if(!this._isRedirect)for(n in o)/^host$/i.test(n)&&delete o[n];var i=r.resolve(this._currentUrl,e);c("redirecting to",i),Object.assign(this._options,r.parse(i)),this._isRedirect=!0,this._performRequest(),t.destroy()}else t.responseUrl=this._currentUrl,t.redirects=this._redirects,this.emit("response",t),this._requestBodyBuffers=[]},t.exports=y({http:i,https:s}),t.exports.wrap=y},function(t,e){t.exports=require("url")},function(t,e,n){"use strict";t.exports=function(t){function e(t){for(var e=0,n=0;n-1}},function(t,e,n){var r=n(11);t.exports=function(t,e){var n=this.__data__,o=r(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this}},function(t,e,n){var r=n(10);t.exports=function(){this.__data__=new r,this.size=0}},function(t,e){t.exports=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}},function(t,e){t.exports=function(t){return this.__data__.get(t)}},function(t,e){t.exports=function(t){return this.__data__.has(t)}},function(t,e,n){var r=n(10),o=n(22),i=n(24),s=200;t.exports=function(t,e){var n=this.__data__;if(n instanceof r){var a=n.__data__;if(!o||a.length1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(s=t.length>3&&"function"==typeof s?(i--,s):void 0,a&&o(n[0],n[1],a)&&(s=i<3?void 0:s,i=1),e=Object(e);++r0){if(++e>=n)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}},function(t,e,n){var r=n(9),o=n(7),i=n(28),s=n(3);t.exports=function(t,e,n){if(!s(n))return!1;var a=typeof e;return!!("number"==a?o(n)&&i(e,n.length):"string"==a&&e in n)&&r(n[e],t)}},function(t,e,n){var r=n(20),o=n(7),i=n(15);t.exports=function(t){return function(e,n,s){var a=Object(e);if(!o(e)){var u=r(n,3);e=i(e),n=function(t){return u(a[t],t,a)}}var c=t(e,n,s);return c>-1?a[u?e[c]:c]:void 0}}},function(t,e,n){var r=n(173),o=n(20),i=n(174),s=Math.max;t.exports=function(t,e,n){var a=null==t?0:t.length;if(!a)return-1;var u=null==n?0:i(n);return u<0&&(u=s(a+u,0)),r(t,o(e,3),u)}},function(t,e){t.exports=function(t,e,n,r){for(var o=t.length,i=n+(r?1:-1);r?i--:++i-1&&t%1==0&&t-1&&t%1==0&&t<=n}},function(t,e){var n=Object.prototype;t.exports=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||n)}},function(t,e,n){var r=n(5),o=n(24),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;t.exports=function(t,e){if(r(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!o(t))||a.test(t)||!i.test(t)||null!=e&&t in Object(e)}},function(t,e,n){var r=n(60);t.exports=function(t,e,n){"__proto__"==e&&r?r(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}},function(t,e,n){"use strict";var r=n(4);function o(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}t.exports=function(t,e,n){if(!e)return t;var i;if(n)i=n(e);else if(r.isURLSearchParams(e))i=e.toString();else{var a=[];r.forEach(e,function(t,e){null!=t&&(r.isArray(t)?e+="[]":t=[t],r.forEach(t,function(t){r.isDate(t)?t=t.toISOString():r.isObject(t)&&(t=JSON.stringify(t)),a.push(o(e)+"="+o(t))}))}),i=a.join("&")}if(i){var u=t.indexOf("#");-1!==u&&(t=t.slice(0,u)),t+=(-1===t.indexOf("?")?"?":"&")+i}return t}},function(t,e,n){"use strict";var r=n(68);t.exports=function(t,e,n,o,i){var a=new Error(t);return r(a,e,n,o,i)}},function(t,e){t.exports=function(t,e){for(var n=-1,r=null==t?0:t.length,o=Array(r);++np))return!1;var d=f.get(t);if(d&&f.get(e))return d==e;var y=-1,v=!0,m=n&u?new r:void 0;for(f.set(t,e),f.set(e,t);++y=200&&t<300}};s.headers={common:{Accept:"application/json, text/plain, */*"}},r.forEach(["delete","get","head"],function(t){s.headers[t]={}}),r.forEach(["post","put","patch"],function(t){s.headers[t]=r.merge(i)}),t.exports=s},function(t,e,n){"use strict";var r=n(43);t.exports=function(t,e,n){var o=n.config.validateStatus;!o||o(n.status)?t(n):e(r("Request failed with status code "+n.status,n.config,null,n.request,n))}},function(t,e,n){"use strict";t.exports=function(t,e,n,r,o){return t.config=e,n&&(t.code=n),t.request=r,t.response=o,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},t}},function(t,e){t.exports=require("http")},function(t,e){t.exports=require("https")},function(t,e,n){var r=n(72),o=n(69),i=n(70),a=n(201),u=n(202).Writable,s=n(203)("follow-redirects"),c={GET:!0,HEAD:!0,OPTIONS:!0,TRACE:!0},f=Object.create(null);function l(t,e){u.call(this),t.headers=t.headers||{},this._options=t,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],t.host&&(t.hostname||(t.hostname=t.host),delete t.host),e&&this.on("response",e);var n=this;if(this._onNativeResponse=function(t){n._processResponse(t)},!t.pathname&&t.path){var r=t.path.indexOf("?");r<0?t.pathname=t.path:(t.pathname=t.path.substring(0,r),t.search=t.path.substring(r))}this._performRequest()}function p(t){var e={maxRedirects:21,maxBodyLength:10485760},n={};return Object.keys(t).forEach(function(o){var i=o+":",u=n[i]=t[o],c=e[o]=Object.create(u);c.request=function(t,o){return"string"==typeof t?(t=r.parse(t)).maxRedirects=e.maxRedirects:t=Object.assign({protocol:i,maxRedirects:e.maxRedirects,maxBodyLength:e.maxBodyLength},t),t.nativeProtocols=n,a.equal(t.protocol,i,"protocol mismatch"),s("options",t),new l(t,o)},c.get=function(t,e){var n=c.request(t,e);return n.end(),n}}),e}["abort","aborted","error","socket","timeout"].forEach(function(t){f[t]=function(e){this._redirectable.emit(t,e)}}),l.prototype=Object.create(u.prototype),l.prototype.write=function(t,e,n){if(!("string"==typeof t||"object"==typeof t&&"length"in t))throw new Error("data should be a string, Buffer or Uint8Array");"function"==typeof e&&(n=e,e=null),0!==t.length?this._requestBodyLength+t.length<=this._options.maxBodyLength?(this._requestBodyLength+=t.length,this._requestBodyBuffers.push({data:t,encoding:e}),this._currentRequest.write(t,e,n)):(this.emit("error",new Error("Request body larger than maxBodyLength limit")),this.abort()):n&&n()},l.prototype.end=function(t,e,n){"function"==typeof t?(n=t,t=e=null):"function"==typeof e&&(n=e,e=null);var r=this._currentRequest;this.write(t||"",e,function(){r.end(null,null,n)})},l.prototype.setHeader=function(t,e){this._options.headers[t]=e,this._currentRequest.setHeader(t,e)},l.prototype.removeHeader=function(t){delete this._options.headers[t],this._currentRequest.removeHeader(t)},["abort","flushHeaders","getHeader","setNoDelay","setSocketKeepAlive","setTimeout"].forEach(function(t){l.prototype[t]=function(e,n){return this._currentRequest[t](e,n)}}),["aborted","connection","socket"].forEach(function(t){Object.defineProperty(l.prototype,t,{get:function(){return this._currentRequest[t]}})}),l.prototype._performRequest=function(){var t=this._options.protocol,e=this._options.nativeProtocols[t];if(e){if(this._options.agents){var n=t.substr(0,t.length-1);this._options.agent=this._options.agents[n]}var o=this._currentRequest=e.request(this._options,this._onNativeResponse);for(var i in this._currentUrl=r.format(this._options),o._redirectable=this,f)i&&o.on(i,f[i]);if(this._isRedirect){var a=0,u=this._requestBodyBuffers;!function t(){if(a=300&&t.statusCode<400){if(++this._redirectCount>this._options.maxRedirects)return void this.emit("error",new Error("Max redirects exceeded."));var n,o=this._options.headers;if(307!==t.statusCode&&!(this._options.method in c))for(n in this._options.method="GET",this._requestBodyBuffers=[],o)/^content-/i.test(n)&&delete o[n];if(!this._isRedirect)for(n in o)/^host$/i.test(n)&&delete o[n];var i=r.resolve(this._currentUrl,e);s("redirecting to",i),Object.assign(this._options,r.parse(i)),this._isRedirect=!0,this._performRequest(),t.destroy()}else t.responseUrl=this._currentUrl,t.redirects=this._redirects,this.emit("response",t),this._requestBodyBuffers=[]},t.exports=p({http:o,https:i}),t.exports.wrap=p},function(t,e){t.exports=require("url")},function(t,e,n){function r(t){var n;function r(){if(r.enabled){var t=r,o=+new Date,i=o-(n||o);t.diff=i,t.prev=n,t.curr=o,n=o;for(var a=new Array(arguments.length),u=0;u-1}},function(t,e,n){var r=n(19);t.exports=function(t,e){var n=this.__data__,o=r(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this}},function(t,e,n){var r=n(18);t.exports=function(){this.__data__=new r,this.size=0}},function(t,e){t.exports=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}},function(t,e){t.exports=function(t){return this.__data__.get(t)}},function(t,e){t.exports=function(t){return this.__data__.has(t)}},function(t,e,n){var r=n(18),o=n(30),i=n(32),a=200;t.exports=function(t,e){var n=this.__data__;if(n instanceof r){var u=n.__data__;if(!o||u.length1?n[i-1]:void 0,u=i>2?n[2]:void 0;for(a=t.length>3&&"function"==typeof a?(i--,a):void 0,u&&o(n[0],n[1],u)&&(a=i<3?void 0:a,i=1),e=Object(e);++r0){if(++e>=n)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}},function(t,e,n){var r=n(16),o=n(14),i=n(36),a=n(10);t.exports=function(t,e,n){if(!a(n))return!1;var u=typeof e;return!!("number"==u?o(n)&&i(e,n.length):"string"==u&&e in n)&&r(n[e],t)}},function(t,e,n){var r=n(28),o=n(14),i=n(23);t.exports=function(t){return function(e,n,a){var u=Object(e);if(!o(e)){var s=r(n,3);e=i(e),n=function(t){return s(u[t],t,u)}}var c=t(e,n,a);return c>-1?u[s?e[c]:c]:void 0}}},function(t,e,n){var r=n(182),o=n(28),i=n(183),a=Math.max;t.exports=function(t,e,n){var u=null==t?0:t.length;if(!u)return-1;var s=null==n?0:i(n);return s<0&&(s=a(u+s,0)),r(t,o(e,3),s)}},function(t,e){t.exports=function(t,e,n,r){for(var o=t.length,i=n+(r?1:-1);r?i--:++i=0,i=o&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,t.exports=n(190),o)r.regeneratorRuntime=i;else try{delete r.regeneratorRuntime}catch(t){r.regeneratorRuntime=void 0}},function(t,e){!function(e){"use strict";var n,r=Object.prototype,o=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag",c="object"==typeof t,f=e.regeneratorRuntime;if(f)c&&(t.exports=f);else{(f=e.regeneratorRuntime=c?t.exports:{}).wrap=x;var l="suspendedStart",p="suspendedYield",h="executing",d="completed",y={},v={};v[a]=function(){return this};var m=Object.getPrototypeOf,g=m&&m(m(A([])));g&&g!==r&&o.call(g,a)&&(v=g);var b=k.prototype=O.prototype=Object.create(v);j.prototype=b.constructor=k,k.constructor=j,k[s]=j.displayName="GeneratorFunction",f.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===j||"GeneratorFunction"===(e.displayName||e.name))},f.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,k):(t.__proto__=k,s in t||(t[s]="GeneratorFunction")),t.prototype=Object.create(b),t},f.awrap=function(t){return{__await:t}},_(C.prototype),C.prototype[u]=function(){return this},f.AsyncIterator=C,f.async=function(t,e,n,r){var o=new C(x(t,e,n,r));return f.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},_(b),b[s]="Generator",b[a]=function(){return this},b.toString=function(){return"[object Generator]"},f.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},f.values=A,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(F),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,o){return u.type="throw",u.arg=t,e.next=r,o&&(e.method="next",e.arg=n),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=o.call(a,"catchLoc"),c=o.call(a,"finallyLoc");if(s&&c){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),F(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;F(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:A(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),y}}}function x(t,e,n,r){var o=e&&e.prototype instanceof O?e:O,i=Object.create(o.prototype),a=new S(r||[]);return i._invoke=function(t,e,n){var r=l;return function(o,i){if(r===h)throw new Error("Generator is already running");if(r===d){if("throw"===o)throw i;return $()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var u=E(a,n);if(u){if(u===y)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===l)throw r=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=h;var s=w(t,e,n);if("normal"===s.type){if(r=n.done?d:p,s.arg===y)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r=d,n.method="throw",n.arg=s.arg)}}}(t,n,a),i}function w(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function O(){}function j(){}function k(){}function _(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function C(t){var e;this._invoke=function(n,r){function i(){return new Promise(function(e,i){!function e(n,r,i,a){var u=w(t[n],t,r);if("throw"!==u.type){var s=u.arg,c=s.value;return c&&"object"==typeof c&&o.call(c,"__await")?Promise.resolve(c.__await).then(function(t){e("next",t,i,a)},function(t){e("throw",t,i,a)}):Promise.resolve(c).then(function(t){s.value=t,i(s)},function(t){return e("throw",t,i,a)})}a(u.arg)}(n,r,e,i)})}return e=e?e.then(i,i):i()}}function E(t,e){var r=t.iterator[e.method];if(r===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=n,E(t,e),"throw"===e.method))return y;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=w(r,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,y;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=n),e.delegate=null,y):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,y)}function R(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function F(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(R,this),this.reset(!0)}function A(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r * @license MIT */ -t.exports=function(t){return null!=t&&(n(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},function(t,e,n){"use strict";var r=n(34),o=n(0),i=n(203),s=n(204);function a(t){this.defaults=t,this.interceptors={request:new i,response:new i}}a.prototype.request=function(t){"string"==typeof t&&(t=o.merge({url:arguments[0]},arguments[1])),(t=o.merge(r,{method:"get"},this.defaults,t)).method=t.method.toLowerCase();var e=[s,void 0],n=Promise.resolve(t);for(this.interceptors.request.forEach(function(t){e.unshift(t.fulfilled,t.rejected)}),this.interceptors.response.forEach(function(t){e.push(t.fulfilled,t.rejected)});e.length;)n=n.then(e.shift(),e.shift());return n},o.forEach(["delete","get","head","options"],function(t){a.prototype[t]=function(e,n){return this.request(o.merge(n||{},{method:t,url:e}))}}),o.forEach(["post","put","patch"],function(t){a.prototype[t]=function(e,n,r){return this.request(o.merge(r||{},{method:t,url:e,data:n}))}}),t.exports=a},function(t,e,n){"use strict";var r=n(0);t.exports=function(t,e){r.forEach(t,function(n,r){r!==e&&r.toUpperCase()===e.toUpperCase()&&(t[e]=n,delete t[r])})}},function(t,e,n){"use strict";var r=n(0),o=n(57),i=n(59),s=n(185),a=n(186),u=n(35),c="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||n(187);t.exports=function(t){return new Promise(function(e,f){var p=t.data,l=t.headers;r.isFormData(p)&&delete l["Content-Type"];var h=new XMLHttpRequest,d="onreadystatechange",y=!1;if("undefined"==typeof window||!window.XDomainRequest||"withCredentials"in h||a(t.url)||(h=new window.XDomainRequest,d="onload",y=!0,h.onprogress=function(){},h.ontimeout=function(){}),t.auth){var v=t.auth.username||"",m=t.auth.password||"";l.Authorization="Basic "+c(v+":"+m)}if(h.open(t.method.toUpperCase(),i(t.url,t.params,t.paramsSerializer),!0),h.timeout=t.timeout,h[d]=function(){if(h&&(4===h.readyState||y)&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in h?s(h.getAllResponseHeaders()):null,r={data:t.responseType&&"text"!==t.responseType?h.response:h.responseText,status:1223===h.status?204:h.status,statusText:1223===h.status?"No Content":h.statusText,headers:n,config:t,request:h};o(e,f,r),h=null}},h.onerror=function(){f(u("Network Error",t,null,h)),h=null},h.ontimeout=function(){f(u("timeout of "+t.timeout+"ms exceeded",t,"ECONNABORTED",h)),h=null},r.isStandardBrowserEnv()){var g=n(188),b=(t.withCredentials||a(t.url))&&t.xsrfCookieName?g.read(t.xsrfCookieName):void 0;b&&(l[t.xsrfHeaderName]=b)}if("setRequestHeader"in h&&r.forEach(l,function(t,e){void 0===p&&"content-type"===e.toLowerCase()?delete l[e]:h.setRequestHeader(e,t)}),t.withCredentials&&(h.withCredentials=!0),t.responseType)try{h.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&h.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&h.upload&&h.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then(function(t){h&&(h.abort(),f(t),h=null)}),void 0===p&&(p=null),h.send(p)})}},function(t,e,n){"use strict";var r=n(0),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];t.exports=function(t){var e,n,i,s={};return t?(r.forEach(t.split("\n"),function(t){if(i=t.indexOf(":"),e=r.trim(t.substr(0,i)).toLowerCase(),n=r.trim(t.substr(i+1)),e){if(s[e]&&o.indexOf(e)>=0)return;s[e]="set-cookie"===e?(s[e]?s[e]:[]).concat([n]):s[e]?s[e]+", "+n:n}}),s):s}},function(t,e,n){"use strict";var r=n(0);t.exports=r.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function o(t){var r=t;return e&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return t=o(window.location.href),function(e){var n=r.isString(e)?o(e):e;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0}},function(t,e,n){"use strict";var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function o(){this.message="String contains an invalid character"}o.prototype=new Error,o.prototype.code=5,o.prototype.name="InvalidCharacterError",t.exports=function(t){for(var e,n,i=String(t),s="",a=0,u=r;i.charAt(0|a)||(u="=",a%1);s+=u.charAt(63&e>>8-a%1*8)){if((n=i.charCodeAt(a+=.75))>255)throw new o;e=e<<8|n}return s}},function(t,e,n){"use strict";var r=n(0);t.exports=r.isStandardBrowserEnv()?{write:function(t,e,n,o,i,s){var a=[];a.push(t+"="+encodeURIComponent(e)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(o)&&a.push("path="+o),r.isString(i)&&a.push("domain="+i),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(t,e,n){"use strict";var r=n(0),o=n(57),i=n(59),s=n(60),a=n(61),u=n(62).http,c=n(62).https,f=n(63),p=n(201),l=n(202),h=n(35),d=n(58);t.exports=function(t){return new Promise(function(e,n){var y,v=t.data,m=t.headers;if(m["User-Agent"]||m["user-agent"]||(m["User-Agent"]="axios/"+l.version),v&&!r.isStream(v)){if(Buffer.isBuffer(v));else if(r.isArrayBuffer(v))v=new Buffer(new Uint8Array(v));else{if(!r.isString(v))return n(h("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",t));v=new Buffer(v,"utf-8")}m["Content-Length"]=v.length}var g=void 0;t.auth&&(g=(t.auth.username||"")+":"+(t.auth.password||""));var b=f.parse(t.url),w=b.protocol||"http:";if(!g&&b.auth){var x=b.auth.split(":");g=(x[0]||"")+":"+(x[1]||"")}g&&delete m.Authorization;var O="https:"===w,_=O?t.httpsAgent:t.httpAgent,C={path:i(b.path,t.params,t.paramsSerializer).replace(/^\?/,""),method:t.method,headers:m,agent:_,auth:g};t.socketPath?C.socketPath=t.socketPath:(C.hostname=b.hostname,C.port=b.port);var j,k=t.proxy;if(!k&&!1!==k){var E=w.slice(0,-1)+"_proxy",R=process.env[E]||process.env[E.toUpperCase()];if(R){var F=f.parse(R);if(k={host:F.hostname,port:F.port},F.auth){var A=F.auth.split(":");k.auth={username:A[0],password:A[1]}}}}if(k&&(C.hostname=k.host,C.host=k.host,C.headers.host=b.hostname+(b.port?":"+b.port:""),C.port=k.port,C.path=w+"//"+b.hostname+(b.port?":"+b.port:"")+C.path,k.auth)){var S=new Buffer(k.auth.username+":"+k.auth.password,"utf8").toString("base64");C.headers["Proxy-Authorization"]="Basic "+S}t.transport?j=t.transport:0===t.maxRedirects?j=O?a:s:(t.maxRedirects&&(C.maxRedirects=t.maxRedirects),j=O?c:u),t.maxContentLength&&t.maxContentLength>-1&&(C.maxBodyLength=t.maxContentLength);var $=j.request(C,function(r){if(!$.aborted){clearTimeout(y),y=null;var i=r;switch(r.headers["content-encoding"]){case"gzip":case"compress":case"deflate":i=i.pipe(p.createUnzip()),delete r.headers["content-encoding"]}var s=r.req||$,a={status:r.statusCode,statusText:r.statusMessage,headers:r.headers,config:t,request:s};if("stream"===t.responseType)a.data=i,o(e,n,a);else{var u=[];i.on("data",function(e){u.push(e),t.maxContentLength>-1&&Buffer.concat(u).length>t.maxContentLength&&n(h("maxContentLength size of "+t.maxContentLength+" exceeded",t,null,s))}),i.on("error",function(e){$.aborted||n(d(e,t,null,s))}),i.on("end",function(){var r=Buffer.concat(u);"arraybuffer"!==t.responseType&&(r=r.toString("utf8")),a.data=r,o(e,n,a)})}}});$.on("error",function(e){$.aborted||n(d(e,t,null,$))}),t.timeout&&!y&&(y=setTimeout(function(){$.abort(),n(h("timeout of "+t.timeout+"ms exceeded",t,"ECONNABORTED",$))},t.timeout)),t.cancelToken&&t.cancelToken.promise.then(function(t){$.aborted||($.abort(),n(t))}),r.isStream(v)?v.pipe($):$.end(v)})}},function(t,e){t.exports=require("assert")},function(t,e){t.exports=require("stream")},function(t,e,n){"use strict";"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?t.exports=n(193):t.exports=n(195)},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}e.log=function(){var t;return"object"===("undefined"==typeof console?"undefined":r(console))&&console.log&&(t=console).log.apply(t,arguments)},e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var r=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(r++,"%c"===t&&(o=r))}),e.splice(o,0,n)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}},e.load=function(){var t;try{t=e.storage.getItem("debug")}catch(t){}!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG);return t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(t){}}(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.exports=n(64)(e),t.exports.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}},function(t,e){var n=1e3,r=60*n,o=60*r,i=24*o,s=7*i,a=365.25*i;function u(t,e,n,r){var o=e>=1.5*n;return Math.round(t/n)+" "+r+(o?"s":"")}t.exports=function(t,e){e=e||{};var c=typeof t;if("string"===c&&t.length>0)return function(t){if((t=String(t)).length>100)return;var e=/^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!e)return;var u=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return u*a;case"weeks":case"week":case"w":return u*s;case"days":case"day":case"d":return u*i;case"hours":case"hour":case"hrs":case"hr":case"h":return u*o;case"minutes":case"minute":case"mins":case"min":case"m":return u*r;case"seconds":case"second":case"secs":case"sec":case"s":return u*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}(t);if("number"===c&&!1===isNaN(t))return e.long?function(t){var e=Math.abs(t);if(e>=i)return u(t,e,i,"day");if(e>=o)return u(t,e,o,"hour");if(e>=r)return u(t,e,r,"minute");if(e>=n)return u(t,e,n,"second");return t+" ms"}(t):function(t){var e=Math.abs(t);if(e>=i)return Math.round(t/i)+"d";if(e>=o)return Math.round(t/o)+"h";if(e>=r)return Math.round(t/r)+"m";if(e>=n)return Math.round(t/n)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e,n){"use strict";var r=n(196),o=n(197);e.init=function(t){t.inspectOpts={};for(var n=Object.keys(e.inspectOpts),r=0;r=2&&(e.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(t){}e.inspectOpts=Object.keys(process.env).filter(function(t){return/^debug_/i.test(t)}).reduce(function(t,e){var n=e.substring(6).toLowerCase().replace(/_([a-z])/g,function(t,e){return e.toUpperCase()}),r=process.env[e];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),t[n]=r,t},{}),t.exports=n(64)(e);var s=t.exports.formatters;s.o=function(t){return this.inspectOpts.colors=this.useColors,o.inspect(t,this.inspectOpts).replace(/\s*\n\s*/g," ")},s.O=function(t){return this.inspectOpts.colors=this.useColors,o.inspect(t,this.inspectOpts)}},function(t,e){t.exports=require("tty")},function(t,e){t.exports=require("util")},function(t,e,n){"use strict";const r=n(199),o=n(200),i=process.env;let s;function a(t){return function(t){return 0!==t&&{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}(function(t){if(!1===s)return 0;if(o("color=16m")||o("color=full")||o("color=truecolor"))return 3;if(o("color=256"))return 2;if(t&&!t.isTTY&&!0!==s)return 0;const e=s?1:0;if("win32"===process.platform){const t=r.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in i)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(t=>t in i)||"codeship"===i.CI_NAME?1:e;if("TEAMCITY_VERSION"in i)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(i.TEAMCITY_VERSION)?1:0;if("truecolor"===i.COLORTERM)return 3;if("TERM_PROGRAM"in i){const t=parseInt((i.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(i.TERM_PROGRAM){case"iTerm.app":return t>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(i.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(i.TERM)?1:"COLORTERM"in i?1:(i.TERM,e)}(t))}o("no-color")||o("no-colors")||o("color=false")?s=!1:(o("color")||o("colors")||o("color=true")||o("color=always"))&&(s=!0),"FORCE_COLOR"in i&&(s=0===i.FORCE_COLOR.length||0!==parseInt(i.FORCE_COLOR,10)),t.exports={supportsColor:a,stdout:a(process.stdout),stderr:a(process.stderr)}},function(t,e){t.exports=require("os")},function(t,e,n){"use strict";t.exports=((t,e)=>{e=e||process.argv;const n=t.startsWith("-")?"":1===t.length?"-":"--",r=e.indexOf(n+t),o=e.indexOf("--");return-1!==r&&(-1===o||r=0?i=a:(i=o+a)<0&&(i=0);i0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]e)return 1;if(t=s)return u;var c=n[a];return u*("desc"===c?-1:1)}}return t.index-e.index}(t,e,n)})},pickBy:function(t,e){return Object.keys(t).reduce(function(n,r){var o=t[r];return e(o,r)&&(n[r]=o),n},{})}},x=function(){return function(t){this.model=t}}(),O=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.isNullable=!1,o.value=n,o.mutator=r,o}return y(e,t),e.prototype.nullable=function(){return this.isNullable=!0,this},e.prototype.mutate=function(t,e){var n=this.mutator||this.model.mutators()[e];return n?n(t):t},e}(x),_=function(t){function e(e,n,r){var o=t.call(this,e,n,r)||this;return o.value=n,o}return y(e,t),e.prototype.make=function(t,e,n){return t=void 0!==t?t:this.value,this.mutate(t,n)},e}(O),C=function(t){function e(e){return t.call(this,e,null)||this}return y(e,t),e.prototype.make=function(t,e,n){return"number"==typeof t?t:null},e}(O),j=function(t){function e(e,n,r){return t.call(this,e,n,r)||this}return y(e,t),e.prototype.make=function(t,e,n){return this.mutate(this.fix(t),n)},e.prototype.fix=function(t){return void 0===t?this.value:"string"==typeof t?t:null===t&&this.isNullable?t:t+""},e}(O),k=function(t){function e(e,n,r){return t.call(this,e,n,r)||this}return y(e,t),e.prototype.make=function(t,e,n){return this.mutate(this.fix(t),n)},e.prototype.fix=function(t){return void 0===t?this.value:"number"==typeof t?t:"string"==typeof t?parseFloat(t):"boolean"==typeof t?t?1:0:null===t&&this.isNullable?t:0},e}(O),E=function(t){function e(e,n,r){return t.call(this,e,n,r)||this}return y(e,t),e.prototype.make=function(t,e,n){return this.mutate(this.fix(t),n)},e.prototype.fix=function(t){if(void 0===t)return this.value;if("boolean"==typeof t)return t;if("string"==typeof t){if(0===t.length)return!1;var e=parseInt(t,0);return!!isNaN(e)||!!e}return"number"==typeof t?!!t:!(null!==t||!this.isNullable)&&t},e}(O),R=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return y(e,t),e.prototype.getRelation=function(t,e,n){var r=t.newQuery(e);return n.forEach(function(t){t(r)}),r},e.prototype.getKeys=function(t,e){return t.map(function(t){return t[e]})},e.prototype.mapSingleRelations=function(t,e){return t.reduce(function(t,n){return t[n[e]]=n,t},{})},e.prototype.mapManyRelations=function(t,e){return t.reduce(function(t,n){var r=n[e];return t[r]||(t[r]=[]),t[r].push(n),t},{})},e.prototype.isOneRelation=function(t){return!Array.isArray(t)&&null!==t&&"object"==typeof t},e.prototype.isManyRelation=function(t){return!!Array.isArray(t)&&!(t.length<1)},e.prototype.makeManyRelation=function(t,e){var n=this;return this.isManyRelation(t)?t.filter(function(t){return n.isOneRelation(t)}).map(function(t){return new e(t)}):[]},e}(x),F=function(t){function e(e,n,r,o){var i=t.call(this,e)||this;return i.related=i.model.relation(n),i.foreignKey=r,i.localKey=o,i}return y(e,t),e.prototype.define=function(t){return t.one(this.related)},e.prototype.attach=function(t,e,n){var r=n[this.related.entity];r&&r[t]&&void 0===r[t][this.foreignKey]&&(e[this.localKey]||(e[this.localKey]=e.$id),r[t][this.foreignKey]=e[this.localKey])},e.prototype.make=function(t,e,n){return this.isOneRelation(t)?new this.related(t):null},e.prototype.load=function(t,e,n,r){var o=this.getRelation(t,this.related.entity,r);this.addEagerConstraints(o,e),this.match(e,o.get(),n)},e.prototype.addEagerConstraints=function(t,e){t.whereFk(this.foreignKey,this.getKeys(e,this.localKey))},e.prototype.match=function(t,e,n){var r=this,o=this.buildDictionary(e);t.forEach(function(t){var e=t[r.localKey],i=o[e];t[n]=i||null})},e.prototype.buildDictionary=function(t){var e=this;return t.reduce(function(t,n){return t[n[e.foreignKey]]=n,t},{})},e}(R),A=function(t){function e(e,n,r,o){var i=t.call(this,e)||this;return i.parent=i.model.relation(n),i.foreignKey=r,i.ownerKey=o,i}return y(e,t),e.prototype.define=function(t){return t.one(this.parent)},e.prototype.attach=function(t,e,n){void 0===e[this.foreignKey]&&(e[this.foreignKey]=t)},e.prototype.make=function(t,e,n){return this.isOneRelation(t)?new this.parent(t):null},e.prototype.load=function(t,e,n,r){var o=this.getRelation(t,this.parent.entity,r);this.addEagerConstraints(o,e),this.match(e,o.get(),n)},e.prototype.addEagerConstraints=function(t,e){t.whereFk(this.ownerKey,this.getKeys(e,this.foreignKey))},e.prototype.match=function(t,e,n){var r=this,o=this.buildDictionary(e);t.forEach(function(t){var e=t[r.foreignKey],i=null!==e?o[e]:null;t[n]=i||null})},e.prototype.buildDictionary=function(t){var e=this;return t.reduce(function(t,n){return t[n[e.ownerKey]]=n,t},{})},e}(R),S=function(t){function e(e,n,r,o){var i=t.call(this,e)||this;return i.related=i.model.relation(n),i.foreignKey=r,i.localKey=o,i}return y(e,t),e.prototype.define=function(t){return t.many(this.related)},e.prototype.attach=function(t,e,n){var r=this;Array.isArray(t)&&t.forEach(function(t){var o=n[r.related.entity];o&&o[t]&&void 0===o[t][r.foreignKey]&&(o[t][r.foreignKey]=e[r.localKey])})},e.prototype.make=function(t,e,n){return this.makeManyRelation(t,this.related)},e.prototype.load=function(t,e,n,r){var o=this.getRelation(t,this.related.entity,r);this.addEagerConstraints(o,e),this.match(e,o.get(),n)},e.prototype.addEagerConstraints=function(t,e){t.whereFk(this.foreignKey,this.getKeys(e,this.localKey))},e.prototype.match=function(t,e,n){var r=this,o=this.buildDictionary(e);t.forEach(function(t){var e=t[r.localKey],i=o[e];t[n]=i||[]})},e.prototype.buildDictionary=function(t){var e=this;return t.reduce(function(t,n){var r=n[e.foreignKey];return t[r]||(t[r]=[]),t[r].push(n),t},{})},e}(R),$=function(t){function e(e,n,r,o){var i=t.call(this,e)||this;return i.parent=i.model.relation(n),i.foreignKey=r,i.ownerKey=o,i}return y(e,t),e.prototype.define=function(t){return t.many(this.parent)},e.prototype.attach=function(t,e,n){0!==t.length&&void 0===e[this.foreignKey]&&(e[this.foreignKey]=t)},e.prototype.make=function(t,e,n){return this.makeManyRelation(t,this.parent)},e.prototype.load=function(t,e,n,r){var o=this,i=this.getRelation(t,this.parent.entity,r);this.addConstraintForHasManyBy(i,e);var s=this.mapSingleRelations(i.get(),this.ownerKey);e.forEach(function(t){var e=o.getRelatedRecords(s,t[o.foreignKey]);t[n]=e})},e.prototype.addConstraintForHasManyBy=function(t,e){var n=this,r=e.reduce(function(t,e){return t.concat(e[n.foreignKey])},[]);t.where(this.ownerKey,r)},e.prototype.getRelatedRecords=function(t,e){return e.reduce(function(e,n){var r=t[n];return r&&e.push(r),e},[])},e}(R),M=function(t){function e(e,n,r,o,i,s,a){var u=t.call(this,e)||this;return u.related=u.model.relation(n),u.through=u.model.relation(r),u.firstKey=o,u.secondKey=i,u.localKey=s,u.secondLocalKey=a,u}return y(e,t),e.prototype.define=function(t){return t.many(this.related)},e.prototype.attach=function(t,e,n){},e.prototype.make=function(t,e,n){return this.makeManyRelation(t,this.related)},e.prototype.load=function(t,e,n,r){var o=this,i=this.getRelation(t,this.related.entity,r),s=t.newQuery(this.through.entity);this.addEagerConstraintForThrough(s,e);var a=s.get();this.addEagerConstraintForRelated(i,a);var u=this.mapThroughRelations(a,i);e.forEach(function(t){var e=u[t[o.localKey]];t[n]=e||[]})},e.prototype.addEagerConstraintForThrough=function(t,e){t.where(this.firstKey,this.getKeys(e,this.localKey))},e.prototype.addEagerConstraintForRelated=function(t,e){t.where(this.secondKey,this.getKeys(e,this.secondLocalKey))},e.prototype.mapThroughRelations=function(t,e){var n=this,r=this.mapManyRelations(e.get(),this.secondKey);return t.reduce(function(t,e){var o=e[n.firstKey];t[o]||(t[o]=[]);var i=r[e[n.secondLocalKey]];return t[o]=t[o].concat(i),t},{})},e}(R),K=function(t){function e(e,n,r,o,i,s,a){var u=t.call(this,e)||this;return u.related=u.model.relation(n),u.pivot=u.model.relation(r),u.foreignPivotKey=o,u.relatedPivotKey=i,u.parentKey=s,u.relatedKey=a,u}return y(e,t),e.prototype.define=function(t){return t.many(this.related)},e.prototype.attach=function(t,e,n){},e.prototype.make=function(t,e,n){return this.makeManyRelation(t,this.related)},e.prototype.load=function(t,e,n,r){var o=this,i=this.getRelation(t,this.related.entity,r),s=t.newQuery(this.pivot.entity);this.addEagerConstraintForPivot(s,e);var a=s.get();this.addEagerConstraintForRelated(i,a);var u=this.mapPivotRelations(a,i);e.forEach(function(t){var e=u[t[o.parentKey]];t[n]=e||[]})},e.prototype.addEagerConstraintForPivot=function(t,e){t.whereFk(this.foreignPivotKey,this.getKeys(e,this.parentKey))},e.prototype.addEagerConstraintForRelated=function(t,e){t.whereFk(this.relatedKey,this.getKeys(e,this.relatedPivotKey))},e.prototype.mapPivotRelations=function(t,e){var n=this,r=this.mapManyRelations(e.get(),this.relatedKey);return t.reduce(function(t,e){var o=e[n.foreignPivotKey];t[o]||(t[o]=[]);var i=r[e[n.relatedPivotKey]];return i&&(t[o]=t[o].concat(i)),t},{})},e.prototype.createPivots=function(t,e,n){var r=this;return this.pivot.primaryKey instanceof Array==!1?e:(w.forOwn(e[t.entity],function(t){var o=t[n];void 0!==o&&0!==o.length&&r.createPivotRecord(e,t,o)}),e)},e.prototype.createPivotRecord=function(t,e,n){var r=this;n.forEach(function(n){var o,i,s=e[r.parentKey]+"_"+n;t[r.pivot.entity]=v({},t[r.pivot.entity],((o={})[s]=((i={$id:s})[r.foreignPivotKey]=e[r.parentKey],i[r.relatedPivotKey]=n,i),o))})},e}(R),P=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.id=n,o.type=r,o}return y(e,t),e.prototype.define=function(t){var e=this;return t.union(function(t,n){return n[e.type]})},e.prototype.attach=function(t,e,n){},e.prototype.make=function(t,e,n){if(!this.isOneRelation(t))return null;var r=e[this.type],o=this.model.relation(r);return o?new o(t):null},e.prototype.load=function(t,e,n,r){var o=this,i=this.getTypes(e).reduce(function(e,n){var i=o.getRelation(t,n,r);return e[n]=o.mapSingleRelations(i.get(),"$id"),e},{});e.forEach(function(t){var e=t[o.id],r=t[o.type],s=i[r][e];t[n]=s||null})},e.prototype.getTypes=function(t){var e=this;return t.reduce(function(t,n){var r=n[e.type];return!t.includes(r)&&t.push(r),t},[])},e}(R),I=function(t){function e(e,n,r,o,i){var s=t.call(this,e)||this;return s.related=s.model.relation(n),s.id=r,s.type=o,s.localKey=i,s}return y(e,t),e.prototype.define=function(t){return t.one(this.related)},e.prototype.attach=function(t,e,n){var r=n[this.related.entity]&&n[this.related.entity][t];r&&(r[this.id]=r[this.id]||e.$id,r[this.type]=r[this.type]||this.model.entity)},e.prototype.make=function(t,e,n){return this.isOneRelation(t)?new this.related(t):null},e.prototype.load=function(t,e,n,r){var o=this,i=this.getRelation(t,this.related.entity,r);this.addEagerConstraintForMorphOne(i,e,t.entity);var s=this.mapSingleRelations(i.get(),this.id);e.forEach(function(t){var e=s[t[o.localKey]];t[n]=e||null})},e.prototype.addEagerConstraintForMorphOne=function(t,e,n){t.whereFk(this.type,n).whereFk(this.id,this.getKeys(e,this.localKey))},e}(R),B=function(t){function e(e,n,r,o,i){var s=t.call(this,e)||this;return s.related=s.model.relation(n),s.id=r,s.type=o,s.localKey=i,s}return y(e,t),e.prototype.define=function(t){return t.many(this.related)},e.prototype.attach=function(t,e,n){var r=this;if(Array.isArray(t)){var o=n[this.related.entity];t.forEach(function(t){var n=o[t];n[r.id]=n[r.id]||e.$id,n[r.type]=n[r.type]||r.model.entity})}},e.prototype.make=function(t,e,n){return this.makeManyRelation(t,this.related)},e.prototype.load=function(t,e,n,r){var o=this,i=this.getRelation(t,this.related.entity,r);this.addEagerConstraintForMorphMany(i,e,t.entity);var s=this.mapManyRelations(i.get(),this.id);e.forEach(function(t){var e=s[t[o.localKey]];t[n]=e||[]})},e.prototype.addEagerConstraintForMorphMany=function(t,e,n){t.whereFk(this.type,n).whereFk(this.id,this.getKeys(e,this.localKey))},e}(R),q=function(t){function e(e,n,r,o,i,s,a,u){var c=t.call(this,e)||this;return c.related=c.model.relation(n),c.pivot=c.model.relation(r),c.relatedId=o,c.id=i,c.type=s,c.parentKey=a,c.relatedKey=u,c}return y(e,t),e.prototype.define=function(t){return t.many(this.related)},e.prototype.attach=function(t,e,n){},e.prototype.make=function(t,e,n){return this.makeManyRelation(t,this.related)},e.prototype.load=function(t,e,n,r){var o=this,i=this.getRelation(t,this.related.entity,r),s=t.newQuery(this.pivot.entity);this.addEagerConstraintForPivot(s,e,t.entity);var a=s.get();this.addEagerConstraintForRelated(i,a);var u=this.mapPivotRelations(a,i);e.forEach(function(t){var e=u[t[o.parentKey]];t[n]=e||[]})},e.prototype.addEagerConstraintForPivot=function(t,e,n){t.whereFk(this.type,n).whereFk(this.id,this.getKeys(e,this.parentKey))},e.prototype.addEagerConstraintForRelated=function(t,e){t.whereFk(this.relatedKey,this.getKeys(e,this.relatedId))},e.prototype.mapPivotRelations=function(t,e){var n=this,r=this.mapManyRelations(e.get(),this.relatedKey);return t.reduce(function(t,e){var o=e[n.id];t[o]||(t[o]=[]);var i=r[e[n.relatedId]];return t[o]=t[o].concat(i),t},{})},e.prototype.createPivots=function(t,e,n){var r=this;return w.forOwn(e[t.entity],function(o){var i=t.query().newQuery(r.pivot.entity).where(r.id,o[r.parentKey]).where(r.type,t.entity).get().map(function(t){return t[r.parentKey]}),s=(o[n]||[]).filter(function(t){return!i.includes(t)});Array.isArray(s)&&0!==s.length&&r.createPivotRecord(t,e,o,s)}),e},e.prototype.createPivotRecord=function(t,e,n,r){var o=this;r.forEach(function(r){var i,s,a=n[o.parentKey],u=a+"_"+r+"_"+t.entity;e[o.pivot.entity]=v({},e[o.pivot.entity],((i={})[u]=((s={$id:u})[o.relatedId]=r,s[o.id]=a,s[o.type]=t.entity,s),i))})},e}(R),T=function(t){function e(e,n,r,o,i,s,a,u){var c=t.call(this,e)||this;return c.related=c.model.relation(n),c.pivot=c.model.relation(r),c.relatedId=o,c.id=i,c.type=s,c.parentKey=a,c.relatedKey=u,c}return y(e,t),e.prototype.define=function(t){return t.many(this.related)},e.prototype.attach=function(t,e,n){},e.prototype.make=function(t,e,n){return this.makeManyRelation(t,this.related)},e.prototype.load=function(t,e,n,r){var o=this,i=this.getRelation(t,this.related.entity,r),s=t.newQuery(this.pivot.entity);this.addEagerConstraintForPivot(s,e,this.related.entity);var a=s.get();this.addEagerConstraintForRelated(i,a);var u=this.mapPivotRelations(a,i);e.forEach(function(t){var e=u[t[o.parentKey]];t[n]=e||[]})},e.prototype.addEagerConstraintForPivot=function(t,e,n){t.whereFk(this.type,n).whereFk(this.relatedId,this.getKeys(e,this.parentKey))},e.prototype.addEagerConstraintForRelated=function(t,e){t.whereFk(this.relatedKey,this.getKeys(e,this.id))},e.prototype.mapPivotRelations=function(t,e){var n=this,r=this.mapManyRelations(e.get(),this.relatedKey);return t.reduce(function(t,e){var o=e[n.relatedId];t[o]||(t[o]=[]);var i=r[e[n.id]];return t[o]=t[o].concat(i),t},{})},e.prototype.createPivots=function(t,e,n){var r=this;return w.forOwn(e[t.entity],function(t){var o=t[n];Array.isArray(o)&&r.createPivotRecord(e,t,o)}),e},e.prototype.createPivotRecord=function(t,e,n){var r=this;n.forEach(function(n){var o,i,s=e[r.parentKey],a=n+"_"+s+"_"+r.related.entity;t[r.pivot.entity]=v({},t[r.pivot.entity],((o={})[a]=((i={$id:a})[r.relatedId]=s,i[r.id]=n,i[r.type]=r.related.entity,i),o))})},e}(R),U=function(){function t(){}return t.serialize=function(t){var e=this,n=t.$fields();return Object.keys(n).reduce(function(n,r){var o=t[r];return n[r]=e.serializeValue(o),n},{})},t.serializeValue=function(t){return t instanceof z?this.serializeItem(t):Array.isArray(t)?this.serializeCollection(t):t},t.serializeItem=function(t){return t.$toJson()},t.serializeCollection=function(t){return t.map(function(t){return t instanceof z?t.$toJson():t})},t}(),z=function(){function t(t){this.$id=null,this.$fill(t)}return t.fields=function(){return{}},t.getFields=function(){return this.cachedFields?this.cachedFields:(this.cachedFields=this.fields(),this.cachedFields)},t.attr=function(t,e){return new _(this,t,e)},t.string=function(t,e){return new j(this,t,e)},t.number=function(t,e){return new k(this,t,e)},t.boolean=function(t,e){return new E(this,t,e)},t.increment=function(){return new C(this)},t.hasOne=function(t,e,n){return new F(this,t,e,this.localKey(n))},t.belongsTo=function(t,e,n){return new A(this,t,e,this.relation(t).localKey(n))},t.hasMany=function(t,e,n){return new S(this,t,e,this.localKey(n))},t.hasManyBy=function(t,e,n){return new $(this,t,e,this.relation(t).localKey(n))},t.hasManyThrough=function(t,e,n,r,o,i){return new M(this,t,e,n,r,this.localKey(o),this.relation(e).localKey(i))},t.belongsToMany=function(t,e,n,r,o,i){return new K(this,t,e,n,r,this.localKey(o),this.relation(t).localKey(i))},t.morphTo=function(t,e){return new P(this,t,e)},t.morphOne=function(t,e,n,r){return new I(this,t,e,n,this.localKey(r))},t.morphMany=function(t,e,n,r){return new B(this,t,e,n,this.localKey(r))},t.morphToMany=function(t,e,n,r,o,i,s){return new q(this,t,e,n,r,o,this.localKey(i),this.relation(t).localKey(s))},t.morphedByMany=function(t,e,n,r,o,i,s){return new T(this,t,e,n,r,o,this.localKey(i),this.relation(t).localKey(s))},t.mutators=function(){return{}},t.database=function(){return h.database},t.store=function(){return this.database().store},t.namespace=function(t){return this.database().namespace+"/"+this.entity+"/"+t},t.getters=function(t){return this.store().getters[this.namespace(t)]},t.dispatch=function(t,e){return this.store().dispatch(this.namespace(t),e)},t.commit=function(t){this.store().commit(this.database().namespace+"/$mutate",{entity:this.entity,callback:t})},t.all=function(){return this.getters("all")()},t.find=function(t){return this.getters("find")(t)},t.findIn=function(t){return this.getters("findIn")(t)},t.query=function(){return this.getters("query")()},t.new=function(){return this.dispatch("new")},t.create=function(t){return this.dispatch("create",t)},t.insert=function(t){return this.dispatch("insert",t)},t.update=function(t){return this.dispatch("update",t)},t.insertOrUpdate=function(t){return this.dispatch("insertOrUpdate",t)},t.delete=function(t){return this.dispatch("delete",t)},t.deleteAll=function(){return this.dispatch("deleteAll")},t.id=function(t){var e=this.primaryKey;return"string"==typeof e?t[e]:e.map(function(e){return t[e]}).join("_")},t.localKey=function(t){return t||("string"==typeof this.primaryKey?this.primaryKey:"id")},t.relation=function(t){return"string"!=typeof t?t:this.database().model(t)},t.getAttributeClass=function(t){switch(t){case"increment":return C;default:throw Error('The attribute name "'+t+"\" doesn't exists.")}},t.getFieldsByAttribute=function(t){var e=this.getAttributeClass(t),n=this.fields();return Object.keys(n).reduce(function(t,r){var o=n[r];return o instanceof e&&(t[r]=o),t},{})},t.getIncrementFields=function(){return this.getFieldsByAttribute("increment")},t.hasIncrementFields=function(){return Object.keys(this.getIncrementFields()).length>0},t.pivotFields=function(){var t=[];return w.forOwn(this.fields(),function(e,n){var r;(e instanceof K||e instanceof q||e instanceof T)&&t.push(((r={})[n]=e,r))}),t},t.hasPivotFields=function(){return this.pivotFields().length>0},t.hydrate=function(t){return new this(t).$toJson()},t.prototype.$self=function(){return this.constructor},t.prototype.$fields=function(){return this.$self().getFields()},t.prototype.$store=function(){return this.$self().store()},t.prototype.$namespace=function(t){return this.$self().namespace(t)},t.prototype.$getters=function(t){return this.$self().getters(t)},t.prototype.$dispatch=function(t,e){return m(this,void 0,void 0,function(){return g(this,function(n){return[2,this.$self().dispatch(t,e)]})})},t.prototype.$all=function(){return this.$getters("all")()},t.prototype.$find=function(t){return this.$getters("find")(t)},t.prototype.$findIn=function(t){return this.$getters("findIn")(t)},t.prototype.$query=function(){return this.$getters("query")()},t.prototype.$create=function(t){return m(this,void 0,void 0,function(){return g(this,function(e){return[2,this.$dispatch("create",t)]})})},t.prototype.$insert=function(t){return m(this,void 0,void 0,function(){return g(this,function(e){return[2,this.$dispatch("insert",t)]})})},t.prototype.$update=function(t){return m(this,void 0,void 0,function(){return g(this,function(e){return Array.isArray(t)?[2,this.$dispatch("update",t)]:void 0!==t.where?[2,this.$dispatch("update",t)]:void 0===this.$self().id(t)?[2,this.$dispatch("update",{where:this.$id,data:t})]:[2,this.$dispatch("update",t)]})})},t.prototype.$insertOrUpdate=function(t){return m(this,void 0,void 0,function(){return g(this,function(e){return[2,this.$dispatch("insertOrUpdate",t)]})})},t.prototype.$save=function(){return m(this,void 0,void 0,function(){var t,e,n,r=this;return g(this,function(o){switch(o.label){case 0:return t=this.$self().getFields(),e=Object.keys(t).reduce(function(e,n){return t[n]instanceof O&&(e[n]=r[n]),e},{}),[4,this.$dispatch("insertOrUpdate",{data:e})];case 1:return n=o.sent(),this.$fill(n[this.$self().entity][0]),[2,this]}})})},t.prototype.$delete=function(t){return m(this,void 0,void 0,function(){return g(this,function(e){return t?[2,this.$dispatch("delete",t)]:null===this.$id?[2,null]:[2,this.$dispatch("delete",this.$id)]})})},t.prototype.$deleteAll=function(){return m(this,void 0,void 0,function(){return g(this,function(t){return[2,this.$dispatch("deleteAll")]})})},t.prototype.$fill=function(t){var e=this,n=t||{},r=this.$fields();Object.keys(r).forEach(function(t){var o=r[t],i=n[t];e[t]=o.make(i,n,t)}),void 0!==n.$id&&(this.$id=n.$id)},t.prototype.$toJson=function(){return U.serialize(this)},t.prototype.toJSON=function(){return this.$toJson()},t.primaryKey="id",t.state={},t}();function L(t){return!(!t||"function"!=typeof t.hasOwnProperty||!(t.hasOwnProperty("__ownerID")||t._map&&t._map.hasOwnProperty("__ownerID")))}function N(t,e,n){return Object.keys(t).reduce(function(e,r){var o=""+r;return e.has(o)?e.set(o,n(e.get(o),t[o])):e},e)}var H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},D=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},V=function(){function t(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(D(this,t),!e||"string"!=typeof e)throw new Error("Expected a string key for Entity, but found "+e+".");var o=r.idAttribute,i=void 0===o?"id":o,s=r.mergeStrategy,a=void 0===s?function(t,e){return G({},t,e)}:s,u=r.processStrategy,c=void 0===u?function(t){return G({},t)}:u;this._key=e,this._getId="function"==typeof i?i:Q(i),this._idAttribute=i,this._mergeStrategy=a,this._processStrategy=c,this.define(n)}return t.prototype.define=function(t){this.schema=Object.keys(t).reduce(function(e,n){var r,o=t[n];return G({},e,((r={})[n]=o,r))},this.schema||{})},t.prototype.getId=function(t,e,n){return this._getId(t,e,n)},t.prototype.merge=function(t,e){return this._mergeStrategy(t,e)},t.prototype.normalize=function(t,e,n,r,o){var i=this,s=this._processStrategy(t,e,n);return Object.keys(this.schema).forEach(function(t){if(s.hasOwnProperty(t)&&"object"===H(s[t])){var e=i.schema[t];s[t]=r(s[t],s,t,e,o)}}),o(this,s,t,e,n),this.getId(t,e,n)},t.prototype.denormalize=function(t,e){var n=this;return L(t)?N(this.schema,t,e):(Object.keys(this.schema).forEach(function(r){if(t.hasOwnProperty(r)){var o=n.schema[r];t[r]=e(t[r],o)}}),t)},V(t,[{key:"key",get:function(){return this._key}},{key:"idAttribute",get:function(){return this._idAttribute}}]),t}(),X=function(){function t(e,n){D(this,t),n&&(this._schemaAttribute="string"==typeof n?function(t){return t[n]}:n),this.define(e)}return t.prototype.define=function(t){this.schema=t},t.prototype.getSchemaAttribute=function(t,e,n){return!this.isSingleSchema&&this._schemaAttribute(t,e,n)},t.prototype.inferSchema=function(t,e,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(t,e,n);return this.schema[r]},t.prototype.normalizeValue=function(t,e,n,r,o){var i=this.inferSchema(t,e,n);if(!i)return t;var s=r(t,e,n,i,o);return this.isSingleSchema||null==s?s:{id:s,schema:this.getSchemaAttribute(t,e,n)}},t.prototype.denormalizeValue=function(t,e){var n=L(t)?t.get("schema"):t.schema;return this.isSingleSchema||n?e((L(t)?t.get("id"):t.id)||t,this.isSingleSchema?this.schema:this.schema[n]):t},V(t,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),t}(),Z=function(t){function e(n,r){if(D(this,e),!r)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return J(this,t.call(this,n,r))}return W(e,t),e.prototype.normalize=function(t,e,n,r,o){return this.normalizeValue(t,e,n,r,o)},e.prototype.denormalize=function(t,e){return this.denormalizeValue(t,e)},e}(X),tt=function(t){function e(){return D(this,e),J(this,t.apply(this,arguments))}return W(e,t),e.prototype.normalize=function(t,e,n,r,o){var i=this;return Object.keys(t).reduce(function(e,n,s){var a,u=t[n];return null!=u?G({},e,((a={})[n]=i.normalizeValue(u,t,n,r,o),a)):e},{})},e.prototype.denormalize=function(t,e){var n=this;return Object.keys(t).reduce(function(r,o){var i,s=t[o];return G({},r,((i={})[o]=n.denormalizeValue(s,e),i))},{})},e}(X),et=function(t){return Array.isArray(t)?t:Object.keys(t).map(function(e){return t[e]})},nt=function(t,e,n,r,o,i){return t=function(t){if(Array.isArray(t)&&t.length>1)throw new Error("Expected schema definition to be a single schema, but found "+t.length+".");return t[0]}(t),et(e).map(function(e,s){return o(e,n,r,t,i)})},rt=function(t){function e(){return D(this,e),J(this,t.apply(this,arguments))}return W(e,t),e.prototype.normalize=function(t,e,n,r,o){var i=this;return et(t).map(function(t,s){return i.normalizeValue(t,e,n,r,o)}).filter(function(t){return null!=t})},e.prototype.denormalize=function(t,e){var n=this;return t&&t.map?t.map(function(t){return n.denormalizeValue(t,e)}):t},e}(X),ot=function(t,e,n,r,o,i){var s=G({},e);return Object.keys(t).forEach(function(n){var r=t[n],a=o(e[n],e,n,r,i);null==a?delete s[n]:s[n]=a}),s},it=function(){function t(e){D(this,t),this.define(e)}return t.prototype.define=function(t){this.schema=Object.keys(t).reduce(function(e,n){var r,o=t[n];return G({},e,((r={})[n]=o,r))},this.schema||{})},t.prototype.normalize=function(){for(var t=arguments.length,e=Array(t),n=0;n0&&t.withAllRecursive(e-1)})},t.setEagerLoad=function(t,e,n){void 0===n&&(n=null),t.load[e]||(t.load[e]=[]),n&&t.load[e].push(n)},t.parseWithRelations=function(t,e,n){var r=this,o=e[0];o.split("|").forEach(function(o){1!==e.length?r.setEagerLoad(t,o):r.setEagerLoad(t,o,n)}),1!==e.length&&(e.shift(),this.addNestedWiths(t,o,e,n))},t.addNestedWiths=function(t,e,n,r){this.setEagerLoad(t,e,function(t){t.with(n.join("."),r)})},t.eagerLoadRelations=function(t,e){var n=t.model.getFields();for(var r in t.load){var o=t.load[r],i=n[r];i instanceof R&&i.load(t,e,r,o)}},t}(),bt=function(){function t(){}return t.has=function(t,e,n,r){this.setHas(t,e,"exists",n,r)},t.hasNot=function(t,e,n,r){this.setHas(t,e,"doesntExist",n,r)},t.whereHas=function(t,e,n){this.setHas(t,e,"exists",void 0,void 0,n)},t.whereHasNot=function(t,e,n){this.setHas(t,e,"doesntExist",void 0,void 0,n)},t.setHas=function(t,e,n,r,o,i){void 0===r&&(r=">="),void 0===o&&(o=1),void 0===i&&(i=null),"number"!=typeof r?t.have.push({relation:e,type:n,operator:r,count:o,constraint:i}):t.have.push({relation:e,type:n,operator:">=",count:r,constraint:i})},t.applyConstraints=function(t){if(0!==t.have.length){var e=t.newQuery();this.addHasWhereConstraints(t,e),this.addHasConstraints(t,e.get())}},t.addHasWhereConstraints=function(t,e){t.have.forEach(function(t){e.with(t.relation,t.constraint)})},t.addHasConstraints=function(t,e){var n=this.getComparators(t),r=[];e.forEach(function(t){n.every(function(e){return e(t)})&&r.push(t.$id)}),t.whereIdIn(r)},t.getComparators=function(t){var e=this;return t.have.map(function(t){return e.getComparator(t)})},t.getComparator=function(t){var e=this,n=this.getCountComparator(t.operator);return function(r){var o=e.getRelationshipCount(r[t.relation]),i=n(o,t.count);return"exists"===t.type?i:!i}},t.getRelationshipCount=function(t){return Array.isArray(t)?t.length:t?1:0},t.getCountComparator=function(t){switch(t){case"=":return function(t,e){return t===e};case">":return function(t,e){return t>e};case">=":return function(t,e){return t>=e};case"<":return function(t,e){return t>0&&t0&&t<=e};default:return function(t,e){return t===e}}},t}(),wt=function(){function t(t){this.indexToBeDeleted=[],this.query=t}return t.on=function(t,e,n){void 0===n&&(n=!1);var r=this.lastHookId+1;return this.lastHookId=r,this.hooks[t]||(this.hooks[t]=[]),this.hooks[t].push({callback:e,once:n,uid:r}),r},t.off=function(t){var e=this,n=!1;return Object.keys(this.hooks).some(function(r){var o=e.hooks[r],i=o.findIndex(function(e){return e.uid===t});return-1!==i&&(o.splice(i,1),n=!0),n}),n},t.prototype.self=function(){return this.constructor},t.prototype.getHook=function(t){return this.query.model[t]||null},t.prototype.getGlobalHook=function(t){return this.self().hooks[t]||null},t.prototype.has=function(t){return!!this.getHook(t)||!!this.getGlobalHook(t)},t.prototype.executeSelectHook=function(t,e){return this.has(t)?(e=this.executeLocalSelectHook(t,e),e=this.executeGlobalSelectHook(t,e)):e},t.prototype.executeLocalSelectHook=function(t,e){var n=this.getHook(t);return n?n(e,this.query.entity):e},t.prototype.executeGlobalSelectHook=function(t,e){var n=this,r=this.getGlobalHook(t);if(!r)return e;var o=[];return r.forEach(function(t,r){var i=t.callback,s=t.once;e=i.call(n.query,e,n.query.entity),s&&o.push(r)}),o.reverse().forEach(function(t){r.splice(t,1)}),e},t.prototype.executeMutationHookOnRecords=function(t,e){var n=this;this.has(t)&&(Object.keys(e).forEach(function(r){!1===n.executeMutationHook(t,e[r])&&delete e[r]}),this.removeGlobalHook(t))},t.prototype.executeMutationHook=function(t,e){return!1!==this.executeLocalMutationHook(t,e)&&(!1!==this.executeGlobalMutationHook(t,e)&&void 0)},t.prototype.executeLocalMutationHook=function(t,e){var n=this.getHook(t);if(n)return n(e,this.query.entity)},t.prototype.executeGlobalMutationHook=function(t,e){var n=this,r=this.getGlobalHook(t);if(r){var o=[];return r.forEach(function(t,r){o.push(t.callback.call(n.query,e,n.query.entity)),t.once&&n.indexToBeDeleted.push(r)}),!o.includes(!1)&&void 0}},t.prototype.removeGlobalHook=function(t){var e=this.getGlobalHook(t);e&&this.indexToBeDeleted.reverse().forEach(function(t){e.splice(t,1)})},t.hooks={},t.lastHookId=0,t}(),xt=function(){function t(t,e){this.idFilter=null,this.cancelIdFilter=!1,this.joinedIdFilter=null,this.wheres=[],this.have=[],this.orders=[],this.offsetNumber=0,this.limitNumber=Math.pow(2,53)-1,this.load={},this.rootState=t,this.state=t[e],this.entity=e,this.model=this.getModel(e),this.module=this.getModule(e),this.hook=new wt(this)}return t.database=function(){return h.database},t.getModel=function(t){return this.database().model(t)},t.getModels=function(){return this.database().models()},t.getModule=function(t){return this.database().module(t)},t.getModules=function(){return this.database().modules()},t.deleteAll=function(t){var e=this,n=this.getModels();w.forOwn(n,function(n,r){t[r]&&new e(t,r).deleteAll()})},t.on=function(t,e,n){return wt.on(t,e,n)},t.off=function(t){return wt.off(t)},t.prototype.self=function(){return this.constructor},t.prototype.newQuery=function(e){return e=e||this.entity,new t(this.rootState,e)},t.prototype.database=function(){return this.self().database()},t.prototype.getModel=function(t){var e=t||this.entity;return this.self().getModel(e)},t.prototype.getModels=function(){return this.self().getModels()},t.prototype.getModule=function(t){var e=t||this.entity;return this.self().getModule(e)},t.prototype.getModules=function(){return this.self().getModules()},t.prototype.all=function(){return this.get()},t.prototype.find=function(t){return this.item(this.state.data[t])},t.prototype.findIn=function(t){var e=this;return t.map(function(t){return e.state.data[t]}).filter(function(t){return t})},t.prototype.get=function(){var t=this.select();return this.collect(t)},t.prototype.first=function(){var t=this.select();return this.item(t[0])},t.prototype.last=function(){var t=this.select();return this.item(t[t.length-1])},t.prototype.where=function(t,e){return this.isIdfilterable(t)&&this.setIdFilter(e),this.wheres.push({field:t,value:e,boolean:"and"}),this},t.prototype.orWhere=function(t,e){return this.cancelIdFilter=!0,this.wheres.push({field:t,value:e,boolean:"or"}),this},t.prototype.whereId=function(t){return this.where(this.model.primaryKey,t)},t.prototype.whereIdIn=function(t){return this.where(this.model.primaryKey,t)},t.prototype.whereFk=function(t,e){var n=Array.isArray(e)?e:[e];return t===this.model.primaryKey?(this.setJoinedIdFilter(n),this):(this.where(t,n),this)},t.prototype.isIdfilterable=function(t){return t===this.model.primaryKey&&!this.cancelIdFilter},t.prototype.setIdFilter=function(t){var e=this,n=Array.isArray(t)?t:[t];null!==this.idFilter?this.idFilter=new Set(n.filter(function(t){return e.idFilter.has(t)})):this.idFilter=new Set(n)},t.prototype.setJoinedIdFilter=function(t){var e=this;null!==this.joinedIdFilter?this.joinedIdFilter=new Set(t.filter(function(t){return e.joinedIdFilter.has(t)})):this.joinedIdFilter=new Set(t)},t.prototype.orderBy=function(t,e){return void 0===e&&(e="asc"),this.orders.push({field:t,direction:e}),this},t.prototype.offset=function(t){return this.offsetNumber=t,this},t.prototype.limit=function(t){return this.limitNumber=t,this},t.prototype.with=function(t,e){return void 0===e&&(e=null),gt.with(this,t,e),this},t.prototype.withAll=function(){return gt.withAll(this),this},t.prototype.withAllRecursive=function(t){return void 0===t&&(t=3),gt.withAllRecursive(this,t),this},t.prototype.has=function(t,e,n){return bt.has(this,t,e,n),this},t.prototype.hasNot=function(t,e,n){return bt.hasNot(this,t,e,n),this},t.prototype.whereHas=function(t,e){return bt.whereHas(this,t,e),this},t.prototype.whereHasNot=function(t,e){return bt.whereHasNot(this,t,e),this},t.prototype.records=function(){var t=this;return this.finalizeIdFilter(),this.getIdsToLookup().map(function(e){var n=t.state.data[e];return n instanceof z?n:t.hydrate(n)})},t.prototype.finalizeIdFilter=function(){this.cancelIdFilter&&null!==this.idFilter&&(this.where(this.model.primaryKey,Array.from(this.idFilter.values())),this.idFilter=null)},t.prototype.getIdsToLookup=function(){var t=this;return this.idFilter&&this.joinedIdFilter?Array.from(this.idFilter.values()).filter(function(e){return t.joinedIdFilter.has(e)}):this.idFilter||this.joinedIdFilter?Array.from((this.idFilter||this.joinedIdFilter).values()):Object.keys(this.state.data)},t.prototype.select=function(){bt.applyConstraints(this);var t=this.records();return t=this.hook.executeSelectHook("beforeSelect",t),t=this.filterWhere(t),t=this.hook.executeSelectHook("afterWhere",t),t=this.filterOrderBy(t),t=this.hook.executeSelectHook("afterOrderBy",t),t=this.filterLimit(t),t=this.hook.executeSelectHook("afterLimit",t)},t.prototype.filterWhere=function(t){return mt.where(this,t)},t.prototype.filterOrderBy=function(t){return mt.orderBy(this,t)},t.prototype.filterLimit=function(t){return mt.limit(this,t)},t.prototype.count=function(){return this.get().length},t.prototype.max=function(t){var e=this.get().reduce(function(e,n){return"number"==typeof n[t]&&e.push(n[t]),e},[]);return 0===e.length?0:Math.max.apply(Math,e)},t.prototype.min=function(t){var e=this.get().reduce(function(e,n){return"number"==typeof n[t]&&e.push(n[t]),e},[]);return 0===e.length?0:Math.min.apply(Math,e)},t.prototype.sum=function(t){return this.get().reduce(function(e,n){return"number"==typeof n[t]&&(e+=n[t]),e},0)},t.prototype.item=function(t){if(!t)return null;if(Object.keys(this.load).length>0){t=new this.model(t);var e=this.hook.executeSelectHook("beforeRelations",[t]);t=e[0],gt.eagerLoadRelations(this,[t]),t=(e=this.hook.executeSelectHook("afterRelations",[t]))[0]}return t},t.prototype.collect=function(t){var e=this;return t.length<1?[]:(Object.keys(this.load).length>0&&(t=t.map(function(t){return new e.model(t)}),t=this.hook.executeSelectHook("beforeRelations",t),gt.eagerLoadRelations(this,t),t=this.hook.executeSelectHook("afterRelations",t)),t)},t.prototype.new=function(){var t=(new this.model).$toJson();return this.insert(t,{})[this.entity][0]},t.prototype.create=function(t,e){return this.persist(t,"create",e)},t.prototype.createMany=function(t){var e=this,n=this.hydrateMany(t);return this.commit("create",n,function(){e.state.data=n}),this.map(n)},t.prototype.insert=function(t,e){return this.persist(t,"insert",e)},t.prototype.insertMany=function(t){var e=this,n=this.hydrateMany(t);return this.commit("create",n,function(){e.state.data=v({},e.state.data,n)}),this.map(n)},t.prototype.update=function(t,e,n){if(Array.isArray(t))return this.persist(t,"update",n);if("function"==typeof t){if(!e)throw new Error("You must specify `where` to update records by specifying `data` as a closure.");return"function"==typeof e?this.updateByCondition(t,e):this.updateById(t,e)}if("function"==typeof e)return this.updateByCondition(t,e);if(!e)return this.persist(t,"update",n);if(Array.isArray(this.model.primaryKey))throw new Error("\n You can't specify `where` value as `string` or `number` when you\n have a composite key defined in your model. Please include composite\n keys to the `data` fields.\n ");return this.updateById(t,e)},t.prototype.updateMany=function(t){var e=this.combine(t);return this.commitUpdate(e)},t.prototype.updateById=function(t,e){var n;e="number"==typeof e?e.toString():e;var r=this.state.data[e];if(!r)return null;var o=((n={})[e]=this.processUpdate(t,r),n);return this.commitUpdate(o),o[e]},t.prototype.updateByCondition=function(t,e){var n=this,r=Object.keys(this.state.data).reduce(function(r,o){var i=n.state.data[o];return e(i)?(r[o]=n.processUpdate(t,i),r):r},{});return this.commitUpdate(r)},t.prototype.processUpdate=function(t,e){return"function"==typeof t?(t(e),e):this.hydrate(v({},e,t))},t.prototype.commitUpdate=function(t){var e=this;return t=this.updateIndexes(t),this.commit("update",t,function(){e.state.data=v({},e.state.data,t)}),this.map(t)},t.prototype.updateIndexes=function(t){var e=this;return Object.keys(t).reduce(function(t,n){var r=t[n],o=String(e.model.id(r));return n!==o&&(r.$id=o,t[o]=r,delete t[n]),t},t)},t.prototype.insertOrUpdate=function(t,e){return this.persist(t,"insertOrUpdate",e)},t.prototype.insertOrUpdateMany=function(t){var e=this,n={},r={};return Object.keys(t).forEach(function(o){var i=t[o];e.state.data[o]?r[o]=i:n[o]=i}),this.insertMany(n).concat(this.updateMany(r))},t.prototype.persist=function(t,e,n){var r=this;return t=this.normalize(t),w.isEmpty(t)?("create"===e&&(this.state.data={}),{}):Object.keys(t).reduce(function(o,i){var s=r.newQuery(i)[r.getPersistMethod(i,e,n)+"Many"](t[i]);return s.length>0&&(o[i]=s),o},{})},t.prototype.getPersistMethod=function(t,e,n){return n.create&&n.create.includes(t)?"create":n.insert&&n.insert.includes(t)?"insert":n.update&&n.update.includes(t)?"update":n.insertOrUpdate&&n.insertOrUpdate.includes(t)?"insertOrUpdate":e},t.prototype.delete=function(t){return"function"==typeof t?this.deleteByCondition(t):this.deleteById(t)},t.prototype.deleteById=function(t){var e;t="number"==typeof t?t.toString():t;var n=this.state.data[t];if(!n)return null;var r=((e={})[t]=n,e);return this.commitDelete(r)[0]},t.prototype.deleteByCondition=function(t){var e=this,n=Object.keys(this.state.data).reduce(function(n,r){var o=e.state.data[r];return t(o)?(n[r]=o,n):n},{});return this.commitDelete(n)},t.prototype.deleteAll=function(){var t=this.state.data;this.commitDelete(t)},t.prototype.commitDelete=function(t){var e=this;return this.commit("delete",t,function(){var n=Object.keys(t);e.state.data=Object.keys(e.state.data).reduce(function(t,r){return n.includes(r)||(t[r]=e.state.data[r]),t},{})}),this.map(t)},t.prototype.normalize=function(t){return ht.normalize(this,t)},t.prototype.hydrate=function(t){return new(0,this.model)(t)},t.prototype.hydrateMany=function(t){var e=this;return Object.keys(t).reduce(function(n,r){var o=t[r];return n[r]=e.hydrate(o),n},{})},t.prototype.combine=function(t){var e=this;return Object.keys(t).reduce(function(n,r){var o=e.state.data[r];if(!o)return n;var i=t[r];return n[r]=e.hydrate(v({},o,i)),n},{})},t.prototype.map=function(t){return Object.keys(t).map(function(e){return t[e]})},t.prototype.commit=function(t,e,n){var r=""+t.charAt(0).toUpperCase()+t.slice(1);this.hook.executeMutationHookOnRecords("before"+r,e),n(),this.hook.executeMutationHookOnRecords("after"+r,e)},t}(),Ot={query:function(t,e,n,r){return function(){return r[t.$connection+"/query"](t.$name)}},all:function(t,e,n,r){return function(){return r[t.$connection+"/all"](t.$name)}},find:function(t,e,n,r){return function(e){return r[t.$connection+"/find"](t.$name,e)}},findIn:function(t,e,n,r){return function(e){return r[t.$connection+"/findIn"](t.$name,e)}}},_t={new:function(t){var e=t.state,n=e.$name;return t.dispatch(e.$connection+"/new",{entity:n},{root:!0})},create:function(t,e){var n=t.state,r=n.$name;return t.dispatch(n.$connection+"/create",v({},e,{entity:r}),{root:!0})},insert:function(t,e){var n=t.state,r=n.$name;return t.dispatch(n.$connection+"/insert",v({},e,{entity:r}),{root:!0})},update:function(t,e){var n=t.state,r=n.$name;return Array.isArray(e)?t.dispatch(n.$connection+"/update",{entity:r,data:e},{root:!0}):void 0===e.data?t.dispatch(n.$connection+"/update",{entity:r,data:e},{root:!0}):t.dispatch(n.$connection+"/update",v({entity:r},e),{root:!0})},insertOrUpdate:function(t,e){var n=t.state,r=n.$name;return t.dispatch(n.$connection+"/insertOrUpdate",v({entity:r},e),{root:!0})},delete:function(t,e){var n=t.state,r=n.$name,o="object"==typeof e?e.where:e;return t.dispatch(n.$connection+"/delete",{entity:r,where:o},{root:!0})},deleteAll:function(t){var e=t.state,n=e.$name;return t.dispatch(e.$connection+"/deleteAll",{entity:n},{root:!0})}},Ct={query:function(t){return function(e){return new xt(t,e)}},all:function(t){return function(e){return new xt(t,e).all()}},find:function(t){return function(e,n){return new xt(t,e).find(n)}},findIn:function(t){return function(e,n){return new xt(t,e).findIn(n)}}},jt={new:function(t,e){var n={data:{}};return t.commit("new",v({},e,{result:n})),n.data},create:function(t,e){return m(this,void 0,void 0,function(){var n;return g(this,function(r){return n={data:{}},t.commit("create",v({},e,{result:n})),[2,n.data]})})},insert:function(t,e){return m(this,void 0,void 0,function(){var n;return g(this,function(r){return n={data:{}},t.commit("insert",v({},e,{result:n})),[2,n.data]})})},update:function(t,e){return m(this,void 0,void 0,function(){var n;return g(this,function(r){return n={data:{}},t.commit("update",v({},e,{result:n})),[2,n.data]})})},insertOrUpdate:function(t,e){return m(this,void 0,void 0,function(){var n;return g(this,function(r){return n={data:{}},t.commit("insertOrUpdate",v({},e,{result:n})),[2,n.data]})})},delete:function(t,e){return m(this,void 0,void 0,function(){var n;return g(this,function(r){return n={data:{}},t.commit("delete",v({},e,{result:n})),[2,n.data]})})},deleteAll:function(t,e){return m(this,void 0,void 0,function(){return g(this,function(n){return e&&e.entity?(t.commit("deleteAll",{entity:e.entity}),[2]):(t.commit("deleteAll"),[2])})})}},kt=function(){function t(){}return t.createPersistOptions=function(t){return{create:t.create,insert:t.insert,update:t.update,insertOrUpdate:t.insertOrUpdate}},t}(),Et={$mutate:function(t,e){e.callback(t[e.entity])},new:function(t,e){var n=e.entity;e.result.data=new xt(t,n).new()},create:function(t,e){var n=e.entity,r=e.data,o=kt.createPersistOptions(e);e.result.data=new xt(t,n).create(r,o)},insert:function(t,e){var n=e.entity,r=e.data,o=kt.createPersistOptions(e);e.result.data=new xt(t,n).insert(r,o)},update:function(t,e){var n=e.entity,r=e.data,o=e.where||null,i=kt.createPersistOptions(e);e.result.data=new xt(t,n).update(r,o,i)},insertOrUpdate:function(t,e){var n=e.entity,r=e.data,o=kt.createPersistOptions(e);e.result.data=new xt(t,n).insertOrUpdate(r,o)},delete:function(t,e){var n=e.entity,r=e.where;e.result.data=new xt(t,n).delete(r)},deleteAll:function(t,e){e&&e.entity?new xt(t,e.entity).deleteAll():xt.deleteAll(t)}};var Rt=function(){function t(){}return t.set=function(){this.value=""+this.prefix+this.count},t.get=function(){return this.value},t.increment=function(){return this.count++,this.set(),this.get()},t.count=0,t.prefix="_no_key_",t.value="",t}(),Ft=function(){function t(){}return t.create=function(t){return function(e,n,r){var o=t.id(e);return null==o||""===o?Rt.get():o}},t}(),At=function(){function t(){}return t.create=function(t){var e=this;return function(n,r,o){var i=e.getId(t,n);return v({},n,{$id:i})}},t.getId=function(t,e){var n=t.id(e);return null==n||""===n?Rt.increment():n},t}(),St=function(){function t(t){var e=this;this.schemas={},this.model=t;var n=t.database().models();Object.keys(n).forEach(function(t){e.one(n[t])})}return t.create=function(t){return new this(t).one()},t.prototype.one=function(t){if(t=t||this.model,this.schemas[t.entity])return this.schemas[t.entity];var e=new st.Entity(t.entity,{},{idAttribute:Ft.create(t),processStrategy:At.create(t)});this.schemas[t.entity]=e;var n=this.definition(t);return e.define(n),e},t.prototype.many=function(t){return new st.Array(this.one(t))},t.prototype.union=function(t){return new st.Union(this.schemas,t)},t.prototype.definition=function(t){var e=this,n=t.fields();return Object.keys(n).reduce(function(t,r){var o=n[r];return o instanceof R&&(t[r]=o.define(e)),t},{})},t}(),$t=function(){function t(){}return t.create=function(t,e,n){var r={namespaced:!0,state:{$name:t},getters:Ct,actions:jt,mutations:Et,modules:{}};return this.createModules(r,t,e,n)},t.createModules=function(t,e,n,r){var o=this;return Object.keys(r).forEach(function(i){var s=n[i],a=r[i];t.modules[i]={namespaced:!0},t.modules[i].state=o.createState(e,i,s,a),t.getters[i]=function(t,e,n,r){return function(){return e.query(i)}},t.modules[i].getters=v({},Ot,a.getters),t.modules[i].actions=v({},_t,a.actions),t.modules[i].mutations=a.mutations||{}}),t},t.createState=function(t,e,n,r){var o="function"==typeof n.state?n.state():n.state,i="function"==typeof r.state?r.state():r.state;return v({},o,i,{$connection:t,$name:e,data:{}})},t}(),Mt=function(){function t(){this.entities=[],this.schemas={}}return t.prototype.start=function(t,e){this.store=t,this.namespace=e,this.registerModules(),this.createSchema()},t.prototype.register=function(t,e){void 0===e&&(e={}),this.entities.push({name:t.entity,model:t,module:e})},t.prototype.model=function(t){return this.models()[t]},t.prototype.models=function(){return this.entities.reduce(function(t,e){return t[e.name]=e.model,t},{})},t.prototype.module=function(t){return this.modules()[t]},t.prototype.modules=function(){return this.entities.reduce(function(t,e){return t[e.name]=e.module,t},{})},t.prototype.registerModules=function(){var t=$t.create(this.namespace,this.models(),this.modules());this.store.registerModule(this.namespace,t)},t.prototype.createSchema=function(){var t=this;this.entities.forEach(function(e){t.schemas[e.name]=St.create(e.model)})},t}();const Kt={axios:void 0,baseURL:"http://localhost:3000",url:"/",method:"get",access_token:"",headers:{"Content-Type":"application/json",Accept:"application/json"},data:{},timeout:0,withCredentials:!1,responseType:"json",responseEncoding:"utf8",validateStatus:t=>t>=200&&t<300,maxRedirects:5,socketPath:null,proxy:{},onResponse:t=>t.data,onUnauthorised(t){},onNotFound(t){},onServerError(t){},onGenericError(t){},onValidationError(t){},onError(t){const{response:e}=t,n={401:this.onUnauthorised,404:this.onNotFound,422:this.onValidationError,500:this.onServerError};return e&&e.status in n?n[e.status](t):this.onGenericError(t),Promise.reject(t)}},Pt={database:new Mt,http:Kt},It={getters:{loading:t=>t.loading,errors:t=>t.errors},mutations:{onRequest(t){t.loading=!0,t.errors=[]},onError(t,e){t.loading=!1,t.errors=e.data},onSuccess(t){t.loading=!1,t.errors=[]}},state:{loading:!1,errors:[]}},Bt={http:Kt,methods:{$fetch:{name:"fetch",http:{url:"",method:"get"}},$get:{name:"get",http:{url:"/:id",method:"get"}},$create:{name:"create",alias:["insert"],http:{url:"",method:"post"}},$update:{name:"update",http:{url:"/:id",method:"put"}},$delete:{name:"delete",http:{url:"/:id",method:"delete"}}}};class qt{constructor(t,e){if(this.components=t,this.options=s()({},Pt,e),this.database=e.database,!e.database)throw new Error("database option is required to initialise!")}static setup(t,e){return this.instance=new qt(t,e),this.instance}static getInstance(){return this.instance}getModelFromState(t){return u()(this.database.entities,{name:t.$name}).model}}var Tt=n(68),Ut=n.n(Tt),zt=n(69),Lt=n.n(zt);class Nt{static transformModule(t){return s()({},It,t)}static transformModel(t){const e=qt.getInstance();return Bt.http=s()({},Bt.http,e.options.http),t.methodConf=s()({},Bt,t.methodConf),t.methodConf.http.url="/"===t.methodConf.http.url?`/${t.entity}`:t.methodConf.http.url,t.getFields=(()=>(t.cachedFields||(t.cachedFields=s()({},{$id:t.attr(void 0),$isUpdating:t.boolean(!1),$updateErrors:t.attr([]),$isDeleting:t.boolean(!1),$deleteErrors:t.attr([])},t.fields())),t.cachedFields)),t}static transformParams(t,e,n={}){let r=`${e.methodConf.http.url}${e.methodConf.methods[t].http.url}`;const i=o()(r.match(/(\/?)(\:)([A-z]*)/gm),t=>t.replace("/",""));return Ut()(i,t=>{const e=Lt()(n.params,t.replace(":",""))?n.params[t.replace(":","")]:"";r=r.replace(t,e).replace("//","/")}),n.query&&(r+=`?${Object.keys(n.query).map(t=>`${encodeURIComponent(t)}=${encodeURIComponent(n.query[t])}`).join("&")}`),r}static getMethod(t,e,n){const r=e.methodConf.methods[t].http.method;return r||n}}var Ht=n(70),Dt=n.n(Ht);class Vt{constructor(t){return this.instance=t.axios||Dt.a.create(t),this.setAuthentication(t.access_token),this.instance.interceptors.response.use(e=>t.onResponse(e,this.instance),e=>t.onError(e,this.instance)),this.instance}setAuthentication(t){if(!t)return;const e=typeof t?t():t;this.instance.defaults.headers.common.Authorization=`Bearer ${e}`}async head(t,e={}){return this.instance.head(t,e)}async get(t,e={}){return this.instance.get(t,e)}async post(t,e={},n={}){return this.instance.post(t,e,n)}async patch(t,e={},n={}){return this.instance.patch(t,e,n)}async put(t,e={},n={}){return this.instance.put(t,e,n)}async delete(t,e={}){return this.instance.delete(t,e)}}class Gt extends Nt{static async call({state:t,commit:e},n={}){const r=qt.getInstance().getModelFromState(t),o=Nt.transformParams("$fetch",r,n),i=new Vt(r.methodConf.http)[Nt.getMethod("$fetch",r,"get")](o);return this.onRequest(e),i.then(t=>this.onSuccess(e,r,t)).catch(t=>this.onError(e,t)),i}static onRequest(t){t("onRequest")}static onSuccess(t,e,n){t("onSuccess"),e.insertOrUpdate({data:n})}static onError(t,e){t("onError",e)}}class Wt extends Nt{static async call({state:t,commit:e},n={}){const r=qt.getInstance().getModelFromState(t),o=Nt.transformParams("$get",r,n),i=new Vt(r.methodConf.http)[Nt.getMethod("$get",r,"get")](o);return this.onRequest(e),i.then(t=>this.onSuccess(e,r,t)).catch(t=>this.onError(e,t)),i}static onRequest(t){t("onRequest")}static onSuccess(t,e,n){t("onSuccess"),e.insertOrUpdate({data:n})}static onError(t,e){t("onError",e)}}class Jt extends Nt{static async call({state:t,commit:e},n={}){if(!n.data||"object"!=typeof n)throw new TypeError("You must include a data object in the params to send a POST request",n);const r=qt.getInstance().getModelFromState(t),o=Nt.transformParams("$create",r,n),i=new Vt(r.methodConf.http)[Nt.getMethod("$create",r,"post")](o,n.data);return this.onRequest(e),i.then(t=>this.onSuccess(e,r,t)).catch(t=>this.onError(e,t)),i}static onRequest(t){t("onRequest")}static onSuccess(t,e,n){t("onSuccess"),e.insertOrUpdate({data:n})}static onError(t,e){t("onError",e)}}class Qt extends Nt{static async call({state:t,commit:e},n={}){if(!n.data||"object"!=typeof n)throw new TypeError("You must include a data object in the params to send a POST request",n);const r=qt.getInstance().getModelFromState(t),o=Nt.transformParams("$update",r,n),i=new Vt(r.methodConf.http)[Nt.getMethod("$update",r,"put")](o,n.data);return this.onRequest(r,n),i.then(t=>this.onSuccess(r,n,t)).catch(t=>this.onError(r,n,t)),i}static onRequest(t,e){t.update({where:e.params.id,data:{$isUpdating:!0,$updateErrors:[]}})}static onSuccess(t,e,n){t.update({where:e.params.id||n.id,data:s()({},n,{$isUpdating:!1,$updateErrors:[]})})}static onError(t,e,n){t.update({where:e.params.id,data:{$isUpdating:!1,$updateErrors:n}})}}class Yt extends Nt{static async call({state:t,commit:e},n={}){const r=qt.getInstance().getModelFromState(t),o=Nt.transformParams("$delete",r,n),i=new Vt(r.methodConf.http)[Nt.getMethod("$delete",r,"delete")](o);return this.onRequest(r,n),i.then(t=>this.onSuccess(r,n,t)).catch(t=>this.onError(r,n,t)),i}static onRequest(t,e){t.update({where:e.params.id,data:{$isDeleting:!0,$deleteErrors:[]}})}static onSuccess(t,e,n){t.delete({where:e.params.id||n.id})}static onError(t,e,n){t.update({where:e.params.id,data:{$isDeleting:!1,$deleteErrors:n}})}}class Xt{constructor(t,e){qt.setup(t,e),this.setupActions(),this.setupModels()}setupActions(){const t=qt.getInstance();t.components.Actions.$fetch=Gt.call.bind(Gt),t.components.Actions.$get=Wt.call.bind(Wt),t.components.Actions.$create=Jt.call.bind(Jt),t.components.Actions.$update=Qt.call.bind(Qt),t.components.Actions.$delete=Yt.call.bind(Yt)}setupModels(){const t=qt.getInstance();o()(t.database.entities,t=>(t.module=Nt.transformModule(t.module),t.model=Nt.transformModel(t.model),t)),t.components.Model.$fetch=function(t={}){return this.dispatch("$fetch",t)},t.components.Model.$get=function(t={}){return this.dispatch("$get",t)},t.components.Model.$create=function(t={}){return this.dispatch("$create",t)},t.components.Model.$update=function(t={}){return this.dispatch("$update",t)},t.components.Model.$delete=function(t={}){return this.dispatch("$delete",t)}}}n.d(e,"default",function(){return Zt});class Zt{static install(t,e){return new Xt(t,e)}}}])}); \ No newline at end of file +t.exports=function(t){return null!=t&&null!=t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}},function(t,e,n){"use strict";var r=n(4),o=n(42),i=n(196),a=n(197),u=n(74);function s(t){this.defaults=t,this.interceptors={request:new i,response:new i}}s.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=u(this.defaults,t)).method=t.method?t.method.toLowerCase():"get";var e=[a,void 0],n=Promise.resolve(t);for(this.interceptors.request.forEach(function(t){e.unshift(t.fulfilled,t.rejected)}),this.interceptors.response.forEach(function(t){e.push(t.fulfilled,t.rejected)});e.length;)n=n.then(e.shift(),e.shift());return n},s.prototype.getUri=function(t){return t=u(this.defaults,t),o(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],function(t){s.prototype[t]=function(e,n){return this.request(r.merge(n||{},{method:t,url:e}))}}),r.forEach(["post","put","patch"],function(t){s.prototype[t]=function(e,n,o){return this.request(r.merge(o||{},{method:t,url:e,data:n}))}}),t.exports=s},function(t,e,n){"use strict";var r=n(4);function o(){this.handlers=[]}o.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},o.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},o.prototype.forEach=function(t){r.forEach(this.handlers,function(e){null!==e&&t(e)})},t.exports=o},function(t,e,n){"use strict";var r=n(4),o=n(198),i=n(65),a=n(66),u=n(218),s=n(219);function c(t){t.cancelToken&&t.cancelToken.throwIfRequested()}t.exports=function(t){return c(t),t.baseURL&&!u(t.url)&&(t.url=s(t.baseURL,t.url)),t.headers=t.headers||{},t.data=o(t.data,t.headers,t.transformRequest),t.headers=r.merge(t.headers.common||{},t.headers[t.method]||{},t.headers||{}),r.forEach(["delete","get","head","post","put","patch","common"],function(e){delete t.headers[e]}),(t.adapter||a.adapter)(t).then(function(e){return c(t),e.data=o(e.data,e.headers,t.transformResponse),e},function(e){return i(e)||(c(t),e&&e.response&&(e.response.data=o(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)})}},function(t,e,n){"use strict";var r=n(4);t.exports=function(t,e,n){return r.forEach(n,function(n){t=n(t,e)}),t}},function(t,e,n){"use strict";var r=n(4);t.exports=function(t,e){r.forEach(t,function(n,r){r!==e&&r.toUpperCase()===e.toUpperCase()&&(t[e]=n,delete t[r])})}},function(t,e,n){"use strict";var r=n(4),o=n(67),i=n(42),a=n(69),u=n(70),s=n(71).http,c=n(71).https,f=n(72),l=n(212),p=n(213),h=n(43),d=n(68),y=/https:?/;t.exports=function(t){return new Promise(function(e,n){var v,m=function(t){clearTimeout(v),e(t)},g=function(t){clearTimeout(v),n(t)},b=t.data,x=t.headers;if(x["User-Agent"]||x["user-agent"]||(x["User-Agent"]="axios/"+p.version),b&&!r.isStream(b)){if(Buffer.isBuffer(b));else if(r.isArrayBuffer(b))b=Buffer.from(new Uint8Array(b));else{if(!r.isString(b))return g(h("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",t));b=Buffer.from(b,"utf-8")}x["Content-Length"]=b.length}var w=void 0;t.auth&&(w=(t.auth.username||"")+":"+(t.auth.password||""));var O=f.parse(t.url),j=O.protocol||"http:";if(!w&&O.auth){var k=O.auth.split(":");w=(k[0]||"")+":"+(k[1]||"")}w&&delete x.Authorization;var _=y.test(j),C=_?t.httpsAgent:t.httpAgent,E={path:i(O.path,t.params,t.paramsSerializer).replace(/^\?/,""),method:t.method.toUpperCase(),headers:x,agent:C,auth:w};t.socketPath?E.socketPath=t.socketPath:(E.hostname=O.hostname,E.port=O.port);var R,F=t.proxy;if(!F&&!1!==F){var S=j.slice(0,-1)+"_proxy",A=process.env[S]||process.env[S.toUpperCase()];if(A){var $=f.parse(A),M=process.env.no_proxy||process.env.NO_PROXY,P=!0;if(M)P=!M.split(",").map(function(t){return t.trim()}).some(function(t){return!!t&&("*"===t||("."===t[0]&&O.hostname.substr(O.hostname.length-t.length)===t&&t.match(/\./g).length===O.hostname.match(/\./g).length||O.hostname===t))});if(P&&(F={host:$.hostname,port:$.port},$.auth)){var K=$.auth.split(":");F.auth={username:K[0],password:K[1]}}}}if(F&&(E.hostname=F.host,E.host=F.host,E.headers.host=O.hostname+(O.port?":"+O.port:""),E.port=F.port,E.path=j+"//"+O.hostname+(O.port?":"+O.port:"")+E.path,F.auth)){var I=Buffer.from(F.auth.username+":"+F.auth.password,"utf8").toString("base64");E.headers["Proxy-Authorization"]="Basic "+I}var T=_&&(!F||y.test(F.protocol));t.transport?R=t.transport:0===t.maxRedirects?R=T?u:a:(t.maxRedirects&&(E.maxRedirects=t.maxRedirects),R=T?c:s),t.maxContentLength&&t.maxContentLength>-1&&(E.maxBodyLength=t.maxContentLength);var B=R.request(E,function(e){if(!B.aborted){var n=e;switch(e.headers["content-encoding"]){case"gzip":case"compress":case"deflate":n=204===e.statusCode?n:n.pipe(l.createUnzip()),delete e.headers["content-encoding"]}var r=e.req||B,i={status:e.statusCode,statusText:e.statusMessage,headers:e.headers,config:t,request:r};if("stream"===t.responseType)i.data=n,o(m,g,i);else{var a=[];n.on("data",function(e){a.push(e),t.maxContentLength>-1&&Buffer.concat(a).length>t.maxContentLength&&(n.destroy(),g(h("maxContentLength size of "+t.maxContentLength+" exceeded",t,null,r)))}),n.on("error",function(e){B.aborted||g(d(e,t,null,r))}),n.on("end",function(){var e=Buffer.concat(a);"arraybuffer"!==t.responseType&&(e=e.toString(t.responseEncoding)),i.data=e,o(m,g,i)})}}});B.on("error",function(e){B.aborted||g(d(e,t,null,B))}),t.timeout&&(v=setTimeout(function(){B.abort(),g(h("timeout of "+t.timeout+"ms exceeded",t,"ECONNABORTED",B))},t.timeout)),t.cancelToken&&t.cancelToken.promise.then(function(t){B.aborted||(B.abort(),g(t))}),r.isStream(b)?b.on("error",function(e){g(d(e,t,null,B))}).pipe(B):B.end(b)})}},function(t,e){t.exports=require("assert")},function(t,e){t.exports=require("stream")},function(t,e,n){"undefined"==typeof process||"renderer"===process.type?t.exports=n(204):t.exports=n(206)},function(t,e,n){function r(){var t;try{t=e.storage.debug}catch(t){}return!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG),t}(e=t.exports=n(73)).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},e.formatArgs=function(t){var n=this.useColors;if(t[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+t[0]+(n?"%c ":" ")+"+"+e.humanize(this.diff),!n)return;var r="color: "+this.color;t.splice(1,0,r,"color: inherit");var o=0,i=0;t[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(o++,"%c"===t&&(i=o))}),t.splice(i,0,r)},e.save=function(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(t){}},e.load=r,e.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},e.enable(r())},function(t,e){var n=1e3,r=60*n,o=60*r,i=24*o,a=365.25*i;function u(t,e,n){if(!(t0)return function(t){if((t=String(t)).length>100)return;var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(!e)return;var u=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return u*a;case"days":case"day":case"d":return u*i;case"hours":case"hour":case"hrs":case"hr":case"h":return u*o;case"minutes":case"minute":case"mins":case"min":case"m":return u*r;case"seconds":case"second":case"secs":case"sec":case"s":return u*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}(t);if("number"===c&&!1===isNaN(t))return e.long?u(s=t,i,"day")||u(s,o,"hour")||u(s,r,"minute")||u(s,n,"second")||s+" ms":function(t){if(t>=i)return Math.round(t/i)+"d";if(t>=o)return Math.round(t/o)+"h";if(t>=r)return Math.round(t/r)+"m";if(t>=n)return Math.round(t/n)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e,n){var r=n(207),o=n(208);(e=t.exports=n(73)).init=function(t){t.inspectOpts={};for(var n=Object.keys(e.inspectOpts),r=0;r=2&&(e.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(t){}function a(){return process.env.DEBUG}e.inspectOpts=Object.keys(process.env).filter(function(t){return/^debug_/i.test(t)}).reduce(function(t,e){var n=e.substring(6).toLowerCase().replace(/_([a-z])/g,function(t,e){return e.toUpperCase()}),r=process.env[e];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),t[n]=r,t},{}),e.formatters.o=function(t){return this.inspectOpts.colors=this.useColors,o.inspect(t,this.inspectOpts).split("\n").map(function(t){return t.trim()}).join(" ")},e.formatters.O=function(t){return this.inspectOpts.colors=this.useColors,o.inspect(t,this.inspectOpts)},e.enable(a())},function(t,e){t.exports=require("tty")},function(t,e){t.exports=require("util")},function(t,e,n){"use strict";const r=n(210),o=n(211),i=process.env;let a;function u(t){return function(t){return 0!==t&&{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}(function(t){if(!1===a)return 0;if(o("color=16m")||o("color=full")||o("color=truecolor"))return 3;if(o("color=256"))return 2;if(t&&!t.isTTY&&!0!==a)return 0;const e=a?1:0;if("win32"===process.platform){const t=r.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in i)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(t=>t in i)||"codeship"===i.CI_NAME?1:e;if("TEAMCITY_VERSION"in i)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(i.TEAMCITY_VERSION)?1:0;if("truecolor"===i.COLORTERM)return 3;if("TERM_PROGRAM"in i){const t=parseInt((i.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(i.TERM_PROGRAM){case"iTerm.app":return t>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(i.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(i.TERM)?1:"COLORTERM"in i?1:(i.TERM,e)}(t))}o("no-color")||o("no-colors")||o("color=false")?a=!1:(o("color")||o("colors")||o("color=true")||o("color=always"))&&(a=!0),"FORCE_COLOR"in i&&(a=0===i.FORCE_COLOR.length||0!==parseInt(i.FORCE_COLOR,10)),t.exports={supportsColor:u,stdout:u(process.stdout),stderr:u(process.stderr)}},function(t,e){t.exports=require("os")},function(t,e,n){"use strict";t.exports=((t,e)=>{e=e||process.argv;const n=t.startsWith("-")?"":1===t.length?"-":"--",r=e.indexOf(n+t),o=e.indexOf("--");return-1!==r&&(-1===o||r=0)return;a[e]="set-cookie"===e?(a[e]?a[e]:[]).concat([n]):a[e]?a[e]+", "+n:n}}),a):a}},function(t,e,n){"use strict";var r=n(4);t.exports=r.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function o(t){var r=t;return e&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return t=o(window.location.href),function(e){var n=r.isString(e)?o(e):e;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0}},function(t,e,n){"use strict";var r=n(4);t.exports=r.isStandardBrowserEnv()?{write:function(t,e,n,o,i,a){var u=[];u.push(t+"="+encodeURIComponent(e)),r.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),r.isString(o)&&u.push("path="+o),r.isString(i)&&u.push("domain="+i),!0===a&&u.push("secure"),document.cookie=u.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(t,e,n){"use strict";t.exports=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}},function(t,e,n){"use strict";t.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}},function(t,e,n){"use strict";var r=n(75);function o(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(t){e=t});var n=this;t(function(t){n.reason||(n.reason=new r(t),e(n.reason))})}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.source=function(){var t;return{token:new o(function(e){t=e}),cancel:t}},t.exports=o},function(t,e,n){"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},function(t,e,n){"use strict";n.r(e);var r=n(1),o=n.n(r),i=n(2),a=n.n(i),u=n(27),s=n.n(u),c=n(11),f=n.n(c),l=n(76),p=n.n(l);function h(t,e){return t(e={exports:{}},e.exports),e.exports}var d=h(function(t){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)}),y=h(function(t){var e=t.exports={version:"2.6.9"};"number"==typeof __e&&(__e=e)}),v=(y.version,function(t){return"object"==typeof t?null!==t:"function"==typeof t}),m=function(t){if(!v(t))throw TypeError(t+" is not an object!");return t},g=function(t){try{return!!t()}catch(t){return!0}},b=!g(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),x=d.document,w=v(x)&&v(x.createElement),O=!b&&!g(function(){return 7!=Object.defineProperty((t="div",w?x.createElement(t):{}),"a",{get:function(){return 7}}).a;var t}),j=Object.defineProperty,k={f:b?Object.defineProperty:function(t,e,n){if(m(t),e=function(t,e){if(!v(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!v(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!v(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!v(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")}(e,!0),m(n),O)try{return j(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},_=b?function(t,e,n){return k.f(t,e,function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}(1,n))}:function(t,e,n){return t[e]=n,t},C={}.hasOwnProperty,E=function(t,e){return C.call(t,e)},R=0,F=Math.random(),S=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++R+F).toString(36))},A=h(function(t){var e=d["__core-js_shared__"]||(d["__core-js_shared__"]={});(t.exports=function(t,n){return e[t]||(e[t]=void 0!==n?n:{})})("versions",[]).push({version:y.version,mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})}),$=A("native-function-to-string",Function.toString),M=h(function(t){var e=S("src"),n=(""+$).split("toString");y.inspectSource=function(t){return $.call(t)},(t.exports=function(t,r,o,i){var a="function"==typeof o;a&&(E(o,"name")||_(o,"name",r)),t[r]!==o&&(a&&(E(o,e)||_(o,e,t[r]?""+t[r]:n.join(String(r)))),t===d?t[r]=o:i?t[r]?t[r]=o:_(t,r,o):(delete t[r],_(t,r,o)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[e]||$.call(this)})}),P=function(t,e,n){if(function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!")}(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}},K=function(t,e,n){var r,o,i,a,u=t&K.F,s=t&K.G,c=t&K.S,f=t&K.P,l=t&K.B,p=s?d:c?d[e]||(d[e]={}):(d[e]||{}).prototype,h=s?y:y[e]||(y[e]={}),v=h.prototype||(h.prototype={});for(r in s&&(n=e),n)i=((o=!u&&p&&void 0!==p[r])?p:n)[r],a=l&&o?P(i,d):f&&"function"==typeof i?P(Function.call,i):i,p&&M(p,r,i,t&K.U),h[r]!=i&&_(h,r,a),f&&v[r]!=i&&(v[r]=i)};d.core=y,K.F=1,K.G=2,K.S=4,K.P=8,K.B=16,K.W=32,K.U=64,K.R=128;var I=K,T={}.toString,B=function(t){return T.call(t).slice(8,-1)},L=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==B(t)?t.split(""):Object(t)},q=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},N=function(t){return L(q(t))},U=Math.ceil,z=Math.floor,H=function(t){return isNaN(t=+t)?0:(t>0?z:U)(t)},D=Math.min,G=function(t){return t>0?D(H(t),9007199254740991):0},V=Math.max,W=Math.min,J=function(t){return function(e,n,r){var o,i=N(e),a=G(i.length),u=function(t,e){return(t=H(t))<0?V(t+e,0):W(t,e)}(r,a);if(t&&n!=n){for(;a>u;)if((o=i[u++])!=o)return!0}else for(;a>u;u++)if((t||u in i)&&i[u]===n)return t||u||0;return!t&&-1}},Q=h(function(t){var e=A("wks"),n=d.Symbol,r="function"==typeof n;(t.exports=function(t){return e[t]||(e[t]=r&&n[t]||(r?n:S)("Symbol."+t))}).store=e}),Y=Q("unscopables"),X=Array.prototype;null==X[Y]&&_(X,Y,{});var Z,tt=J(!0);I(I.P,"Array",{includes:function(t){return tt(this,t,arguments.length>1?arguments[1]:void 0)}}),Z="includes",X[Y][Z]=!0;y.Array.includes;var et=A("keys"),nt=J(!1),rt=function(t){return et[t]||(et[t]=S(t))}("IE_PROTO"),ot="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),it=Object.keys||function(t){return function(t,e){var n,r=N(t),o=0,i=[];for(n in r)n!=rt&&E(r,n)&&i.push(n);for(;e.length>o;)E(r,n=e[o++])&&(~nt(i,n)||i.push(n));return i}(t,ot)},at={f:Object.getOwnPropertySymbols},ut={f:{}.propertyIsEnumerable},st=Object.assign,ct=!st||g(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=st({},t)[n]||Object.keys(st({},e)).join("")!=r})?function(t,e){for(var n=Object(q(t)),r=arguments.length,o=1,i=at.f,a=ut.f;r>o;)for(var u,s=L(arguments[o++]),c=i?it(s).concat(i(s)):it(s),f=c.length,l=0;f>l;)u=c[l++],b&&!a.call(s,u)||(n[u]=s[u]);return n}:st;I(I.S+I.F,"Object",{assign:ct});y.Object.assign;var ft=ut.f,lt=function(t){return function(e){for(var n,r=N(e),o=it(r),i=o.length,a=0,u=[];i>a;)n=o[a++],b&&!ft.call(r,n)||u.push(t?[n,r[n]]:r[n]);return u}},pt=lt(!0);I(I.S,"Object",{entries:function(t){return pt(t)}});y.Object.entries;var ht=lt(!1);I(I.S,"Object",{values:function(t){return ht(t)}});y.Object.values;var dt=Q("match"),yt=function(t,e,n){if(v(r=e)&&(void 0!==(o=r[dt])?o:"RegExp"==B(r)))throw TypeError("String#"+n+" doesn't accept regex!");var r,o;return String(q(t))},vt=Q("match"),mt="".startsWith;I(I.P+I.F*function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[vt]=!1,!"/./"[t](e)}catch(t){}}return!0}("startsWith"),"String",{startsWith:function(t){var e=yt(this,t,"startsWith"),n=G(Math.min(arguments.length>1?arguments[1]:void 0,e.length)),r=String(t);return mt?mt.call(e,r,n):e.slice(n,n+r.length)===r}});y.String.startsWith;var gt=function(){function t(){}return t.register=function(t){this.database=t},t}(),bt=function(t,e){return(bt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function xt(t,e){function n(){this.constructor=t}bt(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var wt=function(){return(wt=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]e)return 1;if(t=a)return s;var c=n[u];return s*("desc"===c?-1:1)}}return t.index-e.index}(t,e,n)})},pickBy:function(t,e){return Object.keys(t).reduce(function(n,r){var o=t[r];return e(o,r)&&(n[r]=o),n},{})}},Ct=function(){return function(t){this.model=t}}(),Et=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.isNullable=!1,o.value=n,o.mutator=r,o}return xt(e,t),e.prototype.nullable=function(){return this.isNullable=!0,this},e.prototype.mutate=function(t,e){var n=this.mutator||this.model.mutators()[e];return n?n(t):t},e}(Ct),Rt=function(t){function e(e,n,r){var o=t.call(this,e,n,r)||this;return o.value=n,o}return xt(e,t),e.prototype.make=function(t,e,n){var r=t=void 0!==t?t:this.value;return"function"==typeof t&&(r=t()),this.mutate(r,n)},e}(Et),Ft=function(t){function e(e){return t.call(this,e,null)||this}return xt(e,t),e.prototype.make=function(t,e,n){return"number"==typeof t?t:null},e}(Et),St=function(t){function e(e,n,r){return t.call(this,e,n,r)||this}return xt(e,t),e.prototype.make=function(t,e,n){return this.mutate(this.fix(t),n)},e.prototype.fix=function(t){return void 0===t?this.value:"string"==typeof t?t:null===t&&this.isNullable?t:t+""},e}(Et),At=function(t){function e(e,n,r){return t.call(this,e,n,r)||this}return xt(e,t),e.prototype.make=function(t,e,n){return this.mutate(this.fix(t),n)},e.prototype.fix=function(t){return void 0===t?this.value:"number"==typeof t?t:"string"==typeof t?parseFloat(t):"boolean"==typeof t?t?1:0:null===t&&this.isNullable?t:0},e}(Et),$t=function(t){function e(e,n,r){return t.call(this,e,n,r)||this}return xt(e,t),e.prototype.make=function(t,e,n){return this.mutate(this.fix(t),n)},e.prototype.fix=function(t){if(void 0===t)return this.value;if("boolean"==typeof t)return t;if("string"==typeof t){if(0===t.length)return!1;var e=parseInt(t,0);return!!isNaN(e)||!!e}return"number"==typeof t?!!t:!(null!==t||!this.isNullable)&&t},e}(Et),Mt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return xt(e,t),e.prototype.getRelation=function(t,e,n){var r=t.newQuery(e);return n.forEach(function(t){t(r)}),r},e.prototype.getKeys=function(t,e){return t.reduce(function(t,n){return null===n[e]||void 0===n[e]?t:(t.push(n[e]),t)},[])},e.prototype.mapSingleRelations=function(t,e){return t.reduce(function(t,n){return t[n[e]]=n,t},{})},e.prototype.mapManyRelations=function(t,e){return t.reduce(function(t,n){var r=n[e];return t[r]||(t[r]=[]),t[r].push(n),t},{})},e.prototype.isOneRelation=function(t){return!Array.isArray(t)&&null!==t&&"object"==typeof t},e.prototype.isManyRelation=function(t){return!!Array.isArray(t)&&!(t.length<1)},e.prototype.makeManyRelation=function(t,e){var n=this;return this.isManyRelation(t)?t.filter(function(t){return n.isOneRelation(t)}).map(function(t){return new e(t)}):[]},e}(Ct),Pt=function(t){function e(e,n,r,o){var i=t.call(this,e)||this;return i.related=i.model.relation(n),i.foreignKey=r,i.localKey=o,i}return xt(e,t),e.prototype.define=function(t){return t.one(this.related)},e.prototype.attach=function(t,e,n){var r=n[this.related.entity];r&&r[t]&&void 0===r[t][this.foreignKey]&&(e[this.localKey]||(e[this.localKey]=e.$id),r[t][this.foreignKey]=e[this.localKey])},e.prototype.make=function(t,e,n){return this.isOneRelation(t)?new this.related(t):null},e.prototype.load=function(t,e,n,r){var o=this.getRelation(t,this.related.entity,r);this.addEagerConstraints(o,e),this.match(e,o.get(),n)},e.prototype.addEagerConstraints=function(t,e){t.whereFk(this.foreignKey,this.getKeys(e,this.localKey))},e.prototype.match=function(t,e,n){var r=this,o=this.buildDictionary(e);t.forEach(function(t){var e=t[r.localKey],i=o[e];t[n]=i||null})},e.prototype.buildDictionary=function(t){var e=this;return t.reduce(function(t,n){return t[n[e.foreignKey]]=n,t},{})},e}(Mt),Kt=function(t){function e(e,n,r,o){var i=t.call(this,e)||this;return i.parent=i.model.relation(n),i.foreignKey=r,i.ownerKey=o,i}return xt(e,t),e.prototype.define=function(t){return t.one(this.parent)},e.prototype.attach=function(t,e,n){void 0===e[this.foreignKey]&&(e[this.foreignKey]=t)},e.prototype.make=function(t,e,n){return this.isOneRelation(t)?new this.parent(t):null},e.prototype.load=function(t,e,n,r){var o=this.getRelation(t,this.parent.entity,r);this.addEagerConstraints(o,e),this.match(e,o.get(),n)},e.prototype.addEagerConstraints=function(t,e){t.whereFk(this.ownerKey,this.getKeys(e,this.foreignKey))},e.prototype.match=function(t,e,n){var r=this,o=this.buildDictionary(e);t.forEach(function(t){var e=t[r.foreignKey],i=null!==e?o[e]:null;t[n]=i||null})},e.prototype.buildDictionary=function(t){var e=this;return t.reduce(function(t,n){return t[n[e.ownerKey]]=n,t},{})},e}(Mt),It=function(t){function e(e,n,r,o){var i=t.call(this,e)||this;return i.related=i.model.relation(n),i.foreignKey=r,i.localKey=o,i}return xt(e,t),e.prototype.define=function(t){return t.many(this.related)},e.prototype.attach=function(t,e,n){var r=this;Array.isArray(t)&&t.forEach(function(t){var o=n[r.related.entity];o&&o[t]&&void 0===o[t][r.foreignKey]&&(o[t][r.foreignKey]=e[r.localKey])})},e.prototype.make=function(t,e,n){return this.makeManyRelation(t,this.related)},e.prototype.load=function(t,e,n,r){var o=this.getRelation(t,this.related.entity,r);this.addEagerConstraints(o,e),this.match(e,o.get(),n)},e.prototype.addEagerConstraints=function(t,e){t.whereFk(this.foreignKey,this.getKeys(e,this.localKey))},e.prototype.match=function(t,e,n){var r=this,o=this.buildDictionary(e);t.forEach(function(t){var e=t[r.localKey],i=o[e];t[n]=i||[]})},e.prototype.buildDictionary=function(t){var e=this;return t.reduce(function(t,n){var r=n[e.foreignKey];return t[r]||(t[r]=[]),t[r].push(n),t},{})},e}(Mt),Tt=function(t){function e(e,n,r,o){var i=t.call(this,e)||this;return i.parent=i.model.relation(n),i.foreignKey=r,i.ownerKey=o,i}return xt(e,t),e.prototype.define=function(t){return t.many(this.parent)},e.prototype.attach=function(t,e,n){0!==t.length&&void 0===e[this.foreignKey]&&(e[this.foreignKey]=t)},e.prototype.make=function(t,e,n){return this.makeManyRelation(t,this.parent)},e.prototype.load=function(t,e,n,r){var o=this,i=this.getRelation(t,this.parent.entity,r);this.addConstraintForHasManyBy(i,e);var a=this.mapSingleRelations(i.get(),this.ownerKey);e.forEach(function(t){var e=o.getRelatedRecords(a,t[o.foreignKey]);t[n]=e})},e.prototype.addConstraintForHasManyBy=function(t,e){var n=this,r=e.reduce(function(t,e){return t.concat(e[n.foreignKey])},[]);t.where(this.ownerKey,r)},e.prototype.getRelatedRecords=function(t,e){return e.reduce(function(e,n){var r=t[n];return r&&e.push(r),e},[])},e}(Mt),Bt=function(t){function e(e,n,r,o,i,a,u){var s=t.call(this,e)||this;return s.related=s.model.relation(n),s.through=s.model.relation(r),s.firstKey=o,s.secondKey=i,s.localKey=a,s.secondLocalKey=u,s}return xt(e,t),e.prototype.define=function(t){return t.many(this.related)},e.prototype.attach=function(t,e,n){},e.prototype.make=function(t,e,n){return this.makeManyRelation(t,this.related)},e.prototype.load=function(t,e,n,r){var o=this,i=this.getRelation(t,this.related.entity,r),a=t.newQuery(this.through.entity);this.addEagerConstraintForThrough(a,e);var u=a.get();this.addEagerConstraintForRelated(i,u);var s=this.mapThroughRelations(u,i);e.forEach(function(t){var e=s[t[o.localKey]];t[n]=e||[]})},e.prototype.addEagerConstraintForThrough=function(t,e){t.where(this.firstKey,this.getKeys(e,this.localKey))},e.prototype.addEagerConstraintForRelated=function(t,e){t.where(this.secondKey,this.getKeys(e,this.secondLocalKey))},e.prototype.mapThroughRelations=function(t,e){var n=this,r=this.mapManyRelations(e.get(),this.secondKey);return t.reduce(function(t,e){var o=e[n.firstKey];t[o]||(t[o]=[]);var i=r[e[n.secondLocalKey]];return t[o]=t[o].concat(i),t},{})},e}(Mt),Lt=function(t){function e(e,n,r,o,i,a,u){var s=t.call(this,e)||this;return s.related=s.model.relation(n),s.pivot=s.model.relation(r),s.foreignPivotKey=o,s.relatedPivotKey=i,s.parentKey=a,s.relatedKey=u,s}return xt(e,t),e.prototype.define=function(t){return t.many(this.related)},e.prototype.attach=function(t,e,n){},e.prototype.make=function(t,e,n){return this.makeManyRelation(t,this.related)},e.prototype.load=function(t,e,n,r){var o=this,i=this.getRelation(t,this.related.entity,r),a=t.newQuery(this.pivot.entity);this.addEagerConstraintForPivot(a,e);var u=a.get();this.addEagerConstraintForRelated(i,u);var s=this.mapPivotRelations(u,i);e.forEach(function(t){var e=s[t[o.parentKey]];t[n]=e||[]})},e.prototype.addEagerConstraintForPivot=function(t,e){t.whereFk(this.foreignPivotKey,this.getKeys(e,this.parentKey))},e.prototype.addEagerConstraintForRelated=function(t,e){t.whereFk(this.relatedKey,this.getKeys(e,this.relatedPivotKey))},e.prototype.mapPivotRelations=function(t,e){var n=this,r=this.mapManyRelations(e.get(),this.relatedKey);return t.reduce(function(t,e){var o=e[n.foreignPivotKey];t[o]||(t[o]=[]);var i=r[e[n.relatedPivotKey]];return i&&(t[o]=t[o].concat(i)),t},{})},e.prototype.createPivots=function(t,e,n){var r=this;return this.pivot.primaryKey instanceof Array==!1?e:(_t.forOwn(e[t.entity],function(t){var o=t[n];void 0!==o&&0!==o.length&&r.createPivotRecord(e,t,o)}),e)},e.prototype.createPivotRecord=function(t,e,n){var r=this;n.forEach(function(n){var o,i,a=e[r.parentKey],u=t[r.related.entity][n][r.relatedKey],s=u+"_"+a,c=t[r.pivot.entity]?t[r.pivot.entity][s]:{};t[r.pivot.entity]=wt({},t[r.pivot.entity],((o={})[s]=wt({},c,((i={$id:s})[r.foreignPivotKey]=a,i[r.relatedPivotKey]=u,i)),o))})},e}(Mt),qt=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.id=n,o.type=r,o}return xt(e,t),e.prototype.define=function(t){var e=this;return t.union(function(t,n){return n[e.type]})},e.prototype.attach=function(t,e,n){},e.prototype.make=function(t,e,n){if(!this.isOneRelation(t))return null;var r=e[this.type],o=this.model.relation(r);return o?new o(t):null},e.prototype.load=function(t,e,n,r){var o=this,i=this.getTypes(e).reduce(function(e,n){var i=o.getRelation(t,n,r);return e[n]=o.mapSingleRelations(i.get(),"$id"),e},{});e.forEach(function(t){var e=t[o.id],r=t[o.type],a=i[r][e];t[n]=a||null})},e.prototype.getTypes=function(t){var e=this;return t.reduce(function(t,n){var r=n[e.type];return!t.includes(r)&&t.push(r),t},[])},e}(Mt),Nt=function(t){function e(e,n,r,o,i){var a=t.call(this,e)||this;return a.related=a.model.relation(n),a.id=r,a.type=o,a.localKey=i,a}return xt(e,t),e.prototype.define=function(t){return t.one(this.related)},e.prototype.attach=function(t,e,n){var r=n[this.related.entity]&&n[this.related.entity][t];r&&(r[this.id]=r[this.id]||e.$id,r[this.type]=r[this.type]||this.model.entity)},e.prototype.make=function(t,e,n){return this.isOneRelation(t)?new this.related(t):null},e.prototype.load=function(t,e,n,r){var o=this,i=this.getRelation(t,this.related.entity,r);this.addEagerConstraintForMorphOne(i,e,t.entity);var a=this.mapSingleRelations(i.get(),this.id);e.forEach(function(t){var e=a[t[o.localKey]];t[n]=e||null})},e.prototype.addEagerConstraintForMorphOne=function(t,e,n){t.whereFk(this.type,n).whereFk(this.id,this.getKeys(e,this.localKey))},e}(Mt),Ut=function(t){function e(e,n,r,o,i){var a=t.call(this,e)||this;return a.related=a.model.relation(n),a.id=r,a.type=o,a.localKey=i,a}return xt(e,t),e.prototype.define=function(t){return t.many(this.related)},e.prototype.attach=function(t,e,n){var r=this;if(Array.isArray(t)){var o=n[this.related.entity];t.forEach(function(t){var n=o[t];n[r.id]=n[r.id]||e.$id,n[r.type]=n[r.type]||r.model.entity})}},e.prototype.make=function(t,e,n){return this.makeManyRelation(t,this.related)},e.prototype.load=function(t,e,n,r){var o=this,i=this.getRelation(t,this.related.entity,r);this.addEagerConstraintForMorphMany(i,e,t.entity);var a=this.mapManyRelations(i.get(),this.id);e.forEach(function(t){var e=a[t[o.localKey]];t[n]=e||[]})},e.prototype.addEagerConstraintForMorphMany=function(t,e,n){t.whereFk(this.type,n).whereFk(this.id,this.getKeys(e,this.localKey))},e}(Mt),zt=function(t){function e(e,n,r,o,i,a,u,s){var c=t.call(this,e)||this;return c.related=c.model.relation(n),c.pivot=c.model.relation(r),c.relatedId=o,c.id=i,c.type=a,c.parentKey=u,c.relatedKey=s,c}return xt(e,t),e.prototype.define=function(t){return t.many(this.related)},e.prototype.attach=function(t,e,n){},e.prototype.make=function(t,e,n){return this.makeManyRelation(t,this.related)},e.prototype.load=function(t,e,n,r){var o=this,i=this.getRelation(t,this.related.entity,r),a=t.newQuery(this.pivot.entity);this.addEagerConstraintForPivot(a,e,t.entity);var u=a.get();this.addEagerConstraintForRelated(i,u);var s=this.mapPivotRelations(u,i);e.forEach(function(t){var e=s[t[o.parentKey]];t[n]=e||[]})},e.prototype.addEagerConstraintForPivot=function(t,e,n){t.whereFk(this.type,n).whereFk(this.id,this.getKeys(e,this.parentKey))},e.prototype.addEagerConstraintForRelated=function(t,e){t.whereFk(this.relatedKey,this.getKeys(e,this.relatedId))},e.prototype.mapPivotRelations=function(t,e){var n=this,r=this.mapManyRelations(e.get(),this.relatedKey);return t.reduce(function(t,e){var o=e[n.id];t[o]||(t[o]=[]);var i=r[e[n.relatedId]];return t[o]=t[o].concat(i),t},{})},e.prototype.createPivots=function(t,e,n){var r=this;return _t.forOwn(e[t.entity],function(o){var i=t.query().newQuery(r.pivot.entity).where(r.id,o[r.parentKey]).where(r.type,t.entity).get().map(function(t){return t[r.parentKey]}),a=(o[n]||[]).filter(function(t){return!i.includes(t)});Array.isArray(a)&&0!==a.length&&r.createPivotRecord(t,e,o,a)}),e},e.prototype.createPivotRecord=function(t,e,n,r){var o=this;r.forEach(function(r){var i,a,u=n[o.parentKey],s=e[o.related.entity][r][o.relatedKey],c=u+"_"+r+"_"+t.entity;e[o.pivot.entity]=wt({},e[o.pivot.entity],((i={})[c]=((a={$id:c})[o.relatedId]=s,a[o.id]=u,a[o.type]=t.entity,a),i))})},e}(Mt),Ht=function(t){function e(e,n,r,o,i,a,u,s){var c=t.call(this,e)||this;return c.related=c.model.relation(n),c.pivot=c.model.relation(r),c.relatedId=o,c.id=i,c.type=a,c.parentKey=u,c.relatedKey=s,c}return xt(e,t),e.prototype.define=function(t){return t.many(this.related)},e.prototype.attach=function(t,e,n){},e.prototype.make=function(t,e,n){return this.makeManyRelation(t,this.related)},e.prototype.load=function(t,e,n,r){var o=this,i=this.getRelation(t,this.related.entity,r),a=t.newQuery(this.pivot.entity);this.addEagerConstraintForPivot(a,e,this.related.entity);var u=a.get();this.addEagerConstraintForRelated(i,u);var s=this.mapPivotRelations(u,i);e.forEach(function(t){var e=s[t[o.parentKey]];t[n]=e||[]})},e.prototype.addEagerConstraintForPivot=function(t,e,n){t.whereFk(this.type,n).whereFk(this.relatedId,this.getKeys(e,this.parentKey))},e.prototype.addEagerConstraintForRelated=function(t,e){t.whereFk(this.relatedKey,this.getKeys(e,this.id))},e.prototype.mapPivotRelations=function(t,e){var n=this,r=this.mapManyRelations(e.get(),this.relatedKey);return t.reduce(function(t,e){var o=e[n.relatedId];t[o]||(t[o]=[]);var i=r[e[n.id]];return t[o]=t[o].concat(i),t},{})},e.prototype.createPivots=function(t,e,n){var r=this;return _t.forOwn(e[t.entity],function(t){var o=t[n];Array.isArray(o)&&r.createPivotRecord(e,t,o)}),e},e.prototype.createPivotRecord=function(t,e,n){var r=this;n.forEach(function(n){var o,i,a=e[r.parentKey],u=n+"_"+a+"_"+r.related.entity;t[r.pivot.entity]=wt({},t[r.pivot.entity],((o={})[u]=((i={$id:u})[r.relatedId]=a,i[r.id]=n,i[r.type]=r.related.entity,i),o))})},e}(Mt),Dt=function(){function t(){}return t.serialize=function(t){var e=this,n=t.$fields();return Object.keys(n).reduce(function(n,r){var o=t[r];return n[r]=e.serializeValue(o),n},{})},t.serializeValue=function(t){return t instanceof Vt?this.serializeItem(t):Array.isArray(t)?this.serializeCollection(t):t},t.serializeItem=function(t){return t.$toJson()},t.serializeCollection=function(t){return t.map(function(t){return t instanceof Vt?t.$toJson():t})},t}(),Gt=function(){function t(){}return t.set=function(){this.value=""+this.prefix+this.count},t.get=function(){return this.value},t.increment=function(){return this.count++,this.set(),this.get()},t.count=0,t.prefix="_no_key_",t.value="",t}(),Vt=function(){function t(t){this.$id=null,this.$fill(t)}return t.fields=function(){return{}},t.getFields=function(){return this.cachedFields?this.cachedFields:(this.cachedFields=this.fields(),this.cachedFields)},t.attr=function(t,e){return new Rt(this,t,e)},t.string=function(t,e){return new St(this,t,e)},t.number=function(t,e){return new At(this,t,e)},t.boolean=function(t,e){return new $t(this,t,e)},t.increment=function(){return new Ft(this)},t.hasOne=function(t,e,n){return new Pt(this,t,e,this.localKey(n))},t.belongsTo=function(t,e,n){return new Kt(this,t,e,this.relation(t).localKey(n))},t.hasMany=function(t,e,n){return new It(this,t,e,this.localKey(n))},t.hasManyBy=function(t,e,n){return new Tt(this,t,e,this.relation(t).localKey(n))},t.hasManyThrough=function(t,e,n,r,o,i){return new Bt(this,t,e,n,r,this.localKey(o),this.relation(e).localKey(i))},t.belongsToMany=function(t,e,n,r,o,i){return new Lt(this,t,e,n,r,this.localKey(o),this.relation(t).localKey(i))},t.morphTo=function(t,e){return new qt(this,t,e)},t.morphOne=function(t,e,n,r){return new Nt(this,t,e,n,this.localKey(r))},t.morphMany=function(t,e,n,r){return new Ut(this,t,e,n,this.localKey(r))},t.morphToMany=function(t,e,n,r,o,i,a){return new zt(this,t,e,n,r,o,this.localKey(i),this.relation(t).localKey(a))},t.morphedByMany=function(t,e,n,r,o,i,a){return new Ht(this,t,e,n,r,o,this.localKey(i),this.relation(t).localKey(a))},t.mutators=function(){return{}},t.database=function(){return gt.database},t.store=function(){return this.database().store},t.namespace=function(t){return this.database().namespace+"/"+this.entity+"/"+t},t.getters=function(t){return this.store().getters[this.namespace(t)]},t.dispatch=function(t,e){return this.store().dispatch(this.namespace(t),e)},t.commit=function(t){this.store().commit(this.database().namespace+"/$mutate",{entity:this.entity,callback:t})},t.all=function(){return this.getters("all")()},t.find=function(t){return this.getters("find")(t)},t.findIn=function(t){return this.getters("findIn")(t)},t.query=function(){return this.getters("query")()},t.new=function(){return this.dispatch("new")},t.create=function(t){return this.dispatch("create",t)},t.insert=function(t){return this.dispatch("insert",t)},t.update=function(t){return this.dispatch("update",t)},t.insertOrUpdate=function(t){return this.dispatch("insertOrUpdate",t)},t.delete=function(t){return this.dispatch("delete",t)},t.deleteAll=function(){return this.dispatch("deleteAll")},t.id=function(t){var e=this.primaryKey;return"string"==typeof e?t[e]:e.map(function(e){return t[e]||Gt.increment()}).join("_")},t.localKey=function(t){return t||("string"==typeof this.primaryKey?this.primaryKey:"id")},t.relation=function(t){return"string"!=typeof t?t:this.database().model(t)},t.getAttributeClass=function(t){switch(t){case"increment":return Ft;default:throw Error('The attribute name "'+t+"\" doesn't exist.")}},t.getFieldsByAttribute=function(t){var e=this.getAttributeClass(t),n=this.fields();return Object.keys(n).reduce(function(t,r){var o=n[r];return o instanceof e&&(t[r]=o),t},{})},t.getIncrementFields=function(){return this.getFieldsByAttribute("increment")},t.hasIncrementFields=function(){return Object.keys(this.getIncrementFields()).length>0},t.pivotFields=function(){var t=[];return _t.forOwn(this.fields(),function(e,n){var r;(e instanceof Lt||e instanceof zt||e instanceof Ht)&&t.push(((r={})[n]=e,r))}),t},t.hasPivotFields=function(){return this.pivotFields().length>0},t.hydrate=function(t){return new this(t).$toJson()},t.prototype.$self=function(){return this.constructor},t.prototype.$fields=function(){return this.$self().getFields()},t.prototype.$store=function(){return this.$self().store()},t.prototype.$namespace=function(t){return this.$self().namespace(t)},t.prototype.$getters=function(t){return this.$self().getters(t)},t.prototype.$dispatch=function(t,e){return Ot(this,void 0,void 0,function(){return jt(this,function(n){return[2,this.$self().dispatch(t,e)]})})},t.prototype.$all=function(){return this.$getters("all")()},t.prototype.$find=function(t){return this.$getters("find")(t)},t.prototype.$findIn=function(t){return this.$getters("findIn")(t)},t.prototype.$query=function(){return this.$getters("query")()},t.prototype.$create=function(t){return Ot(this,void 0,void 0,function(){return jt(this,function(e){return[2,this.$dispatch("create",t)]})})},t.prototype.$insert=function(t){return Ot(this,void 0,void 0,function(){return jt(this,function(e){return[2,this.$dispatch("insert",t)]})})},t.prototype.$update=function(t){return Ot(this,void 0,void 0,function(){return jt(this,function(e){return Array.isArray(t)?[2,this.$dispatch("update",t)]:void 0!==t.where?[2,this.$dispatch("update",t)]:void 0===this.$self().id(t)?[2,this.$dispatch("update",{where:this.$id,data:t})]:[2,this.$dispatch("update",t)]})})},t.prototype.$insertOrUpdate=function(t){return Ot(this,void 0,void 0,function(){return jt(this,function(e){return[2,this.$dispatch("insertOrUpdate",t)]})})},t.prototype.$save=function(){return Ot(this,void 0,void 0,function(){var t,e,n,r=this;return jt(this,function(o){switch(o.label){case 0:return t=this.$self().getFields(),e=Object.keys(t).reduce(function(e,n){return t[n]instanceof Et&&(e[n]=r[n]),e},{}),[4,this.$dispatch("insertOrUpdate",{data:e})];case 1:return n=o.sent(),this.$fill(n[this.$self().entity][0]),[2,this]}})})},t.prototype.$delete=function(t){return Ot(this,void 0,void 0,function(){return jt(this,function(e){return t?[2,this.$dispatch("delete",t)]:null===this.$id?[2,null]:[2,this.$dispatch("delete",this.$id)]})})},t.prototype.$deleteAll=function(){return Ot(this,void 0,void 0,function(){return jt(this,function(t){return[2,this.$dispatch("deleteAll")]})})},t.prototype.$fill=function(t){var e=this,n=t||{},r=this.$fields();Object.keys(r).forEach(function(t){var o=r[t],i=n[t];e[t]=o.make(i,n,t)}),void 0!==n.$id&&(this.$id=n.$id)},t.prototype.$toJson=function(){return Dt.serialize(this)},t.prototype.toJSON=function(){return this.$toJson()},t.primaryKey="id",t.state={},t}();function Wt(t,e){for(var n=0;n1)throw new Error("Expected schema definition to be a single schema, but found "+t.length+".");return t[0]}(t),ae(e).map(function(e,u){return o(e,n,r,t,i,a)})},se=function(t){function e(){return t.apply(this,arguments)||this}Xt(e,t);var n=e.prototype;return n.normalize=function(t,e,n,r,o,i){var a=this;return ae(t).map(function(t,u){return a.normalizeValue(t,e,n,r,o,i)}).filter(function(t){return null!=t})},n.denormalize=function(t,e){var n=this;return t&&t.map?t.map(function(t){return n.denormalizeValue(t,e)}):t},e}(re),ce=function(t,e,n,r,o,i,a){var u=Yt({},e);return Object.keys(t).forEach(function(n){var r=t[n],s=o(e[n],e,n,r,i,a);null==s?delete u[n]:u[n]=s}),u},fe=function t(e,n,r,o,i,a){return"object"==typeof e&&e?"object"!=typeof o||o.normalize&&"function"==typeof o.normalize?o.normalize(e,n,r,t,i,a):(Array.isArray(o)?ue:ce)(o,e,n,r,t,i,a):e},le={Array:se,Entity:ne,Object:function(){function t(t){this.define(t)}var e=t.prototype;return e.define=function(t){this.schema=Object.keys(t).reduce(function(e,n){var r,o=t[n];return Yt({},e,((r={})[n]=o,r))},this.schema||{})},e.normalize=function(){for(var t=arguments.length,e=new Array(t),n=0;n0&&t.withAllRecursive(e-1)})},t.setEagerLoad=function(t,e,n){void 0===n&&(n=null),t.load[e]||(t.load[e]=[]),n&&t.load[e].push(n)},t.parseWithRelations=function(t,e,n){var r=this,o=e[0];o.split("|").forEach(function(o){1!==e.length?r.setEagerLoad(t,o):r.setEagerLoad(t,o,n)}),1!==e.length&&(e.shift(),this.addNestedWiths(t,o,e,n))},t.addNestedWiths=function(t,e,n,r){this.setEagerLoad(t,e,function(t){t.with(n.join("."),r)})},t.eagerLoadRelations=function(t,e){var n=t.model.getFields();for(var r in t.load){var o=t.load[r],i=n[r];i instanceof Mt&&i.load(t,e,r,o)}},t}(),je=function(){function t(){}return t.has=function(t,e,n,r){this.setHas(t,e,"exists",n,r)},t.hasNot=function(t,e,n,r){this.setHas(t,e,"doesntExist",n,r)},t.whereHas=function(t,e,n){this.setHas(t,e,"exists",void 0,void 0,n)},t.whereHasNot=function(t,e,n){this.setHas(t,e,"doesntExist",void 0,void 0,n)},t.setHas=function(t,e,n,r,o,i){void 0===r&&(r=">="),void 0===o&&(o=1),void 0===i&&(i=null),"number"!=typeof r?t.have.push({relation:e,type:n,operator:r,count:o,constraint:i}):t.have.push({relation:e,type:n,operator:">=",count:r,constraint:i})},t.applyConstraints=function(t){if(0!==t.have.length){var e=t.newQuery();this.addHasWhereConstraints(t,e),this.addHasConstraints(t,e.get())}},t.addHasWhereConstraints=function(t,e){t.have.forEach(function(t){e.with(t.relation,t.constraint)})},t.addHasConstraints=function(t,e){var n=this.getComparators(t),r=[];e.forEach(function(t){n.every(function(e){return e(t)})&&r.push(t.$id)}),t.whereIdIn(r)},t.getComparators=function(t){var e=this;return t.have.map(function(t){return e.getComparator(t)})},t.getComparator=function(t){var e=this,n=this.getCountComparator(t.operator);return function(r){var o=e.getRelationshipCount(r[t.relation]),i=n(o,t.count);return"exists"===t.type?i:!i}},t.getRelationshipCount=function(t){return Array.isArray(t)?t.length:t?1:0},t.getCountComparator=function(t){switch(t){case"=":return function(t,e){return t===e};case">":return function(t,e){return t>e};case">=":return function(t,e){return t>=e};case"<":return function(t,e){return t>0&&t0&&t<=e};default:return function(t,e){return t===e}}},t}(),ke=function(){function t(t){this.indexToBeDeleted=[],this.query=t}return t.on=function(t,e,n){void 0===n&&(n=!1);var r=this.lastHookId+1;return this.lastHookId=r,this.hooks[t]||(this.hooks[t]=[]),this.hooks[t].push({callback:e,once:n,uid:r}),r},t.off=function(t){var e=this,n=!1;return Object.keys(this.hooks).some(function(r){var o=e.hooks[r],i=o.findIndex(function(e){return e.uid===t});return-1!==i&&(o.splice(i,1),n=!0),n}),n},t.prototype.self=function(){return this.constructor},t.prototype.getHook=function(t){return this.query.model[t]||null},t.prototype.getGlobalHook=function(t){return this.self().hooks[t]||null},t.prototype.has=function(t){return!!this.getHook(t)||!!this.getGlobalHook(t)},t.prototype.executeSelectHook=function(t,e){return this.has(t)?(e=this.executeLocalSelectHook(t,e),e=this.executeGlobalSelectHook(t,e)):e},t.prototype.executeLocalSelectHook=function(t,e){var n=this.getHook(t);return n?n(e,this.query.entity):e},t.prototype.executeGlobalSelectHook=function(t,e){var n=this,r=this.getGlobalHook(t);if(!r)return e;var o=[];return r.forEach(function(t,r){var i=t.callback,a=t.once;e=i.call(n.query,e,n.query.entity),a&&o.push(r)}),o.reverse().forEach(function(t){r.splice(t,1)}),e},t.prototype.executeMutationHookOnRecords=function(t,e){var n=this;this.has(t)&&(Object.keys(e).forEach(function(r){!1===n.executeMutationHook(t,e[r])&&delete e[r]}),this.removeGlobalHook(t))},t.prototype.executeMutationHook=function(t,e){return!1!==this.executeLocalMutationHook(t,e)&&(!1!==this.executeGlobalMutationHook(t,e)&&void 0)},t.prototype.executeLocalMutationHook=function(t,e){var n=this.getHook(t);if(n)return n(e,this.query.entity)},t.prototype.executeGlobalMutationHook=function(t,e){var n=this,r=this.getGlobalHook(t);if(r){var o=[];return r.forEach(function(t,r){o.push(t.callback.call(n.query,e,n.query.entity)),t.once&&n.indexToBeDeleted.push(r)}),!o.includes(!1)&&void 0}},t.prototype.removeGlobalHook=function(t){var e=this.getGlobalHook(t);e&&this.indexToBeDeleted.reverse().forEach(function(t){e.splice(t,1)})},t.hooks={},t.lastHookId=0,t}(),_e=function(){function t(t,e){this.idFilter=null,this.cancelIdFilter=!1,this.joinedIdFilter=null,this.wheres=[],this.have=[],this.orders=[],this.offsetNumber=0,this.limitNumber=Math.pow(2,53)-1,this.load={},this.rootState=t,this.state=t[e],this.entity=e,this.model=this.getModel(e),this.module=this.getModule(e),this.hook=new ke(this)}return t.database=function(){return gt.database},t.getModel=function(t){return this.database().model(t)},t.getModels=function(){return this.database().models()},t.getModule=function(t){return this.database().module(t)},t.getModules=function(){return this.database().modules()},t.deleteAll=function(t){var e=this,n=this.getModels();_t.forOwn(n,function(n,r){t[r]&&new e(t,r).deleteAll()})},t.on=function(t,e,n){return ke.on(t,e,n)},t.off=function(t){return ke.off(t)},t.prototype.self=function(){return this.constructor},t.prototype.newQuery=function(e){return e=e||this.entity,new t(this.rootState,e)},t.prototype.database=function(){return this.self().database()},t.prototype.getModel=function(t){var e=t||this.entity;return this.self().getModel(e)},t.prototype.getModels=function(){return this.self().getModels()},t.prototype.getModule=function(t){var e=t||this.entity;return this.self().getModule(e)},t.prototype.getModules=function(){return this.self().getModules()},t.prototype.all=function(){return this.get()},t.prototype.find=function(t){return this.item(this.state.data[t])},t.prototype.findIn=function(t){var e=this;return t.map(function(t){return e.state.data[t]}).filter(function(t){return t})},t.prototype.get=function(){var t=this.select();return this.collect(t)},t.prototype.first=function(){var t=this.select();return this.item(t[0])},t.prototype.last=function(){var t=this.select();return this.item(t[t.length-1])},t.prototype.where=function(t,e){return this.isIdfilterable(t)&&this.setIdFilter(e),this.wheres.push({field:t,value:e,boolean:"and"}),this},t.prototype.orWhere=function(t,e){return this.cancelIdFilter=!0,this.wheres.push({field:t,value:e,boolean:"or"}),this},t.prototype.whereId=function(t){return this.where(this.model.primaryKey,t)},t.prototype.whereIdIn=function(t){return this.where(this.model.primaryKey,t)},t.prototype.whereFk=function(t,e){var n=Array.isArray(e)?e:[e];return t===this.model.primaryKey?(this.setJoinedIdFilter(n),this):(this.where(t,n),this)},t.prototype.isIdfilterable=function(t){return t===this.model.primaryKey&&!this.cancelIdFilter},t.prototype.setIdFilter=function(t){var e=this,n=Array.isArray(t)?t:[t];null!==this.idFilter?this.idFilter=new Set(n.filter(function(t){return e.idFilter.has(t)})):this.idFilter=new Set(n)},t.prototype.setJoinedIdFilter=function(t){var e=this;null!==this.joinedIdFilter?this.joinedIdFilter=new Set(t.filter(function(t){return e.joinedIdFilter.has(t)})):this.joinedIdFilter=new Set(t)},t.prototype.orderBy=function(t,e){return void 0===e&&(e="asc"),this.orders.push({field:t,direction:e}),this},t.prototype.offset=function(t){return this.offsetNumber=t,this},t.prototype.limit=function(t){return this.limitNumber=t,this},t.prototype.with=function(t,e){return void 0===e&&(e=null),Oe.with(this,t,e),this},t.prototype.withAll=function(){return Oe.withAll(this),this},t.prototype.withAllRecursive=function(t){return void 0===t&&(t=3),Oe.withAllRecursive(this,t),this},t.prototype.has=function(t,e,n){return je.has(this,t,e,n),this},t.prototype.hasNot=function(t,e,n){return je.hasNot(this,t,e,n),this},t.prototype.whereHas=function(t,e){return je.whereHas(this,t,e),this},t.prototype.whereHasNot=function(t,e){return je.whereHasNot(this,t,e),this},t.prototype.records=function(){var t=this;return this.finalizeIdFilter(),this.getIdsToLookup().map(function(e){var n=t.state.data[e];return n instanceof Vt?n:t.hydrate(n)})},t.prototype.finalizeIdFilter=function(){this.cancelIdFilter&&null!==this.idFilter&&(this.where(this.model.primaryKey,Array.from(this.idFilter.values())),this.idFilter=null)},t.prototype.getIdsToLookup=function(){var t=this;return this.idFilter&&this.joinedIdFilter?Array.from(this.idFilter.values()).filter(function(e){return t.joinedIdFilter.has(e)}):this.idFilter||this.joinedIdFilter?Array.from((this.idFilter||this.joinedIdFilter).values()):Object.keys(this.state.data)},t.prototype.select=function(){je.applyConstraints(this);var t=this.records();return t=this.hook.executeSelectHook("beforeSelect",t),t=this.filterWhere(t),t=this.hook.executeSelectHook("afterWhere",t),t=this.filterOrderBy(t),t=this.hook.executeSelectHook("afterOrderBy",t),t=this.filterLimit(t),t=this.hook.executeSelectHook("afterLimit",t)},t.prototype.filterWhere=function(t){return we.where(this,t)},t.prototype.filterOrderBy=function(t){return we.orderBy(this,t)},t.prototype.filterLimit=function(t){return we.limit(this,t)},t.prototype.count=function(){return this.get().length},t.prototype.max=function(t){var e=this.get().reduce(function(e,n){return"number"==typeof n[t]&&e.push(n[t]),e},[]);return 0===e.length?0:Math.max.apply(Math,e)},t.prototype.min=function(t){var e=this.get().reduce(function(e,n){return"number"==typeof n[t]&&e.push(n[t]),e},[]);return 0===e.length?0:Math.min.apply(Math,e)},t.prototype.sum=function(t){return this.get().reduce(function(e,n){return"number"==typeof n[t]&&(e+=n[t]),e},0)},t.prototype.item=function(t){if(!t)return null;if(Object.keys(this.load).length>0){t=new this.model(t);var e=this.hook.executeSelectHook("beforeRelations",[t]);t=e[0],Oe.eagerLoadRelations(this,[t]),t=(e=this.hook.executeSelectHook("afterRelations",[t]))[0]}return t},t.prototype.collect=function(t){var e=this;return t.length<1?[]:(Object.keys(this.load).length>0&&(t=t.map(function(t){return new e.model(t)}),t=this.hook.executeSelectHook("beforeRelations",t),Oe.eagerLoadRelations(this,t),t=this.hook.executeSelectHook("afterRelations",t)),t)},t.prototype.new=function(){var t=(new this.model).$toJson();return this.insert(t,{})[this.entity][0]},t.prototype.create=function(t,e){return this.persist(t,"create",e)},t.prototype.createMany=function(t){var e=this,n=this.hydrateMany(t);return this.commit("create",n,function(){e.state.data=n}),this.map(n)},t.prototype.insert=function(t,e){return this.persist(t,"insert",e)},t.prototype.insertMany=function(t){var e=this,n=this.hydrateMany(t);return this.commit("create",n,function(){e.state.data=wt({},e.state.data,n)}),this.map(n)},t.prototype.update=function(t,e,n){if(Array.isArray(t))return this.persist(t,"update",n);if("function"==typeof t){if(!e)throw new Error("You must specify `where` to update records by specifying `data` as a closure.");return"function"==typeof e?this.updateByCondition(t,e):this.updateById(t,e)}if("function"==typeof e)return this.updateByCondition(t,e);if(!e)return this.persist(t,"update",n);if(Array.isArray(this.model.primaryKey))throw new Error("\n You can't specify `where` value as `string` or `number` when you\n have a composite key defined in your model. Please include composite\n keys to the `data` fields.\n ");return this.updateById(t,e)},t.prototype.updateMany=function(t){var e=this.combine(t);return this.commitUpdate(e)},t.prototype.updateById=function(t,e){var n;e="number"==typeof e?e.toString():e;var r=this.state.data[e];if(!r)return null;var o=((n={})[e]=this.processUpdate(t,r),n);return this.commitUpdate(o),o[e]},t.prototype.updateByCondition=function(t,e){var n=this,r=Object.keys(this.state.data).reduce(function(r,o){var i=n.state.data[o];return e(i)?(r[o]=n.processUpdate(t,i),r):r},{});return this.commitUpdate(r)},t.prototype.processUpdate=function(t,e){return"function"==typeof t?(t(e),e):this.hydrate(wt({},e,t))},t.prototype.commitUpdate=function(t){var e=this;return t=this.updateIndexes(t),this.commit("update",t,function(){e.state.data=wt({},e.state.data,t)}),this.map(t)},t.prototype.updateIndexes=function(t){var e=this;return Object.keys(t).reduce(function(t,n){var r=t[n],o=String(e.model.id(r));return n!==o&&(r.$id=o,t[o]=r,delete t[n]),t},t)},t.prototype.insertOrUpdate=function(t,e){return this.persist(t,"insertOrUpdate",e)},t.prototype.insertOrUpdateMany=function(t){var e=this,n={},r={};return Object.keys(t).forEach(function(o){var i=t[o];e.state.data[o]?r[o]=i:n[o]=i}),this.insertMany(n).concat(this.updateMany(r))},t.prototype.persist=function(t,e,n){var r=this;return t=this.normalize(t),_t.isEmpty(t)?("create"===e&&(this.state.data={}),{}):Object.keys(t).reduce(function(o,i){var a=r.newQuery(i)[r.getPersistMethod(i,e,n)+"Many"](t[i]);return a.length>0&&(o[i]=a),o},{})},t.prototype.getPersistMethod=function(t,e,n){return n.create&&n.create.includes(t)?"create":n.insert&&n.insert.includes(t)?"insert":n.update&&n.update.includes(t)?"update":n.insertOrUpdate&&n.insertOrUpdate.includes(t)?"insertOrUpdate":e},t.prototype.delete=function(t){return"function"==typeof t?this.deleteByCondition(t):this.deleteById(t)},t.prototype.deleteById=function(t){var e;t="number"==typeof t?t.toString():t;var n=this.state.data[t];if(!n)return null;var r=((e={})[t]=n,e);return this.commitDelete(r)[0]},t.prototype.deleteByCondition=function(t){var e=this,n=Object.keys(this.state.data).reduce(function(n,r){var o=e.state.data[r];return t(o)?(n[r]=o,n):n},{});return this.commitDelete(n)},t.prototype.deleteAll=function(){var t=this.state.data;this.commitDelete(t)},t.prototype.commitDelete=function(t){var e=this;return this.commit("delete",t,function(){var n=Object.keys(t);e.state.data=Object.keys(e.state.data).reduce(function(t,r){return n.includes(r)||(t[r]=e.state.data[r]),t},{})}),this.map(t)},t.prototype.normalize=function(t){return me.normalize(this,t)},t.prototype.hydrate=function(t){return new(0,this.model)(t)},t.prototype.hydrateMany=function(t){var e=this;return Object.keys(t).reduce(function(n,r){var o=t[r];return n[r]=e.hydrate(o),n},{})},t.prototype.combine=function(t){var e=this;return Object.keys(t).reduce(function(n,r){var o=e.state.data[r];if(!o)return n;var i=t[r];return n[r]=e.hydrate(wt({},o,i)),n},{})},t.prototype.map=function(t){return Object.keys(t).map(function(e){return t[e]})},t.prototype.commit=function(t,e,n){var r=""+t.charAt(0).toUpperCase()+t.slice(1);this.hook.executeMutationHookOnRecords("before"+r,e),n(),this.hook.executeMutationHookOnRecords("after"+r,e)},t}(),Ce={query:function(t,e,n,r){return function(){return r[t.$connection+"/query"](t.$name)}},all:function(t,e,n,r){return function(){return r[t.$connection+"/all"](t.$name)}},find:function(t,e,n,r){return function(e){return r[t.$connection+"/find"](t.$name,e)}},findIn:function(t,e,n,r){return function(e){return r[t.$connection+"/findIn"](t.$name,e)}}},Ee={new:function(t){var e=t.state,n=e.$name;return t.dispatch(e.$connection+"/new",{entity:n},{root:!0})},create:function(t,e){var n=t.state,r=n.$name;return t.dispatch(n.$connection+"/create",wt({},e,{entity:r}),{root:!0})},insert:function(t,e){var n=t.state,r=n.$name;return t.dispatch(n.$connection+"/insert",wt({},e,{entity:r}),{root:!0})},update:function(t,e){var n=t.state,r=n.$name;return Array.isArray(e)?t.dispatch(n.$connection+"/update",{entity:r,data:e},{root:!0}):void 0===e.data?t.dispatch(n.$connection+"/update",{entity:r,data:e},{root:!0}):t.dispatch(n.$connection+"/update",wt({entity:r},e),{root:!0})},insertOrUpdate:function(t,e){var n=t.state,r=n.$name;return t.dispatch(n.$connection+"/insertOrUpdate",wt({entity:r},e),{root:!0})},delete:function(t,e){var n=t.state,r=n.$name,o="object"==typeof e?e.where:e;return t.dispatch(n.$connection+"/delete",{entity:r,where:o},{root:!0})},deleteAll:function(t){var e=t.state,n=e.$name;return t.dispatch(e.$connection+"/deleteAll",{entity:n},{root:!0})}},Re={query:function(t){return function(e){return new _e(t,e)}},all:function(t){return function(e){return new _e(t,e).all()}},find:function(t){return function(e,n){return new _e(t,e).find(n)}},findIn:function(t){return function(e,n){return new _e(t,e).findIn(n)}}},Fe={new:function(t,e){var n={data:{}};return t.commit("new",wt({},e,{result:n})),n.data},create:function(t,e){return Ot(this,void 0,void 0,function(){var n;return jt(this,function(r){return n={data:{}},t.commit("create",wt({},e,{result:n})),[2,n.data]})})},insert:function(t,e){return Ot(this,void 0,void 0,function(){var n;return jt(this,function(r){return n={data:{}},t.commit("insert",wt({},e,{result:n})),[2,n.data]})})},update:function(t,e){return Ot(this,void 0,void 0,function(){var n;return jt(this,function(r){return n={data:{}},t.commit("update",wt({},e,{result:n})),[2,n.data]})})},insertOrUpdate:function(t,e){return Ot(this,void 0,void 0,function(){var n;return jt(this,function(r){return n={data:{}},t.commit("insertOrUpdate",wt({},e,{result:n})),[2,n.data]})})},delete:function(t,e){return Ot(this,void 0,void 0,function(){var n;return jt(this,function(r){return n={data:{}},t.commit("delete",wt({},e,{result:n})),[2,n.data]})})},deleteAll:function(t,e){return Ot(this,void 0,void 0,function(){return jt(this,function(n){return e&&e.entity?(t.commit("deleteAll",{entity:e.entity}),[2]):(t.commit("deleteAll"),[2])})})}},Se=function(){function t(){}return t.createPersistOptions=function(t){return{create:t.create,insert:t.insert,update:t.update,insertOrUpdate:t.insertOrUpdate}},t}(),Ae={$mutate:function(t,e){e.callback(t[e.entity])},new:function(t,e){var n=e.entity;e.result.data=new _e(t,n).new()},create:function(t,e){var n=e.entity,r=e.data,o=Se.createPersistOptions(e);e.result.data=new _e(t,n).create(r,o)},insert:function(t,e){var n=e.entity,r=e.data,o=Se.createPersistOptions(e);e.result.data=new _e(t,n).insert(r,o)},update:function(t,e){var n=e.entity,r=e.data,o=e.where||null,i=Se.createPersistOptions(e);e.result.data=new _e(t,n).update(r,o,i)},insertOrUpdate:function(t,e){var n=e.entity,r=e.data,o=Se.createPersistOptions(e);e.result.data=new _e(t,n).insertOrUpdate(r,o)},delete:function(t,e){var n=e.entity,r=e.where;e.result.data=new _e(t,n).delete(r)},deleteAll:function(t,e){e&&e.entity?new _e(t,e.entity).deleteAll():_e.deleteAll(t)}};var $e=function(){function t(){}return t.create=function(t){return function(e,n,r){var o=t.id(e);return null==o||""===o?Gt.get():o}},t}(),Me=function(){function t(){}return t.create=function(t){var e=this;return function(n,r,o){var i=e.getId(t,n);return wt({},n,{$id:i})}},t.getId=function(t,e){var n=t.id(e);return null==n||""===n?Gt.increment():n},t}(),Pe=function(){function t(t){var e=this;this.schemas={},this.model=t;var n=t.database().models();Object.keys(n).forEach(function(t){e.one(n[t])})}return t.create=function(t){return new this(t).one()},t.prototype.one=function(t){if(t=t||this.model,this.schemas[t.entity])return this.schemas[t.entity];var e=new le.Entity(t.entity,{},{idAttribute:$e.create(t),processStrategy:Me.create(t)});this.schemas[t.entity]=e;var n=this.definition(t);return e.define(n),e},t.prototype.many=function(t){return new le.Array(this.one(t))},t.prototype.union=function(t){return new le.Union(this.schemas,t)},t.prototype.definition=function(t){var e=this,n=t.fields();return Object.keys(n).reduce(function(t,r){var o=n[r];return o instanceof Mt&&(t[r]=o.define(e)),t},{})},t}(),Ke=function(){function t(){}return t.create=function(t,e,n){var r={namespaced:!0,state:{$name:t},getters:Re,actions:Fe,mutations:Ae,modules:{}};return this.createModules(r,t,e,n)},t.createModules=function(t,e,n,r){var o=this;return Object.keys(r).forEach(function(i){var a=n[i],u=r[i];t.modules[i]={namespaced:!0},t.modules[i].state=o.createState(e,i,a,u),t.getters[i]=function(t,e,n,r){return function(){return e.query(i)}},t.modules[i].getters=wt({},Ce,u.getters),t.modules[i].actions=wt({},Ee,u.actions),t.modules[i].mutations=u.mutations||{}}),t},t.createState=function(t,e,n,r){var o="function"==typeof n.state?n.state():n.state,i="function"==typeof r.state?r.state():r.state;return wt({},o,i,{$connection:t,$name:e,data:{}})},t}(),Ie=function(){function t(){this.entities=[],this.schemas={}}return t.prototype.start=function(t,e){this.store=t,this.namespace=e,this.registerModules(),this.createSchema()},t.prototype.register=function(t,e){void 0===e&&(e={}),this.entities.push({name:t.entity,model:t,module:e})},t.prototype.model=function(t){return this.models()[t]},t.prototype.models=function(){return this.entities.reduce(function(t,e){return t[e.name]=e.model,t},{})},t.prototype.module=function(t){return this.modules()[t]},t.prototype.modules=function(){return this.entities.reduce(function(t,e){return t[e.name]=e.module,t},{})},t.prototype.registerModules=function(){var t=Ke.create(this.namespace,this.models(),this.modules());this.store.registerModule(this.namespace,t)},t.prototype.createSchema=function(){var t=this;this.entities.forEach(function(e){t.schemas[e.name]=Pe.create(e.model)})},t}(),Te={axios:void 0,baseURL:"http://localhost:3000",url:"/",method:"get",access_token:"",headers:{"Content-Type":"application/json",Accept:"application/json"},data:{},timeout:0,withCredentials:!1,responseType:"json",responseEncoding:"utf8",validateStatus:function(t){return t>=200&&t<300},maxRedirects:5,socketPath:null,proxy:{},onRequest:function(t,e){return t},onResponse:function(t,e){return t.data},onUnauthorised:function(t){},onNotFound:function(t){},onServerError:function(t){},onGenericError:function(t){},onValidationError:function(t){},onError:function(t,e){var n=t.response,r={401:this.onUnauthorised,404:this.onNotFound,422:this.onValidationError,500:this.onServerError};return n&&n.status in r?r[n.status](t):this.onGenericError(t),Promise.reject(t)}},Be={database:new Ie,http:Te},Le={getters:{loading:function(t){return t.loading},errors:function(t){return t.errors}},mutations:{onRequest:function(t){t.loading=!0,t.errors=[]},onError:function(t,e){t.loading=!1,t.errors=e.data},onSuccess:function(t){t.loading=!1,t.errors=[]}},state:{loading:!1,errors:[]}},qe={http:Te,methods:{$fetch:{name:"fetch",http:{url:"",method:"get"}},$get:{name:"get",http:{url:"/:id",method:"get"}},$create:{name:"create",alias:["insert"],http:{url:"",method:"post"}},$update:{name:"update",http:{url:"/:id",method:"put"}},$delete:{name:"delete",http:{url:"/:id",method:"delete"}}}},Ne=function(){function t(e,n){if(o()(this,t),this.components=e,this.options=f()({},Be,n),this.database=n.database,!n.database)throw new Error("database option is required to initialise!")}return a()(t,[{key:"getModelFromState",value:function(t){return p()(this.database.entities,{name:t.$name}).model}}],[{key:"setup",value:function(e,n){return this.instance=new t(e,n),this.instance}},{key:"getInstance",value:function(){return this.instance}}]),t}(),Ue=n(77),ze=n.n(Ue),He=n(78),De=n.n(He),Ge=function(){function t(){o()(this,t)}return a()(t,null,[{key:"transformModule",value:function(t){return f()({},Le,t)}},{key:"transformModel",value:function(t){var e=Ne.getInstance();return qe.http=f()({},qe.http,e.options.http),t.methodConf=f()({},qe,t.methodConf),t.methodConf.http.url="/"===t.methodConf.http.url?"/".concat(t.entity):t.methodConf.http.url,t.getFields=function(){return t.cachedFields||(t.cachedFields=f()({},{$id:t.attr(void 0),$isUpdating:t.boolean(!1),$updateErrors:t.attr([]),$isDeleting:t.boolean(!1),$deleteErrors:t.attr([])},t.fields())),t.cachedFields},t}},{key:"transformParams",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r="".concat(e.methodConf.http.url).concat(e.methodConf.methods[t].http.url),o=s()(r.match(/(\/?)(\:)([A-z]*)/gm),function(t){return t.replace("/","")});return ze()(o,function(t){var e=De()(n.params,t.replace(":",""))?n.params[t.replace(":","")]:"";r=r.replace(t,e).replace("//","/")}),n.query&&(r+="?".concat(Object.keys(n.query).map(function(t){return"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(n.query[t]))}).join("&"))),r}},{key:"getMethod",value:function(t,e,n){var r=e.methodConf.methods[t].http.method;return r||n}}]),t}(),Ve=n(0),We=n.n(Ve),Je=n(3),Qe=n.n(Je),Ye=n(7),Xe=n.n(Ye),Ze=n(8),tn=n.n(Ze),en=n(9),nn=n.n(en),rn=n(79),on=n.n(rn),an=function(){function t(e){var n=this;return o()(this,t),this.instance=e.axios||on.a.create(e),this.setAuthentication(e.access_token),this.instance.interceptors.request.use(function(t){return e.onRequest(t,n.instance)},function(t){return e.onError(t,n.instance)}),this.instance.interceptors.response.use(function(t){return e.onResponse(t,n.instance)},function(t){return e.onError(t,n.instance)}),this.instance}return a()(t,[{key:"setAuthentication",value:function(t){if(t){var e="function"==typeof t?t():t;this.instance.defaults.headers.common.Authorization="Bearer ".concat(e)}}},{key:"head",value:function(){var t=Qe()(We.a.mark(function t(e){var n,r=arguments;return We.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},t.abrupt("return",this.instance.head(e,n));case 2:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"get",value:function(){var t=Qe()(We.a.mark(function t(e){var n,r=arguments;return We.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},t.abrupt("return",this.instance.get(e,n));case 2:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"post",value:function(){var t=Qe()(We.a.mark(function t(e){var n,r,o=arguments;return We.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=o.length>1&&void 0!==o[1]?o[1]:{},r=o.length>2&&void 0!==o[2]?o[2]:{},t.abrupt("return",this.instance.post(e,n,r));case 3:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"patch",value:function(){var t=Qe()(We.a.mark(function t(e){var n,r,o=arguments;return We.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=o.length>1&&void 0!==o[1]?o[1]:{},r=o.length>2&&void 0!==o[2]?o[2]:{},t.abrupt("return",this.instance.patch(e,n,r));case 3:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"put",value:function(){var t=Qe()(We.a.mark(function t(e){var n,r,o=arguments;return We.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=o.length>1&&void 0!==o[1]?o[1]:{},r=o.length>2&&void 0!==o[2]?o[2]:{},t.abrupt("return",this.instance.put(e,n,r));case 3:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"delete",value:function(){var t=Qe()(We.a.mark(function t(e){var n,r=arguments;return We.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},t.abrupt("return",this.instance.delete(e,n));case 2:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()}]),t}(),un=function(t){function e(){return o()(this,e),Xe()(this,tn()(e).apply(this,arguments))}return nn()(e,t),a()(e,null,[{key:"call",value:function(){var t=Qe()(We.a.mark(function t(e){var n,r,o,i,a,u,s,c,f,l=arguments;return We.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.state,r=e.commit,o=l.length>1&&void 0!==l[1]?l[1]:{},i=Ne.getInstance(),a=i.getModelFromState(n),u=Ge.transformParams("$fetch",a,o),s=new an(a.methodConf.http),c=Ge.getMethod("$fetch",a,"get"),f=s[c](u),this.onRequest(r),t.prev=9,t.t0=this,t.t1=r,t.t2=a,t.next=15,f;case 15:return t.t3=t.sent,t.next=18,t.t0.onSuccess.call(t.t0,t.t1,t.t2,t.t3);case 18:t.next=23;break;case 20:t.prev=20,t.t4=t.catch(9),this.onError(r,t.t4);case 23:return t.abrupt("return",f);case 24:case"end":return t.stop()}},t,this,[[9,20]])}));return function(e){return t.apply(this,arguments)}}()},{key:"onRequest",value:function(t){t("onRequest")}},{key:"onSuccess",value:function(t,e,n){return t("onSuccess"),e.insertOrUpdate({data:n})}},{key:"onError",value:function(t,e){t("onError",e)}}]),e}(Ge),sn=function(t){function e(){return o()(this,e),Xe()(this,tn()(e).apply(this,arguments))}return nn()(e,t),a()(e,null,[{key:"call",value:function(){var t=Qe()(We.a.mark(function t(e){var n,r,o,i,a,u,s,c,f,l=arguments;return We.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.state,r=e.commit,o=l.length>1&&void 0!==l[1]?l[1]:{},i=Ne.getInstance(),a=i.getModelFromState(n),u=Ge.transformParams("$get",a,o),s=new an(a.methodConf.http),c=Ge.getMethod("$get",a,"get"),f=s[c](u),this.onRequest(r),t.prev=9,t.t0=this,t.t1=r,t.t2=a,t.next=15,f;case 15:return t.t3=t.sent,t.next=18,t.t0.onSuccess.call(t.t0,t.t1,t.t2,t.t3);case 18:t.next=23;break;case 20:t.prev=20,t.t4=t.catch(9),this.onError(r,t.t4);case 23:return t.abrupt("return",f);case 24:case"end":return t.stop()}},t,this,[[9,20]])}));return function(e){return t.apply(this,arguments)}}()},{key:"onRequest",value:function(t){t("onRequest")}},{key:"onSuccess",value:function(t,e,n){return t("onSuccess"),e.insertOrUpdate({data:n})}},{key:"onError",value:function(t,e){t("onError",e)}}]),e}(Ge),cn=n(17),fn=n.n(cn),ln=function(t){function e(){return o()(this,e),Xe()(this,tn()(e).apply(this,arguments))}return nn()(e,t),a()(e,null,[{key:"call",value:function(){var t=Qe()(We.a.mark(function t(e){var n,r,o,i,a,u,s,c,f,l=arguments;return We.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.state,r=e.commit,(o=l.length>1&&void 0!==l[1]?l[1]:{}).data&&"object"===fn()(o)){t.next=4;break}throw new TypeError("You must include a data object in the params to send a POST request",o);case 4:return i=Ne.getInstance(),a=i.getModelFromState(n),u=Ge.transformParams("$create",a,o),s=new an(a.methodConf.http),c=Ge.getMethod("$create",a,"post"),f=s[c](u,o.data),this.onRequest(r),t.prev=11,t.t0=this,t.t1=r,t.t2=a,t.next=17,f;case 17:return t.t3=t.sent,t.next=20,t.t0.onSuccess.call(t.t0,t.t1,t.t2,t.t3);case 20:t.next=25;break;case 22:t.prev=22,t.t4=t.catch(11),this.onError(r,t.t4);case 25:return t.abrupt("return",f);case 26:case"end":return t.stop()}},t,this,[[11,22]])}));return function(e){return t.apply(this,arguments)}}()},{key:"onRequest",value:function(t){t("onRequest")}},{key:"onSuccess",value:function(t,e,n){return t("onSuccess"),e.insertOrUpdate({data:n})}},{key:"onError",value:function(t,e){t("onError",e)}}]),e}(Ge),pn=function(t){function e(){return o()(this,e),Xe()(this,tn()(e).apply(this,arguments))}return nn()(e,t),a()(e,null,[{key:"call",value:function(){var t=Qe()(We.a.mark(function t(e){var n,r,o,i,a,u,s,c,f=arguments;return We.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.state,e.commit,(r=f.length>1&&void 0!==f[1]?f[1]:{}).data&&"object"===fn()(r)){t.next=4;break}throw new TypeError("You must include a data object in the params to send a POST request",r);case 4:return o=Ne.getInstance(),i=o.getModelFromState(n),a=Ge.transformParams("$update",i,r),u=new an(i.methodConf.http),s=Ge.getMethod("$update",i,"put"),c=u[s](a,r.data),t.next=12,this.onRequest(i,r);case 12:return t.prev=12,t.t0=this,t.t1=i,t.t2=r,t.next=18,c;case 18:return t.t3=t.sent,t.next=21,t.t0.onSuccess.call(t.t0,t.t1,t.t2,t.t3);case 21:t.next=27;break;case 23:return t.prev=23,t.t4=t.catch(12),t.next=27,this.onError(i,r,t.t4);case 27:return t.abrupt("return",c);case 28:case"end":return t.stop()}},t,this,[[12,23]])}));return function(e){return t.apply(this,arguments)}}()},{key:"onRequest",value:function(t,e){return t.update({where:e.params.id,data:{$isUpdating:!0,$updateErrors:[]}})}},{key:"onSuccess",value:function(t,e,n){return t.update({where:e.params.id||n.id,data:f()({},n,{$isUpdating:!1,$updateErrors:[]})})}},{key:"onError",value:function(t,e,n){return t.update({where:e.params.id,data:{$isUpdating:!1,$updateErrors:n}})}}]),e}(Ge),hn=function(t){function e(){return o()(this,e),Xe()(this,tn()(e).apply(this,arguments))}return nn()(e,t),a()(e,null,[{key:"call",value:function(){var t=Qe()(We.a.mark(function t(e){var n,r,o,i,a,u,s,c,f=arguments;return We.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.state,e.commit,r=f.length>1&&void 0!==f[1]?f[1]:{},o=Ne.getInstance(),i=o.getModelFromState(n),a=Ge.transformParams("$delete",i,r),u=new an(i.methodConf.http),s=Ge.getMethod("$delete",i,"delete"),c=u[s](a),t.next=10,this.onRequest(i,r);case 10:return t.prev=10,t.t0=this,t.t1=i,t.t2=r,t.next=16,c;case 16:return t.t3=t.sent,t.next=19,t.t0.onSuccess.call(t.t0,t.t1,t.t2,t.t3);case 19:t.next=25;break;case 21:return t.prev=21,t.t4=t.catch(10),t.next=25,this.onError(i,r,t.t4);case 25:return t.abrupt("return",c);case 26:case"end":return t.stop()}},t,this,[[10,21]])}));return function(e){return t.apply(this,arguments)}}()},{key:"onRequest",value:function(t,e){return t.update({where:e.params.id,data:{$isDeleting:!0,$deleteErrors:[]}})}},{key:"onSuccess",value:function(t,e,n){return t.delete({where:e.params.id||n.id})}},{key:"onError",value:function(t,e,n){return t.update({where:e.params.id,data:{$isDeleting:!1,$deleteErrors:n}})}}]),e}(Ge),dn=function(){function t(e,n){o()(this,t),Ne.setup(e,n),this.setupActions(),this.setupModels()}return a()(t,[{key:"setupActions",value:function(){var t=Ne.getInstance();t.components.Actions.$fetch=un.call.bind(un),t.components.Actions.$get=sn.call.bind(sn),t.components.Actions.$create=ln.call.bind(ln),t.components.Actions.$update=pn.call.bind(pn),t.components.Actions.$delete=hn.call.bind(hn)}},{key:"setupModels",value:function(){var t=Ne.getInstance();s()(t.database.entities,function(t){return t.module=Ge.transformModule(t.module),t.model=Ge.transformModel(t.model),t}),t.components.Model.$fetch=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.dispatch("$fetch",t)},t.components.Model.$get=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.dispatch("$get",t)},t.components.Model.$create=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.dispatch("$create",t)},t.components.Model.$update=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.dispatch("$update",t)},t.components.Model.$delete=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.dispatch("$delete",t)}}}]),t}();n.d(e,"default",function(){return yn});var yn=function(){function t(){o()(this,t)}return a()(t,null,[{key:"install",value:function(t,e){return new dn(t,e)}}]),t}()}])}); \ No newline at end of file