text: !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.feathers=t():e.feathers=t()}(this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=45)}([function(e,t,n){"use strict";var r=n(22),o=n(1).Unavailable,i=n(2)._,s=n(2).stripSlashes,a=n(1).convert;function c(e){if("ECONNREFUSED"===e.code)throw new o(e.message,i.pick(e,"address","port","config"));throw a(e)}var u=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name=s(t.name),this.options=t.options,this.connection=t.connection,this.base=t.base+"/"+this.name}return e.prototype.makeUrl=function(e,t){e=e||{};var n=this.base;return void 0!==t&&null!==t&&(n+="/"+t),0!==Object.keys(e).length&&(n+="?"+r.stringify(e)),n},e.prototype.find=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.request({url:this.makeUrl(e.query),method:"GET",headers:Object.assign({},e.headers)}).catch(c)},e.prototype.get=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return void 0===e?Promise.reject(new Error("id for 'get' can not be undefined")):this.request({url:this.makeUrl(t.query,e),method:"GET",headers:Object.assign({},t.headers)}).catch(c)},e.prototype.create=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.request({url:this.makeUrl(t.query),body:e,method:"POST",headers:Object.assign({"Content-Type":"application/json"},t.headers)}).catch(c)},e.prototype.update=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return void 0===e?Promise.reject(new Error("id for 'update' can not be undefined, only 'null' when updating multiple entries")):this.request({url:this.makeUrl(n.query,e),body:t,method:"PUT",headers:Object.assign({"Content-Type":"application/json"},n.headers)}).catch(c)},e.prototype.patch=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return void 0===e?Promise.reject(new Error("id for 'patch' can not be undefined, only 'null' when updating multiple entries")):this.request({url:this.makeUrl(n.query,e),body:t,method:"PATCH",headers:Object.assign({"Content-Type":"application/json"},n.headers)}).catch(c)},e.prototype.remove=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return void 0===e?Promise.reject(new Error("id for 'remove' can not be undefined, only 'null' when removing multiple entries")):this.request({url:this.makeUrl(t.query,e),method:"DELETE",headers:Object.assign({},t.headers)}).catch(c)},e}();e.exports=u},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=n(3)("@feathersjs/errors");function i(e,t,n,s,a){var c=void 0,u=void 0,f=void 0;(e=e||"Error")instanceof Error?(u=e.message||"Error",e.errors&&(c=e.errors)):"object"===(void 0===e?"undefined":r(e))?(u=e.message||"Error",a=e):u=e,a&&((f=JSON.parse(JSON.stringify(a))).errors?(c=f.errors,delete f.errors):a.errors&&(c=JSON.parse(JSON.stringify(a.errors)))),this.type="FeathersError",this.name=t,this.message=u,this.code=n,this.className=s,this.data=f,this.errors=c||{},o(this.name+"("+this.code+"): "+this.message),o(this.errors),Error.captureStackTrace?Error.captureStackTrace(this,i):this.stack=(new Error).stack}function s(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e}function a(e,t){i.call(this,e,"BadRequest",400,"bad-request",t)}function c(e,t){i.call(this,e,"NotAuthenticated",401,"not-authenticated",t)}function u(e,t){i.call(this,e,"PaymentError",402,"payment-error",t)}function f(e,t){i.call(this,e,"Forbidden",403,"forbidden",t)}function p(e,t){i.call(this,e,"NotFound",404,"not-found",t)}function l(e,t){i.call(this,e,"MethodNotAllowed",405,"method-not-allowed",t)}function h(e,t){i.call(this,e,"NotAcceptable",406,"not-acceptable",t)}function d(e,t){i.call(this,e,"Timeout",408,"timeout",t)}function y(e,t){i.call(this,e,"Conflict",409,"conflict",t)}function v(e,t){i.call(this,e,"LengthRequired",411,"length-required",t)}function m(e,t){i.call(this,e,"Unprocessable",422,"unprocessable",t)}function g(e,t){i.call(this,e,"TooManyRequests",429,"too-many-requests",t)}function b(e,t){i.call(this,e,"GeneralError",500,"general-error",t)}function w(e,t){i.call(this,e,"NotImplemented",501,"not-implemented",t)}function j(e,t){i.call(this,e,"BadGateway",502,"bad-gateway",t)}function k(e,t){i.call(this,e,"Unavailable",503,"unavailable",t)}s(i,Error),Object.defineProperty(i.prototype,"toJSON",{value:function(){return{name:this.name,message:this.message,code:this.code,className:this.className,data:this.data,errors:this.errors}}}),s(a,i),s(c,i),s(u,i),s(f,i),s(p,i),s(l,i),s(h,i),s(d,i),s(y,i),s(v,i),s(m,i),s(g,i),s(b,i),s(w,i),s(j,i),s(k,i);var O={FeathersError:i,BadRequest:a,NotAuthenticated:c,PaymentError:u,Forbidden:f,NotFound:p,MethodNotAllowed:l,NotAcceptable:h,Timeout:d,Conflict:y,LengthRequired:v,Unprocessable:m,TooManyRequests:g,GeneralError:b,NotImplemented:w,BadGateway:j,Unavailable:k,400:a,401:c,402:u,403:f,404:p,405:l,406:h,408:d,409:y,411:v,422:m,429:g,500:b,501:w,502:j,503:k};e.exports=Object.assign({convert:function(e){if(!e)return e;var t=O[e.name],n=t?new t(e.message,e.data):new Error(e.message||e);return"object"===(void 0===e?"undefined":r(e))&&Object.assign(n,e),n}},O)},function(e,t,n){"use strict";var r=n(5),o=n(43),i=n(42),s=n(41);e.exports=Object.assign({},r,i,{hooks:o,filterQuery:s})},function(e,t,n){(function(r){function o(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}(t=e.exports=n(39)).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var o=0,i=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&"%c"===e&&(i=++o)}),e.splice(i,0,r)}},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=o,t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("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+)/))},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.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.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(o())}).call(this,n(10))},function(e,t,n){var r,o;void 0===(o="function"==typeof(r=function(){function e(e,t,n,r){return function(){var o=this._super;this._super="function"==typeof t?t:e[n];var i=r.apply(this,arguments);return this._super=o,i}}return{create:function(){var e=Object.create(this),t="string"==typeof e.__init?e.__init:"init";return"function"==typeof e[t]&&e[t].apply(e,arguments),e},mixin:"function"==typeof Object.defineProperty?function(t,n){var r=n||this,o=/\b_super\b/,i=Object.getPrototypeOf(r)||r.prototype,s={},a=t,c=function(e){s[e]||(s[e]=Object.getOwnPropertyDescriptor(a,e))};do{Object.getOwnPropertyNames(a).forEach(c)}while((a=Object.getPrototypeOf(a))&&Object.getPrototypeOf(a));return Object.keys(s).forEach(function(t){var n=s[t];"function"==typeof n.value&&o.test(n.value)&&(n.value=e(i,r[t],t,n.value)),Object.defineProperty(r,t,n)}),r}:function(t,n){var r,o=n||this,i=/\b_super\b/,s=Object.getPrototypeOf(o)||o.prototype;for(var a in t)r=o[a],("function"==typeof t[a]&&"function"==typeof s[a]||"function"==typeof r&&"function"==typeof t[a])&&i.test(t[a])?o[a]=e(s,r,a,t[a]):o[a]=t[a];return o},extend:function(e,t){return this.mixin(e,Object.create(t||this))},proxy:function(e){var t=this[e],n=Array.prototype.slice.call(arguments,1);return n.unshift(this),t.bind.apply(t,n)}}})?r.apply(t,[]):r)||(e.exports=o)},function(e,t,n){"use strict";(function(e){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.stripSlashes=function(e){return e.replace(/^(\/*)|(\/*)$/g,"")};var r=t._={each:function(e,t){e&&"function"==typeof e.forEach?e.forEach(t):r.isObject(e)&&Object.keys(e).forEach(function(n){return t(e[n],n)})},some:function(e,t){return Object.keys(e).map(function(t){return[e[t],t]}).some(function(e){var n=e[0],r=e[1];return t(n,r)})},every:function(e,t){return Object.keys(e).map(function(t){return[e[t],t]}).every(function(e){var n=e[0],r=e[1];return t(n,r)})},keys:function(e){return Object.keys(e)},values:function(e){return r.keys(e).map(function(t){return e[t]})},isMatch:function(e,t){return r.keys(t).every(function(n){return e[n]===t[n]})},isEmpty:function(e){return 0===r.keys(e).length},isObject:function(e){return"object"===(void 0===e?"undefined":n(e))&&!Array.isArray(e)&&null!==e},extend:function(){return Object.assign.apply(Object,arguments)},omit:function(e){for(var t=r.extend({},e),n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return o.forEach(function(e){return delete t[e]}),t},pick:function(e){for(var t={},n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.forEach(function(n){void 0!==e[n]&&(t[n]=e[n])}),t},merge:function(e,t){return r.isObject(e)&&r.isObject(t)&&Object.keys(t).forEach(function(n){var o,i;r.isObject(t[n])?(e[n]||Object.assign(e,((o={})[n]={},o)),r.merge(e[n],t[n])):Object.assign(e,((i={})[n]=t[n],i))}),e}};t.select=function(e){for(var t=e&&e.query&&e.query.$select,n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];Array.isArray(t)&&o.length&&t.push.apply(t,o);var s=function(e){return Array.isArray(t)?r.pick.apply(r,[e].concat(t)):e};return function(e){return Array.isArray(e)?e.map(s):s(e)}},t.sorter=function(e){return function(t,n){var o=0;return r.each(e,function(e,r){e=parseInt(e,10),t[r]<n[r]&&(o-=1*e),t[r]>n[r]&&(o+=1*e)}),o}},t.isPromise=function(e){return r.isObject(e)&&"function"==typeof e.then},t.makeUrl=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o="function"==typeof r.get?r.get.bind(r):function(){},i=o("env")||"production",s=o("host")||e.env.HOST_NAME||"localhost",a="development"===i||"test"===i||void 0===i?"http":"https",c=o("port")||e.env.PORT||3030;return n=n||"",a+"://"+s+("development"===i||"test"===i||void 0===i?":"+c:"")+"/"+t.stripSlashes(n)}}).call(this,n(10))},function(e,t,n){"use strict";e.exports=n(12)},function(e,t,n){"use strict";var r=String.prototype.replace,o=/%20/g;e.exports={default:"RFC3986",formatters:{RFC1738:function(e){return r.call(e,o,"+")},RFC3986:function(e){return e}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,o=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}();t.arrayToObject=function(e,t){for(var n=t&&t.plainObjects?Object.create(null):{},r=0;r<e.length;++r)void 0!==e[r]&&(n[r]=e[r]);return n},t.merge=function(e,n,o){if(!n)return e;if("object"!=typeof n){if(Array.isArray(e))e.push(n);else{if("object"!=typeof e)return[e,n];(o.plainObjects||o.allowPrototypes||!r.call(Object.prototype,n))&&(e[n]=!0)}return e}if("object"!=typeof e)return[e].concat(n);var i=e;return Array.isArray(e)&&!Array.isArray(n)&&(i=t.arrayToObject(e,o)),Array.isArray(e)&&Array.isArray(n)?(n.forEach(function(n,i){r.call(e,i)?e[i]&&"object"==typeof e[i]?e[i]=t.merge(e[i],n,o):e.push(n):e[i]=n}),e):Object.keys(n).reduce(function(e,i){var s=n[i];return r.call(e,i)?e[i]=t.merge(e[i],s,o):e[i]=s,e},i)},t.assign=function(e,t){return Object.keys(t).reduce(function(e,n){return e[n]=t[n],e},e)},t.decode=function(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return e}},t.encode=function(e){if(0===e.length)return e;for(var t="string"==typeof e?e:String(e),n="",r=0;r<t.length;++r){var i=t.charCodeAt(r);45===i||46===i||95===i||126===i||i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122?n+=t.charAt(r):i<128?n+=o[i]:i<2048?n+=o[192|i>>6]+o[128|63&i]:i<55296||i>=57344?n+=o[224|i>>12]+o[128|i>>6&63]+o[128|63&i]:(r+=1,i=65536+((1023&i)<<10|1023&t.charCodeAt(r)),n+=o[240|i>>18]+o[128|i>>12&63]+o[128|i>>6&63]+o[128|63&i])}return n},t.compact=function(e){for(var t=[{obj:{o:e},prop:"o"}],n=[],r=0;r<t.length;++r)for(var o=t[r],i=o.obj[o.prop],s=Object.keys(i),a=0;a<s.length;++a){var c=s[a],u=i[c];"object"==typeof u&&null!==u&&-1===n.indexOf(u)&&(t.push({obj:i,prop:c}),n.push(u))}return function(e){for(var t;e.length;){var n=e.pop();if(t=n.obj[n.prop],Array.isArray(t)){for(var r=[],o=0;o<t.length;++o)void 0!==t[o]&&r.push(t[o]);n.obj[n.prop]=r}}return t}(t)},t.isRegExp=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},t.isBuffer=function(e){return null!==e&&void 0!==e&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}},function(e,t,n){"use strict";e.exports="3.1.5"},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c,u=[],f=!1,p=-1;function l(){f&&c&&(f=!1,c.length?u=c.concat(u):p=-1,u.length&&h())}function h(){if(!f){var e=a(l);f=!0;for(var t=u.length;t;){for(c=u,u=[];++p<t;)c&&c[p].run();p=-1,t=u.length}c=null,f=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function y(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new d(e,t)),1!==u.length||f||a(h)},d.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=y,o.addListener=y,o.once=y,o.off=y,o.removeListener=y,o.removeAllListeners=y,o.emit=y,o.prependListener=y,o.prependOnceListener=y,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,n){"use strict";var r=n(6);function o(e,t){if(!e)throw new Error("Primus connection needs to be provided");var n=function(n){return new r(Object.assign({},t,{name:n,connection:e,method:"send"}))},o=function(){if("function"==typeof this.defaultService)throw new Error("Only one default client provider can be configured");this.primus=e,this.defaultService=n};return o.Service=r,o.service=n,o}e.exports=o,e.exports.default=o},function(e,t,n){"use strict";var r=n(1),o=r.convert,i=r.Timeout,s=n(3)("@feathersjs/transport-commons/client"),a=["addListener","emit","listenerCount","listeners","on","once","prependListener","prependOnceListener","removeAllListeners","removeListener"],c=["eventNames","getMaxListeners","setMaxListeners"],u=function(e){c.forEach(function(t){e[t]=function(){var e;if("function"!=typeof this.connection[t])throw new Error("Can not call '"+t+"' on the client service connection");return(e=this.connection)[t].apply(e,arguments)}}),a.forEach(function(t){e[t]=function(e){var n;if("function"!=typeof this.connection[t])throw new Error("Can not call '"+t+"' on the client service connection");var r=this.path+" "+e;s("Calling emitter method "+t+" with namespaced event '"+r+"'");for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];var c=(n=this.connection)[t].apply(n,[r].concat(i));return c===this.connection?this:c}})};e.exports=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.events=t.events,this.path=t.name,this.connection=t.connection,this.method=t.method,this.timeout=t.timeout||5e3,u(this)}return e.prototype.send=function(e){for(var t=this,n=arguments.length,r=Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return new Promise(function(n,a){var c,u=setTimeout(function(){return a(new i("Timeout of "+t.timeout+"ms exceeded calling "+e+" on "+t.path,{timeout:t.timeout,method:e,path:t.path}))},t.timeout);r.unshift(e,t.path),r.push(function(e,t){return e=o(e),clearTimeout(u),e?a(e):n(t)}),s("Sending socket."+t.method,r),(c=t.connection)[t.method].apply(c,r)})},e.prototype.find=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.send("find",e.query||{})},e.prototype.get=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.send("get",e,t.query||{})},e.prototype.create=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.send("create",e,t.query||{})},e.prototype.update=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.send("update",e,t,n.query||{})},e.prototype.patch=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.send("patch",e,t,n.query||{})},e.prototype.remove=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.send("remove",e,t.query||{})},e.prototype.off=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o;return"function"==typeof this.connection.off?(o=this.connection).off.apply(o,[this.path+" "+e].concat(n)):0===n.length?this.removeAllListeners(e):this.removeListener.apply(this,[e].concat(n))},e}()},function(e,t,n){"use strict";var r=n(6);function o(e,t){if(!e)throw new Error("Socket.io connection needs to be provided");var n=function(n){var o=this,i=Object.keys(this.eventMappings||{}).map(function(e){return o.eventMappings[e]}),s=Object.assign({},t,{events:i,name:n,connection:e,method:"emit"});return new r(s)},o=function(){if("function"==typeof this.defaultService)throw new Error("Only one default client provider can be configured");this.io=e,this.defaultService=n};return o.Service=r,o.service=n,o}e.exports=o,e.exports.default=o},function(e,t,n){"use strict";var r=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.request=function(e){var t=this.connection,n=this.options.HttpHeaders;if(!t||!n)throw new Error("Please pass angular's 'httpClient' (instance) and and object with 'HttpHeaders' (class) to feathers-rest");var r=e.url,o={body:e.body,headers:new n(Object.assign({Accept:"application/json"},this.options.headers,e.headers))};return new Promise(function(n,i){t.request(e.method,r,o).subscribe(n,i)}).catch(function(e){var t=e.error;if(t)throw"string"==typeof t?JSON.parse(t):t;throw e})},t}(n(0));e.exports=r},function(e,t,n){"use strict";var r=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.request=function(e){var t=this.connection,n=this.options.Headers;if(!t||!n)throw new Error("Please pass angular's 'http' (instance) and and object with 'Headers' (class) to feathers-rest");var r=e.url,o={method:e.method,body:e.body,headers:new n(Object.assign({Accept:"application/json"},this.options.headers,e.headers))};return new Promise(function(e,n){t.request(r,o).subscribe(e,n)}).then(function(e){return e.json()}).catch(function(e){var t=e.response||e;throw t instanceof Error?t:t.json()||t})},t}(n(0));e.exports=r},function(e,t,n){"use strict";var r=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.request=function(e){var t={url:e.url,method:e.method,data:e.body,headers:Object.assign({Accept:"application/json"},this.options.headers,e.headers)};return this.connection.request(t).then(function(e){return e.data}).catch(function(e){var t=e.response||e;throw t instanceof Error?t:t.data||t})},t}(n(0));e.exports=r},function(e,t,n){"use strict";var r=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.request=function(e){var t=Object.assign({},e);return t.headers=Object.assign({Accept:"application/json"},this.options.headers,t.headers),e.body&&(t.body=JSON.stringify(e.body)),(0,this.connection)(e.url,t).then(this.checkStatus).then(function(e){return 204===e.status?null:e.json()})},t.prototype.checkStatus=function(e){return e.ok?e:e.json().then(function(t){throw t.response=e,t})},t}(n(0));e.exports=r},function(e,t,n){"use strict";var r=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.request=function(e){var t=this;return new Promise(function(n,r){t.connection(Object.assign({json:!0},e),function(e,t,o){return e?r(e):!e&&t.statusCode>=400?"string"==typeof o?r(new Error(o)):(o.response=t,r(Object.assign(new Error(o.message),o))):void n(o)})})},t}(n(0));e.exports=r},function(e,t,n){"use strict";var r=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.request=function(e){var t=this.connection(e.method,e.url).set(this.options.headers||{}).set("Accept","application/json").set(e.headers||{}).type(e.type||"json");return new Promise(function(n,r){t.set(e.headers),e.body&&t.send(e.body),t.end(function(e,t){if(e){try{var o=e.response;(e=JSON.parse(e.response.text)).response=o}catch(e){}return r(e)}n(t&&t.body)})})},t}(n(0));e.exports=r},function(e,t,n){"use strict";var r=n(8),o=Object.prototype.hasOwnProperty,i={allowDots:!1,allowPrototypes:!1,arrayLimit:20,decoder:r.decode,delimiter:"&",depth:5,parameterLimit:1e3,plainObjects:!1,strictNullHandling:!1},s=function(e,t,n){if(e){var r=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,i=/(\[[^[\]]*])/g,s=/(\[[^[\]]*])/.exec(r),a=s?r.slice(0,s.index):r,c=[];if(a){if(!n.plainObjects&&o.call(Object.prototype,a)&&!n.allowPrototypes)return;c.push(a)}for(var u=0;null!==(s=i.exec(r))&&u<n.depth;){if(u+=1,!n.plainObjects&&o.call(Object.prototype,s[1].slice(1,-1))&&!n.allowPrototypes)return;c.push(s[1])}return s&&c.push("["+r.slice(s.index)+"]"),function(e,t,n){for(var r=t,o=e.length-1;o>=0;--o){var i,s=e[o];if("[]"===s)i=(i=[]).concat(r);else{i=n.plainObjects?Object.create(null):{};var a="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,c=parseInt(a,10);!isNaN(c)&&s!==a&&String(c)===a&&c>=0&&n.parseArrays&&c<=n.arrayLimit?(i=[])[c]=r:i[a]=r}r=i}return r}(c,t,n)}};e.exports=function(e,t){var n=t?r.assign({},t):{};if(null!==n.decoder&&void 0!==n.decoder&&"function"!=typeof n.decoder)throw new TypeError("Decoder has to be a function.");if(n.ignoreQueryPrefix=!0===n.ignoreQueryPrefix,n.delimiter="string"==typeof n.delimiter||r.isRegExp(n.delimiter)?n.delimiter:i.delimiter,n.depth="number"==typeof n.depth?n.depth:i.depth,n.arrayLimit="number"==typeof n.arrayLimit?n.arrayLimit:i.arrayLimit,n.parseArrays=!1!==n.parseArrays,n.decoder="function"==typeof n.decoder?n.decoder:i.decoder,n.allowDots="boolean"==typeof n.allowDots?n.allowDots:i.allowDots,n.plainObjects="boolean"==typeof n.plainObjects?n.plainObjects:i.plainObjects,n.allowPrototypes="boolean"==typeof n.allowPrototypes?n.allowPrototypes:i.allowPrototypes,n.parameterLimit="number"==typeof n.parameterLimit?n.parameterLimit:i.parameterLimit,n.strictNullHandling="boolean"==typeof n.strictNullHandling?n.strictNullHandling:i.strictNullHandling,""===e||null===e||void 0===e)return n.plainObjects?Object.create(null):{};for(var a="string"==typeof e?function(e,t){for(var n={},r=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=t.parameterLimit===1/0?void 0:t.parameterLimit,a=r.split(t.delimiter,s),c=0;c<a.length;++c){var u,f,p=a[c],l=p.indexOf("]="),h=-1===l?p.indexOf("="):l+1;-1===h?(u=t.decoder(p,i.decoder),f=t.strictNullHandling?null:""):(u=t.decoder(p.slice(0,h),i.decoder),f=t.decoder(p.slice(h+1),i.decoder)),o.call(n,u)?n[u]=[].concat(n[u]).concat(f):n[u]=f}return n}(e,n):e,c=n.plainObjects?Object.create(null):{},u=Object.keys(a),f=0;f<u.length;++f){var p=u[f],l=s(p,a[p],n);c=r.merge(c,l,n)}return r.compact(c)}},function(e,t,n){"use strict";var r=n(8),o=n(7),i={brackets:function(e){return e+"[]"},indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},s=Date.prototype.toISOString,a={delimiter:"&",encode:!0,encoder:r.encode,encodeValuesOnly:!1,serializeDate:function(e){return s.call(e)},skipNulls:!1,strictNullHandling:!1},c=function e(t,n,o,i,s,c,u,f,p,l,h,d){var y=t;if("function"==typeof u)y=u(n,y);else if(y instanceof Date)y=l(y);else if(null===y){if(i)return c&&!d?c(n,a.encoder):n;y=""}if("string"==typeof y||"number"==typeof y||"boolean"==typeof y||r.isBuffer(y))return c?[h(d?n:c(n,a.encoder))+"="+h(c(y,a.encoder))]:[h(n)+"="+h(String(y))];var v,m=[];if(void 0===y)return m;if(Array.isArray(u))v=u;else{var g=Object.keys(y);v=f?g.sort(f):g}for(var b=0;b<v.length;++b){var w=v[b];s&&null===y[w]||(m=Array.isArray(y)?m.concat(e(y[w],o(n,w),o,i,s,c,u,f,p,l,h,d)):m.concat(e(y[w],n+(p?"."+w:"["+w+"]"),o,i,s,c,u,f,p,l,h,d)))}return m};e.exports=function(e,t){var n=e,s=t?r.assign({},t):{};if(null!==s.encoder&&void 0!==s.encoder&&"function"!=typeof s.encoder)throw new TypeError("Encoder has to be a function.");var u=void 0===s.delimiter?a.delimiter:s.delimiter,f="boolean"==typeof s.strictNullHandling?s.strictNullHandling:a.strictNullHandling,p="boolean"==typeof s.skipNulls?s.skipNulls:a.skipNulls,l="boolean"==typeof s.encode?s.encode:a.encode,h="function"==typeof s.encoder?s.encoder:a.encoder,d="function"==typeof s.sort?s.sort:null,y=void 0!==s.allowDots&&s.allowDots,v="function"==typeof s.serializeDate?s.serializeDate:a.serializeDate,m="boolean"==typeof s.encodeValuesOnly?s.encodeValuesOnly:a.encodeValuesOnly;if(void 0===s.format)s.format=o.default;else if(!Object.prototype.hasOwnProperty.call(o.formatters,s.format))throw new TypeError("Unknown format option provided.");var g,b,w=o.formatters[s.format];"function"==typeof s.filter?n=(b=s.filter)("",n):Array.isArray(s.filter)&&(g=b=s.filter);var j,k=[];if("object"!=typeof n||null===n)return"";j=s.arrayFormat in i?s.arrayFormat:"indices"in s?s.indices?"indices":"repeat":"indices";var O=i[j];g||(g=Object.keys(n)),d&&g.sort(d);for(var C=0;C<g.length;++C){var E=g[C];p&&null===n[E]||(k=k.concat(c(n[E],E,O,f,p,l?h:null,b,d,y,v,w,m)))}var x=k.join(u),_=!0===s.addQueryPrefix?"?":"";return x.length>0?_+x:""}},function(e,t,n){"use strict";var r=n(21),o=n(20),i=n(7);e.exports={formats:i,parse:o,stringify:r}},function(e,t,n){"use strict";var r=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.request=function(e){var t=this,n=Object.assign({dataType:e.type||"json"},{headers:this.options.headers||{}},e);return e.body&&(n.data=JSON.stringify(e.body),n.contentType="application/json"),delete n.type,delete n.body,new Promise(function(e,r){t.connection.ajax(n).then(e,function(e){var t=e.responseText;try{t=JSON.parse(t)}catch(n){t=new Error(e.responseText)}t.xhr=t.response=e,r(t)})})},t}(n(0));e.exports=r},function(e,t,n){"use strict";var r=n(23),o=n(19),i=n(18),s=n(17),a=n(16),c=n(15),u=n(0),f={jquery:r,superagent:o,request:i,fetch:s,axios:a,angular:c,angularHttpClient:n(14)};function p(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t={Base:u};return Object.keys(f).forEach(function(n){var r=f[n];t[n]=function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t)throw new Error(n+" has to be provided to feathers-rest");var i=function(n){return new r({base:e,name:n,connection:t,options:o})},s=function(){if("function"==typeof this.defaultService)throw new Error("Only one default client provider can be configured");this.rest=t,this.defaultService=i};return s.Service=r,s.service=i,s}}),t}e.exports=p,e.exports.default=p},function(e,t,n){"use strict";t.Storage=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.store={}}return e.prototype.getItem=function(e){return this.store[e]},e.prototype.setItem=function(e,t){return this.store[e]=t},e.prototype.removeItem=function(e){return delete this.store[e],this},e}(),t.payloadIsValid=function(e){return e&&(!e.exp||1e3*e.exp>(new Date).getTime())},t.getCookie=function(e){if("undefined"!=typeof document){var t=("; "+document.cookie).split("; "+e+"=");if(2===t.length)return t.pop().split(";").shift()}return null},t.clearCookie=function(e){return"undefined"!=typeof document&&(document.cookie=e+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;"),null}},function(e,t){function n(e){this.message=e}n.prototype=new Error,n.prototype.name="InvalidCharacterError",e.exports="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new n("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,o,i=0,s=0,a="";o=t.charAt(s++);~o&&(r=i%4?64*r+o:o,i++%4)?a+=String.fromCharCode(255&r>>(-2*i&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return a}},function(e,t,n){var r=n(26);e.exports=function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return decodeURIComponent(r(t).replace(/(.)/g,function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}catch(e){return r(t)}}},function(e,t,n){"use strict";var r=n(27);function o(e){this.message=e}o.prototype=new Error,o.prototype.name="InvalidTokenError",e.exports=function(e,t){if("string"!=typeof e)throw new o("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(r(e.split(".")[n]))}catch(e){throw new o("Invalid token specified: "+e.message)}},e.exports.InvalidTokenError=o},function(e,t,n){"use strict";var r=n(1),o=n(28),i=n(3),s=n(25),a=s.Storage,c=s.payloadIsValid,u=s.getCookie,f=s.clearCookie,p=i("@feathersjs/authentication-client");e.exports=function(){function e(t,n){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t.passport)throw new Error("You have already registered authentication on this client app instance. You only need to do it once.");Object.assign(this,{options:n,app:t,payloadIsValid:c,getCookie:u,clearCookie:f,storage:t.get("storage")||this.getStorage(n.storage)}),this.setJWT=this.setJWT.bind(this),t.set("storage",this.storage),this.getJWT().then(this.setJWT),this.setupSocketListeners()}return e.prototype.setupSocketListeners=function(){var e=this,t=this.app,n=t.io||t.primus,r=t.io?"emit":"send",o=t.io?"reconnect":"reconnected";if(n){n.on(o,function(){if(p("Socket reconnected"),n.authenticated){var o={strategy:e.options.jwtStrategy,accessToken:t.get("accessToken")};e.authenticateSocket(o,n,r).then(e.setJWT).catch(function(e){p("Error re-authenticating after socket reconnect",e),n.authenticated=!1,t.emit("reauthentication-error",e)})}});var i=function(){n.io.engine.on("upgrade",function(){if(p("Socket upgrading"),n.authenticated){var o={strategy:e.options.jwtStrategy,accessToken:t.get("accessToken")};e.authenticateSocket(o,n,r).then(e.setJWT).catch(function(e){p("Error re-authenticating after socket upgrade",e),n.authenticated=!1,t.emit("reauthentication-error",e)})}})};n.io&&n.io.engine?i():n.on("connect",i)}},e.prototype.connected=function(){var e=this,t=this.app;if(t.rest)return Promise.resolve();var n=t.io||t.primus;return n?t.io&&n.connected||t.primus&&3===n.readyState?(p("Socket already connected"),Promise.resolve(n)):new Promise(function(r,o){var i=t.primus?"open":"connect",s=t.io?"disconnect":"end",a=setTimeout(function(){p("Socket connection timed out"),o(new Error("Socket connection timed out"))},e.options.timeout);p("Waiting for socket connection");var c=function(){p("Socket disconnected before it could connect"),n.authenticated=!1};n.once(s,c),n.once(i,function(){p("Socket connected"),p("Removing "+s+" listener"),n.removeListener(s,c),clearTimeout(a),r(n)})}):Promise.reject(new Error("It looks like your client connection has not been configured."))},e.prototype.authenticate=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.app,o=Promise.resolve(t);return t.strategy||(t.accessToken?t.strategy=this.options.jwtStrategy:o=this.getJWT().then(function(t){return t?{strategy:e.options.jwtStrategy,accessToken:t}:Promise.reject(new r.NotAuthenticated("Could not find stored JWT and no authentication strategy was given"))})),o.then(function(t){return e.connected(n).then(function(r){if(n.rest)return n.service(e.options.path).create(t).then(e.setJWT);var o=n.io?"emit":"send";return e.authenticateSocket(t,r,o).then(e.setJWT)})}).then(function(e){return n.emit("authenticated",e),e})},e.prototype.authenticateSocket=function(e,t,n){var r=this;return new Promise(function(o,i){var s=setTimeout(function(){p("authenticateSocket timed out"),i(new Error("Authentication timed out"))},r.options.timeout);p("Attempting to authenticate socket"),t[n]("authenticate",e,function(e,n){if(e)return i(e);clearTimeout(s),t.authenticated=!0,p("Socket authenticated!"),o(n)})})},e.prototype.logoutSocket=function(e,t){var n=this;return new Promise(function(r,o){var i=setTimeout(function(){p("logoutSocket timed out"),o(new Error("Logout timed out"))},n.options.timeout);e[t]("logout",function(t){if(clearTimeout(i),e.authenticated=!1,t)return o(t);r()})})},e.prototype.logout=function(){var e=this,t=this.app;return t.set("accessToken",null),this.clearCookie(this.options.cookie),Promise.resolve(t.get("storage").removeItem(this.options.storageKey)).then(function(){if(t.io||t.primus){var n=t.io?"emit":"send",r=t.io?t.io:t.primus;return e.logoutSocket(r,n)}}).then(function(e){return t.emit("logout",e),e})},e.prototype.setJWT=function(e){var t=e&&e.accessToken?e.accessToken:e;return t&&(this.app.set("accessToken",t),this.app.get("storage").setItem(this.options.storageKey,t)),Promise.resolve(e)},e.prototype.getJWT=function(){var e=this,t=this.app;return new Promise(function(n,r){var i=t.get("accessToken");return i?n(i):Promise.resolve(e.storage.getItem(e.options.storageKey)).then(function(t){var r=t||e.getCookie(e.options.cookie);return r&&"null"!==r&&!e.payloadIsValid(o(r))&&(r=void 0),n(r)}).catch(r)})},e.prototype.verifyJWT=function(e){if("string"!=typeof e)return Promise.reject(new Error("Token provided to verifyJWT is missing or not a string"));try{var t=o(e);return this.payloadIsValid(t)?Promise.resolve(t):Promise.reject(new Error("Invalid token: expired"))}catch(e){return Promise.reject(new Error("Cannot decode malformed token."))}},e.prototype.getStorage=function(e){return e||new a},e}()},function(e,t,n){"use strict";e.exports=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.service)throw new Error("You need to pass 'options.service' to the populateEntity() hook.");if(!e.field)throw new Error("You need to pass 'options.field' to the populateEntity() hook.");if(!e.entity)throw new Error("You need to pass 'options.entity' to the populateEntity() hook.");return function(t){var n=t.app;return"after"!==t.type?Promise.reject(new Error("The 'populateEntity' hook should only be used as an 'after' hook.")):n.passport.verifyJWT(t.result.accessToken).then(function(t){var r=t[e.field];return r?n.service(e.service).get(r):Promise.reject(new Error("Access token payload is missing the '"+e.field+"' field."))}).then(function(r){return t.result[e.entity]=r,n.set(e.entity,r),Promise.resolve(t)})}}},function(e,t,n){"use strict";e.exports=function(){return function(e){var t=e.app;return"before"!==e.type?Promise.reject(new Error("The 'populateAccessToken' hook should only be used as a 'before' hook.")):(Object.assign(e.params,{accessToken:t.get("accessToken")}),Promise.resolve(e))}}},function(e,t,n){"use strict";e.exports=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.header)throw new Error("You need to pass 'options.header' to the populateHeader() hook.");return function(t){return"before"!==t.type?Promise.reject(new Error("The 'populateHeader' hook should only be used as a 'before' hook.")):(t.params.accessToken&&(t.params.headers=Object.assign({},((n={})[e.header]=e.prefix?e.prefix+" "+t.params.accessToken:t.params.accessToken,n),t.params.headers)),Promise.resolve(t));var n}}},function(e,t,n){"use strict";var r={populateHeader:n(32),populateAccessToken:n(31),populateEntity:n(30)};e.exports=r},function(e,t,n){"use strict";var r=n(33),o=n(29),i={header:"Authorization",cookie:"feathers-jwt",storageKey:"feathers-jwt",jwtStrategy:"jwt",path:"/authentication",entity:"user",service:"users",timeout:5e3};function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Object.assign({},i,e);return function(){var e=this;e.passport=new o(e,t),e.authenticate=e.passport.authenticate.bind(e.passport),e.logout=e.passport.logout.bind(e.passport),e.mixins.push(function(n){if(e.version<"3.0.0")throw new Error("This version of @feathersjs/authentication-client only works with @feathersjs/feathers v3.0.0 or later.");n.hooks({before:r.populateAccessToken(t)})}),e.rest&&e.mixins.push(function(e){e.hooks({before:r.populateHeader(t)})})}}e.exports=s,e.exports.default=s,e.exports.defaults=i},function(e,t,n){"use strict";var r=n(2),o=r.hooks,i=r.validateArguments,s=r.isPromise,a=r._,c=o.createHookObject,u=o.getHooks,f=o.processHooks,p=o.enableHooks,l=o.makeArguments,h=t.hookMixin=function(e){if("function"!=typeof e.hooks){var t=this,n=t.methods,r={};p(e,n,t.hookTypes),n.forEach(function(n){"function"==typeof e[n]&&(r[n]=function(){var e=this,r=Array.from(arguments),o=!0===r[r.length-1]&&r.pop(),p=e._super.bind(e),h=c(n,r,{type:"before",service:e,app:t}),d=[function(e){return i(n,r),e}].concat(u(t,e,"before",n));return f.call(e,d,h).then(function(e){if(void 0!==e.result)return e;var t=p.apply(void 0,l(e));if(!s(t))throw new Error("Service method '"+e.method+"' for '"+e.path+"' service must return a promise");return t.then(function(t){return e.result=t,e})}).then(function(e){return Object.assign({},e,{type:"after"})}).then(function(r){var o=u(t,e,"after",n,!0),i=u(t,e,"finally",n,!0),s=o.concat(i);return f.call(e,s,r)}).then(function(e){return o?e:e.result}).catch(function(r){var i=u(t,e,"error",n,!0),s=u(t,e,"finally",n,!0),c=i.concat(s),p=a.omit(Object.assign({},r.hook,h,{type:"error",original:r.hook,error:r}),"result");return f.call(e,c,p).catch(function(e){return p.error=e,p}).then(function(e){return o?void 0!==e.result?e:Promise.reject(e):void 0!==e.result?e.result:Promise.reject(e.error)})})})}),e.mixin(r)}};e.exports=function(){return function(e){Object.assign(e,{hookTypes:["before","after","error","finally"]}),p(e,e.methods,e.hookTypes),e.mixins.push(h)}}},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function o(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,s,a,c,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var f=new Error('Uncaught, unspecified "error" event. ('+t+")");throw f.context=t,f}if(i(n=this._events[e]))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),n.apply(this,a)}else if(o(n))for(a=Array.prototype.slice.call(arguments,1),s=(u=n.slice()).length,c=0;c<s;c++)u[c].apply(this,a);return!0},n.prototype.addListener=function(e,t){var s;if(!r(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?o(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,o(this._events[e])&&!this._events[e].warned&&(s=i(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&s>0&&this._events[e].length>s&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function o(){this.removeListener(e,o),n||(n=!0,t.apply(this,arguments))}return o.listener=t,this.on(e,o),this},n.prototype.removeListener=function(e,t){var n,i,s,a;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(s=(n=this._events[e]).length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(n)){for(a=s;a-- >0;)if(n[a]===t||n[a].listener&&n[a].listener===t){i=a;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";var r=n(36).EventEmitter,o=n(4),i=t.eventHook=function(){return function(e){var t=e.app,n=e.service,r=t.eventMappings[e.method],o=n._hookEvents&&-1!==n._hookEvents.indexOf(r);r&&o&&"error"!==e.type&&(Array.isArray(e.result)?e.result:[e.result]).forEach(function(t){return n.emit(r,t,e)})}},s=t.eventMixin=function(e){if(!e._serviceEvents){var t=this,n="function"==typeof e.on&&"function"==typeof e.emit;"function"!=typeof e.mixin||n||e.mixin(r.prototype),Object.defineProperties(e,{_serviceEvents:{value:Array.isArray(e.events)?e.events.slice():[]},_hookEvents:{value:[]}}),Object.keys(t.eventMappings).forEach(function(n){var r=t.eventMappings[n],o=-1!==e._serviceEvents.indexOf(r);"function"!=typeof e[n]||o||(e._serviceEvents.push(r),e._hookEvents.push(r))})}};e.exports=function(){return function(e){Object.assign(e,{eventMappings:{create:"created",update:"updated",remove:"removed",patch:"patched"}}),e.hooks({finally:i()}),o.mixin(r.prototype,e),e.mixins.push(s)}}},function(e,t){var n=1e3,r=6e4,o=36e5,i=24*o;function s(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}e.exports=function(e,t){t=t||{};var a,c=typeof e;if("string"===c&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var s=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"days":case"day":case"d":return s*i;case"hours":case"hour":case"hrs":case"hr":case"h":return s*o;case"minutes":case"minute":case"mins":case"min":case"m":return s*r;case"seconds":case"second":case"secs":case"sec":case"s":return s*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}}}(e);if("number"===c&&!1===isNaN(e))return t.long?s(a=e,i,"day")||s(a,o,"hour")||s(a,r,"minute")||s(a,n,"second")||a+" ms":function(e){return e>=i?Math.round(e/i)+"d":e>=o?Math.round(e/o)+"h":e>=r?Math.round(e/r)+"m":e>=n?Math.round(e/n)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){function r(e){var n;function r(){if(r.enabled){var e=r,o=+new Date,i=o-(n||o);e.diff=i,e.prev=n,e.curr=o,n=o;for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];s[0]=t.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var c=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,function(n,r){if("%%"===n)return n;c++;var o=t.formatters[r];if("function"==typeof o){var i=s[c];n=o.call(e,i),s.splice(c,1),c--}return n}),t.formatArgs.call(e,s),(r.log||t.log||console.log.bind(console)).apply(e,s)}}return r.namespace=e,r.enabled=t.enabled(e),r.useColors=t.useColors(),r.color=function(e){var n,r=0;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}(e),r.destroy=o,"function"==typeof t.init&&t.init(r),t.instances.push(r),r}function o(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=r.debug=r.default=r).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var n;t.save(e),t.names=[],t.skips=[];var r=("string"==typeof e?e:"").split(/[\s,]+/),o=r.length;for(n=0;n<o;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(n=0;n<t.instances.length;n++){var i=t.instances[n];i.enabled=t.enabled(i.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=n(38),t.instances=[],t.names=[],t.skips=[],t.formatters={}},function(e,t,n){"use strict";var r=n(3)("feathers:application"),o=n(2).stripSlashes,i=n(4),s=n(37),a=n(35),c=n(9),u=i.extend({create:null}),f={init:function(){Object.assign(this,{version:c,methods:["find","get","create","update","patch","remove"],mixins:[],services:{},providers:[],_setup:!1,settings:{}}),this.configure(a()),this.configure(s())},get:function(e){return this.settings[e]},set:function(e,t){return this.settings[e]=t,this},disable:function(e){return this.settings[e]=!1,this},disabled:function(e){return!this.settings[e]},enable:function(e){return this.settings[e]=!0,this},enabled:function(e){return!!this.settings[e]},configure:function(e){return e.call(this,this),this},service:function(e,t){if(void 0!==t)throw new Error("Registering a new service with `app.service(path, service)` is no longer supported. Use `app.use(path, service)` instead.");var n=o(e),r=this.services[n];return void 0===r&&"function"==typeof this.defaultService?this.use("/"+n,this.defaultService(n)).service(n):r},use:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("string"!=typeof e||""===o(e))throw new Error("'"+e+"' is not a valid service path.");var s=o(e),a="function"==typeof t.service&&t.services,c=this.methods.concat("setup").some(function(e){return t&&"function"==typeof t[e]});if(a){var f=t;return Object.keys(f.services).forEach(function(e){return n.use(s+"/"+e,f.service(e))}),this}if(!c)throw new Error("Invalid service object passed for path `"+s+"`");var p=u.isPrototypeOf(t)?t:u.extend(t);return r("Registering new service at `"+s+"`"),this.mixins.forEach(function(e){return e.call(n,p,s,i)}),"function"==typeof p._setup&&p._setup(this,s),this.providers.forEach(function(e){return e.call(n,p,s,i)}),this._isSetup&&"function"==typeof p.setup&&(r("Setting up service for `"+s+"`"),p.setup(this,s)),this.services[s]=p,this},setup:function(){var e=this;return Object.keys(this.services).forEach(function(t){var n=e.services[t];r("Setting up service for `"+t+"`"),"function"==typeof n.setup&&n.setup(e,t)}),this._isSetup=!0,this}};e.exports=f},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=n(5)._,i=["$sort","$limit","$skip","$select","$populate"];function s(e){if(void 0!==e)return Math.abs(parseInt(e,10))}e.exports=function(e,t){return{filters:{$sort:function(e){if("object"!==(void 0===e?"undefined":r(e))||Array.isArray(e))return e;var t={};return Object.keys(e).forEach(function(n){t[n]="object"===r(e[n])?e[n]:parseInt(e[n],10)}),t}(e.$sort),$limit:function(e,t){if(t&&t.default){var n="number"==typeof e?e:t.default,r="number"==typeof t.max?t.max:Number.MAX_VALUE;return Math.min(n,r)}return e}(s(e.$limit),t),$skip:s(e.$skip),$select:e.$select,$populate:e.$populate},query:o.omit.apply(o,[e].concat(i))}}},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o={find:1,get:2,create:2,update:3,patch:3,remove:2};function i(e){return"object"===(void 0===e?"undefined":r(e))&&null!==e}t.validateArguments=function(e,t){if("function"==typeof t[t.length-1])throw new Error("Callbacks are no longer supported. Use Promises or async/await instead.");var n=o[e];if(n&&t.length>n)throw new Error("Too many arguments for '"+e+"' method");var r=t[n-1];if(void 0!==r&&!i(r))throw new Error("Params for '"+e+"' method must be an object");switch(e){case"create":if(!i(t[0]))throw new Error("A data object must be provided to the 'create' method");break;case"get":case"remove":case"update":case"patch":if(void 0===t[0])throw new Error("An id must be provided to the '"+e+"' method");if(("update"===e||"patch"===e)&&!i(t[1]))throw new Error("A data object must be provided to the '"+e+"' method")}return!0}},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=n(5)._,i=o.each,s=o.pick;function a(e){var t=e[0],n=e[1];return{id:t,params:void 0===n?{}:n}}function c(e){var t=e[0],n=e[1],r=e[2];return{id:t,data:n,params:void 0===r?{}:r}}var u=t.SKIP="undefined"!=typeof Symbol?Symbol("__feathersSkipHooks"):"__feathersSkipHooks";t.converters={find:function(e){var t=e[0];return{params:void 0===t?{}:t}},create:function(e){var t=e[0],n=e[1];return{data:t,params:void 0===n?{}:n}},get:a,remove:a,update:c,patch:c},t.createHookObject=function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=t.converters[e](n);return Object.defineProperty(o,"toJSON",{value:function(){return s(this,"type","method","path","params","id","data","result","error")}}),Object.assign(o,r,{method:e,get path(){var e=r.app,t=r.service;return t&&e&&e.services?Object.keys(e.services).find(function(n){return e.services[n]===t}):null}})},t.defaultMakeArguments=function(e){var t=[];return void 0!==e.id&&t.push(e.id),e.data&&t.push(e.data),t.push(e.params||{}),t},t.makeArguments=function(e){switch(e.method){case"find":return[e.params];case"get":case"remove":return[e.id,e.params];case"update":case"patch":return[e.id,e.data,e.params];case"create":return[e.data,e.params]}return t.defaultMakeArguments(e)},t.convertHookData=function(e){var t={};return Array.isArray(e)?t={all:e}:"object"!==(void 0===e?"undefined":r(e))?t={all:[e]}:i(e,function(e,n){t[n]=Array.isArray(e)?e:[e]}),t},t.isHookObject=function(e){return"object"===(void 0===e?"undefined":r(e))&&"string"==typeof e.method&&"string"==typeof e.type},t.getHooks=function(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i=e.__hooks[n][r]||[],s=t.__hooks[n][r]||[];return o?s.concat(i):i.concat(s)},t.processHooks=function(e,n){var r=this,o=n,i=function(e){if(e){if(e===u)return u;if(!t.isHookObject(e))throw new Error(o.type+" hook for '"+o.method+"' method returned invalid hook object");o=e}return o},s=Promise.resolve(o);return e.forEach(function(e){var t=e.bind(r);s=(s=2===t.length?s.then(function(e){return e===u?u:new Promise(function(n,r){t(e,function(e,t){return e?r(e):n(t)})})}):s.then(function(e){return e===u?u:t(e)})).then(i)}),s.then(function(){return o}).catch(function(e){throw e.hook=o,e})},t.enableHooks=function(e,n,r){if("function"==typeof e.hooks)return e;var o={};return r.forEach(function(e){o[e]={}}),Object.defineProperty(e,"__hooks",{value:o}),Object.assign(e,{hooks:function(e){var r=this;return i(e,function(e,o){if(!r.__hooks[o])throw new Error("'"+o+"' is not a valid hook type");var s=t.convertHookData(e);i(s,function(e,t){if("all"!==t&&-1===n.indexOf(t))throw new Error("'"+t+"' is not a valid hook method")}),n.forEach(function(e){var t=r.__hooks[o][e]||(r.__hooks[o][e]=[]);s.all&&t.push.apply(t,s.all),s[e]&&t.push.apply(t,s[e])})}),this}})}},function(e,t,n){"use strict";var r=n(2).hooks,o=n(4),i=n(40),s=n(9);function a(){var e={};return o.mixin(i,e),e.init(),e}a.version=s,a.SKIP=r.SKIP,e.exports=a,e.exports.default=a},function(e,t,n){"use strict";var r=n(44),o=n(1),i=n(34),s=n(24),a=n(13),c=n(11);Object.assign(r,{errors:o,authentication:i,socketio:a,primus:c,rest:s}),e.exports=r}])});