/**
* kinvey-html5-sdk - Kinvey JavaScript SDK for HTML5 applications.
* @version 4.0.0
* @author Thomas Conner
* @license Apache-2.0
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Kinvey=t():e.Kinvey=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},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=99)}([function(e,t,n){"use strict";n.r(t),n.d(t,"__extends",function(){return i}),n.d(t,"__assign",function(){return o}),n.d(t,"__rest",function(){return s}),n.d(t,"__decorate",function(){return u}),n.d(t,"__param",function(){return a}),n.d(t,"__metadata",function(){return c}),n.d(t,"__awaiter",function(){return l}),n.d(t,"__generator",function(){return f}),n.d(t,"__exportStar",function(){return h}),n.d(t,"__values",function(){return d}),n.d(t,"__read",function(){return p}),n.d(t,"__spread",function(){return v}),n.d(t,"__await",function(){return y}),n.d(t,"__asyncGenerator",function(){return _}),n.d(t,"__asyncDelegator",function(){return b}),n.d(t,"__asyncValues",function(){return g}),n.d(t,"__makeTemplateObject",function(){return m}),n.d(t,"__importStar",function(){return w}),n.d(t,"__importDefault",function(){return S});
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function i(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=0;u--)(i=e[u])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function a(e,t){return function(n,r){t(n,r,e)}}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function u(e){try{a(r.throw(e))}catch(e){o(e)}}function a(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,u)}a((r=r.apply(e,t||[])).next())})}function f(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function p(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function v(){for(var e=[],t=0;t1||u(e,t)})})}function u(e,t){try{(n=i[e](t)).value instanceof y?Promise.resolve(n.value.v).then(a,c):l(o[0][2],n)}catch(e){l(o[0][3],e)}var n}function a(e){u("next",e)}function c(e){u("throw",e)}function l(e,t){e(t),o.shift(),o.length&&u(o[0][0],o[0][1])}}function b(e){var t,n;return t={},r("next"),r("throw",function(e){throw e}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:y(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function g(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=d(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,i){(function(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)})(r,i,(t=e[n](t)).done,t.value)})}}}function m(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function w(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function S(e){return e&&e.__esModule?e:{default:e}}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){var r=this.constructor;void 0===t&&(t="An error occurred."),void 0===n&&(n="");var i=e.call(this,t)||this;return Object.setPrototypeOf(i,r.prototype),i.name="KinveyError",i.debug=n,i}return r.__extends(t,e),t}(Error);t.KinveyError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0);r.__exportStar(n(25),t),r.__exportStar(n(54),t),r.__exportStar(n(127),t),r.__exportStar(n(55),t),r.__exportStar(n(30),t),r.__exportStar(n(80),t)},function(e,t,n){var r=n(8),i=n(7),o=n(12),s="[object String]";e.exports=function(e){return"string"==typeof e||!i(e)&&o(e)&&r(e)==s}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(21),i=n(13);function o(){return i.getConfig(i.ConfigKey.KinveyConfig).instanceId}t.getAppKey=function(){return i.getConfig(i.ConfigKey.KinveyConfig).appKey},t.getAppSecret=function(){return i.getConfig(i.ConfigKey.KinveyConfig).appSecret},t.getMasterSecret=function(){return i.getConfig(i.ConfigKey.KinveyConfig).masterSecret},t.getInstanceId=o,t.getBaasProtocol=function(){return"https"},t.getBaasHost=function(){var e=o();return e?e+"-baas.kinvey.com":"baas.kinvey.com"},t.getAuthProtocol=function(){return"https"},t.getAuthHost=function(){var e=o();return e?e+"-auth.kinvey.com":"auth.kinvey.com"},t.getDefaultTimeout=function(){var e=i.getConfig(i.ConfigKey.KinveyConfig);return r(e.defaultTimeout)?e.defaultTimeout:6e4},t.getEncryptionKey=function(){return i.getConfig(i.ConfigKey.KinveyConfig).encryptionKey}},function(e,t,n){"use strict";var r=n(92),i=n(188),o=Object.prototype.toString;function s(e){return"[object Array]"===o.call(e)}function u(e){return null!==e&&"object"==typeof e}function a(e){return"[object Function]"===o.call(e)}function c(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),s(e))for(var n=0,r=e.length;n0&&this.addFilter(e,"$options",r.join("")),this.addFilter(e,"$regex",i.source)},e.prototype.near=function(e,t,n){if(!Array.isArray(t)||!i.default(t[0])||!i.default(t[1]))throw new f.QueryError("coord must be a [number, number]");var r=this.addFilter(e,"$nearSphere",[t[0],t[1]]);return i.default(n)&&this.addFilter(e,"$maxDistance",n),r},e.prototype.withinBox=function(e,t,n){if(!Array.isArray(t)||!i.default(t[0])||!i.default(t[1]))throw new f.QueryError("bottomLeftCoord must be a [number, number]");if(!Array.isArray(n)||!i.default(n[0])||!i.default(n[1]))throw new f.QueryError("upperRightCoord must be a [number, number]");var r=[[t[0],t[1]],[n[0],n[1]]];return this.addFilter(e,"$within",{$box:r})},e.prototype.withinPolygon=function(e,t){if(!1===Array.isArray(t)||0===t.length||t[0].length>3)throw new f.QueryError("coords must be a [[number, number]]");var n=t.map(function(e){if(!i.default(e[0])||!i.default(e[1]))throw new f.QueryError("coords argument must be a [number, number]");return[e[0],e[1]]});return this.addFilter(e,"$within",{$polygon:n})},e.prototype.size=function(e,t){if(!i.default(t))throw new f.QueryError("size must be a number");return this.addFilter(e,"$size",t)},e.prototype.ascending=function(e){return this._parent?this._parent.ascending(e):(this.sort||(this.sort={}),this.sort[e]=1),this},e.prototype.descending=function(e){return this._parent?this._parent.descending(e):(this.sort||(this.sort={}),this.sort[e]=-1),this},e.prototype.and=function(){for(var e=[],t=0;t0&&(e.query=this.filter),this.fields&&this.fields.length>0&&(e.fields=this.fields.join(",")),i.default(this.limit)&&this.limit0&&(e.skip=this.skip),this.sort&&Object.keys(this.sort).length>0&&(e.sort=this.sort),Object.keys(e).forEach(function(t){e[t]=o.default(e[t])?e[t]:JSON.stringify(e[t])}),e},e.prototype.toQueryString=function(){return this.toQueryObject()},e.prototype.toPlainObject=function(){return this._parent?this._parent.toPlainObject():{fields:this.fields,filter:this.filter,sort:this.sort,skip:this.skip,limit:this.limit}},e.prototype.toString=function(){return JSON.stringify(this.toQueryString())},e.prototype.addFilter=function(e){for(var t=[],n=1;n0){var n=void 0;return n=this.filter&&!a.default(this.filter)?l.default(this.filter,e):e,a.default(this.sort)||n.sort(function(e,n){return Object.keys(t.sort).reduce(function(r,i){if(void 0!==r&&0!==r)return r;if(Object.prototype.hasOwnProperty.call(t.sort,i)){var o=p(e,i),s=p(n,i),u=t.sort[i];if(null!=o&&null==s)return 1*u;if(null!=s&&null==o)return-1*u;if(void 0===o&&null===s)return 0;if(null===o&&void 0===s)return 0;if(o!==s)return(o0?n=i.default(this.limit)&&this.limit0&&(n=n.map(function(e){var n=e;return Object.keys(n).forEach(function(e){t.fields&&-1===t.fields.indexOf(e)&&-1===d.indexOf(e)&&delete n[e]}),n})),n}return e},e}();t.Query=v},function(e,t,n){"use strict";n.r(t),n.d(t,"__extends",function(){return i}),n.d(t,"__assign",function(){return o}),n.d(t,"__rest",function(){return s}),n.d(t,"__decorate",function(){return u}),n.d(t,"__param",function(){return a}),n.d(t,"__metadata",function(){return c}),n.d(t,"__awaiter",function(){return l}),n.d(t,"__generator",function(){return f}),n.d(t,"__exportStar",function(){return h}),n.d(t,"__values",function(){return d}),n.d(t,"__read",function(){return p}),n.d(t,"__spread",function(){return v}),n.d(t,"__await",function(){return y}),n.d(t,"__asyncGenerator",function(){return _}),n.d(t,"__asyncDelegator",function(){return b}),n.d(t,"__asyncValues",function(){return g}),n.d(t,"__makeTemplateObject",function(){return m}),n.d(t,"__importStar",function(){return w}),n.d(t,"__importDefault",function(){return S});
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function i(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=0;u--)(i=e[u])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function a(e,t){return function(n,r){t(n,r,e)}}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function u(e){try{a(r.throw(e))}catch(e){o(e)}}function a(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,u)}a((r=r.apply(e,t||[])).next())})}function f(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function p(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function v(){for(var e=[],t=0;t1||u(e,t)})})}function u(e,t){try{(n=i[e](t)).value instanceof y?Promise.resolve(n.value.v).then(a,c):l(o[0][2],n)}catch(e){l(o[0][3],e)}var n}function a(e){u("next",e)}function c(e){u("throw",e)}function l(e,t){e(t),o.shift(),o.length&&u(o[0][0],o[0][1])}}function b(e){var t,n;return t={},r("next"),r("throw",function(e){throw e}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:y(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function g(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=d(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,i){(function(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)})(r,i,(t=e[n](t)).done,t.value)})}}}function m(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function w(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function S(e){return e&&e.__esModule?e:{default:e}}},function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}},function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=new Map;!function(e){e[e.KinveyConfig=0]="KinveyConfig",e[e.HttpAdapter=1]="HttpAdapter",e[e.SessionStore=2]="SessionStore",e[e.StorageAdapter=3]="StorageAdapter",e[e.Popup=4]="Popup",e[e.PubNub=5]="PubNub"}(t.ConfigKey||(t.ConfigKey={})),t.getConfig=function(e){return n.get(e)},t.setConfig=function(e,t){return n.set(e,t)}},function(e,t,n){var r=n(8),i=n(102),o=n(12),s="[object Object]",u=Function.prototype,a=Object.prototype,c=u.toString,l=a.hasOwnProperty,f=c.call(Object);e.exports=function(e){if(!o(e)||r(e)!=s)return!1;var t=i(e);if(null===t)return!0;var n=l.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&c.call(n)==f}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=r.__importDefault(n(3)),o=r.__importDefault(n(23)),s=n(52),u=n(4),a="_QueryCache",c="kinvey_sync";function l(e){return i.default(e)&&/^[a-z0-9-]+$/i.test(e)}t.isValidTag=l;var f=function(e){function t(t,n){if(n&&!l(n))throw new Error('A tag can only contain letters, numbers, and "-".');return n?e.call(this,u.getAppKey(),t+"."+n)||this:e.call(this,u.getAppKey(),t)||this}return r.__extends(t,e),t.clear=function(){return s.Storage.clear(u.getAppKey())},t}(s.Storage);t.DataStoreCache=f;var h=function(e){function t(t){return e.call(this,a,t)||this}return r.__extends(t,e),t.prototype.serializeQuery=function(e){if(!e)return"";if(e.skip&&e.skip>0||e.limit&&e.limit=2e3)throw new Error("The custom properties are "+n+" bytes.It must be less then 2000 bytes.");this.set("X-Kinvey-Custom-Request-Properties",t)}},t}(f);t.KinveyHttpHeaders=d},function(module,exports,__webpack_require__){(function(global){var __WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__;!function(e,t){module.exports=t(e)}("undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==global?global:this,function(global){"use strict";global=global||{};var _Base64=global.Base64,version="2.5.1",buffer;if(module.exports)try{buffer=eval("require('buffer').Buffer")}catch(e){buffer=void 0}var b64chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b64tab=function(e){for(var t={},n=0,r=e.length;n>>6)+fromCharCode(128|63&t):fromCharCode(224|t>>>12&15)+fromCharCode(128|t>>>6&63)+fromCharCode(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return fromCharCode(240|t>>>18&7)+fromCharCode(128|t>>>12&63)+fromCharCode(128|t>>>6&63)+fromCharCode(128|63&t)},re_utob=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,utob=function(e){return e.replace(re_utob,cb_utob)},cb_encode=function(e){var t=[0,2,1][e.length%3],n=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0);return[b64chars.charAt(n>>>18),b64chars.charAt(n>>>12&63),t>=2?"=":b64chars.charAt(n>>>6&63),t>=1?"=":b64chars.charAt(63&n)].join("")},btoa=global.btoa?function(e){return global.btoa(e)}:function(e){return e.replace(/[\s\S]{1,3}/g,cb_encode)},_encode=buffer?buffer.from&&Uint8Array&&buffer.from!==Uint8Array.from?function(e){return(e.constructor===buffer.constructor?e:buffer.from(e)).toString("base64")}:function(e){return(e.constructor===buffer.constructor?e:new buffer(e)).toString("base64")}:function(e){return btoa(utob(e))},encode=function(e,t){return t?_encode(String(e)).replace(/[+\/]/g,function(e){return"+"==e?"-":"_"}).replace(/=/g,""):_encode(String(e))},encodeURI=function(e){return encode(e,!0)},re_btou=new RegExp(["[À-ß][-¿]","[à-ï][-¿]{2}","[ð-÷][-¿]{3}"].join("|"),"g"),cb_btou=function(e){switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return fromCharCode(55296+(t>>>10))+fromCharCode(56320+(1023&t));case 3:return fromCharCode((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return fromCharCode((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},btou=function(e){return e.replace(re_btou,cb_btou)},cb_decode=function(e){var t=e.length,n=t%4,r=(t>0?b64tab[e.charAt(0)]<<18:0)|(t>1?b64tab[e.charAt(1)]<<12:0)|(t>2?b64tab[e.charAt(2)]<<6:0)|(t>3?b64tab[e.charAt(3)]:0),i=[fromCharCode(r>>>16),fromCharCode(r>>>8&255),fromCharCode(255&r)];return i.length-=[0,0,2,1][n],i.join("")},_atob=global.atob?function(e){return global.atob(e)}:function(e){return e.replace(/\S{1,4}/g,cb_decode)},atob=function(e){return _atob(String(e).replace(/[^A-Za-z0-9\+\/]/g,""))},_decode=buffer?buffer.from&&Uint8Array&&buffer.from!==Uint8Array.from?function(e){return(e.constructor===buffer.constructor?e:buffer.from(e,"base64")).toString()}:function(e){return(e.constructor===buffer.constructor?e:new buffer(e,"base64")).toString()}:function(e){return btou(_atob(e))},decode=function(e){return _decode(String(e).replace(/[-_]/g,function(e){return"-"==e?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,""))},noConflict=function(){var e=global.Base64;return global.Base64=_Base64,e};if(global.Base64={VERSION:version,atob:atob,btoa:btoa,fromBase64:decode,toBase64:encode,utob:utob,encode:encode,encodeURI:encodeURI,btou:btou,decode:decode,noConflict:noConflict,__buffer__:buffer},"function"==typeof Object.defineProperty){var noEnum=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}};global.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",noEnum(function(){return decode(this)})),Object.defineProperty(String.prototype,"toBase64",noEnum(function(e){return encode(this,e)})),Object.defineProperty(String.prototype,"toBase64URI",noEnum(function(){return encode(this,!0)}))}}return global.Meteor&&(Base64=global.Base64),module.exports?module.exports.Base64=global.Base64:(__WEBPACK_AMD_DEFINE_ARRAY__=[],__WEBPACK_AMD_DEFINE_RESULT__=function(){return global.Base64}.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)),{Base64:global.Base64}})}).call(this,__webpack_require__(20))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=r.__importDefault(n(7)),o=n(44),s=n(88),u=n(81),a=n(2),c=n(1),l=n(15),f=n(82),h=n(34),d=n(89),p=function(){function e(e){void 0===e&&(e={}),this.data=e}return Object.defineProperty(e.prototype,"_id",{get:function(){if(this.data)return this.data._id},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_acl",{get:function(){if(this.data)return new o.Acl(this.data)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_kmd",{get:function(){if(this.data)return new s.Kmd(this.data)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"metadata",{get:function(){return this._kmd},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"authtoken",{get:function(){var e=this._kmd;if(e)return e.authtoken},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_socialIdentity",{get:function(){return this.data._socialIdentity},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"username",{get:function(){if(this.data)return this.data.username},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"email",{get:function(){if(this.data)return this.data.email},enumerable:!0,configurable:!0}),e.prototype.isActive=function(){var e=a.getSession();return!(!e||e._id!==this._id)},e.prototype.isEmailVerified=function(){var e=this.metadata;return!!e&&e.isEmailConfirmed()},e.prototype.me=function(e){return void 0===e&&(e={}),r.__awaiter(this,void 0,void 0,function(){var t,n;return r.__generator(this,function(r){switch(r.label){case 0:return[4,new a.KinveyHttpRequest({method:a.HttpRequestMethod.GET,auth:a.KinveyHttpAuth.Session,url:a.formatKinveyBaasUrl(a.KinveyBaasNamespace.User,"/_me"),timeout:e.timeout}).execute()];case 1:return t=r.sent(),delete(n=t.data).password,n._socialIdentity&&(n._socialIdentity=d.mergeSocialIdentity(this._socialIdentity,n._socialIdentity)),this.isActive()&&a.setSession(n),this.data=n,[2,this]}})})},e.prototype.update=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,function(){var n,o,s;return r.__generator(this,function(r){switch(r.label){case 0:if(n=Object.assign({},this.data,e),!e)throw new c.KinveyError("No user was provided to be updated.");if(i.default(e))throw new c.KinveyError("Only one user can be updated at one time.");if(!n._id)throw new c.KinveyError("User must have an _id.");return[4,new a.KinveyHttpRequest({method:a.HttpRequestMethod.PUT,auth:a.KinveyHttpAuth.SessionOrMaster,url:a.formatKinveyBaasUrl(a.KinveyBaasNamespace.User,"/"+this._id),body:n,timeout:t.timeout}).execute()];case 1:return o=r.sent(),delete(s=o.data).password,s._socialIdentity&&(s._socialIdentity=d.mergeSocialIdentity(this._socialIdentity,s._socialIdentity)),this.isActive()&&a.setSession(s),this.data=s,[2,this]}})})},e.prototype.registerForLiveService=function(e){return void 0===e&&(e={}),r.__awaiter(this,void 0,void 0,function(){var t,n,i;return r.__generator(this,function(r){switch(r.label){case 0:return f.isSubscribed()?[3,3]:[4,u.getDeviceId()];case 1:return t=r.sent(),[4,new a.KinveyHttpRequest({method:a.HttpRequestMethod.POST,auth:a.KinveyHttpAuth.Session,url:a.formatKinveyBaasUrl(a.KinveyBaasNamespace.User,"/"+this._id+"/register-realtime"),body:{deviceId:t},timeout:e.timeout}).execute()];case 2:n=r.sent(),i=Object.assign({},{authKey:this.authtoken},n.data),f.subscribe(i),r.label=3;case 3:return[2,!0]}})})},e.prototype.unregisterFromLiveService=function(e){return void 0===e&&(e={}),r.__awaiter(this,void 0,void 0,function(){var t;return r.__generator(this,function(n){switch(n.label){case 0:return f.isSubscribed()?(f.unsubscribe(),[4,u.getDeviceId()]):[3,3];case 1:return t=n.sent(),[4,new a.KinveyHttpRequest({method:a.HttpRequestMethod.POST,auth:a.KinveyHttpAuth.Session,url:a.formatKinveyBaasUrl(a.KinveyBaasNamespace.User,"/"+this._id+"/unregister-realtime"),body:{deviceId:t},timeout:e.timeout}).execute()];case 2:n.sent(),n.label=3;case 3:return[2,!0]}})})},e.prototype.logout=function(e){return void 0===e&&(e={}),r.__awaiter(this,void 0,void 0,function(){var t;return r.__generator(this,function(n){switch(n.label){case 0:if(!this.isActive())return[3,8];this.unregisterFromLiveService(),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,new a.KinveyHttpRequest({method:a.HttpRequestMethod.POST,auth:a.KinveyHttpAuth.Session,url:a.formatKinveyBaasUrl(a.KinveyBaasNamespace.User,"/_logout"),timeout:e.timeout}).execute()];case 2:return n.sent(),[3,4];case 3:return t=n.sent(),h.logger.error("Logout request failed."),h.logger.error(t.message),[3,4];case 4:return a.removeSession(),[4,l.QueryCache.clear()];case 5:return n.sent(),[4,l.SyncCache.clear()];case 6:return n.sent(),[4,l.DataStoreCache.clear()];case 7:n.sent(),n.label=8;case 8:return[2,this]}})})},e}();t.User=p},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(10),i=function(){function e(e){var t=Object.assign({},{query:null,initial:{},key:{},reduceFn:function(){}.toString()},e);this.query=t.query,this.initial=t.initial,this.key=t.key,this.reduceFn=t.reduceFn}return Object.defineProperty(e.prototype,"query",{get:function(){return this._query},set:function(e){if(e&&!(e instanceof r.Query))throw new Error("Query must be an instance of Query class.");this._query=e},enumerable:!0,configurable:!0}),e.prototype.by=function(e){return this.key[e]=!0,this},e.prototype.process=function(e){var t=this;void 0===e&&(e=[]);var n=new Function("doc","out",this.reduceFn.replace(/function[\s\S]*?\([\s\S]*?\)/,"")),r=e;if(this.query&&(r=this.query.process(e)),r.length>0){var i=Object.keys(this.key)||[];return i.length>0?r.reduce(function(e,r){var o=e.findIndex(function(e){return i.reduce(function(t,n){return t&&e[n]===r[n]},!0)});if(-1===o){var s=i.reduce(function(e,t){return e[t]=r[t],e},Object.assign({},t.initial));e.push(n(r,s))}else{s=e[o];e[o]=n(r,s)}return e},[]):r.reduce(function(e,t){return n(t,e)},Object.assign({},this.initial))}return Object.assign({},this.initial)},e.prototype.toPlainObject=function(){return{key:this.key,initial:this.initial,reduce:this.reduceFn,reduceFn:this.reduceFn,condition:this.query?this.query.toPlainObject().filter:{},query:this.query?this.query.toPlainObject():null}},e.average=function(t){return void 0===t&&(t=""),new e({initial:{count:0,average:0},reduceFn:'function(doc, out) { out.average = (out.average * out.count + doc["'+t.replace("'","\\'")+'"]) / (out.count + 1); out.count += 1; return out;}'})},e.count=function(t){void 0===t&&(t="");var n=new e({initial:{count:0},reduceFn:"function(doc, out) { out.count += 1; return out;}"});return n.by(t),n},e.max=function(t){return void 0===t&&(t=""),new e({initial:{max:-1*Number.MAX_SAFE_INTEGER},reduceFn:'function(doc, out) { out.max = Math.max(out.max, doc["'+t.replace("'","\\'")+'"]); return out;}'})},e.min=function(t){return void 0===t&&(t=""),new e({initial:{min:Number.MAX_SAFE_INTEGER},reduceFn:'function(doc, out) { out.min = Math.min(out.min, doc["'+t.replace("'","\\'")+'"]); return out;}'})},e.sum=function(t){return void 0===t&&(t=""),new e({initial:{sum:0},reduceFn:'function(doc, out) { out.sum += doc["'+t.replace("'","\\'")+'"]; return out;}'})},e}();t.Aggregation=i},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(13),i=n(4);function o(){return r.getConfig(r.ConfigKey.SessionStore)}function s(){return i.getAppKey()+".active_user"}t.getKey=s,t.getSession=function(){var e=o().get(s());return e?JSON.parse(e):null},t.setSession=function(e){return o().set(s(),JSON.stringify(e))},t.removeSession=function(){return o().remove(s())}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="Invalid credentials. Please retry your request with correct credentials.");var r=e.call(this,t,n)||this;return r.name="InvalidCredentialsError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.InvalidCredentialsError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="Missing configuration error.");var r=e.call(this,t,n)||this;return r.name="MissingConfigurationError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.MissingConfigurationError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="The value specified for one of the request parameters is out of range.");var r=e.call(this,t,n)||this;return r.name="ParameterValueOutOfRangeError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.ParameterValueOutOfRangeError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=r.__importStar(n(128));t.logger=i;var o=r.__importStar(n(129));i.setDefaultLevel(i.levels.ERROR),o.reg(i);o.apply(i,{template:"[%t] %l (%n):",timestampFormatter:function(e){return e.toISOString()}})},function(e,t,n){"use strict";var r=n(130),i=n(131);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=g,t.resolve=function(e,t){return g(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?g(e,!1,!0).resolveObject(t):t},t.format=function(e){i.isString(e)&&(e=g(e));return e instanceof o?e.format():o.prototype.format.call(e)},t.Url=o;var s=/^([a-z0-9.+-]+:)/i,u=/:[0-9]*$/,a=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),f=["%","/","?",";","#"].concat(l),h=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},_={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},b=n(132);function g(e,t,n){if(e&&i.isObject(e)&&e instanceof o)return e;var r=new o;return r.parse(e,t,n),r}o.prototype.parse=function(e,t,n){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),u=-1!==o&&o127?M+="x":M+=N[I];if(!M.match(d)){var K=k.slice(0,C),D=k.slice(C+1),q=N.match(p);q&&(K.push(q[1]),D.unshift(q[2])),D.length&&(g="/"+D.join(".")+g),this.hostname=K.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),A||(this.hostname=r.toASCII(this.hostname));var B=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+B,this.href+=this.host,A&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==g[0]&&(g="/"+g))}if(!v[S])for(C=0,T=l.length;C0)&&n.host.split("@"))&&(n.auth=A.shift(),n.host=n.hostname=A.shift());return n.search=e.search,n.query=e.query,i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!x.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var O=x.slice(-1)[0],P=(n.host||e.host||x.length>1)&&("."===O||".."===O)||""===O,C=0,j=x.length;j>=0;j--)"."===(O=x[j])?x.splice(j,1):".."===O?(x.splice(j,1),C++):C&&(x.splice(j,1),C--);if(!w&&!S)for(;C--;C)x.unshift("..");!w||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),P&&"/"!==x.join("/").substr(-1)&&x.push("");var A,k=""===x[0]||x[0]&&"/"===x[0].charAt(0);E&&(n.hostname=n.host=k?"":x.length?x.shift():"",(A=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=A.shift(),n.host=n.hostname=A.shift()));return(w=w||n.host&&x.length)&&!k&&x.unshift(""),x.length?n.pathname=x.join("/"):(n.pathname=null,n.path=null),i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var e=this.host,t=u.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=r.__importDefault(n(7)),o=n(43),s=n(81),u=n(28),a=n(10),c=n(1),l=n(2),f=n(4),h=n(82);function d(e,t,n){return new l.KinveyHttpRequest({method:e,auth:l.KinveyHttpAuth.SessionOrMaster,url:t,body:n})}t.createRequest=d;var p=function(){function e(e){this.collectionName=e}return Object.defineProperty(e.prototype,"collection",{get:function(){return this.collectionName},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pathname",{get:function(){return"/"+this.collectionName},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"channelName",{get:function(){return f.getAppKey()+".c-"+this.collectionName},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"personalChannelName",{get:function(){var e=l.getSession();if(e)return this.channelName+".u-"+e._id},enumerable:!0,configurable:!0}),e.prototype.find=function(e,t){var n=this;return void 0===t&&(t={}),o.Observable.create(function(i){return r.__awaiter(n,void 0,void 0,function(){var n,o,s,u,f,h,p,v,y,_,b;return r.__generator(this,function(r){switch(r.label){case 0:if(r.trys.push([0,2,,3]),e&&!(e instanceof a.Query))throw new c.KinveyError("Invalid query. It must be an instance of the Query class.");return n=t.rawResponse,o=void 0!==n&&n,s=t.timeout,u=t.properties,t.trace,t.skipBL,f=t.kinveyFileTTL,h=t.kinveyFileTLS,p=Object.assign({},e?e.toQueryObject():{},{kinveyfile_ttl:f,kinveyfile_tls:h}),v=l.formatKinveyBaasUrl(l.KinveyBaasNamespace.AppData,this.pathname,p),(y=d(l.HttpRequestMethod.GET,v)).headers.setCustomRequestProperties(u),y.timeout=s,[4,y.execute()];case 1:return _=r.sent(),!0===o?i.next(_):i.next(_.data),i.complete(),[3,3];case 2:return b=r.sent(),i.error(b),[3,3];case 3:return[2]}})})})},e.prototype.count=function(e,t){var n=this;return void 0===t&&(t={}),o.Observable.create(function(i){return r.__awaiter(n,void 0,void 0,function(){var n,o,s,u,f,h,p,v,y;return r.__generator(this,function(r){switch(r.label){case 0:if(r.trys.push([0,2,,3]),e&&!(e instanceof a.Query))throw new c.KinveyError("Invalid query. It must be an instance of the Query class.");return n=t.rawResponse,o=void 0!==n&&n,s=t.timeout,u=t.properties,t.trace,t.skipBL,f=Object.assign({},e?e.toQueryObject():{},{}),h=l.formatKinveyBaasUrl(l.KinveyBaasNamespace.AppData,this.pathname+"/_count",f),(p=d(l.HttpRequestMethod.GET,h)).headers.setCustomRequestProperties(u),p.timeout=s,[4,p.execute()];case 1:return v=r.sent(),!0===o?i.next(v):i.next(v.data.count),i.complete(),[3,3];case 2:return y=r.sent(),i.error(y),[3,3];case 3:return[2]}})})})},e.prototype.group=function(e,t){var n=this;return void 0===t&&(t={}),o.Observable.create(function(i){return r.__awaiter(n,void 0,void 0,function(){var n,o,s,a,f,h,p,v,y;return r.__generator(this,function(r){switch(r.label){case 0:if(r.trys.push([0,2,,3]),!(e instanceof u.Aggregation))throw new c.KinveyError("Invalid aggregation. It must be an instance of the Aggregation class.");return n=t.rawResponse,o=void 0!==n&&n,s=t.timeout,a=t.properties,t.trace,t.skipBL,f={},h=l.formatKinveyBaasUrl(l.KinveyBaasNamespace.AppData,this.pathname+"/_group",f),(p=d(l.HttpRequestMethod.POST,h,e.toPlainObject())).headers.setCustomRequestProperties(a),p.timeout=s,[4,p.execute()];case 1:return v=r.sent(),!0===o?i.next(v):i.next(v.data),i.complete(),[3,3];case 2:return y=r.sent(),i.error(y),[3,3];case 3:return[2]}})})})},e.prototype.findById=function(e,t){var n=this;return void 0===t&&(t={}),o.Observable.create(function(i){return r.__awaiter(n,void 0,void 0,function(){var n,o,s,u,a,c,f,h,p,v,y;return r.__generator(this,function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),e?(n=t.rawResponse,o=void 0!==n&&n,s=t.timeout,u=t.properties,t.trace,t.skipBL,a=t.kinveyFileTTL,c=t.kinveyFileTLS,f={kinveyfile_ttl:a,kinveyfile_tls:c},h=l.formatKinveyBaasUrl(l.KinveyBaasNamespace.AppData,this.pathname+"/"+e,f),(p=d(l.HttpRequestMethod.GET,h)).headers.setCustomRequestProperties(u),p.timeout=s,[4,p.execute()]):[3,2];case 1:return v=r.sent(),!0===o?i.next(v):i.next(v.data),[3,3];case 2:i.next(void 0),r.label=3;case 3:return i.complete(),[3,5];case 4:return y=r.sent(),i.error(y),[3,5];case 5:return[2]}})})})},e.prototype.create=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,function(){var n,o,s,u,a,f,h,p;return r.__generator(this,function(r){switch(r.label){case 0:if(i.default(e))throw new c.KinveyError("Unable to create an array of entities. Please create entities one by one.");return n=t.rawResponse,o=void 0!==n&&n,s=t.timeout,u=t.properties,t.trace,t.skipBL,a={},f=l.formatKinveyBaasUrl(l.KinveyBaasNamespace.AppData,this.pathname,a),(h=d(l.HttpRequestMethod.POST,f,e)).headers.setCustomRequestProperties(u),h.timeout=s,[4,h.execute()];case 1:return p=r.sent(),!0===o?[2,p]:[2,p.data]}})})},e.prototype.update=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,function(){var n,o,s,u,a,f,h,p;return r.__generator(this,function(r){switch(r.label){case 0:if(i.default(e))throw new c.KinveyError("Unable to update an array of entities. Please update entities one by one.");if(!e._id)throw new c.KinveyError("The entity provided does not contain an _id. An _id is required to update the entity.");return n=t.rawResponse,o=void 0!==n&&n,s=t.timeout,u=t.properties,t.trace,t.skipBL,a={},f=l.formatKinveyBaasUrl(l.KinveyBaasNamespace.AppData,this.pathname+"/"+e._id,a),(h=d(l.HttpRequestMethod.PUT,f,e)).headers.setCustomRequestProperties(u),h.timeout=s,[4,h.execute()];case 1:return p=r.sent(),!0===o?[2,p]:[2,p.data]}})})},e.prototype.save=function(e,t){return e._id?this.update(e,t):this.create(e,t)},e.prototype.remove=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,function(){var n,i,o,s,u,f,h,p;return r.__generator(this,function(r){switch(r.label){case 0:if(e&&!(e instanceof a.Query))throw new c.KinveyError("Invalid query. It must be an instance of the Query class.");return n=t.rawResponse,i=void 0!==n&&n,o=t.timeout,s=t.properties,t.trace,t.skipBL,u=Object.assign({},e?e.toQueryObject():{},{}),f=l.formatKinveyBaasUrl(l.KinveyBaasNamespace.AppData,this.pathname,u),(h=d(l.HttpRequestMethod.DELETE,f)).headers.setCustomRequestProperties(s),h.timeout=o,[4,h.execute()];case 1:return p=r.sent(),!0===i?[2,p]:[2,p.data]}})})},e.prototype.removeById=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,function(){var n,i,o,s,u,a,c,f;return r.__generator(this,function(r){switch(r.label){case 0:return n=t.rawResponse,i=void 0!==n&&n,o=t.timeout,s=t.properties,t.trace,t.skipBL,u={},a=l.formatKinveyBaasUrl(l.KinveyBaasNamespace.AppData,this.pathname+"/"+e,u),(c=d(l.HttpRequestMethod.DELETE,a)).headers.setCustomRequestProperties(s),c.timeout=o,[4,c.execute()];case 1:return f=r.sent(),!0===i?[2,f]:[2,f.data]}})})},e.prototype.subscribe=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,function(){var n,i,o,u,a;return r.__generator(this,function(r){switch(r.label){case 0:return n=t.timeout,i=t.properties,t.trace,t.skipBL,[4,s.getDeviceId()];case 1:return o=r.sent(),u=l.formatKinveyBaasUrl(l.KinveyBaasNamespace.AppData,this.pathname+"/_subscribe"),(a=d(l.HttpRequestMethod.POST,u,{deviceId:o})).headers.setCustomRequestProperties(i),a.timeout=n,[4,a.execute()];case 2:return r.sent(),h.subscribeToChannel(this.channelName,e),this.personalChannelName&&h.subscribeToChannel(this.personalChannelName,e),[2,!0]}})})},e.prototype.unsubscribe=function(e){return void 0===e&&(e={}),r.__awaiter(this,void 0,void 0,function(){var t,n,i,o,u;return r.__generator(this,function(r){switch(r.label){case 0:return t=e.timeout,n=e.properties,e.trace,e.skipBL,[4,s.getDeviceId()];case 1:return i=r.sent(),o=l.formatKinveyBaasUrl(l.KinveyBaasNamespace.AppData,this.pathname+"/_unsubscribe"),(u=d(l.HttpRequestMethod.POST,o,{deviceId:i})).headers.setCustomRequestProperties(n),u.timeout=t,[4,u.execute()];case 2:return r.sent(),h.unsubscribeFromChannel(this.channelName),h.unsubscribeFromChannel(this.personalChannelName),[2,!0]}})})},e}();t.NetworkStore=p},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(1),o=n(2),s=32e3;function u(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=Object.assign({},{filename:e._filename||e.name,public:!1,size:e.size||e.length,mimeType:e.mimeType||e.type||"application/octet-stream"},t);return n._filename=n.filename,delete n.filename,n._public=n.public,delete n.public,n}function a(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(n){switch(n.label){case 0:if(e.size<=0)throw new i.KinveyError("Unable to create a file with a size of 0.");return[4,new o.KinveyHttpRequest({method:e._id?o.HttpRequestMethod.PUT:o.HttpRequestMethod.POST,headers:new o.KinveyHttpHeaders({"X-Kinvey-Content-Type":e.mimeType}),auth:o.KinveyHttpAuth.SessionOrMaster,url:e._id?o.formatKinveyBaasUrl(o.KinveyBaasNamespace.Blob,"/"+e._id):o.formatKinveyBaasUrl(o.KinveyBaasNamespace.Blob),body:e,timeout:t.timeout}).execute()];case 1:return[2,n.sent().data]}})})}function c(e,t,n,r){var i=new o.HttpHeaders(t);return i.set("Content-Type",n.mimeType),i.set("Content-Range","bytes */"+n.size),new o.HttpRequest({method:o.HttpRequestMethod.PUT,headers:i,url:e,timeout:r}).execute()}function l(e,t){var n=e?parseInt(e.split("-")[1],10)+1:0;return n>=t?t-1:n}function f(e,t){return Math.floor(Math.random()*(t-e))+e}function h(e,t,n,i){return void 0===i&&(i={}),r.__awaiter(this,void 0,void 0,function(){var u,a,c,d,p,v,y,_,b;return r.__generator(this,function(r){switch(r.label){case 0:return u=i.count,a=void 0===u?0:u,c=i.maxBackoff,d=void 0===c?s:c,p=i.start,v=void 0===p?0:p,(y=new o.HttpHeaders(i.headers)).set("Content-Type",n.mimeType),y.set("Content-Range","bytes "+i.start+"-"+(n.size-1)+"/"+n.size),[4,new o.HttpRequest({method:o.HttpRequestMethod.PUT,headers:y,url:e,body:t.slice(i.start,n.size),timeout:i.timeout}).execute()];case 1:return(_=r.sent()).isSuccess()?[3,4]:_.statusCode>=500&&_.statusCode<600&&(b=Math.pow(2,i.count)+f(1,1001))=200&&e<300}};a.headers={common:{Accept:"application/json, text/plain, */*"}},r.forEach(["delete","get","head"],function(e){a.headers[e]={}}),r.forEach(["post","put","patch"],function(e){a.headers[e]=r.merge(o)}),e.exports=a}).call(this,n(190))},function(e,t,n){"use strict";n.r(t);var r=n(0);function i(e){return"function"==typeof e}var o=!1,s={Promise:void 0,set useDeprecatedSynchronousErrorHandling(e){e&&(new Error).stack;o=e},get useDeprecatedSynchronousErrorHandling(){return o}};function u(e){setTimeout(function(){throw e})}var a={closed:!0,next:function(e){},error:function(e){if(s.useDeprecatedSynchronousErrorHandling)throw e;u(e)},complete:function(){}},c=Array.isArray||function(e){return e&&"number"==typeof e.length};function l(e){return null!==e&&"object"==typeof e}function f(e){return Error.call(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map(function(e,t){return t+1+") "+e.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=e,this}f.prototype=Object.create(Error.prototype);var h=f,d=function(){function e(e){this.closed=!1,this._parent=null,this._parents=null,this._subscriptions=null,e&&(this._unsubscribe=e)}var t;return e.prototype.unsubscribe=function(){var e,t=!1;if(!this.closed){var n=this._parent,r=this._parents,o=this._unsubscribe,s=this._subscriptions;this.closed=!0,this._parent=null,this._parents=null,this._subscriptions=null;for(var u=-1,a=r?r.length:0;n;)n.remove(this),n=++u1)this.connection=null;else{var n=this.connection,r=e._connection;this.connection=null,!r||n&&r!==n||r.unsubscribe()}}else this.connection=null},t}(y),M=function(e){function t(t,n){var r=e.call(this)||this;return r.source=t,r.subjectFactory=n,r._refCount=0,r._isComplete=!1,r}return r.__extends(t,e),t.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},t.prototype.getSubject=function(){var e=this._subject;return e&&!e.isStopped||(this._subject=this.subjectFactory()),this._subject},t.prototype.connect=function(){var e=this._connection;return e||(this._isComplete=!1,(e=this._connection=new d).add(this.source.subscribe(new R(this.getSubject(),this))),e.closed?(this._connection=null,e=d.EMPTY):this._connection=e),e},t.prototype.refCount=function(){return(e=this).lift(new T(e));var e},t}(x),I=M.prototype,R=(I._subscribe,I._isComplete,I.getSubject,I.connect,I.refCount,function(e){function t(t,n){var r=e.call(this,t)||this;return r.connectable=n,r}return r.__extends(t,e),t.prototype._error=function(t){this._unsubscribe(),e.prototype._error.call(this,t)},t.prototype._complete=function(){this.connectable._isComplete=!0,this._unsubscribe(),e.prototype._complete.call(this)},t.prototype._unsubscribe=function(){var e=this.connectable;if(e){this.connectable=null;var t=e._connection;e._refCount=0,e._subject=null,e._connection=null,t&&t.unsubscribe()}},t}(j));var K=function(e){function t(t,n,r){var i=e.call(this)||this;return i.key=t,i.groupSubject=n,i.refCountSubscription=r,i}return r.__extends(t,e),t.prototype._subscribe=function(e){var t=new d,n=this.refCountSubscription,r=this.groupSubject;return n&&!n.closed&&t.add(new D(n)),t.add(r.subscribe(e)),t},t}(x),D=function(e){function t(t){var n=e.call(this)||this;return n.parent=t,t.count++,n}return r.__extends(t,e),t.prototype.unsubscribe=function(){var t=this.parent;t.closed||this.closed||(e.prototype.unsubscribe.call(this),t.count-=1,0===t.count&&t.attemptedToUnsubscribe&&t.unsubscribe())},t}(d),q=function(e){function t(t){var n=e.call(this)||this;return n._value=t,n}return r.__extends(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),t.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return n&&!n.closed&&t.next(this._value),n},t.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new P;return this._value},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(A),B=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return r.__extends(t,e),t.prototype.schedule=function(e,t){if(void 0===t&&(t=0),this.closed)return this;this.state=e;var n=this.id,r=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(r,n,t)),this.pending=!0,this.delay=t,this.id=this.id||this.requestAsyncId(r,this.id,t),this},t.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),setInterval(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!==n&&this.delay===n&&!1===this.pending)return t;clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,t);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var n=!1,r=void 0;try{this.work(e)}catch(e){n=!0,r=!!e&&e||new Error(e)}if(n)return this.unsubscribe(),r},t.prototype._unsubscribe=function(){var e=this.id,t=this.scheduler,n=t.actions,r=n.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==r&&n.splice(r,1),null!=e&&(this.id=this.recycleAsyncId(t,e,null)),this.delay=null},t}(function(e){function t(t,n){return e.call(this)||this}return r.__extends(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(d)),U=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return r.__extends(t,e),t.prototype.schedule=function(t,n){return void 0===n&&(n=0),n>0?e.prototype.schedule.call(this,t,n):(this.delay=n,this.state=t,this.scheduler.flush(this),this)},t.prototype.execute=function(t,n){return n>0||this.closed?e.prototype.execute.call(this,t,n):this._execute(t,n)},t.prototype.requestAsyncId=function(t,n,r){return void 0===r&&(r=0),null!==r&&r>0||null===r&&this.delay>0?e.prototype.requestAsyncId.call(this,t,n,r):t.flush(this)},t}(B),L=function(){function e(t,n){void 0===n&&(n=e.now),this.SchedulerAction=t,this.now=n}return e.prototype.schedule=function(e,t,n){return void 0===t&&(t=0),new this.SchedulerAction(this,e).schedule(n,t)},e.now=function(){return Date.now()},e}(),H=function(e){function t(n,r){void 0===r&&(r=L.now);var i=e.call(this,n,function(){return t.delegate&&t.delegate!==i?t.delegate.now():r()})||this;return i.actions=[],i.active=!1,i.scheduled=void 0,i}return r.__extends(t,e),t.prototype.schedule=function(n,r,i){return void 0===r&&(r=0),t.delegate&&t.delegate!==this?t.delegate.schedule(n,r,i):e.prototype.schedule.call(this,n,r,i)},t.prototype.flush=function(e){var t=this.actions;if(this.active)t.push(e);else{var n;this.active=!0;do{if(n=e.execute(e.state,e.delay))break}while(e=t.shift());if(this.active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}}},t}(L),F=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(t,e),t}(H))(U),G=new x(function(e){return e.complete()});function z(e){return e?function(e){return new x(function(t){return e.schedule(function(){return t.complete()})})}(e):G}function $(e){return e&&"function"==typeof e.schedule}var Q,V=function(e){return function(t){for(var n=0,r=e.length;nthis._bufferSize&&n.shift(),e.prototype.next.call(this,t)},t.prototype.nextTimeWindow=function(t){this._events.push(new re(this._getNow(),t)),this._trimBufferThenGetEvents(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){var t,n=this._infiniteTimeWindow,r=n?this._events:this._trimBufferThenGetEvents(),i=this.scheduler,o=r.length;if(this.closed)throw new P;if(this.isStopped||this.hasError?t=d.EMPTY:(this.observers.push(e),t=new C(this,e)),i&&e.add(e=new ee(e,i)),n)for(var s=0;st&&(o=Math.max(o,i-t)),o>0&&r.splice(0,o),r},t}(A),re=function(){return function(e,t){this.time=e,this.value=t}}(),ie=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.value=null,t.hasNext=!1,t.hasCompleted=!1,t}return r.__extends(t,e),t.prototype._subscribe=function(t){return this.hasError?(t.error(this.thrownError),d.EMPTY):this.hasCompleted&&this.hasNext?(t.next(this.value),t.complete(),d.EMPTY):e.prototype._subscribe.call(this,t)},t.prototype.next=function(e){this.hasCompleted||(this.value=e,this.hasNext=!0)},t.prototype.error=function(t){this.hasCompleted||e.prototype.error.call(this,t)},t.prototype.complete=function(){this.hasCompleted=!0,this.hasNext&&e.prototype.next.call(this,this.value),e.prototype.complete.call(this)},t}(A),oe=1,se={};var ue=function(e){var t=oe++;return se[t]=e,Promise.resolve().then(function(){return function(e){var t=se[e];t&&t()}(t)}),t},ae=function(e){delete se[e]},ce=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return r.__extends(t,e),t.prototype.requestAsyncId=function(t,n,r){return void 0===r&&(r=0),null!==r&&r>0?e.prototype.requestAsyncId.call(this,t,n,r):(t.actions.push(this),t.scheduled||(t.scheduled=ue(t.flush.bind(t,null))))},t.prototype.recycleAsyncId=function(t,n,r){if(void 0===r&&(r=0),null!==r&&r>0||null===r&&this.delay>0)return e.prototype.recycleAsyncId.call(this,t,n,r);0===t.actions.length&&(ae(n),t.scheduled=void 0)},t}(B),le=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(t,e),t.prototype.flush=function(e){this.active=!0,this.scheduled=void 0;var t,n=this.actions,r=-1,i=n.length;e=e||n.shift();do{if(t=e.execute(e.state,e.delay))break}while(++r0?e.prototype.requestAsyncId.call(this,t,n,r):(t.actions.push(this),t.scheduled||(t.scheduled=requestAnimationFrame(function(){return t.flush(null)})))},t.prototype.recycleAsyncId=function(t,n,r){if(void 0===r&&(r=0),null!==r&&r>0||null===r&&this.delay>0)return e.prototype.recycleAsyncId.call(this,t,n,r);0===t.actions.length&&(cancelAnimationFrame(n),t.scheduled=void 0)},t}(B),de=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(t,e),t.prototype.flush=function(e){this.active=!0,this.scheduled=void 0;var t,n=this.actions,r=-1,i=n.length;e=e||n.shift();do{if(t=e.execute(e.state,e.delay))break}while(++rt.index?1:-1:e.delay>t.delay?1:-1},t}(B);function ye(e){return e}function _e(e){return!!e&&(e instanceof x||"function"==typeof e.lift&&"function"==typeof e.subscribe)}function be(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}be.prototype=Object.create(Error.prototype);var ge=be;function me(){return Error.call(this),this.message="no elements in sequence",this.name="EmptyError",this}me.prototype=Object.create(Error.prototype);var we=me;function Se(){return Error.call(this),this.message="Timeout has occurred",this.name="TimeoutError",this}Se.prototype=Object.create(Error.prototype);var xe=Se;function Ee(e,t){return function(n){if("function"!=typeof e)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return n.lift(new Oe(e,t))}}var Oe=function(){function e(e,t){this.project=e,this.thisArg=t}return e.prototype.call=function(e,t){return t.subscribe(new Pe(e,this.project,this.thisArg))},e}(),Pe=function(e){function t(t,n,r){var i=e.call(this,t)||this;return i.project=n,i.count=0,i.thisArg=r||i,i}return r.__extends(t,e),t.prototype._next=function(e){var t;try{t=this.project.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(y);function Ce(e,t,n){if(t){if(!$(t))return function(){for(var r=[],i=0;i0?this._next(t.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},t}(Ie);function Ye(e){return void 0===e&&(e=Number.POSITIVE_INFINITY),function e(t,n,r){return void 0===r&&(r=Number.POSITIVE_INFINITY),"function"==typeof n?function(i){return i.pipe(e(function(e,r){return We(t(e,r)).pipe(Ee(function(t,i){return n(e,t,r,i)}))},r))}:("number"==typeof n&&(r=n),function(e){return e.lift(new Xe(t,r))})}(ye,e)}function Ze(){for(var e=[],t=0;t1?r.next(Array.prototype.slice.call(arguments)):r.next(e)},r,n)})}function it(e,t,n){return n?it(e,t).pipe(Ee(function(e){return c(e)?n.apply(void 0,e):n(e)})):new x(function(n){var r,o=function(){for(var e=[],t=0;t=0}function ct(e,t){return void 0===e&&(e=0),void 0===t&&(t=fe),(!at(e)||e<0)&&(e=0),t&&"function"==typeof t.schedule||(t=fe),new x(function(n){return n.add(t.schedule(lt,e,{subscriber:n,counter:0,period:e})),n})}function lt(e){var t=e.subscriber,n=e.counter,r=e.period;t.next(n),this.schedule({subscriber:t,counter:n+1,period:r},r)}function ft(){for(var e=[],t=0;t1&&"number"==typeof e[e.length-1]&&(n=e.pop())):"number"==typeof i&&(n=e.pop()),null===r&&1===e.length&&e[0]instanceof x?e[0]:Ye(n)(W(e,r))}var ht=new x(m);function dt(){return ht}function pt(){for(var e=[],t=0;t=t){r.complete();break}if(r.next(o++),r.closed)break}})}function wt(e){var t=e.start,n=e.index,r=e.count,i=e.subscriber;n>=r?i.complete():(i.next(t),i.closed||(e.index=n+1,e.start=t+1,this.schedule(e)))}function St(e,t,n){void 0===e&&(e=0);var r=-1;return at(t)?r=Number(t)<1?1:Number(t):$(t)&&(n=t),$(n)||(n=fe),new x(function(t){var i=at(e)?e:+e-n.now();return n.schedule(xt,i,{index:0,period:r,subscriber:t})})}function xt(e){var t=e.index,n=e.period,r=e.subscriber;if(r.next(t),!r.closed){if(-1===n)return r.complete();e.index=t+1,this.schedule(e,n)}}function Et(e,t){return new x(function(n){var r,i;try{r=e()}catch(e){return void n.error(e)}try{i=t(r)}catch(e){return void n.error(e)}var o=(i?We(i):G).subscribe(n);return function(){o.unsubscribe(),r&&r.unsubscribe()}})}function Ot(){for(var e=[],t=0;tthis.index},e.prototype.hasCompleted=function(){return this.array.length===this.index},e}(),kt=function(e){function t(t,n,r){var i=e.call(this,t)||this;return i.parent=n,i.observable=r,i.stillUnsubscribed=!0,i.buffer=[],i.isComplete=!1,i}return r.__extends(t,e),t.prototype[qe]=function(){return this},t.prototype.next=function(){var e=this.buffer;return 0===e.length&&this.isComplete?{value:null,done:!0}:{value:e.shift(),done:!1}},t.prototype.hasValue=function(){return this.buffer.length>0},t.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete},t.prototype.notifyComplete=function(){this.buffer.length>0?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()},t.prototype.notifyNext=function(e,t,n,r,i){this.buffer.push(t),this.parent.checkIterators()},t.prototype.subscribe=function(e,t){return Ge(this,this.observable,this,t)},t}(Ie);n.d(t,"Observable",function(){return x}),n.d(t,"ConnectableObservable",function(){return M}),n.d(t,"GroupedObservable",function(){return K}),n.d(t,"observable",function(){return g}),n.d(t,"Subject",function(){return A}),n.d(t,"BehaviorSubject",function(){return q}),n.d(t,"ReplaySubject",function(){return ne}),n.d(t,"AsyncSubject",function(){return ie}),n.d(t,"asapScheduler",function(){return le}),n.d(t,"asyncScheduler",function(){return fe}),n.d(t,"queueScheduler",function(){return F}),n.d(t,"animationFrameScheduler",function(){return de}),n.d(t,"VirtualTimeScheduler",function(){return pe}),n.d(t,"VirtualAction",function(){return ve}),n.d(t,"Scheduler",function(){return L}),n.d(t,"Subscription",function(){return d}),n.d(t,"Subscriber",function(){return y}),n.d(t,"Notification",function(){return Z}),n.d(t,"pipe",function(){return w}),n.d(t,"noop",function(){return m}),n.d(t,"identity",function(){return ye}),n.d(t,"isObservable",function(){return _e}),n.d(t,"ArgumentOutOfRangeError",function(){return ge}),n.d(t,"EmptyError",function(){return we}),n.d(t,"ObjectUnsubscribedError",function(){return P}),n.d(t,"UnsubscriptionError",function(){return h}),n.d(t,"TimeoutError",function(){return xe}),n.d(t,"bindCallback",function(){return Ce}),n.d(t,"bindNodeCallback",function(){return ke}),n.d(t,"combineLatest",function(){return $e}),n.d(t,"concat",function(){return Ze}),n.d(t,"defer",function(){return et}),n.d(t,"empty",function(){return z}),n.d(t,"forkJoin",function(){return tt}),n.d(t,"from",function(){return We}),n.d(t,"fromEvent",function(){return rt}),n.d(t,"fromEventPattern",function(){return it}),n.d(t,"generate",function(){return ot}),n.d(t,"iif",function(){return ut}),n.d(t,"interval",function(){return ct}),n.d(t,"merge",function(){return ft}),n.d(t,"never",function(){return dt}),n.d(t,"of",function(){return X}),n.d(t,"onErrorResumeNext",function(){return pt}),n.d(t,"pairs",function(){return vt}),n.d(t,"race",function(){return _t}),n.d(t,"range",function(){return mt}),n.d(t,"throwError",function(){return J}),n.d(t,"timer",function(){return St}),n.d(t,"using",function(){return Et}),n.d(t,"zip",function(){return Ot}),n.d(t,"EMPTY",function(){return G}),n.d(t,"NEVER",function(){return ht}),n.d(t,"config",function(){return s})},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=r.__importDefault(n(14)),o=r.__importDefault(n(7)),s=n(1),u=function(){function e(e){if(!i.default(e))throw new s.KinveyError("entity must be an object.");e._acl=e._acl||{},this.entity=e}return Object.defineProperty(e.prototype,"creator",{get:function(){return this.entity._acl&&this.entity._acl.creator||null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"readers",{get:function(){return this.entity._acl&&o.default(this.entity._acl.r)?this.entity._acl.r:[]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"writers",{get:function(){return this.entity._acl&&o.default(this.entity._acl.w)?this.entity._acl.w:[]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"readerGroups",{get:function(){return this.entity._acl&&this.entity._acl.groups&&o.default(this.entity._acl.groups.r)?this.entity._acl.groups.r:[]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"writerGroups",{get:function(){return this.entity._acl&&this.entity._acl.groups&&o.default(this.entity._acl.groups.w)?this.entity._acl.groups.w:[]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"globallyReadable",{set:function(e){this.entity._acl||(this.entity._acl={}),this.entity._acl.gr=!0===e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"globallyWritable",{set:function(e){this.entity._acl||(this.entity._acl={}),this.entity._acl.gw=!0===e},enumerable:!0,configurable:!0}),e.prototype.addReader=function(e){var t=this.readers;return-1===t.indexOf(e)&&t.push(e),this.entity._acl||(this.entity._acl={}),this.entity._acl.r=t,this},e.prototype.addReaderGroup=function(e){var t=this.readerGroups;return-1===t.indexOf(e)&&t.push(e),this.entity._acl||(this.entity._acl={}),this.entity._acl.groups=Object.assign({},this.entity._acl.groups,{r:t}),this},e.prototype.addWriter=function(e){var t=this.writers;return-1===t.indexOf(e)&&t.push(e),this.entity._acl||(this.entity._acl={}),this.entity._acl.w=t,this},e.prototype.addWriterGroup=function(e){var t=this.writerGroups;return-1===t.indexOf(e)&&t.push(e),this.entity._acl||(this.entity._acl={}),this.entity._acl.groups=Object.assign({},this.entity._acl.groups,{w:t}),this},e.prototype.isGloballyReadable=function(){return this.entity._acl&&!0===this.entity._acl.gr||!1},e.prototype.isGloballyWritable=function(){return this.entity._acl&&!0===this.entity._acl.gw||!1},e.prototype.removeReader=function(e){var t=this.readers,n=t.indexOf(e);return-1!==n&&t.splice(n,1),this.entity._acl||(this.entity._acl={}),this.entity._acl.r=t,this},e.prototype.removeReaderGroup=function(e){var t=this.readerGroups,n=t.indexOf(e);return-1!==n&&t.splice(n,1),this.entity._acl||(this.entity._acl={}),this.entity._acl.groups=Object.assign({},this.entity._acl.groups,{r:t}),this},e.prototype.removeWriter=function(e){var t=this.writers,n=t.indexOf(e);return-1!==n&&t.splice(n,1),this.entity._acl||(this.entity._acl={}),this.entity._acl.w=t,this},e.prototype.removeWriterGroup=function(e){var t=this.writerGroups,n=t.indexOf(e);return-1!==n&&t.splice(n,1),this.entity._acl||(this.entity._acl={}),this.entity._acl.groups=Object.assign({},this.entity._acl.groups,{w:t}),this},e.prototype.toPlainObject=function(){return this.entity._acl},e}();t.Acl=u},function(e,t,n){var r=n(9).Symbol;e.exports=r},function(e,t,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(this,n(20))},function(e,t){e.exports=function(e,t){return function(n){return e(t(n))}}},function(e,t){var n=Object.prototype;e.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||n)}},function(e,t){var n=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return n.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},function(e,t){var n=9007199254740991;e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="An error occurred with the query.");var r=e.call(this,t,n)||this;return r.name="QueryError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.QueryError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=r.__importDefault(n(7)),o=r.__importDefault(n(53)),s=n(13),u=n(10),a=n(28),c=n(1),l=n(2),f=new o.default({concurrency:1});function h(e){void 0===e&&(e=24);for(var t="abcdef0123456789",n="",r=0,i=t.length;r0&&e?[2,e.process(t)]:[2,t]}})})})},e.prototype.group=function(e){return r.__awaiter(this,void 0,void 0,function(){var t;return r.__generator(this,function(n){switch(n.label){case 0:if(!(e instanceof a.Aggregation))throw new c.KinveyError("Invalid aggregation. It must be an instance of the Aggregation class.");return[4,this.find()];case 1:return t=n.sent(),[2,e.process(t)]}})})},e.prototype.count=function(e){return r.__awaiter(this,void 0,void 0,function(){var t=this;return r.__generator(this,function(n){switch(n.label){case 0:return e?[4,this.find(e)]:[3,2];case 1:return[2,n.sent().length];case 2:return[2,f.add(function(){return t.storageAdapter.count(t.dbName,t.collectionName)})]}})})},e.prototype.findById=function(e){var t=this;return f.add(function(){return t.storageAdapter.findById(t.dbName,t.collectionName,e)})},e.prototype.save=function(e){var t=this;return f.add(function(){return r.__awaiter(t,void 0,void 0,function(){var t,n;return r.__generator(this,function(r){switch(r.label){case 0:return t=e,n=!1,e?(i.default(e)||(n=!0,t=[e]),(t=t.slice(0,t.length)).length>0?(t=t.map(function(e){return e._id?e:Object.assign({},{_id:h(),_kmd:Object.assign({},e._kmd,{local:!0})},e)}),[4,this.storageAdapter.save(this.dbName,this.collectionName,t)]):[3,2]):[2,null];case 1:return r.sent(),[2,n?t.shift():t];case 2:return[2,e]}})})})},e.prototype.remove=function(e){return r.__awaiter(this,void 0,void 0,function(){var t,n=this;return r.__generator(this,function(r){switch(r.label){case 0:return[4,this.find(e)];case 1:return t=r.sent(),e?[4,Promise.all(t.map(function(e){return n.removeById(e._id)}))]:[3,3];case 2:return[2,r.sent().reduce(function(e,t){return e+t},0)];case 3:return[4,this.clear()];case 4:return r.sent(),[2,t.length]}})})},e.prototype.removeById=function(e){var t=this;return f.add(function(){return t.storageAdapter.removeById(t.dbName,t.collectionName,e)})},e.prototype.clear=function(){var e=this;return f.add(function(){return e.storageAdapter.clear(e.dbName,e.collectionName)})},e.clear=function(e){var t=s.getConfig(s.ConfigKey.StorageAdapter),n=[l.getKey()];return f.add(function(){return t.clearDatabase(e,n)})},e}();t.Storage=d},function(e,t,n){"use strict";const r=n(126);class i{constructor(){this._queue=[]}enqueue(e,t){const n={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&this._queue[this.size-1].priority>=t.priority)return void this._queue.push(n);const r=function(e,t,n){let r=0,i=e.length;for(;i>0;){const o=i/2|0;let s=r+o;n(e[s],t)<=0?(r=++s,i-=o+1):i=o}return r}(this._queue,n,(e,t)=>t.priority-e.priority);this._queue.splice(r,0,n)}dequeue(){return this._queue.shift().run}get size(){return this._queue.length}}e.exports=class extends r{constructor(e){if(super(),!("number"==typeof(e={carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:i,...e}).concurrency&&e.concurrency>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e.concurrency}\` (${typeof e.concurrency})`);if(!("number"==typeof e.intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap}\` (${typeof e.intervalCap})`);if(!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval}\` (${typeof e.interval})`);this._carryoverConcurrencyCount=e.carryoverConcurrencyCount,this._isIntervalIgnored=e.intervalCap===1/0||0===e.interval,this._intervalCount=0,this._intervalCap=e.intervalCap,this._interval=e.interval,this._intervalId=null,this._intervalEnd=0,this._timeoutId=null,this.queue=new e.queueClass,this._queueClass=e.queueClass,this._pendingCount=0,this._concurrency=e.concurrency,this._isPaused=!1===e.autoStart,this._resolveEmpty=(()=>{}),this._resolveIdle=(()=>{})}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount{}),0===this._pendingCount&&(this._resolveIdle(),this._resolveIdle=(()=>{}))}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=null}_intervalPaused(){const e=Date.now();if(null===this._intervalId){const t=this._intervalEnd-e;if(!(t<0))return null===this._timeoutId&&(this._timeoutId=setTimeout(()=>{this._onResumeInterval()},t)),!0;this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0}return!1}_tryToStartAnother(){if(0===this.queue.size)return clearInterval(this._intervalId),this._intervalId=null,this._resolvePromises(),!1;if(!this._isPaused){const e=!this._intervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother)return this.emit("active"),this.queue.dequeue()(),e&&this._initializeIntervalIfNeeded(),!0}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||null!==this._intervalId||(this._intervalId=setInterval(()=>this._onInterval(),this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){for(0===this._intervalCount&&0===this._pendingCount&&(clearInterval(this._intervalId),this._intervalId=null),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0;this._tryToStartAnother(););}async add(e,t){return new Promise((n,r)=>{this.queue.enqueue(async()=>{this._pendingCount++,this._intervalCount++;try{n(await e())}catch(e){r(e)}this._next()},t),this._tryToStartAnother()})}async addAll(e,t){return Promise.all(e.map(e=>this.add(e,t)))}start(){if(this._isPaused)for(this._isPaused=!1;this._tryToStartAnother(););}pause(){this._isPaused=!0}clear(){this.queue=new this._queueClass}async onEmpty(){if(0!==this.queue.size)return new Promise(e=>{const t=this._resolveEmpty;this._resolveEmpty=(()=>{t(),e()})})}async onIdle(){if(0!==this._pendingCount||0!==this.queue.size)return new Promise(e=>{const t=this._resolveIdle;this._resolveIdle=(()=>{t(),e()})})}get size(){return this.queue.size}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(13),o=n(25),s=n(55);t.send=function(e){return r.__awaiter(this,void 0,void 0,function(){var t;return r.__generator(this,function(n){switch(n.label){case 0:return[4,i.getConfig(i.ConfigKey.HttpAdapter).send(e)];case 1:return t=n.sent(),[2,new s.HttpResponse({statusCode:t.statusCode,headers:new o.HttpHeaders(t.headers),data:t.data})]}})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(0).__importDefault(n(3)),o=n(56),s=n(57),u=n(58),a=n(59),c=n(60),l=n(61),f=n(62),h=n(63),d=n(64),p=n(65),v=n(66),y=n(31),_=n(67),b=n(68),g=n(69),m=n(1),w=n(70),S=n(71),x=n(72),E=n(73),O=n(74),P=n(32),C=n(16),j=n(33),A=n(75),k=n(76),T=n(77),N=n(78),M=n(79),I=n(25),R=n(14);!function(e){e[e.Ok=200]="Ok",e[e.Created=201]="Created",e[e.Empty=204]="Empty",e[e.MovedPermanently=301]="MovedPermanently",e[e.Found=302]="Found",e[e.NotModified=304]="NotModified",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e[e.Unauthorized=401]="Unauthorized",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.ServerError=500]="ServerError"}(r=t.HttpStatusCode||(t.HttpStatusCode={}));var K=function(){function e(e){this.statusCode=e.statusCode,this.headers=new I.HttpHeaders(e.headers);var t=this.headers.get("Content-Type")||"";if(i.default(e.data)&&-1!==t.indexOf("application/json"))try{this.data=JSON.parse(e.data)}catch(t){this.data=e.data}else this.data=e.data}return Object.defineProperty(e.prototype,"error",{get:function(){if(!this.isSuccess()){if(R(this.data)){var e=this.data.message||this.data.description,t=this.data.name||this.data.error,n=this.data.debug;return"APIVersionNotAvailable"===t?new o.APIVersionNotAvailableError(e,n):"APIVersionNotImplemented"===t?new s.APIVersionNotImplementedError(e,n):"AppProblem"===t?new u.AppProblemError(e,n):"AppProblem"===t?new u.AppProblemError(e,n):"BadRequest"===t?new a.BadRequestError(e,n):"BLInternalError"===t||"BLRuntimeError"===t||"BLSyntaxError"===t||"BLTimeoutError"===t||"BLViolationError"===t?new c.BLError(e,n):"CORSDisabled"===t?new l.CORSDisabledError(e,n):"DuplicateEndUsers"===t?new f.DuplicateEndUsersError(e,n):"FeatureUnavailable"===t?new h.FeatureUnavailableError(e,n):"IncompleteRequestBody"===t?new d.IncompleteRequestBodyError(e,n):"IndirectCollectionAccessDisallowed"===t?new p.IndirectCollectionAccessDisallowedError(e,n):"InsufficientCredentials"===t?new v.InsufficientCredentialsError(e,n):"InvalidCredentials"===t?new y.InvalidCredentialsError(e,n):"InvalidIdentifier"===t?new _.InvalidIdentifierError(e,n):"InvalidQuerySyntax"===t?new b.InvalidQuerySyntaxError(e,n):"JSONParseError"===t?new g.JSONParseError(e,n):"KinveyInternalErrorRetry"===t?new w.KinveyInternalErrorRetry(e,n):"KinveyInternalErrorStop"===t?new S.KinveyInternalErrorStop(e,n):"MissingQuery"===t?new x.MissingQueryError(e,n):"MissingRequestHeader"===t?new E.MissingRequestHeaderError(e,n):"MissingRequestParameter"===t?new O.MissingRequestParameterError(e,n):"MissingConfiguration"===t?new P.MissingConfigurationError(e,n):"EntityNotFound"===t||"CollectionNotFound"===t||"AppNotFound"===t||"UserNotFound"===t||"BlobNotFound"===t||"DocumentNotFound"===t?new C.NotFoundError(e,n):"ParameterValueOutOfRange"===t?new j.ParameterValueOutOfRangeError(e,n):"ResultSetSizeExceeded"===t?new A.ResultSetSizeExceededError(e,n):"ServerError"===t?new k.ServerError(e,n):"StaleRequest"===t?new T.StaleRequestError(e,n):"UserAlreadyExists"===t?new N.UserAlreadyExistsError(e,n):"WritesToCollectionDisallowed"===t?new M.WritesToCollectionDisallowedError(e,n):this.statusCode===r.Unauthorized||this.statusCode===r.Forbidden?new v.InsufficientCredentialsError(e,n):this.statusCode===r.NotFound?new C.NotFoundError(e,n):this.statusCode===r.ServerError?new k.ServerError(e,n):new m.KinveyError(e,n)}return new m.KinveyError}return null},enumerable:!0,configurable:!0}),e.prototype.isSuccess=function(){return this.statusCode>=200&&this.statusCode<300||this.statusCode===r.MovedPermanently||this.statusCode===r.Found||this.statusCode===r.NotModified||this.statusCode===r.TemporaryRedirect||this.statusCode===r.PermanentRedirect},e}();t.HttpResponse=K},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="This API version is not available for your app.");var r=e.call(this,t,n)||this;return r.name="APIVersionNotAvailableError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.APIVersionNotAvailableError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="This API version is not implemented.");var r=e.call(this,t,n)||this;return r.name="APIVersionNotImplementedError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.APIVersionNotImplementedError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="There is a problem with this app backend that prevents execution of this operation. Please contact support@kinvey.com for assistance.");var r=e.call(this,t,n)||this;return r.name="AppProblemError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.AppProblemError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="Unable to understand request.");var r=e.call(this,t,n)||this;return r.name="BadRequestError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.BadRequestError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="The Business Logic script did not complete.");var r=e.call(this,t,n)||this;return r.name="BLError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.BLError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="Cross Origin Support is disabled for this application.");var r=e.call(this,t,n)||this;return r.name="CORSDisabledError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.CORSDisabledError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="More than one user registered with this username for this application.");var r=e.call(this,t,n)||this;return r.name="DuplicateEndUsersError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.DuplicateEndUsersError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="Requested functionality is unavailable in this API version.");var r=e.call(this,t,n)||this;return r.name="FeatureUnavailableError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.FeatureUnavailableError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="The request body is either missing or incomplete.");var r=e.call(this,t,n)||this;return r.name="IncompleteRequestBodyError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.IncompleteRequestBodyError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="Please use the appropriate API to access this collection for this app backend.");var r=e.call(this,t,n)||this;return r.name="IndirectCollectionAccessDisallowedError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.IndirectCollectionAccessDisallowedError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="The credentials used to authenticate this request are not authorized to run this operation. Please retry your request with appropriate credentials.");var r=e.call(this,t,n)||this;return r.name="InsufficientCredentialsError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.InsufficientCredentialsError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="One of more identifier names in the request has an invalid format.");var r=e.call(this,t,n)||this;return r.name="InvalidIdentifierError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.InvalidIdentifierError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="The query string in the request has an invalid syntax.");var r=e.call(this,t,n)||this;return r.name="InvalidQuerySyntaxError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.InvalidQuerySyntaxError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="Unable to parse the JSON in the request.");var r=e.call(this,t,n)||this;return r.name="JSONParseError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.JSONParseError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="The Kinvey server encountered an unexpected error. Please retry your request.");var r=e.call(this,t,n)||this;return r.name="KinveyInternalErrorRetry",r}return r.__extends(t,e),t}(n(1).KinveyError);t.KinveyInternalErrorRetry=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="The Kinvey server encountered an unexpected error. Please contact support@kinvey.com for assistance.");var r=e.call(this,t,n)||this;return r.name="KinveyInternalErrorStop",r}return r.__extends(t,e),t}(n(1).KinveyError);t.KinveyInternalErrorStop=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="The request is missing a query string.");var r=e.call(this,t,n)||this;return r.name="MissingQueryError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.MissingQueryError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="The request is missing a required header.");var r=e.call(this,t,n)||this;return r.name="MissingRequestHeaderError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.MissingRequestHeaderError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="A required parameter is missing from the request.");var r=e.call(this,t,n)||this;return r.name="MissingRequestParameterError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.MissingRequestParameterError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="Result set size exceeded.");var r=e.call(this,t,n)||this;return r.name="ResultSetSizeExceededError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.ResultSetSizeExceededError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="An error occurred on the server.");var r=e.call(this,t,n)||this;return r.name="ServerError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.ServerError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="The time window for this request has expired.");var r=e.call(this,t,n)||this;return r.name="StaleRequestError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.StaleRequestError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="This username is already taken. Please retry your request with a different username.");var r=e.call(this,t,n)||this;return r.name="UserAlreadyExistsError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.UserAlreadyExistsError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="This collection is configured to disallow any modifications to an existing entity or creation of new entities.");var r=e.call(this,t,n)||this;return r.name="WritesToCollectionDisallowedError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.WritesToCollectionDisallowedError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(35),o=r.__importDefault(n(135)),s=r.__importDefault(n(14)),u=n(4);function a(e){return Object.keys(e).reduce(function(t,n){var r=e[n];return s.default(r)&&(r=a(r)),null!=r&&(t[n]=r),t},{})}!function(e){e.AppData="appdata",e.Blob="blob",e.Push="push",e.Rpc="rpc",e.User="user"}(t.KinveyBaasNamespace||(t.KinveyBaasNamespace={})),t.formatKinveyBaasUrl=function(e,t,n){return i.format({protocol:u.getBaasProtocol(),host:u.getBaasHost(),pathname:t?o.default(e,u.getAppKey(),t):o.default(e,u.getAppKey()),query:n?a(n):void 0})},t.formatKinveyAuthUrl=function(e,t){return i.format({protocol:u.getAuthProtocol(),host:u.getAuthHost(),pathname:e,query:t?a(t):void 0})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(4),o=n(52),s="_Device";function u(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}t.getDeviceId=function(){return r.__awaiter(this,void 0,void 0,function(){var e,t,n;return r.__generator(this,function(r){switch(r.label){case 0:return[4,(e=new o.Storage(i.getAppKey(),s)).find()];case 1:return t=r.sent(),(n=t.shift())?[3,3]:[4,e.save({uuid:""+u()+u()+"-"+u()+"-"+u()+"-"+u()+"-"+u()+u()+u()})];case 2:n=r.sent(),r.label=3;case 3:return[2,n.uuid]}})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=r.__importDefault(n(24)),o=n(83),s=n(13),u=n(84),a="status:";var c,l=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(t,e),t.prototype.message=function(e){this.emit(e.channel,e.message)},t.prototype.status=function(e){var t=this,n=e.affectedChannels,r=void 0===n?[]:n,i=e.affectedChannelGroups,o=void 0===i?[]:i,s=r.concat(o),u={error:e.error,category:e.category,operation:e.operation};s.length>0?s.forEach(function(e){t.emit(""+a+e,u)}):this.emit("pubNubEventsNotRouted",u)},t}(o.EventEmitter));function f(e){return l.removeAllListeners(e),l.removeAllListeners(""+a+e),!0}t.isSubscribed=function(e){return!(!c||e&&-1===l.eventNames().indexOf(e))},t.subscribe=function(e){if(c)throw new u.KinveyError("You are already subscribed to the live service. Please unsubscribe before you subscribe again.");var t=s.getConfig(s.ConfigKey.PubNub);(c=new t(Object.assign({},{ssl:!0,dedupeOnSubscribe:!0},e))).subscribe({channelGroups:[e.userChannelGroup]}),c.addListener(l)},t.subscribeToChannel=function(e,t){void 0===t&&(t={});var n=t.onMessage,r=t.onError,o=t.onStatus;if(!function(e){return"string"==typeof e&&""!==e}(e))throw new Error("Invalid channel name.");if(!function(e){if(!e)return!1;var t=e.onMessage,n=e.onError,r=e.onStatus;return i.default(t)||i.default(n)||i.default(r)}(t))throw new Error("Invalid receiver.");return i.default(n)&&l.on(e,n),i.default(r)&&l.on(""+a+e,function(e){e.error&&r(e)}),i.default(o)&&l.on(""+a+e,function(e){e.error||o(e)}),!0},t.unsubscribeFromChannel=f,t.unsubscribe=function(){return f(),c&&(c.removeListener(l),c.destroy(),c=null),!0}},function(e,t,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function u(){u.init.call(this)}e.exports=u,u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var a=10;function c(e){return void 0===e._maxListeners?u.defaultMaxListeners:e._maxListeners}function l(e,t,n,r){var i,o,s,u;if("function"!=typeof n)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n);if(void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]),void 0===s)s=o[t]=n,++e._eventsCount;else if("function"==typeof s?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=c(e))>0&&s.length>i&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=s.length,u=a,console&&console.warn&&console.warn(u)}return e}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=function(){for(var e=[],t=0;t0&&(s=t[0]),s instanceof Error)throw s;var u=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw u.context=s,u}var a=i[e];if(void 0===a)return!1;if("function"==typeof a)o(a,this,t);else{var c=a.length,l=p(a,c);for(n=0;n=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},u.prototype.listeners=function(e){return h(this,e,!0)},u.prototype.rawListeners=function(e){return h(this,e,!1)},u.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},u.prototype.listenerCount=d,u.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0);r.__exportStar(n(18),t),r.__exportStar(n(56),t),r.__exportStar(n(57),t),r.__exportStar(n(58),t),r.__exportStar(n(59),t),r.__exportStar(n(136),t),r.__exportStar(n(60),t),r.__exportStar(n(61),t),r.__exportStar(n(62),t),r.__exportStar(n(63),t),r.__exportStar(n(64),t),r.__exportStar(n(65),t),r.__exportStar(n(66),t),r.__exportStar(n(31),t),r.__exportStar(n(67),t),r.__exportStar(n(68),t),r.__exportStar(n(69),t),r.__exportStar(n(1),t),r.__exportStar(n(70),t),r.__exportStar(n(71),t),r.__exportStar(n(32),t),r.__exportStar(n(72),t),r.__exportStar(n(73),t),r.__exportStar(n(74),t),r.__exportStar(n(137),t),r.__exportStar(n(138),t),r.__exportStar(n(139),t),r.__exportStar(n(140),t),r.__exportStar(n(16),t),r.__exportStar(n(33),t),r.__exportStar(n(141),t),r.__exportStar(n(51),t),r.__exportStar(n(75),t),r.__exportStar(n(76),t),r.__exportStar(n(77),t),r.__exportStar(n(85),t),r.__exportStar(n(142),t),r.__exportStar(n(78),t),r.__exportStar(n(79),t)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="An error occurred during sync.");var r=e.call(this,t,n)||this;return r.name="SyncError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.SyncError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=r.__importDefault(n(21)),o=n(38),s=n(2);t.download=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,function(){var n,u,a,c,l,f,h,d;return r.__generator(this,function(r){switch(r.label){case 0:return n=t.stream,u=void 0!==n&&n,a=t.tls,c=void 0===a||a,l=t.ttl,f=Object.assign({},{tls:!0===c}),i.default(l)&&(f.ttl_in_seconds=l),[4,new s.KinveyHttpRequest({method:s.HttpRequestMethod.GET,auth:s.KinveyHttpAuth.SessionOrMaster,url:s.formatKinveyBaasUrl(s.KinveyBaasNamespace.Blob,"/"+e,f),timeout:t.timeout}).execute()];case 1:return h=r.sent(),d=h.data,u?[2,d]:[2,o.downloadByUrl(d._downloadURL,t)]}})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(86);t.findById=function(e,t){return r.download(e,t)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0).__importDefault(n(14)),i=n(1),o=function(){function e(e){if(!r.default(e))throw new i.KinveyError("entity argument must be an object");e._kmd=e._kmd||{},this.entity=e}return Object.defineProperty(e.prototype,"authtoken",{get:function(){return this.entity._kmd&&this.entity._kmd.authtoken||null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ect",{get:function(){return this.createdAt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"createdAt",{get:function(){if(this.entity._kmd&&this.entity._kmd.ect)return new Date(this.entity._kmd.ect)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lmt",{get:function(){return this.updatedAt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lastModified",{get:function(){return this.updatedAt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"updatedAt",{get:function(){if(this.entity._kmd&&this.entity._kmd.lmt)return new Date(this.entity._kmd.lmt)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"emailVerification",{get:function(){if(this.entity._kmd&&this.entity._kmd.emailVerification)return this.entity._kmd.emailVerification},enumerable:!0,configurable:!0}),e.prototype.isEmailConfirmed=function(){return!!this.emailVerification&&"confirmed"===this.emailVerification.status},e.prototype.isLocal=function(){return this.entity._kmd&&!0===this.entity._kmd.local||!1},e.prototype.toPlainObject=function(){return this.entity._kmd},e}();t.Kmd=o},function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.mergeSocialIdentity=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=JSON.parse(JSON.stringify(e));return Object.keys(t).reduce(function(n,r){return n[r]=Object.assign({},e[r],t[r]),n},n)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=r.__importDefault(n(3)),o=n(18),s=n(16),u=n(1),a=n(4),c=n(39),l=n(91),f=n(41),h=n(6);t.loginWithRedirectUri=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,function(){var n,d,p,v,y,_,b,g,m;return r.__generator(this,function(r){switch(r.label){case 0:if(d=h.getActiveUser(),p=t.micId,v=t.version,y=a.getAppKey(),d)throw new o.ActiveUserError("An active user already exists. Please logout the active user before you login with Mobile Identity Connect.");if(!i.default(e))throw new u.KinveyError("A redirectUri is required and must be a string.");return i.default(p)&&(y=y+"."+p),[4,l.loginWithPopup(y,e,v)];case 1:return _=r.sent(),[4,l.getTokenWithCode(_,y,e,t)];case 2:b=r.sent(),(n={})[b.identity]=b,g={_socialIdentity:n},r.label=3;case 3:return r.trys.push([3,5,,8]),[4,c.login(g)];case 4:return[2,r.sent()];case 5:return(m=r.sent())instanceof s.NotFoundError?[4,f.signup(g)]:[3,7];case 6:return[2,r.sent()];case 7:throw m;case 8:return[2]}})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0);r.__exportStar(n(166),t),r.__exportStar(n(167),t),r.__exportStar(n(168),t)},function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r0}),$gte:u(function(e,t){return m(o(t),e)>=0}),$lt:u(function(e,t){return m(o(t),e)<0}),$lte:u(function(e,t){return m(o(t),e)<=0}),$mod:u(function(e,t){return t%e[0]==e[1]}),$in:function(e,t){if(!(t instanceof Array)){var n=o(t);if(n===t&&"object"==typeof t)for(i=e.length;i--;)if(String(e[i])===String(t)&&"[object Object]"!==String(t))return!0;if(void 0===n)for(i=e.length;i--;)if(null==e[i])return!0;for(i=e.length;i--;){var r=a(_(s(e,i),void 0),t,i,e);if(r&&"[object Object]"!==String(r)&&"[object Object]"!==String(t))return!0}return!!~e.indexOf(n)}for(var i=t.length;i--;)if(~e.indexOf(o(s(t,i))))return!0;return!1},$nin:function(e,t,n,r){return!l.$in(e,t,n,r)},$not:function(e,t,n,r){return!a(e,t,n,r)},$type:function(e,t){return null!=t&&(t instanceof e||t.constructor==e)},$all:function(e,t,n,r){return l.$and(e,t,n,r)},$size:function(e,t){return!!t&&e===t.length},$or:function(e,t,n,r){for(var i=0,o=e.length;it)return 1;if(e=0&&r<=a.levels.SILENT))throw"log.setLevel() called with invalid level: "+r;if(u=r,!1!==o&&function(e){var r=(n[e]||"silent").toUpperCase();if(typeof window===t)return;try{return void(window.localStorage[c]=r)}catch(e){}try{window.document.cookie=encodeURIComponent(c)+"="+r+";"}catch(e){}}(r),i.call(a,r,e),typeof console===t&&r= 0x80 (not a basic code point)","invalid-input":"Invalid input"},w=c-l,S=Math.floor,x=String.fromCharCode;function E(e){throw RangeError(m[e])}function O(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function P(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+O((e=e.replace(g,".")).split("."),t).join(".")}function C(e){for(var t,n,r=[],i=0,o=e.length;i=55296&&t<=56319&&i65535&&(t+=x((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=x(e)}).join("")}function A(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function k(e,t,n){var r=0;for(e=n?S(e/d):e>>1,e+=S(e/t);e>w*f>>1;r+=c)e=S(e/w);return S(r+(w+1)*e/(e+h))}function T(e){var t,n,r,i,o,s,u,h,d,_,b,g=[],m=e.length,w=0,x=v,O=p;for((n=e.lastIndexOf(y))<0&&(n=0),r=0;r=128&&E("not-basic"),g.push(e.charCodeAt(r));for(i=n>0?n+1:0;i=m&&E("invalid-input"),((h=(b=e.charCodeAt(i++))-48<10?b-22:b-65<26?b-65:b-97<26?b-97:c)>=c||h>S((a-w)/s))&&E("overflow"),w+=h*s,!(h<(d=u<=O?l:u>=O+f?f:u-O));u+=c)s>S(a/(_=c-d))&&E("overflow"),s*=_;O=k(w-o,t=g.length+1,0==o),S(w/t)>a-x&&E("overflow"),x+=S(w/t),w%=t,g.splice(w++,0,x)}return j(g)}function N(e){var t,n,r,i,o,s,u,h,d,_,b,g,m,w,O,P=[];for(g=(e=C(e)).length,t=v,n=0,o=p,s=0;s=t&&bS((a-n)/(m=r+1))&&E("overflow"),n+=(u-t)*m,t=u,s=0;sa&&E("overflow"),b==t){for(h=n,d=c;!(h<(_=d<=o?l:d>=o+f?f:d-o));d+=c)O=h-_,w=c-_,P.push(x(A(_+O%w,0))),h=S(O/w);P.push(x(A(h,0))),o=k(n,m,r==i),n=0,++r}++n,++t}return P.join("")}u={version:"1.3.2",ucs2:{decode:C,encode:j},decode:T,encode:N,toASCII:function(e){return P(e,function(e){return b.test(e)?"xn--"+N(e):e})},toUnicode:function(e){return P(e,function(e){return _.test(e)?T(e.slice(4).toLowerCase()):e})}},void 0===(i=function(){return u}.call(t,n,t,e))||(e.exports=i)}()}).call(this,n(29)(e),n(20))},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";t.decode=t.parse=n(133),t.encode=t.stringify=n(134)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,o){t=t||"&",n=n||"=";var s={};if("string"!=typeof e||0===e.length)return s;var u=/\+/g;e=e.split(t);var a=1e3;o&&"number"==typeof o.maxKeys&&(a=o.maxKeys);var c=e.length;a>0&&c>a&&(c=a);for(var l=0;l=0?(f=v.substr(0,y),h=v.substr(y+1)):(f=v,h=""),d=decodeURIComponent(f),p=decodeURIComponent(h),r(s,d)?i(s[d])?s[d].push(p):s[d]=[s[d],p]:s[d]=p}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,u){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),function(s){var u=encodeURIComponent(r(s))+n;return i(e[s])?o(e[s],function(e){return u+encodeURIComponent(r(e))}).join(t):u+encodeURIComponent(r(e[s]))}).join(t):u?encodeURIComponent(r(u))+n+encodeURIComponent(r(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r1){var n=e.shift();e[0]=n+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^\/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^\/:]+):\/*/,"$1://");for(var r=0;r0&&(i=i.replace(/^[\/]+/,"")),i=r0?"?":"")+s.join("&")}("object"==typeof arguments[0]?arguments[0]:[].slice.call(arguments))}},e.exports?e.exports=o():void 0===(i="function"==typeof(r=o)?r.call(t,n,t,e):r)||(e.exports=i)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t){var n=this.constructor;void 0===t&&(t="An error occurred.");var r=e.call(this,t)||this;return Object.setPrototypeOf(r,n.prototype),r.name="BaseError",r}return r.__extends(t,e),t}(Error);t.BaseError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="An error has occurred with Mobile Identity Connect.");var r=e.call(this,t,n)||this;return r.name="MobileIdentityConnectError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.MobileIdentityConnectError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="There was an error connecting to the network.");var r=e.call(this,t,n)||this;return r.name="NetworkConnectionError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.NetworkConnectionError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="There is not an active user.");var r=e.call(this,t,n)||this;return r.name="NoActiveUserError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.NoActiveUserError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="No response was provided.");var r=e.call(this,t,n)||this;return r.name="NoResponseError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.NoResponseError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="Unable to open a popup on this platform.");var r=e.call(this,t,n)||this;return r.name="PopupError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.PopupError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){function t(t,n){void 0===t&&(t="The request timed out.");var r=e.call(this,t,n)||this;return r.name="TimeoutError",r}return r.__extends(t,e),t}(n(1).KinveyError);t.TimeoutError=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=r.__importDefault(n(7)),o=r.__importDefault(n(144)),s=n(43),u=n(10),a=n(1),c=n(32),l=n(33),f=n(16),h=n(2),d=n(15),p=n(152),v=n(36),y=function(e){function t(t){void 0===t&&(t="Invalid delta set query.");var n=e.call(this,t)||this;return n.name="InvalidDeltaSetQueryError",n}return r.__extends(t,e),t}(a.KinveyError);t.InvalidDeltaSetQueryError=y;var _=function(){function e(e,t){void 0===t&&(t={tag:void 0,useDeltaSet:!1,useAutoPagination:!1,autoSync:!0}),this.collectionName=e,this.tag=t.tag,this.useDeltaSet=!0===t.useDeltaSet,this.useAutoPagination=!0===t.useAutoPagination||t.autoPagination,this.autoSync=!0===t.autoSync}return Object.defineProperty(e.prototype,"pathname",{get:function(){return"/"+this.collectionName},enumerable:!0,configurable:!0}),e.prototype.find=function(e,t){var n=this;void 0===t&&(t={});var i=!0===t.autoSync||this.autoSync,o=new d.DataStoreCache(this.collectionName,this.tag);return s.Observable.create(function(s){return r.__awaiter(n,void 0,void 0,function(){var n,u,a;return r.__generator(this,function(r){switch(r.label){case 0:return r.trys.push([0,5,,6]),[4,o.find(e)];case 1:return n=r.sent(),s.next(n),i?[4,this.pull(e,t)]:[3,4];case 2:return r.sent(),[4,o.find(e)];case 3:u=r.sent(),s.next(u),r.label=4;case 4:return s.complete(),[3,6];case 5:return a=r.sent(),s.error(a),[3,6];case 6:return[2]}})})})},e.prototype.count=function(e,t){var n=this;void 0===t&&(t={});var i=!0===t.autoSync||this.autoSync,o=new d.DataStoreCache(this.collectionName,this.tag);return s.Observable.create(function(s){return r.__awaiter(n,void 0,void 0,function(){var n,u,a;return r.__generator(this,function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),[4,o.count(e)];case 1:return n=r.sent(),s.next(n),i?[4,new v.NetworkStore(this.collectionName).count(e,t).toPromise()]:[3,3];case 2:u=r.sent(),s.next(u),r.label=3;case 3:return s.complete(),[3,5];case 4:return a=r.sent(),s.error(a),[3,5];case 5:return[2]}})})})},e.prototype.group=function(e,t){var n=this;void 0===t&&(t={});var i=!0===t.autoSync||this.autoSync,o=new d.DataStoreCache(this.collectionName,this.tag);return s.Observable.create(function(s){return r.__awaiter(n,void 0,void 0,function(){var n,u,a;return r.__generator(this,function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),[4,o.group(e)];case 1:return n=r.sent(),s.next(n),i?[4,new v.NetworkStore(this.collectionName).group(e,t).toPromise()]:[3,3];case 2:u=r.sent(),s.next(u),r.label=3;case 3:return s.complete(),[3,5];case 4:return a=r.sent(),s.error(a),[3,5];case 5:return[2]}})})})},e.prototype.findById=function(e,t){var n=this;return void 0===t&&(t={}),s.Observable.create(function(i){return r.__awaiter(n,void 0,void 0,function(){var n,o,s,u;return r.__generator(this,function(r){switch(r.label){case 0:return r.trys.push([0,5,,6]),e?[3,1]:(i.next(void 0),[3,4]);case 1:return n=!0===t.autoSync||this.autoSync,[4,new d.DataStoreCache(this.collectionName,this.tag).findById(e)];case 2:if(o=r.sent())i.next(o);else{if(!n)throw new f.NotFoundError;i.next(void 0)}return n?[4,this.pullById(e,t)]:[3,4];case 3:s=r.sent(),i.next(s),r.label=4;case 4:return i.complete(),[3,6];case 5:return u=r.sent(),i.error(u),[3,6];case 6:return[2]}})})})},e.prototype.create=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,function(){var n,o,s,c,l,f,h,v;return r.__generator(this,function(r){switch(r.label){case 0:if(i.default(e))throw new a.KinveyError("Unable to create an array of entities. Please create entities one by one.");return n=!0===t.autoSync||this.autoSync,o=new d.DataStoreCache(this.collectionName,this.tag),s=new p.Sync(this.collectionName,this.tag),[4,o.save(e)];case 1:return c=r.sent(),[4,s.addCreateSyncEvent(c)];case 2:return l=r.sent(),n?(f=(new u.Query).equalTo("_id",l._id),[4,s.push(f,t)]):[3,4];case 3:if(h=r.sent(),(v=h.shift()).error)throw v.error;return[2,v.entity];case 4:return[2,c]}})})},e.prototype.update=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,function(){var n,o,s,c,l,f,h,v;return r.__generator(this,function(r){switch(r.label){case 0:if(i.default(e))throw new a.KinveyError("Unable to update an array of entities. Please update entities one by one.");if(!e._id)throw new a.KinveyError("The entity provided does not contain an _id. An _id is required to update the entity.");return n=!0===t.autoSync||this.autoSync,o=new d.DataStoreCache(this.collectionName,this.tag),s=new p.Sync(this.collectionName,this.tag),[4,o.save(e)];case 1:return c=r.sent(),[4,s.addUpdateSyncEvent(c)];case 2:return l=r.sent(),n?(f=(new u.Query).equalTo("_id",l._id),[4,s.push(f,t)]):[3,4];case 3:if(h=r.sent(),(v=h.shift()).error)throw v.error;return[2,v.entity];case 4:return[2,c]}})})},e.prototype.save=function(e,t){return e._id?this.update(e,t):this.create(e,t)},e.prototype.remove=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,function(){var n,i,o,s,u,a;return r.__generator(this,function(r){switch(r.label){case 0:return n=!0===t.autoSync||this.autoSync,i=new d.DataStoreCache(this.collectionName,this.tag),o=new p.Sync(this.collectionName,this.tag),s=0,[4,i.find(e)];case 1:return(u=r.sent()).length>0?[4,i.remove(e)]:[3,4];case 2:return s=r.sent(),[4,o.addDeleteSyncEvent(u)];case 3:r.sent(),r.label=4;case 4:return n?[4,new v.NetworkStore(this.collectionName).remove(e,t)]:[3,7];case 5:return a=r.sent(),s=a.count,[4,this.clearSync(e)];case 6:r.sent(),r.label=7;case 7:return[2,{count:s}]}})})},e.prototype.removeById=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,function(){var n,i,o,s,a,c,l,h;return r.__generator(this,function(r){switch(r.label){case 0:return n=!0===t.autoSync||this.autoSync,i=new d.DataStoreCache(this.collectionName,this.tag),o=new p.Sync(this.collectionName,this.tag),s=0,e?[4,i.findById(e)]:[3,8];case 1:return(a=r.sent())?[4,i.removeById(e)]:[3,7];case 2:return s=r.sent(),[4,o.addDeleteSyncEvent(a)];case 3:return c=r.sent(),n&&c?(l=(new u.Query).equalTo("_id",c._id),[4,o.push(l)]):[3,5];case 4:return(h=r.sent()).length>0&&h.shift().error&&(s-=1),[3,6];case 5:s=1,r.label=6;case 6:return[3,8];case 7:throw new f.NotFoundError;case 8:return[2,{count:s}]}})})},e.prototype.clear=function(e){return r.__awaiter(this,void 0,void 0,function(){var t;return r.__generator(this,function(n){switch(n.label){case 0:return[4,new d.DataStoreCache(this.collectionName,this.tag).remove(e)];case 1:return t=n.sent(),[4,this.clearSync(e)];case 2:return n.sent(),e||new d.QueryCache(this.tag).remove(),[2,{count:t}]}})})},e.prototype.push=function(e,t){return new p.Sync(this.collectionName,this.tag).push(void 0,t)},e.prototype.pull=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,function(){var n,i,s,f,p,y,_,b,g,m,w,S,x,E,O,P,C,j,A,k,T,N,M,I,R,K,D,q,B,U,L;return r.__generator(this,function(r){switch(r.label){case 0:return n=new v.NetworkStore(this.collectionName),i=new d.DataStoreCache(this.collectionName,this.tag),s=new d.QueryCache(this.tag),f=!0===t.useDeltaSet||this.useDeltaSet,p=!0===t.useAutoPagination||t.autoPagination||this.useAutoPagination,y=s.serializeQuery(e),_=(new u.Query).equalTo("query",y).equalTo("collectionName",this.collectionName),[4,s.find(_)];case 1:return b=r.sent(),g=b.shift()||{collectionName:this.collectionName,query:y,lastRequest:null},[4,this.pendingSyncCount()];case 2:if((m=r.sent())>0){if(1===m)throw new a.KinveyError("Unable to pull entities from the backend. There is "+m+" entity that needs to be pushed to the backend.");throw new a.KinveyError("Unable to pull entities from the backend. There are "+m+" entities that need to be pushed to the backend.")}if(!(f&&g&&g.lastRequest))return[3,11];r.label=3;case 3:return r.trys.push([3,10,,11]),w={since:g.lastRequest},e&&(w=Object.assign({},e.toQueryObject(),w)),S=h.formatKinveyBaasUrl(h.KinveyBaasNamespace.AppData,"/"+this.collectionName+"/_deltaset",w),[4,new h.KinveyHttpRequest({method:h.HttpRequestMethod.GET,auth:h.KinveyHttpAuth.Session,url:S}).execute()];case 4:return x=r.sent(),E=x.data,O=E.changed,P=E.deleted,Array.isArray(P)&&P.length>0?(C=(new u.Query).contains("_id",P.map(function(e){return e._id})),[4,i.remove(C)]):[3,6];case 5:r.sent(),r.label=6;case 6:return Array.isArray(O)&&O.length>0?[4,i.save(O)]:[3,8];case 7:r.sent(),r.label=8;case 8:return j=new h.KinveyHttpHeaders(x.headers.toPlainObject()),g.lastRequest=j.requestStart,[4,s.save(g)];case 9:return r.sent(),[2,O.length];case 10:if(!((A=r.sent())instanceof c.MissingConfigurationError||A instanceof l.ParameterValueOutOfRangeError))throw A;return[3,11];case 11:return p?[4,i.clear()]:[3,16];case 12:return r.sent(),[4,n.count(e,Object.assign({},t,{rawResponse:!0})).toPromise()];case 13:return k=r.sent(),T="count"in k.data?k.data.count:Number.MAX_SAFE_INTEGER,N=t.autoPaginationPageSize||t.autoPagination&&t.autoPagination.pageSize||1e4,M=Math.ceil(T/N),I=o.default(M,function(t){var n=new u.Query(e);return n.skip=t*N,n.limit=Math.min(T-t*N,N),n}),R=I.map(function(e){return n.find(e,t).toPromise().then(function(e){return i.save(e)}).then(function(e){return e.length})}),[4,Promise.all(R)];case 14:return K=r.sent(),D=K.reduce(function(e,t){return e+t},0),q=new h.KinveyHttpHeaders(k.headers.toPlainObject()),g.lastRequest=q.requestStart,[4,s.save(g)];case 15:return r.sent(),[2,D];case 16:return[4,n.find(e,Object.assign({},t,{rawResponse:!0})).toPromise()];case 17:return B=r.sent(),U=B.data,e?[4,i.remove(e)]:[3,19];case 18:return r.sent(),[3,21];case 19:return[4,i.clear()];case 20:r.sent(),r.label=21;case 21:return[4,i.save(U)];case 22:return r.sent(),L=new h.KinveyHttpHeaders(B.headers.toPlainObject()),g.lastRequest=L.requestStart,[4,s.save(g)];case 23:return r.sent(),[2,U.length]}})})},e.prototype.pullById=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,function(){var n,i,o,s,u;return r.__generator(this,function(r){switch(r.label){case 0:return n=new v.NetworkStore(this.collectionName),i=new d.DataStoreCache(this.collectionName,this.tag),[4,this.pendingSyncCount()];case 1:if((o=r.sent())>0){if(1===o)throw new a.KinveyError("Unable to pull entities from the backend. There is "+o+" entity that needs to be pushed to the backend.");throw new a.KinveyError("Unable to pull entities from the backend. There are "+o+" entities that need to be pushed to the backend.")}r.label=2;case 2:return r.trys.push([2,5,,8]),[4,n.findById(e,t).toPromise()];case 3:return s=r.sent(),[4,i.save(s)];case 4:return r.sent(),[2,s];case 5:return(u=r.sent())instanceof f.NotFoundError?[4,i.removeById(e)]:[3,7];case 6:r.sent(),r.label=7;case 7:throw u;case 8:return[2]}})})},e.prototype.sync=function(e,t){return r.__awaiter(this,void 0,void 0,function(){var n,i;return r.__generator(this,function(r){switch(r.label){case 0:return[4,this.push(void 0,t)];case 1:return n=r.sent(),[4,this.pull(e,t)];case 2:return i=r.sent(),[2,{push:n,pull:i}]}})})},e.prototype.pendingSyncDocs=function(e){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(t){return[2,new p.Sync(this.collectionName,this.tag).find(p.queryToSyncQuery(e))]})})},e.prototype.pendingSyncEntities=function(e){return this.pendingSyncDocs(e)},e.prototype.pendingSyncCount=function(e){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(t){switch(t.label){case 0:return[4,this.pendingSyncDocs(e)];case 1:return[2,t.sent().length]}})})},e.prototype.clearSync=function(e){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(t){return[2,new p.Sync(this.collectionName,this.tag).remove(p.queryToSyncQuery(e))]})})},e.prototype.subscribe=function(e,t){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(n){return[2,new v.NetworkStore(this.collectionName).subscribe(e,t)]})})},e.prototype.unsubscribe=function(e){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(t){return[2,new v.NetworkStore(this.collectionName).unsubscribe(e)]})})},e}();t.CacheStore=_},function(e,t,n){var r=n(145),i=n(146),o=n(148),s=9007199254740991,u=4294967295,a=Math.min;e.exports=function(e,t){if((e=o(e))<1||e>s)return[];var n=u,c=a(e,u);t=i(t),e-=u;for(var l=r(c,t);++n0))return[3,3];if(c.find(function(e){return!e._id}))throw new o.SyncError("A doc is missing an _id. All docs must have an _id in order to be added to the sync collection.");return l=(new i.Query).contains("entityId",c.map(function(e){return e._id})),[4,this.remove(l)];case 1:return r.sent(),e===a.SyncEvent.Delete&&(c=c.filter(function(e){return!e._kmd||!0!==e._kmd.local})),[4,n.save(c.map(function(t){return{entityId:t._id,entity:t,collection:f.collectionName,state:{operation:e}}}))];case 2:u=r.sent(),r.label=3;case 3:return[2,s?u.shift():u]}})})},e.prototype.push=function(e,t){return r.__awaiter(this,void 0,void 0,function(){var n,f,h,d,p,v,y,_,b=this;return r.__generator(this,function(g){switch(g.label){case 0:if(n=new u.NetworkStore(this.collectionName),f=new a.DataStoreCache(this.collectionName,this.tag),h=new a.SyncCache(this.tag),this.isPushInProgress())throw new o.SyncError("Data is already being pushed to the backend. Please wait for it to complete before pushing new data to the backend.");return d=100,p=new i.Query(e).equalTo("collection",this.collectionName),[4,h.find(p)];case 1:return(v=g.sent()).length>0?(y=0,[2,(_=function(e){return void 0===e&&(e=[]),r.__awaiter(b,void 0,void 0,function(){var i,o,u=this;return r.__generator(this,function(p){switch(p.label){case 0:return b=this.collectionName,c.set(b,!0),y>=v.length?(l(this.collectionName),[2,e]):(i=v.slice(y,y+d),y+=d,[4,Promise.all(i.map(function(e){return r.__awaiter(u,void 0,void 0,function(){var i,o,u,c,l,d,p,v,y;return r.__generator(this,function(r){switch(r.label){case 0:if(i=e._id,o=e.entityId,u=e.state,(c=(void 0===u?{operation:void 0}:u).operation)!==a.SyncEvent.Delete)return[3,9];r.label=1;case 1:r.trys.push([1,7,,8]),r.label=2;case 2:return r.trys.push([2,4,,5]),[4,n.removeById(o,t)];case 3:return r.sent(),[3,5];case 4:if(!((l=r.sent())instanceof s.NotFoundError))throw l;return[3,5];case 5:return[4,h.removeById(i)];case 6:return r.sent(),[2,{_id:o,operation:c}];case 7:return d=r.sent(),[2,{_id:o,operation:c,error:d}];case 8:return[3,21];case 9:return c!==a.SyncEvent.Create&&c!==a.SyncEvent.Update?[3,21]:[4,f.findById(o)];case 10:p=r.sent(),v=!1,r.label=11;case 11:return r.trys.push([11,20,,21]),c!==a.SyncEvent.Create?[3,13]:(p._kmd&&!0===p._kmd.local&&(v=!0,delete p._id,delete p._kmd.local),[4,n.create(p,t)]);case 12:return p=r.sent(),[3,15];case 13:return[4,n.update(p,t)];case 14:p=r.sent(),r.label=15;case 15:return[4,h.removeById(i)];case 16:return r.sent(),[4,f.save(p)];case 17:return r.sent(),v?[4,f.removeById(o)]:[3,19];case 18:r.sent(),r.label=19;case 19:return[2,{_id:o,operation:c,entity:p}];case 20:return y=r.sent(),[2,{_id:o,operation:c,entity:p,error:y}];case 21:return[2,{_id:i,operation:c,error:new Error("Unable to push item in sync table because the event was not recognized.")}]}})})}))]);case 1:return o=p.sent(),l(this.collectionName),[2,_(e.concat(o))]}var b})})})()]):[2,[]]}})})},e.prototype.remove=function(e){return r.__awaiter(this,void 0,void 0,function(){var t,n;return r.__generator(this,function(r){return t=new a.SyncCache(this.tag),n=new i.Query(e).equalTo("collection",this.collectionName),[2,t.remove(n)]})})},e.prototype.removeById=function(e){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(t){return[2,new a.SyncCache(this.tag).removeById(e)]})})},e.prototype.clear=function(){return r.__awaiter(this,void 0,void 0,function(){var e,t;return r.__generator(this,function(n){return e=new a.SyncCache(this.tag),t=(new i.Query).equalTo("collection",this.collectionName),[2,e.remove(t)]})})},e}();t.Sync=f},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=r.__importDefault(n(3)),o=n(2),s=n(1);t.endpoint=function(e,t,n){return void 0===n&&(n={}),r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(r){switch(r.label){case 0:if(!i.default(e))throw new s.KinveyError("An endpoint is required and must be a string.");return[4,new o.KinveyHttpRequest({method:o.HttpRequestMethod.POST,auth:o.KinveyHttpAuth.SessionOrMaster,url:o.formatKinveyBaasUrl(o.KinveyBaasNamespace.Rpc,"/custom/"+e),body:t,timeout:n.timeout}).execute()];case 1:return[2,r.sent().data]}})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(155);t.create=r.create;var i=n(86);t.download=i.download;var o=n(38);t.downloadByUrl=o.downloadByUrl;var s=n(156);t.find=s.find;var u=n(87);t.findById=u.findById;var a=n(157);t.remove=a.remove;var c=n(158);t.removeById=c.removeById;var l=n(159);t.stream=l.stream;var f=n(160);t.update=f.update;var h=n(37);t.upload=h.upload},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(37);t.create=function(e,t,n){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(r){return[2,i.upload(e,t,n)]})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=r.__importDefault(n(21)),o=n(10),s=n(1),u=n(2),a=n(38);t.find=function(e,t){return void 0===e&&(e=new o.Query),void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,function(){var n,c,l,f,h,d,p,v;return r.__generator(this,function(r){switch(r.label){case 0:if(n=t.download,c=void 0!==n&&n,l=t.tls,f=void 0===l||l,h=t.ttl,d=Object.assign({},{tls:!0===f}),e){if(!(e instanceof o.Query))throw new s.KinveyError("Invalid query. It must be an instance of the Query class.");d=Object.assign({},d,e.toQueryObject())}return i.default(h)&&(d.ttl_in_seconds=h),[4,new u.KinveyHttpRequest({method:u.HttpRequestMethod.GET,auth:u.KinveyHttpAuth.SessionOrMaster,url:u.formatKinveyBaasUrl(u.KinveyBaasNamespace.Blob,"/",d),timeout:t.timeout}).execute()];case 1:return p=r.sent(),v=p.data,!0===c?[2,Promise.all(v.map(function(e){return a.downloadByUrl(e._downloadURL,t)}))]:[2,v]}})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(1);t.remove=function(){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(e){throw new i.KinveyError("Please use removeById() to remove files one by one.")})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(2);t.removeById=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(n){switch(n.label){case 0:return[4,new i.KinveyHttpRequest({method:i.HttpRequestMethod.DELETE,auth:i.KinveyHttpAuth.SessionOrMaster,url:i.formatKinveyBaasUrl(i.KinveyBaasNamespace.Blob,"/"+e),timeout:t.timeout}).execute()];case 1:return[2,n.sent().data]}})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(87);t.stream=function(e,t){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(n){return[2,i.findById(e,Object.assign({},t,{stream:!0}))]})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(37);t.update=function(e,t,n){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(r){return[2,i.upload(e,t,n)]})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(35),i=n(13),o=n(2),s=n(4),u=n(1);function a(e){if(null===e.kinveyConfig.appKey&&void 0===e.kinveyConfig.appKey)throw new u.KinveyError("No app key was provided to initialize the Kinvey JavaScript SDK.");if(null===e.kinveyConfig.appSecret&&void 0===e.kinveyConfig.appSecret&&null===e.kinveyConfig.masterSecret&&void 0===e.kinveyConfig.masterSecret)throw new u.KinveyError("No app secret was provided to initialize the Kinvey JavaScript SDK.");return i.setConfig(i.ConfigKey.KinveyConfig,e.kinveyConfig),i.setConfig(i.ConfigKey.HttpAdapter,e.httpAdapter),i.setConfig(i.ConfigKey.SessionStore,e.sessionStore),i.setConfig(i.ConfigKey.Popup,e.popup),i.setConfig(i.ConfigKey.StorageAdapter,e.storageAdapter),i.setConfig(i.ConfigKey.PubNub,e.pubnub),{apiHost:s.getBaasHost(),apiHostname:r.format({protocol:s.getBaasProtocol(),host:s.getBaasHost()}),apiProtocol:s.getBaasProtocol(),appKey:s.getAppKey(),appSecret:s.getAppSecret(),masterSecret:s.getMasterSecret(),authHost:s.getAuthHost(),authHostname:r.format({protocol:s.getAuthProtocol(),host:s.getAuthHost()}),authProtocol:s.getAuthProtocol(),micHost:s.getAuthHost(),micHostname:r.format({protocol:s.getAuthProtocol(),host:s.getAuthHost()}),micProtocol:s.getAuthProtocol(),_defaultTimeout:s.getDefaultTimeout(),defaultTimeout:s.getDefaultTimeout(),encryptionKey:s.getEncryptionKey(),_appVersion:o.getAppVersion(),appVersion:o.getAppVersion()}}t.init=a,t.initialize=function(e){return a(e)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(2);t.ping=function(e){return void 0===e&&(e={}),r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(t){switch(t.label){case 0:return[4,new i.KinveyHttpRequest({method:i.HttpRequestMethod.GET,auth:i.KinveyHttpAuth.All,url:i.formatKinveyBaasUrl(i.KinveyBaasNamespace.AppData),timeout:e.timeout}).execute()];case 1:return[2,t.sent().data]}})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(164),o=n(165),s=n(39),u=n(90),a=n(170),c=n(171);t.AuthorizationGrant=c.AuthorizationGrant;var l=n(172),f=n(173),h=n(174),d=n(175),p=n(176),v=n(177),y=n(41),_=n(178),b=n(179),g=n(6),m=n(27),w=n(180),S=n(181),x=n(182),E=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(t,e),t.exists=function(e,t){return i.exists(e,t)},t.forgotUsername=function(e,t){return o.forgotUsername(e,t)},t.login=function(e,t,n){return s.login(e,t,n)},t.loginWithRedirectUri=function(e,t){return u.loginWithRedirectUri(e,t)},t.loginWithMICUsingResourceOwnerCredentials=function(e,t,n){return a.loginWithMICUsingResourceOwnerCredentials(e,t,n)},t.loginWithMIC=function(e,t,n){return c.loginWithMIC(e,t,n)},t.logout=function(e){return l.logout(e)},t.lookup=function(e,t){return f.lookup(e,t)},t.me=function(e){return h.me(e)},t.remove=function(e,t){return d.remove(e,t)},t.resetPassword=function(e,t){return p.resetPassword(e,t)},t.restore=function(){return v.restore()},t.signup=function(e,t){return y.signup(e,t)},t.signUpWithIdentity=function(){return _.signUpWithIdentity()},t.update=function(e,t){return b.update(e,t)},t.getActiveUser=function(){return g.getActiveUser()},t.verifyEmail=function(e,t){return w.verifyEmail(e,t)},t.registerForLiveService=function(e){return S.registerForLiveService(e)},t.unregisterFromLiveService=function(e){return x.unregisterFromLiveService(e)},t}(m.User);t.User=E},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=r.__importDefault(n(3)),o=n(1),s=n(2);t.exists=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(n){switch(n.label){case 0:if(!e)throw new o.KinveyError("A username was not provided.");if(!i.default(e))throw new o.KinveyError("The provided username is not a string.");return[4,new s.KinveyHttpRequest({method:s.HttpRequestMethod.POST,auth:s.KinveyHttpAuth.App,url:s.formatKinveyBaasUrl(s.KinveyBaasNamespace.Rpc,"/check-username-exists"),body:{username:e},timeout:t.timeout}).execute()];case 1:return[2,!0===n.sent().data.usernameExists]}})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=r.__importDefault(n(3)),o=n(1),s=n(2);t.forgotUsername=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(n){switch(n.label){case 0:if(!e)throw new o.KinveyError("An email was not provided.");if(!i.default(e))throw new o.KinveyError("The provided email is not a string.");return[4,new s.KinveyHttpRequest({method:s.HttpRequestMethod.POST,auth:s.KinveyHttpAuth.App,url:s.formatKinveyBaasUrl(s.KinveyBaasNamespace.Rpc,"/user-forgot-username"),body:{email:e},timeout:t.timeout}).execute()];case 1:return[2,n.sent().data]}})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(26),o=n(2),s=n(4),u=n(40);t.getTokenWithCode=function(e,t,n,a){return void 0===a&&(a={}),r.__awaiter(this,void 0,void 0,function(){var c,l;return r.__generator(this,function(r){switch(r.label){case 0:return[4,new o.KinveyHttpRequest({method:o.HttpRequestMethod.POST,headers:new o.KinveyHttpHeaders({"Content-Type":function(){return"application/x-www-form-urlencoded"},Authorization:function(){return"Basic "+i.Base64.encode(t+":"+s.getAppSecret())}}),url:o.formatKinveyAuthUrl("/oauth/token"),body:{grant_type:"authorization_code",client_id:t,redirect_uri:n,code:e},timeout:a.timeout}).execute()];case 1:return c=r.sent(),l=c.data,[2,Object.assign({},{identity:u.Identity,client_id:t,redirect_uri:n,protocol:s.getAuthProtocol(),host:s.getAuthHost()},l)]}})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(26),o=n(2),s=n(4),u=n(40);t.getTokenWithUsernamePassword=function(e,t,n,a){return void 0===a&&(a={}),r.__awaiter(this,void 0,void 0,function(){var c,l;return r.__generator(this,function(r){switch(r.label){case 0:return[4,new o.KinveyHttpRequest({method:o.HttpRequestMethod.POST,headers:new o.KinveyHttpHeaders({"Content-Type":function(){return"application/x-www-form-urlencoded"},Authorization:function(){return"Basic "+i.Base64.encode(n+":"+s.getAppSecret())}}),url:o.formatKinveyAuthUrl("/oauth/token"),body:{grant_type:"password",client_id:n,username:e,password:t},timeout:a.timeout}).execute()];case 1:return c=r.sent(),l=c.data,[2,Object.assign({},{identity:u.Identity,client_id:n,protocol:s.getAuthProtocol(),host:s.getAuthHost()},l)]}})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(35),o=n(2),s=n(1),u=n(40),a=n(169);t.loginWithPopup=function(e,t,n){var c=this;return new Promise(function(l,f){return r.__awaiter(c,void 0,void 0,function(){var c,h,d,p=this;return r.__generator(this,function(v){switch(v.label){case 0:return c=o.formatKinveyAuthUrl("/"+u.getVersion(n)+"/oauth/auth",{client_id:e,redirect_uri:t,response_type:"code",scope:"openid"}),[4,a.open(c)];case 1:return h=v.sent(),d=!1,h.onLoaded(function(e){return r.__awaiter(p,void 0,void 0,function(){var n,o,u,a;return r.__generator(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),e.url&&0===e.url.indexOf(t)&&!1===d?(n=i.parse(e.url,!0),o=n.query,u=o.code,a=o.error,o.error_description,d=!0,h.removeAllListeners(),[4,h.close()]):[3,2];case 1:r.sent(),u?l(u):f(a?new s.KinveyError(a):new s.KinveyError("No code or error was provided.")),r.label=2;case 2:return[3,4];case 3:return r.sent(),[3,4];case 4:return[2]}})})}),h.onClosed(function(){d||(h.removeAllListeners(),f(new s.KinveyError("Login has been cancelled.")))}),[2]}})})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(13);t.open=function(e){return r.getConfig(r.ConfigKey.Popup).open(e)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=r.__importDefault(n(3)),o=n(18),s=n(16),u=n(1),a=n(4),c=n(39),l=n(91),f=n(41),h=n(6);t.loginWithMICUsingResourceOwnerCredentials=function(e,t,n){return void 0===n&&(n={}),r.__awaiter(this,void 0,void 0,function(){var d,p,v,y,_,b,g;return r.__generator(this,function(r){switch(r.label){case 0:if(p=h.getActiveUser(),v=n.micId,y=a.getAppKey(),p)throw new o.ActiveUserError("An active user already exists. Please logout the active user before you login with Mobile Identity Connect.");if(!i.default(e)||!i.default(t))throw new u.KinveyError("A username and password are required and must be a string.");return i.default(v)&&(y=y+"."+v),[4,l.getTokenWithUsernamePassword(e,t,y,n)];case 1:_=r.sent(),(d={})[_.identity]=_,b={_socialIdentity:d},r.label=2;case 2:return r.trys.push([2,4,,7]),[4,c.login(b)];case 3:return[2,r.sent()];case 4:return(g=r.sent())instanceof s.NotFoundError?[4,f.signup(b)]:[3,6];case 5:return[2,r.sent()];case 6:throw g;case 7:return[2]}})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(90);!function(e){e[e.AuthorizationCodeLoginPage=0]="AuthorizationCodeLoginPage"}(t.AuthorizationGrant||(t.AuthorizationGrant={})),t.loginWithMIC=function(e,t,n){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(t){return[2,i.loginWithRedirectUri(e,n)]})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(6);t.logout=function(e){return r.__awaiter(this,void 0,void 0,function(){var t;return r.__generator(this,function(n){return(t=i.getActiveUser())?[2,t.logout(e)]:[2,null]})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(43),o=n(10),s=n(1),u=n(2);t.lookup=function(e,t){var n=this;return void 0===t&&(t={}),i.Observable.create(function(i){return r.__awaiter(n,void 0,void 0,function(){var n,a;return r.__generator(this,function(r){switch(r.label){case 0:if(r.trys.push([0,2,,3]),e&&!(e instanceof o.Query))throw new s.KinveyError("Invalid query. It must be an instance of the Query class.");return[4,new u.KinveyHttpRequest({method:u.HttpRequestMethod.POST,auth:u.KinveyHttpAuth.SessionOrMaster,url:u.formatKinveyBaasUrl(u.KinveyBaasNamespace.User,"/_lookup"),body:e?e.filter:void 0,timeout:t.timeout}).execute()];case 1:return n=r.sent(),i.next(n.data),i.complete(),[3,3];case 2:return a=r.sent(),i.error(a),[3,3];case 3:return[2]}})})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(6);t.me=function(e){return r.__awaiter(this,void 0,void 0,function(){var t;return r.__generator(this,function(n){return(t=i.getActiveUser())?[2,t.me(e)]:[2,null]})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=r.__importDefault(n(3)),o=n(1),s=n(2),u=n(6);t.remove=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,function(){var n,a,c,l;return r.__generator(this,function(r){switch(r.label){case 0:if(n=t.hard,a=u.getActiveUser(),!e)throw new o.KinveyError("An id was not provided.");if(!i.default(e))throw new o.KinveyError("The id provided is not a string.");return c=s.formatKinveyBaasUrl(s.KinveyBaasNamespace.User,"/"+e,{hard:n?!0===n:void 0}),[4,new s.KinveyHttpRequest({method:s.HttpRequestMethod.DELETE,auth:s.KinveyHttpAuth.SessionOrMaster,url:c,timeout:t.timeout}).execute()];case 1:return l=r.sent(),a&&a._id===e?[4,a.logout()]:[3,3];case 2:r.sent(),r.label=3;case 3:return[2,l.data]}})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=r.__importDefault(n(3)),o=n(1),s=n(2);t.resetPassword=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(n){switch(n.label){case 0:if(!e)throw new o.KinveyError("A username was not provided.");if(!i.default(e))throw new o.KinveyError("The provided username is not a string.");return[4,new s.KinveyHttpRequest({method:s.HttpRequestMethod.POST,auth:s.KinveyHttpAuth.App,url:s.formatKinveyBaasUrl(s.KinveyBaasNamespace.Rpc,"/"+e+"/user-password-reset-initiate"),timeout:t.timeout}).execute()];case 1:return[2,n.sent().data]}})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(1);t.restore=function(){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(e){throw new i.KinveyError("This function requires a master secret to be provided for your application. We strongly advise not to do this.")})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(1);t.signUpWithIdentity=function(){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(e){throw new i.KinveyError("This function has been deprecated. You should use MIC to login instead.")})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(6);t.update=function(e,t){return r.__awaiter(this,void 0,void 0,function(){var n;return r.__generator(this,function(r){return(n=i.getActiveUser())?[2,n.update(e,t)]:[2,null]})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=r.__importDefault(n(3)),o=n(1),s=n(2);t.verifyEmail=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(n){switch(n.label){case 0:if(!e)throw new o.KinveyError("A username was not provided.");if(!i.default(e))throw new o.KinveyError("The provided username is not a string.");return[4,new s.KinveyHttpRequest({method:s.HttpRequestMethod.POST,auth:s.KinveyHttpAuth.App,url:s.formatKinveyBaasUrl(s.KinveyBaasNamespace.Rpc,"/"+e+"/user-email-verification-initiate"),timeout:t.timeout}).execute()];case 1:return[2,n.sent().data]}})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(6);t.registerForLiveService=function(e){return r.__awaiter(this,void 0,void 0,function(){var t;return r.__generator(this,function(n){return(t=i.getActiveUser())?[2,t.registerForLiveService(e)]:[2,null]})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(6);t.unregisterFromLiveService=function(e){return r.__awaiter(this,void 0,void 0,function(){var t;return r.__generator(this,function(n){return(t=i.getActiveUser())?[2,t.unregisterFromLiveService(e)]:[2,null]})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(11),i=n(19),o=r.__importDefault(n(184)),s=r.__importStar(n(185)),u=r.__importStar(n(207)),a=r.__importStar(n(208)),c=n(97);function l(e){var t=i.init({kinveyConfig:e,httpAdapter:s,sessionStore:u,popup:a,storageAdapter:c.getStorageAdapter(e.storage),pubnub:o.default});return Object.assign({},t,{storage:e.storage})}t.init=l,t.initialize=function(e){return l(e)}},function(e,t,n){e.exports=function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){if(!navigator||!navigator.sendBeacon)return!1;navigator.sendBeacon(e)}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),s=r(o),u=n(40),a=r(u),c=n(41),l=r(c),f=n(42),h=(n(5),function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=e.listenToBrowserNetworkEvents,r=void 0===n||n;e.db=l.default,e.sdkFamily="Web",e.networking=new a.default({del:f.del,get:f.get,post:f.post,sendBeacon:i});var o=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,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r&&(window.addEventListener("offline",function(){o.networkDownDetected()}),window.addEventListener("online",function(){o.networkUpDetected()})),o}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}(s.default));t.default=h,e.exports=t.default},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n>>2]|=(n[i>>>2]>>>24-i%4*8&255)<<24-(r+i)%4*8;else if(65535>>2]=n[i>>>2];else t.push.apply(t,n);return this.sigBytes+=e,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],r=0;r>>2]>>>24-r%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new s.init(n,t/2)}},c=u.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],r=0;r>>2]>>>24-r%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new s.init(n,t)}},l=u.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},f=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,i=n.sigBytes,o=this.blockSize,u=i/(4*o),u=t?e.ceil(u):e.max((0|u)-this._minBufferSize,0);if(t=u*o,i=e.min(4*t,i),t){for(var a=0;al;){var f;e:{f=c;for(var h=e.sqrt(f),d=2;d<=h;d++)if(!(f%d)){f=!1;break e}f=!0}f&&(8>l&&(s[l]=a(e.pow(c,.5))),u[l]=a(e.pow(c,1/3)),l++),c++}var p=[],r=r.SHA256=o.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],c=n[5],l=n[6],f=n[7],h=0;64>h;h++){if(16>h)p[h]=0|e[t+h];else{var d=p[h-15],v=p[h-2];p[h]=((d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3)+p[h-7]+((v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10)+p[h-16]}d=f+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&c^~a&l)+u[h]+p[h],v=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&i^r&o^i&o),f=l,l=c,c=a,a=s+d|0,s=o,o=i,i=r,r=d+v|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+a|0,n[5]=n[5]+c|0,n[6]=n[6]+l|0,n[7]=n[7]+f|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(r),t.HmacSHA256=o._createHmacHelper(r)}(Math),function(){var e=n,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,n){e=this._hasher=new e.init,"string"==typeof n&&(n=t.parse(n));var r=e.blockSize,i=4*r;n.sigBytes>i&&(n=e.finalize(n)),n.clamp();for(var o=this._oKey=n.clone(),s=this._iKey=n.clone(),u=o.words,a=s.words,c=0;c>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;4>s&&i+.75*s>>6*(3-s)&63));if(t=r.charAt(64))for(;e.length%4;)e.push(t);return e.join("")},parse:function(e){var n=e.length,r=this._map,i=r.charAt(64);i&&-1!=(i=e.indexOf(i))&&(n=i);for(var i=[],o=0,s=0;s>>6-s%4*2;i[o>>>2]|=(u|a)<<24-o%4*8,o++}return t.create(i,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(e){function t(e,t,n,r,i,o,s){return((e=e+(t&n|~t&r)+i+s)<>>32-o)+t}function r(e,t,n,r,i,o,s){return((e=e+(t&r|n&~r)+i+s)<>>32-o)+t}function i(e,t,n,r,i,o,s){return((e=e+(t^n^r)+i+s)<>>32-o)+t}function o(e,t,n,r,i,o,s){return((e=e+(n^(t|~r))+i+s)<>>32-o)+t}for(var s=n,u=s.lib,a=u.WordArray,c=u.Hasher,u=s.algo,l=[],f=0;64>f;f++)l[f]=4294967296*e.abs(e.sin(f+1))|0;u=u.MD5=c.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,n){for(var s=0;16>s;s++){var u=n+s,a=e[u];e[u]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}var s=this._hash.words,u=e[n+0],a=e[n+1],c=e[n+2],f=e[n+3],h=e[n+4],d=e[n+5],p=e[n+6],v=e[n+7],y=e[n+8],_=e[n+9],b=e[n+10],g=e[n+11],m=e[n+12],w=e[n+13],S=e[n+14],x=e[n+15],E=s[0],O=s[1],P=s[2],C=s[3],E=t(E,O,P,C,u,7,l[0]),C=t(C,E,O,P,a,12,l[1]),P=t(P,C,E,O,c,17,l[2]),O=t(O,P,C,E,f,22,l[3]),E=t(E,O,P,C,h,7,l[4]),C=t(C,E,O,P,d,12,l[5]),P=t(P,C,E,O,p,17,l[6]),O=t(O,P,C,E,v,22,l[7]),E=t(E,O,P,C,y,7,l[8]),C=t(C,E,O,P,_,12,l[9]),P=t(P,C,E,O,b,17,l[10]),O=t(O,P,C,E,g,22,l[11]),E=t(E,O,P,C,m,7,l[12]),C=t(C,E,O,P,w,12,l[13]),P=t(P,C,E,O,S,17,l[14]),O=t(O,P,C,E,x,22,l[15]),E=r(E,O,P,C,a,5,l[16]),C=r(C,E,O,P,p,9,l[17]),P=r(P,C,E,O,g,14,l[18]),O=r(O,P,C,E,u,20,l[19]),E=r(E,O,P,C,d,5,l[20]),C=r(C,E,O,P,b,9,l[21]),P=r(P,C,E,O,x,14,l[22]),O=r(O,P,C,E,h,20,l[23]),E=r(E,O,P,C,_,5,l[24]),C=r(C,E,O,P,S,9,l[25]),P=r(P,C,E,O,f,14,l[26]),O=r(O,P,C,E,y,20,l[27]),E=r(E,O,P,C,w,5,l[28]),C=r(C,E,O,P,c,9,l[29]),P=r(P,C,E,O,v,14,l[30]),O=r(O,P,C,E,m,20,l[31]),E=i(E,O,P,C,d,4,l[32]),C=i(C,E,O,P,y,11,l[33]),P=i(P,C,E,O,g,16,l[34]),O=i(O,P,C,E,S,23,l[35]),E=i(E,O,P,C,a,4,l[36]),C=i(C,E,O,P,h,11,l[37]),P=i(P,C,E,O,v,16,l[38]),O=i(O,P,C,E,b,23,l[39]),E=i(E,O,P,C,w,4,l[40]),C=i(C,E,O,P,u,11,l[41]),P=i(P,C,E,O,f,16,l[42]),O=i(O,P,C,E,p,23,l[43]),E=i(E,O,P,C,_,4,l[44]),C=i(C,E,O,P,m,11,l[45]),P=i(P,C,E,O,x,16,l[46]),O=i(O,P,C,E,c,23,l[47]),E=o(E,O,P,C,u,6,l[48]),C=o(C,E,O,P,v,10,l[49]),P=o(P,C,E,O,S,15,l[50]),O=o(O,P,C,E,d,21,l[51]),E=o(E,O,P,C,m,6,l[52]),C=o(C,E,O,P,f,10,l[53]),P=o(P,C,E,O,b,15,l[54]),O=o(O,P,C,E,a,21,l[55]),E=o(E,O,P,C,y,6,l[56]),C=o(C,E,O,P,x,10,l[57]),P=o(P,C,E,O,p,15,l[58]),O=o(O,P,C,E,w,21,l[59]),E=o(E,O,P,C,h,6,l[60]),C=o(C,E,O,P,g,10,l[61]),P=o(P,C,E,O,c,15,l[62]),O=o(O,P,C,E,_,21,l[63]);s[0]=s[0]+E|0,s[1]=s[1]+O|0,s[2]=s[2]+P|0,s[3]=s[3]+C|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;n[i>>>5]|=128<<24-i%32;var o=e.floor(r/4294967296);for(n[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(n.length+1),this._process(),t=this._hash,n=t.words,r=0;4>r;r++)i=n[r],n[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8);return t},clone:function(){var e=c.clone.call(this);return e._hash=this._hash.clone(),e}}),s.MD5=c._createHelper(u),s.HmacMD5=c._createHmacHelper(u)}(Math),function(){var e=n,t=e.lib,r=t.Base,i=t.WordArray,t=e.algo,o=t.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:t.MD5,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,r=n.hasher.create(),o=i.create(),s=o.words,u=n.keySize,n=n.iterations;s.length>>2]}},r.BlockCipher=c.extend({cfg:c.cfg.extend({mode:l,padding:h}),reset:function(){c.reset.call(this);var e=this.cfg,t=e.iv,e=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=e.createEncryptor;else n=e.createDecryptor,this._minBufferSize=1;this._mode=n.call(e,this,t&&t.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var d=r.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),l=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return((e=e.salt)?o.create([1398893684,1701076831]).concat(e).concat(t):t).toString(u)},parse:function(e){var t=(e=u.parse(e)).words;if(1398893684==t[0]&&1701076831==t[1]){var n=o.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return d.create({ciphertext:e,salt:n})}},p=r.SerializableCipher=i.extend({cfg:i.extend({format:l}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var i=e.createEncryptor(n,r);return t=i.finalize(t),i=i.cfg,d.create({ciphertext:t,key:n,iv:i.iv,algorithm:e,mode:i.mode,padding:i.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(n,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),t=(t.kdf={}).OpenSSL={execute:function(e,t,n,r){return r||(r=o.random(8)),e=a.create({keySize:t+n}).compute(e,r),n=o.create(e.words.slice(t),4*n),e.sigBytes=4*t,d.create({key:e,iv:n,salt:r})}},v=r.PasswordBasedCipher=p.extend({cfg:p.cfg.extend({kdf:t}),encrypt:function(e,t,n,r){return r=this.cfg.extend(r),n=r.kdf.execute(n,e.keySize,e.ivSize),r.iv=n.iv,(e=p.encrypt.call(this,e,t,n.key,r)).mixIn(n),e},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),n=r.kdf.execute(n,e.keySize,e.ivSize,t.salt),r.iv=n.iv,p.decrypt.call(this,e,t,n.key,r)}})}(),function(){for(var e=n,t=e.lib.BlockCipher,r=e.algo,i=[],o=[],s=[],u=[],a=[],c=[],l=[],f=[],h=[],d=[],p=[],v=0;256>v;v++)p[v]=128>v?v<<1:v<<1^283;for(var y=0,_=0,v=0;256>v;v++){var b=_^_<<1^_<<2^_<<3^_<<4,b=b>>>8^255&b^99;i[y]=b,o[b]=y;var g=p[y],m=p[g],w=p[m],S=257*p[b]^16843008*b;s[y]=S<<24|S>>>8,u[y]=S<<16|S>>>16,a[y]=S<<8|S>>>24,c[y]=S,S=16843009*w^65537*m^257*g^16843008*y,l[b]=S<<24|S>>>8,f[b]=S<<16|S>>>16,h[b]=S<<8|S>>>24,d[b]=S,y?(y=g^p[p[p[w^g]]],_^=p[p[_]]):y=_=1}var x=[0,1,2,4,8,16,32,64,128,27,54],r=r.AES=t.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes/4,e=4*((this._nRounds=n+6)+1),r=this._keySchedule=[],o=0;o>>24]<<24|i[s>>>16&255]<<16|i[s>>>8&255]<<8|i[255&s]):(s=i[(s=s<<8|s>>>24)>>>24]<<24|i[s>>>16&255]<<16|i[s>>>8&255]<<8|i[255&s],s^=x[o/n|0]<<24),r[o]=r[o-n]^s}for(t=this._invKeySchedule=[],n=0;nn||4>=o?s:l[i[s>>>24]]^f[i[s>>>16&255]]^h[i[s>>>8&255]]^d[i[255&s]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,u,a,c,i)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,l,f,h,d,o),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,o,s,u){for(var a=this._nRounds,c=e[t]^n[0],l=e[t+1]^n[1],f=e[t+2]^n[2],h=e[t+3]^n[3],d=4,p=1;p>>24]^i[l>>>16&255]^o[f>>>8&255]^s[255&h]^n[d++],y=r[l>>>24]^i[f>>>16&255]^o[h>>>8&255]^s[255&c]^n[d++],_=r[f>>>24]^i[h>>>16&255]^o[c>>>8&255]^s[255&l]^n[d++],h=r[h>>>24]^i[c>>>16&255]^o[l>>>8&255]^s[255&f]^n[d++],c=v,l=y,f=_;v=(u[c>>>24]<<24|u[l>>>16&255]<<16|u[f>>>8&255]<<8|u[255&h])^n[d++],y=(u[l>>>24]<<24|u[f>>>16&255]<<16|u[h>>>8&255]<<8|u[255&c])^n[d++],_=(u[f>>>24]<<24|u[h>>>16&255]<<16|u[c>>>8&255]<<8|u[255&l])^n[d++],h=(u[h>>>24]<<24|u[c>>>16&255]<<16|u[l>>>8&255]<<8|u[255&f])^n[d++],e[t]=v,e[t+1]=y,e[t+2]=_,e[t+3]=h},keySize:8});e.AES=t._createHelper(r)}(),n.mode.ECB=function(){var e=n.lib.BlockCipherMode.extend();return e.Encryptor=e.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),e.Decryptor=e.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),e}(),e.exports=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n=s){var a={};a.category=v.default.PNRequestMessageCountExceededCategory,a.operation=e.operation,this._listenerManager.announceStatus(a)}i.forEach(function(e){var t=e.channel,r=e.subscriptionMatch,i=e.publishMetaData;if(t===r&&(r=null),u){if(n._dedupingManager.isDuplicate(e))return;n._dedupingManager.addEntry(e)}if(d.default.endsWith(e.channel,"-pnpres")){var o={channel:null,subscription:null};o.actualChannel=null!=r?t:null,o.subscribedChannel=null!=r?r:t,t&&(o.channel=t.substring(0,t.lastIndexOf("-pnpres"))),r&&(o.subscription=r.substring(0,r.lastIndexOf("-pnpres"))),o.action=e.payload.action,o.state=e.payload.data,o.timetoken=i.publishTimetoken,o.occupancy=e.payload.occupancy,o.uuid=e.payload.uuid,o.timestamp=e.payload.timestamp,e.payload.join&&(o.join=e.payload.join),e.payload.leave&&(o.leave=e.payload.leave),e.payload.timeout&&(o.timeout=e.payload.timeout),n._listenerManager.announcePresence(o)}else{var s={channel:null,subscription:null};s.actualChannel=null!=r?t:null,s.subscribedChannel=null!=r?r:t,s.channel=t,s.subscription=r,s.timetoken=i.publishTimetoken,s.publisher=e.issuingClientId,e.userMetadata&&(s.userMetadata=e.userMetadata),n._config.cipherKey?s.message=n._crypto.decrypt(e.payload):s.message=e.payload,n._listenerManager.announceMessage(s)}}),this._region=t.metadata.region,this._startSubscribeLoop()}}},{key:"_stopSubscribeLoop",value:function(){this._subscribeCall&&("function"==typeof this._subscribeCall.abort&&this._subscribeCall.abort(),this._subscribeCall=null)}}]),e}();t.default=y,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n=this._config.maximumCacheSize&&this.hashHistory.shift(),this.hashHistory.push(this.getKey(e))}},{key:"clearHistory",value:function(){this.hashHistory=[]}}]),e}();t.default=o,e.exports=t.default},function(e,t){"use strict";function n(e){return encodeURIComponent(e).replace(/[!~*'()]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}function r(e){return function(e){var t=[];return Object.keys(e).forEach(function(e){return t.push(e)}),t}(e).sort()}e.exports={signPamFromParams:function(e){return r(e).map(function(t){return t+"="+n(e[t])}).join("&")},endsWith:function(e,t){return-1!==e.indexOf(t,this.length-t.length)},createPromise:function(){var e=void 0,t=void 0;return{promise:new Promise(function(n,r){e=n,t=r}),reject:t,fulfill:e}},encodeString:n}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){return function(e,t){return e.type=t,e.error=!0,e}({message:e},"validationError")}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=e.networking,r=e.config,o=null,u=null,c={};t.getOperation()===f.default.PNTimeOperation||t.getOperation()===f.default.PNChannelGroupsOperation?o=arguments.length<=2?void 0:arguments[2]:(c=arguments.length<=2?void 0:arguments[2],o=arguments.length<=3?void 0:arguments[3]),"undefined"==typeof Promise||o||(u=a.default.createPromise());var l=t.validateParams(e,c);if(!l){var d=t.prepareParams(e,c),p=function(e,t,n){return e.usePost&&e.usePost(t,n)?e.postURL(t,n):e.getURL(t,n)}(t,e,c),v=void 0,y={url:p,operation:t.getOperation(),timeout:t.getRequestTimeout(e)};d.uuid=r.UUID,d.pnsdk=function(e){if(e.sdkName)return e.sdkName;var t="PubNub-JS-"+e.sdkFamily;return e.partnerId&&(t+="-"+e.partnerId),t+="/"+e.getVersion()}(r),r.useInstanceId&&(d.instanceid=r.instanceId),r.useRequestId&&(d.requestid=s.default.createUUID()),t.isAuthSupported()&&r.getAuthKey()&&(d.auth=r.getAuthKey()),r.secretKey&&function(e,t,n){var r=e.config,i=e.crypto;n.timestamp=Math.floor((new Date).getTime()/1e3);var o=r.subscribeKey+"\n"+r.publishKey+"\n"+t+"\n";o+=a.default.signPamFromParams(n);var s=i.HMACSHA256(o);s=(s=s.replace(/\+/g,"-")).replace(/\//g,"_"),n.signature=s}(e,p,d);var _=function(n,r){if(n.error)o?o(n):u&&u.reject(new h("PubNub call failed, check status for details",n));else{var i=t.handleResponse(e,r,c);o?o(n,i):u&&u.fulfill(i)}};if(t.usePost&&t.usePost(e,c)){var b=t.postPayload(e,c);v=n.POST(d,b,y,_)}else v=t.useDelete&&t.useDelete()?n.DELETE(d,y,_):n.GET(d,y,_);return t.getOperation()===f.default.PNSubscribeOperation?v:u?u.promise:void 0}return o?o(i(l)):u?(u.reject(new h("Validation failed, check status for details",i(l))),u.promise):void 0};var o=n(3),s=r(o),u=(n(5),n(15)),a=r(u),c=n(2),l=(r(c),n(13)),f=r(l),h=function(e){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=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,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.name=r.constructor.name,r.status=n,r.message=e,r}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}(Error);e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNAddChannelsToGroupOperation},t.validateParams=function(e,t){var n=t.channels,r=t.channelGroup,i=e.config;return r?n&&0!==n.length?i.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing Channel Group"},t.getURL=function(e,t){var n=t.channelGroup;return"/v1/channel-registration/sub-key/"+e.config.subscribeKey+"/channel-group/"+u.default.encodeString(n)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channels;return{add:(void 0===n?[]:n).join(",")}},t.handleResponse=function(){return{}};var i=(n(5),n(13)),o=r(i),s=n(15),u=r(s)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNRemoveChannelsFromGroupOperation},t.validateParams=function(e,t){var n=t.channels,r=t.channelGroup,i=e.config;return r?n&&0!==n.length?i.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing Channel Group"},t.getURL=function(e,t){var n=t.channelGroup;return"/v1/channel-registration/sub-key/"+e.config.subscribeKey+"/channel-group/"+u.default.encodeString(n)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channels;return{remove:(void 0===n?[]:n).join(",")}},t.handleResponse=function(){return{}};var i=(n(5),n(13)),o=r(i),s=n(15),u=r(s)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNRemoveGroupOperation},t.validateParams=function(e,t){var n=t.channelGroup,r=e.config;return n?r.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channel Group"},t.getURL=function(e,t){var n=t.channelGroup;return"/v1/channel-registration/sub-key/"+e.config.subscribeKey+"/channel-group/"+u.default.encodeString(n)+"/remove"},t.isAuthSupported=function(){return!0},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.prepareParams=function(){return{}},t.handleResponse=function(){return{}};var i=(n(5),n(13)),o=r(i),s=n(15),u=r(s)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNChannelGroupsOperation},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e){return"/v1/channel-registration/sub-key/"+e.config.subscribeKey+"/channel-group"},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.handleResponse=function(e,t){return{groups:t.payload.groups}};var r=(n(5),n(13)),i=function(e){return e&&e.__esModule?e:{default:e}}(r)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNChannelsForGroupOperation},t.validateParams=function(e,t){var n=t.channelGroup,r=e.config;return n?r.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channel Group"},t.getURL=function(e,t){var n=t.channelGroup;return"/v1/channel-registration/sub-key/"+e.config.subscribeKey+"/channel-group/"+u.default.encodeString(n)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.handleResponse=function(e,t){return{channels:t.payload.channels}};var i=(n(5),n(13)),o=r(i),s=n(15),u=r(s)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNPushNotificationEnabledChannelsOperation},t.validateParams=function(e,t){var n=t.device,r=t.pushGateway,i=t.channels,o=e.config;return n?r?i&&0!==i.length?o.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing GW Type (pushGateway: gcm or apns)":"Missing Device ID (device)"},t.getURL=function(e,t){var n=t.device;return"/v1/push/sub-key/"+e.config.subscribeKey+"/devices/"+n},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,r=t.channels;return{type:n,add:(void 0===r?[]:r).join(",")}},t.handleResponse=function(){return{}};var r=(n(5),n(13)),i=function(e){return e&&e.__esModule?e:{default:e}}(r)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNPushNotificationEnabledChannelsOperation},t.validateParams=function(e,t){var n=t.device,r=t.pushGateway,i=t.channels,o=e.config;return n?r?i&&0!==i.length?o.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing GW Type (pushGateway: gcm or apns)":"Missing Device ID (device)"},t.getURL=function(e,t){var n=t.device;return"/v1/push/sub-key/"+e.config.subscribeKey+"/devices/"+n},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,r=t.channels;return{type:n,remove:(void 0===r?[]:r).join(",")}},t.handleResponse=function(){return{}};var r=(n(5),n(13)),i=function(e){return e&&e.__esModule?e:{default:e}}(r)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNPushNotificationEnabledChannelsOperation},t.validateParams=function(e,t){var n=t.device,r=t.pushGateway,i=e.config;return n?r?i.subscribeKey?void 0:"Missing Subscribe Key":"Missing GW Type (pushGateway: gcm or apns)":"Missing Device ID (device)"},t.getURL=function(e,t){var n=t.device;return"/v1/push/sub-key/"+e.config.subscribeKey+"/devices/"+n},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){return{type:t.pushGateway}},t.handleResponse=function(e,t){return{channels:t}};var r=(n(5),n(13)),i=function(e){return e&&e.__esModule?e:{default:e}}(r)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNRemoveAllPushNotificationsOperation},t.validateParams=function(e,t){var n=t.device,r=t.pushGateway,i=e.config;return n?r?i.subscribeKey?void 0:"Missing Subscribe Key":"Missing GW Type (pushGateway: gcm or apns)":"Missing Device ID (device)"},t.getURL=function(e,t){var n=t.device;return"/v1/push/sub-key/"+e.config.subscribeKey+"/devices/"+n+"/remove"},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){return{type:t.pushGateway}},t.handleResponse=function(){return{}};var r=(n(5),n(13)),i=function(e){return e&&e.__esModule?e:{default:e}}(r)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNUnsubscribeOperation},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,o=i.length>0?i.join(","):",";return"/v2/presence/sub-key/"+n.subscribeKey+"/channel/"+u.default.encodeString(o)+"/leave"},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i={};return r.length>0&&(i["channel-group"]=r.join(",")),i},t.handleResponse=function(){return{}};var i=(n(5),n(13)),o=r(i),s=n(15),u=r(s)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNWhereNowOperation},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e,t){var n=e.config,r=t.uuid,i=void 0===r?n.UUID:r;return"/v2/presence/sub-key/"+n.subscribeKey+"/uuid/"+i},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.handleResponse=function(e,t){return t.payload?{channels:t.payload.channels}:{channels:[]}};var r=(n(5),n(13)),i=function(e){return e&&e.__esModule?e:{default:e}}(r)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNHeartbeatOperation},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,o=i.length>0?i.join(","):",";return"/v2/presence/sub-key/"+n.subscribeKey+"/channel/"+u.default.encodeString(o)+"/heartbeat"},t.isAuthSupported=function(){return!0},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.prepareParams=function(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i=t.state,o=void 0===i?{}:i,s=e.config,u={};return r.length>0&&(u["channel-group"]=r.join(",")),u.state=JSON.stringify(o),u.heartbeat=s.getPresenceTimeout(),u},t.handleResponse=function(){return{}};var i=(n(5),n(13)),o=r(i),s=n(15),u=r(s)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNGetStateOperation},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e,t){var n=e.config,r=t.uuid,i=void 0===r?n.UUID:r,o=t.channels,s=void 0===o?[]:o,a=s.length>0?s.join(","):",";return"/v2/presence/sub-key/"+n.subscribeKey+"/channel/"+u.default.encodeString(a)+"/uuid/"+i},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i={};return r.length>0&&(i["channel-group"]=r.join(",")),i},t.handleResponse=function(e,t,n){var r=n.channels,i=void 0===r?[]:r,o=n.channelGroups,s=void 0===o?[]:o,u={};return 1===i.length&&0===s.length?u[i[0]]=t.payload:u=t.payload,{channels:u}};var i=(n(5),n(13)),o=r(i),s=n(15),u=r(s)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNSetStateOperation},t.validateParams=function(e,t){var n=e.config,r=t.state,i=t.channels,o=void 0===i?[]:i,s=t.channelGroups,u=void 0===s?[]:s;return r?n.subscribeKey?0===o.length&&0===u.length?"Please provide a list of channels and/or channel-groups":void 0:"Missing Subscribe Key":"Missing State"},t.getURL=function(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,o=i.length>0?i.join(","):",";return"/v2/presence/sub-key/"+n.subscribeKey+"/channel/"+u.default.encodeString(o)+"/uuid/"+n.UUID+"/data"},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.state,r=t.channelGroups,i=void 0===r?[]:r,o={};return o.state=JSON.stringify(n),i.length>0&&(o["channel-group"]=i.join(",")),o},t.handleResponse=function(e,t){return{state:t.payload}};var i=(n(5),n(13)),o=r(i),s=n(15),u=r(s)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNHereNowOperation},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,o=t.channelGroups,s=void 0===o?[]:o,a="/v2/presence/sub-key/"+n.subscribeKey;if(i.length>0||s.length>0){var c=i.length>0?i.join(","):",";a+="/channel/"+u.default.encodeString(c)}return a},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i=t.includeUUIDs,o=void 0===i||i,s=t.includeState,u=void 0!==s&&s,a={};return o||(a.disable_uuids=1),u&&(a.state=1),r.length>0&&(a["channel-group"]=r.join(",")),a},t.handleResponse=function(e,t,n){var r=n.channels,i=void 0===r?[]:r,o=n.channelGroups,s=void 0===o?[]:o,u=n.includeUUIDs,a=void 0===u||u,c=n.includeState,l=void 0!==c&&c;return i.length>1||s.length>0||0===s.length&&0===i.length?function(){var e={};return e.totalChannels=t.payload.total_channels,e.totalOccupancy=t.payload.total_occupancy,e.channels={},Object.keys(t.payload.channels).forEach(function(n){var r=t.payload.channels[n],i=[];return e.channels[n]={occupants:i,name:n,occupancy:r.occupancy},a&&r.uuids.forEach(function(e){l?i.push({state:e.state,uuid:e.uuid}):i.push({state:null,uuid:e})}),e}),e}():function(){var e={},n=[];return e.totalChannels=1,e.totalOccupancy=t.occupancy,e.channels={},e.channels[i[0]]={occupants:n,name:i[0],occupancy:t.occupancy},a&&t.uuids&&t.uuids.forEach(function(e){l?n.push({state:e.state,uuid:e.uuid}):n.push({state:null,uuid:e})}),e}()};var i=(n(5),n(13)),o=r(i),s=n(15),u=r(s)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNAccessManagerAudit},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e){return"/v2/auth/audit/sub-key/"+e.config.subscribeKey},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!1},t.prepareParams=function(e,t){var n=t.channel,r=t.channelGroup,i=t.authKeys,o=void 0===i?[]:i,s={};return n&&(s.channel=n),r&&(s["channel-group"]=r),o.length>0&&(s.auth=o.join(",")),s},t.handleResponse=function(e,t){return t.payload};var r=(n(5),n(13)),i=function(e){return e&&e.__esModule?e:{default:e}}(r)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNAccessManagerGrant},t.validateParams=function(e){var t=e.config;return t.subscribeKey?t.publishKey?t.secretKey?void 0:"Missing Secret Key":"Missing Publish Key":"Missing Subscribe Key"},t.getURL=function(e){return"/v2/auth/grant/sub-key/"+e.config.subscribeKey},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!1},t.prepareParams=function(e,t){var n=t.channels,r=void 0===n?[]:n,i=t.channelGroups,o=void 0===i?[]:i,s=t.ttl,u=t.read,a=void 0!==u&&u,c=t.write,l=void 0!==c&&c,f=t.manage,h=void 0!==f&&f,d=t.authKeys,p=void 0===d?[]:d,v={};return v.r=a?"1":"0",v.w=l?"1":"0",v.m=h?"1":"0",r.length>0&&(v.channel=r.join(",")),o.length>0&&(v["channel-group"]=o.join(",")),p.length>0&&(v.auth=p.join(",")),(s||0===s)&&(v.ttl=s),v},t.handleResponse=function(){return{}};var r=(n(5),n(13)),i=function(e){return e&&e.__esModule?e:{default:e}}(r)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=e.crypto,r=e.config,i=JSON.stringify(t);return r.cipherKey&&(i=n.encrypt(i),i=JSON.stringify(i)),i}Object.defineProperty(t,"__esModule",{value:!0});var o="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.getOperation=function(){return u.default.PNPublishOperation},t.validateParams=function(e,t){var n=e.config,r=t.message;return t.channel?r?n.subscribeKey?void 0:"Missing Subscribe Key":"Missing Message":"Missing Channel"},t.usePost=function(e,t){var n=t.sendByPost;return void 0!==n&&n},t.getURL=function(e,t){var n=e.config,r=t.channel,o=t.message,s=i(e,o);return"/publish/"+n.publishKey+"/"+n.subscribeKey+"/0/"+c.default.encodeString(r)+"/0/"+c.default.encodeString(s)},t.postURL=function(e,t){var n=e.config,r=t.channel;return"/publish/"+n.publishKey+"/"+n.subscribeKey+"/0/"+c.default.encodeString(r)+"/0"},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.postPayload=function(e,t){return i(e,t.message)},t.prepareParams=function(e,t){var n=t.meta,r=t.replicate,i=void 0===r||r,s=t.storeInHistory,u=t.ttl,a={};return null!=s&&(a.store=s?"1":"0"),u&&(a.ttl=u),!1===i&&(a.norep="true"),n&&"object"===(void 0===n?"undefined":o(n))&&(a.meta=JSON.stringify(n)),a},t.handleResponse=function(e,t){return{timetoken:t[2]}};var s=(n(5),n(13)),u=r(s),a=n(15),c=r(a)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=e.config,r=e.crypto;if(!n.cipherKey)return t;try{return r.decrypt(t)}catch(e){return t}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return s.default.PNHistoryOperation},t.validateParams=function(e,t){var n=t.channel,r=e.config;return n?r.subscribeKey?void 0:"Missing Subscribe Key":"Missing channel"},t.getURL=function(e,t){var n=t.channel;return"/v2/history/sub-key/"+e.config.subscribeKey+"/channel/"+a.default.encodeString(n)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.start,r=t.end,i=t.reverse,o=t.count,s=void 0===o?100:o,u=t.stringifiedTimeToken,a=void 0!==u&&u,c={include_token:"true"};return c.count=s,n&&(c.start=n),r&&(c.end=r),a&&(c.string_message_token="true"),null!=i&&(c.reverse=i.toString()),c},t.handleResponse=function(e,t){var n={messages:[],startTimeToken:t[1],endTimeToken:t[2]};return t[0].forEach(function(t){var r={timetoken:t.timetoken,entry:i(e,t.message)};n.messages.push(r)}),n};var o=(n(5),n(13)),s=r(o),u=n(15),a=r(u)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNDeleteMessagesOperation},t.validateParams=function(e,t){var n=t.channel,r=e.config;return n?r.subscribeKey?void 0:"Missing Subscribe Key":"Missing channel"},t.useDelete=function(){return!0},t.getURL=function(e,t){var n=t.channel;return"/v3/history/sub-key/"+e.config.subscribeKey+"/channel/"+u.default.encodeString(n)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.start,r=t.end,i={};return n&&(i.start=n),r&&(i.end=r),i},t.handleResponse=function(e,t){return t.payload};var i=(n(5),n(13)),o=r(i),s=n(15),u=r(s)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var s,u=e[Symbol.iterator]();!(r=(s=u.next()).done)&&(n.push(s.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&u.return&&u.return()}finally{if(i)throw o}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};t.getOperation=function(){return s.default.PNMessageCounts},t.validateParams=function(e,t){var n=t.channels,r=t.timetoken,i=t.channelTimetokens,o=e.config;return n?r&&i?"timetoken and channelTimetokens are incompatible together":r&&i&&i.length>1&&n.length!==i.length?"Length of channelTimetokens and channels do not match":o.subscribeKey?void 0:"Missing Subscribe Key":"Missing channel"},t.getURL=function(e,t){var n=t.channels,r=e.config,i=n.join(",");return"/v3/history/sub-key/"+r.subscribeKey+"/message-counts/"+a.default.encodeString(i)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.timetoken,r=t.channelTimetokens,o={};if(r&&1===r.length){var s=i(r,1),u=s[0];o.timetoken=u}else r?o.channelsTimetoken=r.join(","):n&&(o.timetoken=n);return o},t.handleResponse=function(e,t){return{channels:t.channels}};var o=n(13),s=r(o),u=n(15),a=r(u)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNFetchMessagesOperation},t.validateParams=function(e,t){var n=t.channels,r=e.config;return n&&0!==n.length?r.subscribeKey?void 0:"Missing Subscribe Key":"Missing channels"},t.getURL=function(e,t){var n=t.channels,r=void 0===n?[]:n,i=e.config,o=r.length>0?r.join(","):",";return"/v3/history/sub-key/"+i.subscribeKey+"/channel/"+u.default.encodeString(o)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.start,r=t.end,i=t.count,o=t.stringifiedTimeToken,s=void 0!==o&&o,u={};return i&&(u.max=i),n&&(u.start=n),r&&(u.end=r),s&&(u.string_message_token="true"),u},t.handleResponse=function(e,t){var n={channels:{}};return Object.keys(t.channels||{}).forEach(function(r){n.channels[r]=[],(t.channels[r]||[]).forEach(function(t){var i={};i.channel=r,i.subscription=null,i.timetoken=t.timetoken,i.message=function(e,t){var n=e.config,r=e.crypto;if(!n.cipherKey)return t;try{return r.decrypt(t)}catch(e){return t}}(e,t.message),n.channels[r].push(i)})}),n};var i=(n(5),n(13)),o=r(i),s=n(15),u=r(s)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNSubscribeOperation},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,o=i.length>0?i.join(","):",";return"/v2/subscribe/"+n.subscribeKey+"/"+u.default.encodeString(o)+"/0"},t.getRequestTimeout=function(e){return e.config.getSubscribeTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=e.config,r=t.channelGroups,i=void 0===r?[]:r,o=t.timetoken,s=t.filterExpression,u=t.region,a={heartbeat:n.getPresenceTimeout()};return i.length>0&&(a["channel-group"]=i.join(",")),s&&s.length>0&&(a["filter-expr"]=s),o&&(a.tt=o),u&&(a.tr=u),a},t.handleResponse=function(e,t){var n=[];t.m.forEach(function(e){var t={publishTimetoken:e.p.t,region:e.p.r},r={shard:parseInt(e.a,10),subscriptionMatch:e.b,channel:e.c,payload:e.d,flags:e.f,issuingClientId:e.i,subscribeKey:e.k,originationTimetoken:e.o,userMetadata:e.u,publishMetaData:t};n.push(r)});var r={timetoken:t.t.t,region:t.t.r};return{messages:n,metadata:r}};var i=(n(5),n(13)),o=r(i),s=n(15),u=r(s)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n=this._maxSubDomain&&(this._currentSubDomain=1),e=this._currentSubDomain.toString(),this._providedFQDN.replace("pubsub","ps"+e)}},{key:"hasModule",value:function(e){return e in this._modules}},{key:"shiftStandardOrigin",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._standardOrigin=this.nextOrigin(e),this._standardOrigin}},{key:"getStandardOrigin",value:function(){return this._standardOrigin}},{key:"POST",value:function(e,t,n,r){return this._modules.post(e,t,n,r)}},{key:"GET",value:function(e,t,n){return this._modules.get(e,t,n)}},{key:"DELETE",value:function(e,t,n){return this._modules.del(e,t,n)}},{key:"_detectErrorCategory",value:function(e){if("ENOTFOUND"===e.code)return u.default.PNNetworkIssuesCategory;if("ECONNREFUSED"===e.code)return u.default.PNNetworkIssuesCategory;if("ECONNRESET"===e.code)return u.default.PNNetworkIssuesCategory;if("EAI_AGAIN"===e.code)return u.default.PNNetworkIssuesCategory;if(0===e.status||e.hasOwnProperty("status")&&void 0===e.status)return u.default.PNNetworkIssuesCategory;if(e.timeout)return u.default.PNTimeoutCategory;if("ETIMEDOUT"===e.code)return u.default.PNNetworkIssuesCategory;if(e.response){if(e.response.badRequest)return u.default.PNBadRequestCategory;if(e.response.forbidden)return u.default.PNAccessDeniedCategory}return u.default.PNUnknownCategory}}]),e}());t.default=a,e.exports=t.default},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={get:function(e){try{return localStorage.getItem(e)}catch(e){return null}},set:function(e,t){try{return localStorage.setItem(e,t)}catch(e){return null}}},e.exports=t.default},function(e,t,n){"use strict";function r(e){var t=(new Date).getTime(),n=(new Date).toISOString(),r=console&&console.log?console:window&&window.console&&window.console.log?window.console:console;r.log("<<<<<"),r.log("["+n+"]","\n",e.url,"\n",e.qs),r.log("-----"),e.on("response",function(n){var i=(new Date).getTime(),o=i-t,s=(new Date).toISOString();r.log(">>>>>>"),r.log("["+s+" / "+o+"]","\n",e.url,"\n",e.qs,"\n",n.text),r.log("-----")})}function i(e,t,n){var i=this;return this._config.logVerbosity&&(e=e.use(r)),this._config.proxy&&this._modules.proxy&&(e=this._modules.proxy.call(this,e)),this._config.keepAlive&&this._modules.keepAlive&&(e=this._modules.keepAlive(e)),e.timeout(t.timeout).end(function(e,r){var o={};if(o.error=null!==e,o.operation=t.operation,r&&r.status&&(o.statusCode=r.status),e){if(e.response&&e.response.text&&!i._config.logVerbosity)try{o.errorData=JSON.parse(e.response.text)}catch(t){o.errorData=e}else o.errorData=e;return o.category=i._detectErrorCategory(e),n(o,null)}var s=JSON.parse(r.text);return s.error&&1===s.error&&s.status&&s.message&&s.service?(o.errorData=s,o.statusCode=s.status,o.error=!0,o.category=i._detectErrorCategory(o),n(o,null)):n(o,s)})}Object.defineProperty(t,"__esModule",{value:!0}),t.get=function(e,t,n){var r=s.default.get(this.getStandardOrigin()+t.url).query(e);return i.call(this,r,t,n)},t.post=function(e,t,n,r){var o=s.default.post(this.getStandardOrigin()+n.url).query(e).send(t);return i.call(this,o,n,r)},t.del=function(e,t,n){var r=s.default.delete(this.getStandardOrigin()+t.url).query(e);return i.call(this,r,t,n)};var o=n(43),s=function(e){return e&&e.__esModule?e:{default:e}}(o);n(5)},function(e,t,n){function r(){}function i(e){if(!p(e))return e;var t=[];for(var n in e)o(t,n,e[n]);return t.join("&")}function o(e,t,n){if(null!=n)if(Array.isArray(n))n.forEach(function(n){o(e,t,n)});else if(p(n))for(var r in n)o(e,t+"["+r+"]",n[r]);else e.push(encodeURIComponent(t)+"="+encodeURIComponent(n));else null===n&&e.push(encodeURIComponent(t))}function s(e){for(var t,n,r={},i=e.split("&"),o=0,s=i.length;o=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4==n){var r;try{r=t.status}catch(e){r=0}if(!r){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}};var r=function(t,n){n.total>0&&(n.percent=n.loaded/n.total*100),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{t.onprogress=r.bind(null,"download"),t.upload&&(t.upload.onprogress=r.bind(null,"upload"))}catch(e){}try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(e){return this.callback(e)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof n&&!this._isHost(n)){var i=this._header["content-type"],o=this._serializer||_.serialize[i?i.split(";")[0]:""];!o&&u(i)&&(o=_.serialize["application/json"]),o&&(n=o(n))}for(var s in this.header)null!=this.header[s]&&this.header.hasOwnProperty(s)&&t.setRequestHeader(s,this.header[s]);return this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0!==n?n:null),this},_.agent=function(){return new y},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach(function(e){y.prototype[e.toLowerCase()]=function(t,n){var r=new _.Request(e,t);return this._setDefaults(r),n&&r.end(n),r}}),y.prototype.del=y.prototype.delete,_.get=function(e,t,n){var r=_("GET",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},_.head=function(e,t,n){var r=_("HEAD",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},_.options=function(e,t,n){var r=_("OPTIONS",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},_.del=l,_.delete=l,_.patch=function(e,t,n){var r=_("PATCH",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},_.post=function(e,t,n){var r=_("POST",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},_.put=function(e,t,n){var r=_("PUT",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r}},function(e,t,n){function r(e){if(e)return function(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}(e)}e.exports=r,r.prototype.on=r.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},r.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var r,i=0;i=this._maxRetries)return!1;if(this._retryCallback)try{var n=this._retryCallback(e,t);if(!0===n)return!0;if(!1===n)return!1}catch(e){console.error(e)}if(t&&t.status&&t.status>=500&&501!=t.status)return!0;if(e){if(e.code&&~o.indexOf(e.code))return!0;if(e.timeout&&"ECONNABORTED"==e.code)return!0;if(e.crossDomain)return!0}return!1},r.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this._end()},r.prototype.then=function(e,t){if(!this._fullfilledPromise){var n=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise(function(e,t){n.end(function(n,r){n?t(n):e(r)})})}return this._fullfilledPromise.then(e,t)},r.prototype.catch=function(e){return this.then(void 0,e)},r.prototype.use=function(e){return e(this),this},r.prototype.ok=function(e){if("function"!=typeof e)throw Error("Callback required");return this._okCallback=e,this},r.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},r.prototype.get=function(e){return this._header[e.toLowerCase()]},r.prototype.getHeader=r.prototype.get,r.prototype.set=function(e,t){if(i(e)){for(var n in e)this.set(n,e[n]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},r.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},r.prototype.field=function(e,t){if(null==e)throw new Error(".field(name, val) name can not be empty");if(this._data&&console.error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()"),i(e)){for(var n in e)this.field(n,e[n]);return this}if(Array.isArray(t)){for(var r in t)this.field(e,t[r]);return this}if(null==t)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof t&&(t=""+t),this._getFormData().append(e,t),this},r.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},r.prototype._auth=function(e,t,n,r){switch(n.type){case"basic":this.set("Authorization","Basic "+r(e+":"+t));break;case"auto":this.username=e,this.password=t;break;case"bearer":this.set("Authorization","Bearer "+e)}return this},r.prototype.withCredentials=function(e){return null==e&&(e=!0),this._withCredentials=e,this},r.prototype.redirects=function(e){return this._maxRedirects=e,this},r.prototype.maxResponseSize=function(e){if("number"!=typeof e)throw TypeError("Invalid argument");return this._maxResponseSize=e,this},r.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},r.prototype.send=function(e){var t=i(e),n=this._header["content-type"];if(this._formData&&console.error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()"),t&&!this._data)Array.isArray(e)?this._data=[]:this._isHost(e)||(this._data={});else if(e&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(t&&i(this._data))for(var r in e)this._data[r]=e[r];else"string"==typeof e?(n||this.type("form"),n=this._header["content-type"],this._data="application/x-www-form-urlencoded"==n?this._data?this._data+"&"+e:e:(this._data||"")+e):this._data=e;return!t||this._isHost(e)?this:(n||this.type("json"),this)},r.prototype.sortQuery=function(e){return this._sort=void 0===e||e,this},r.prototype._finalizeQueryString=function(){var e=this._query.join("&");if(e&&(this.url+=(this.url.indexOf("?")>=0?"&":"?")+e),this._query.length=0,this._sort){var t=this.url.indexOf("?");if(t>=0){var n=this.url.substring(t+1).split("&");"function"==typeof this._sort?n.sort(this._sort):n.sort(),this.url=this.url.substring(0,t)+"?"+n.join("&")}}},r.prototype._appendQueryString=function(){console.trace("Unsupported")},r.prototype._timeoutError=function(e,t,n){if(!this._aborted){var r=new Error(e+t+"ms exceeded");r.timeout=t,r.code="ECONNABORTED",r.errno=n,this.timedout=!0,this.abort(),this.callback(r)}},r.prototype._setTimeouts=function(){var e=this;this._timeout&&!this._timer&&(this._timer=setTimeout(function(){e._timeoutError("Timeout of ",e._timeout,"ETIME")},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(function(){e._timeoutError("Response timeout of ",e._responseTimeout,"ETIMEDOUT")},this._responseTimeout))}},function(e,t){"use strict";e.exports=function(e){return null!==e&&"object"==typeof e}},function(e,t,n){"use strict";function r(e){if(e)return function(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}(e)}var i=n(48);e.exports=r,r.prototype.get=function(e){return this.header[e.toLowerCase()]},r.prototype._setHeaderProperties=function(e){var t=e["content-type"]||"";this.type=i.type(t);var n=i.params(t);for(var r in n)this[r]=n[r];this.links={};try{e.link&&(this.links=i.parseLinks(e.link))}catch(e){}},r.prototype._setStatusProperties=function(e){var t=e/100|0;this.status=this.statusCode=e,this.statusType=t,this.info=1==t,this.ok=2==t,this.redirect=3==t,this.clientError=4==t,this.serverError=5==t,this.error=(4==t||5==t)&&this.toError(),this.accepted=202==e,this.noContent=204==e,this.badRequest=400==e,this.unauthorized=401==e,this.notAcceptable=406==e,this.forbidden=403==e,this.notFound=404==e}},function(e,t){"use strict";t.type=function(e){return e.split(/ *; */).shift()},t.params=function(e){return e.split(/ *; */).reduce(function(e,t){var n=t.split(/ *= */),r=n.shift(),i=n.shift();return r&&i&&(e[r]=i),e},{})},t.parseLinks=function(e){return e.split(/ *, */).reduce(function(e,t){var n=t.split(/ *; */),r=n[0].slice(1,-1);return e[n[1].split(/ *= */)[1].slice(1,-1)]=r,e},{})},t.cleanHeader=function(e,t){return delete e["content-type"],delete e["content-length"],delete e["transfer-encoding"],delete e.host,t&&(delete e.authorization,delete e.cookie),e}},function(e,t){function n(){this._defaults=[]}["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert"].forEach(function(e){n.prototype[e]=function(){return this._defaults.push({fn:e,arguments:arguments}),this}}),n.prototype._setDefaults=function(e){this._defaults.forEach(function(t){e[t.fn].apply(e,t.arguments)})},e.exports=n}])},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(11),i=r.__importDefault(n(186)),o=n(206);function s(){return{hv:1,os:window.navigator.appVersion,ov:window.navigator.appVersion,sdk:{name:o.name,version:o.version},pv:window.navigator.userAgent}}t.deviceInfo=s,t.send=function(e){return r.__awaiter(this,void 0,void 0,function(){var t,n,u,a,c,l,f;return r.__generator(this,function(r){switch(r.label){case 0:t=e.url,n=e.method,u=e.headers,a=e.body,c=e.timeout,/kinvey\.com/gm.test(t)&&(u["X-Kinvey-Device-Information"]=(h=(h=window.navigator.userAgent).toLowerCase(),d=/(chrome)\/([\w]+)/.exec(h)||/(firefox)\/([\w.]+)/.exec(h)||/(msie) ([\w.]+)/i.exec(h)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(h)||/(safari)\/([\w.]+)/.exec(h)||[],p=d[1],v=d[2],y=window.navigator.platform,["js-"+o.name+"/"+o.version].concat([p,v,y]).map(function(e){return e?e.toString().replace(/\s/g,"_").toLowerCase():"unknown"}).join(" ")),u["X-Kinvey-Device-Info"]=JSON.stringify(s())),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,i.default({headers:u,method:n,url:t,data:a,timeout:c})];case 2:return l=r.sent(),[3,4];case 3:if(!(f=r.sent()).response)throw f;return l=f.response,[3,4];case 4:return[2,{statusCode:l.status,headers:l.headers,data:l.data}]}var h,d,p,v,y})})}},function(e,t,n){e.exports=n(187)},function(e,t,n){"use strict";var r=n(5),i=n(92),o=n(189),s=n(42);function u(e){var t=new o(e),n=i(o.prototype.request,t);return r.extend(n,o.prototype,t),r.extend(n,t),n}var a=u(s);a.Axios=o,a.create=function(e){return u(r.merge(s,e))},a.Cancel=n(96),a.CancelToken=n(204),a.isCancel=n(95),a.all=function(e){return Promise.all(e)},a.spread=n(205),e.exports=a,e.exports.default=a},function(e,t){function n(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh
* @license MIT
*/
e.exports=function(e){return null!=e&&(n(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&n(e.slice(0,0))}(e)||!!e._isBuffer)}},function(e,t,n){"use strict";var r=n(42),i=n(5),o=n(199),s=n(200);function u(e){this.defaults=e,this.interceptors={request:new o,response:new o}}u.prototype.request=function(e){"string"==typeof e&&(e=i.merge({url:arguments[0]},arguments[1])),(e=i.merge(r,{method:"get"},this.defaults,e)).method=e.method.toLowerCase();var t=[s,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},i.forEach(["delete","get","head","options"],function(e){u.prototype[e]=function(t,n){return this.request(i.merge(n||{},{method:e,url:t}))}}),i.forEach(["post","put","patch"],function(e){u.prototype[e]=function(t,n,r){return this.request(i.merge(r||{},{method:e,url:t,data:n}))}}),e.exports=u},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!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:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var a,c=[],l=!1,f=-1;function h(){l&&a&&(l=!1,a.length?c=a.concat(c):f=-1,c.length&&d())}function d(){if(!l){var e=u(h);l=!0;for(var t=c.length;t;){for(a=c,c=[];++f1)for(var n=1;n=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([n]):s[t]?s[t]+", "+n:n}}),s):s}},function(e,t,n){"use strict";var r=n(5);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(e){var r=e;return t&&(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 e=i(window.location.href),function(t){var n=r.isString(t)?i(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},function(e,t,n){"use strict";var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function i(){this.message="String contains an invalid character"}i.prototype=new Error,i.prototype.code=5,i.prototype.name="InvalidCharacterError",e.exports=function(e){for(var t,n,o=String(e),s="",u=0,a=r;o.charAt(0|u)||(a="=",u%1);s+=a.charAt(63&t>>8-u%1*8)){if((n=o.charCodeAt(u+=.75))>255)throw new i;t=t<<8|n}return s}},function(e,t,n){"use strict";var r=n(5);e.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,i,o,s){var u=[];u.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),r.isString(i)&&u.push("path="+i),r.isString(o)&&u.push("domain="+o),!0===s&&u.push("secure"),document.cookie=u.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,n){"use strict";var r=n(5);function i(){this.handlers=[]}i.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){r.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=i},function(e,t,n){"use strict";var r=n(5),i=n(201),o=n(95),s=n(42),u=n(202),a=n(203);function c(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return c(e),e.baseURL&&!u(e.url)&&(e.url=a(e.baseURL,e.url)),e.headers=e.headers||{},e.data=i(e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),r.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]}),(e.adapter||s.adapter)(e).then(function(t){return c(e),t.data=i(t.data,t.headers,e.transformResponse),t},function(t){return o(t)||(c(e),t&&t.response&&(t.response.data=i(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,n){"use strict";var r=n(5);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var r=n(96);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new r(e),t(n.reason))})}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var e;return{token:new i(function(t){e=t}),cancel:e}},e.exports=i},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e){e.exports={name:"kinvey-html5-sdk",description:"Kinvey JavaScript SDK for HTML5 applications.",version:"4.0.0",license:"Apache-2.0",homepage:"https://github.com/Kinvey/js-sdk/tree/master/packages/html5-sdk",repository:{type:"git",url:"https://github.com/Kinvey/js-sdk.git"},bugs:{url:"https://github.com/Kinvey/js-sdk/issues"},author:{name:"Thomas Conner",email:"thomas.conner@progress.com"},keywords:["Kinvey","JavaScript","HTML5"],main:"lib/index.js",scripts:{prebuild:"del lib",build:"tsc -p tsconfig.json",postbuild:"node scripts/postbuild.js",prebundle:"npm run build",bundle:"webpack"},dependencies:{axios:"0.18.0","kinvey-js-sdk":"^4.0.0",lodash:"4.17.11",pubnub:"4.23.0",tslib:"1.9.3"},devDependencies:{"@types/events":"^3.0.0","@types/lodash":"~4.14.123","clean-webpack-plugin":"~2.0.1","del-cli":"~1.1.0",typescript:"~3.4.4",webpack:"~4.29.6","webpack-cli":"^3.3.0"},files:["lib/**/*"]}},function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.get=function(e){return window.localStorage.getItem(e)},t.set=function(e,t){return window.localStorage.setItem(e,t),!0},t.remove=function(e){return window.localStorage.removeItem(e),!0}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(11),i=n(83),o="loaded",s="error",u=function(e){function t(t){var n=e.call(this)||this;return n.popupWindow=t,n.interval=window.setInterval(function(){if(t.closed)n.close();else try{var e={url:t.location.href};n.emit(o,e)}catch(e){e.code!==window.DOMException.SECURITY_ERR&&n.emit(s,e)}},100),n}return r.__extends(t,e),t.prototype.isClosed=function(){return this.popupWindow&&!0===this.popupWindow.closed||!1},t.prototype.onLoaded=function(e){return this.on(o,e)},t.prototype.onClosed=function(e){return this.on("closed",e)},t.prototype.onError=function(e){return this.on(s,e)},t.prototype.close=function(){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(e){return this.interval&&(window.clearInterval(this.interval),this.interval=null),this.popupWindow&&!this.popupWindow.closed&&(this.popupWindow.close(),this.popupWindow=null),this.emit("closed"),[2]})})},t.open=function(e){return r.__awaiter(this,void 0,void 0,function(){var n;return r.__generator(this,function(r){if(!(n=window.open(e,"_blank","toolbar=no,location=no")))throw new Error("The popup was blocked.");return[2,new t(n)]})})},t}(i.EventEmitter);t.open=function(e){return u.open(e)}},function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n={},r="readwrite",i="readonly",o=function(){function e(e){this.dbName=e,this.db=n[this.dbName],this.inTransaction=!1,this.queue=[]}return Object.defineProperty(e.prototype,"db",{get:function(){return this._db},set:function(e){e?(this._db=e,n[this.dbName]=e):(this._db=null,delete n[this.dbName])},enumerable:!0,configurable:!0}),e.prototype.hasObjectStore=function(e){return!(!this.db||!this.db.objectStoreName)&&("function"==typeof this.db.objectStoreNames.contains?this.db.objectStoreNames.contains(e):-1!==this.db.objectStoreNames.indexOf(e))},e.prototype.openTransaction=function(e,t){void 0===t&&(t=i);var n=this.db.transaction(e,t);if(!n)throw new Error("Unable to open a transaction for "+e+" collection on the "+this.dbName+" IndexedDB database.");return n},e.prototype.openDB=function(){var e=window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.msIndexedDB;if(this.db){var t=this.db.version+1;return this.close(),e.open(this.dbName,t)}return e.open(this.dbName)},e.prototype.open=function(e,t,n,o,s){var u=this;void 0===t&&(t=!1),void 0===s&&(s=!1);try{if(this.db){if(this.db.objectStoreNames.contains(e)){var a=t?r:i;return n(this.openTransaction(e,a))}if(!t)throw new Error("The "+e+" collection was not found on the "+this.dbName+" IndexedDB database.")}if(!s&&this.inTransaction)return this.queue.push(function(){return u.open(e,t,n,o)});this.inTransaction=!0;var c=this.openDB();c.onupgradeneeded=function(n){u.db=n.target.result,t&&!u.db.objectStoreNames.contains(e)&&u.db.createObjectStore(e,{keyPath:"_id"})},c.onsuccess=function(r){u.db=r.target.result,u.db.onversionchange=function(){return u.close()};var i=function(e){return function(t){if(e(t),u.inTransaction=!1,u.queue.length>0){var n=u.queue;u.queue=[],n.forEach(function(e){e.call(u)})}}};return u.open(e,t,i(n),i(o),!0)},c.onblocked=function(){},c.onerror=function(e){o(new Error("Unable to open the "+u.dbName+" IndexedDB database. "+e.target.error.message+"."))}}catch(e){o(e)}return null},e.prototype.close=function(){this.db&&(this.db.close(),this.db=null)},e}();t.find=function(e,t){var n=new o(e);return new Promise(function(e,r){n.open(t,!1,function(n){var i=n.objectStore(t).openCursor(),o=[];i.onsuccess=function(t){var n=t.target.result;return n?(o.push(n.value),n.continue()):e(o)},i.onerror=function(e){r(e.target.error)}},function(t){-1!==t.message.indexOf("not found")?e([]):r(t)})})},t.count=function(e,t){var n=new o(e);return new Promise(function(e,r){n.open(t,!1,function(n){var i=n.objectStore(t).count();i.onsuccess=function(){return e(i.result)},i.onerror=function(e){return r(e.target.error)}},function(t){-1!==t.message.indexOf("not found")?e(0):r(t)})})},t.findById=function(e,t,n){var r=new o(e);return new Promise(function(e,i){r.open(t,!1,function(r){var o=r.objectStore(t).get(n);o.onsuccess=function(t){e(t.target.result)},o.onerror=function(e){i(e.target.error)}},i)})},t.save=function(e,t,n){void 0===n&&(n=[]);var r=new o(e);return new Promise(function(i,o){r.open(t,!0,function(r){var s=r.objectStore(t),u=n;Array.isArray(n)||(u=[n]),u.forEach(function(e){s.put(e)}),r.oncomplete=function(){i(n)},r.onerror=function(n){o(new Error("An error occurred while saving the entities to the "+t+" collection on the "+e+" IndexedDB database. "+n.target.error.message+"."))}},o)})},t.removeById=function(e,t,n){var r=new o(e);return new Promise(function(i,o){r.open(t,!0,function(r){var s=r.objectStore(t),u=s.get(n);s.delete(n),r.oncomplete=function(){u.result?i(1):o(new Error("An entity with _id = "+n+" was not found in the "+t+" collection on the "+e+" database."))},r.onerror=function(){o(new Error("An entity with _id = "+n+" was not found in the "+t+" collection on the "+e+" database."))}},o)})},t.clear=function(e,t){var n=new o(e);return new Promise(function(e,r){n.open(t,!0,function(n){n.objectStore(t).clear(),n.oncomplete=function(){return e(!0)},n.onerror=function(e){return r(e)}},r)})},t.clearDatabase=function(e){return new Promise(function(t,r){var i=(window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.msIndexedDB).deleteDatabase(e);i.onsuccess=function(){delete n[e],t(!0)},i.onerror=function(t){r(new Error("An error occurred while clearing the "+e+" IndexedDB database. "+t.target.error.message+"."))},i.onblocked=function(){r(new Error("The "+e+" IndexedDB database could not be cleared due to the operation being blocked."))}})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(11);function i(e,t){var n=window.localStorage.getItem(e+"."+t);if(n){var r=JSON.parse(n),i=new Map;return r.forEach(function(e){i.set(e._id,e)}),i}return new Map}function o(e,t,n){var r=[];n.forEach(function(e){return r.push(e)}),window.localStorage.setItem(e+"."+t,JSON.stringify(r))}function s(e,t){return r.__awaiter(this,void 0,void 0,function(){var n;return r.__generator(this,function(r){return(n=i(e,t))?[2,Array.from(n.values())]:[2,[]]})})}t.find=s,t.count=function(e,t){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(n){switch(n.label){case 0:return[4,s(e,t)];case 1:return[2,n.sent().length]}})})},t.findById=function(e,t,n){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(r){switch(r.label){case 0:return[4,s(e,t)];case 1:return[2,r.sent().find(function(e){return e._id===n})]}})})},t.save=function(e,t,n){return void 0===n&&(n=[]),r.__awaiter(this,void 0,void 0,function(){var s;return r.__generator(this,function(r){return s=i(e,t),n.forEach(function(e){s.set(e._id,e)}),o(e,t,s),[2,n]})})},t.removeById=function(e,t,n){return r.__awaiter(this,void 0,void 0,function(){var s;return r.__generator(this,function(r){return(s=i(e,t)).delete(n)?(o(e,t,s),[2,1]):[2,0]})})},t.clear=function(e,t){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(n){return window.localStorage.removeItem(e+"."+t),[2,!0]})})},t.clearDatabase=function(e,t){return void 0===t&&(t=[]),r.__awaiter(this,void 0,void 0,function(){var n,i,o;return r.__generator(this,function(r){for(n=[],i=0,o=window.localStorage.length;i=0&&-1===t.indexOf(n)&&window.localStorage.removeItem(n)}),[2,!0]})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(11),i=new Map;function o(e,t){return i.get(e+"."+t)||new Map}function s(e,t,n){return i.set(e+"."+t,n)}function u(e,t){return r.__awaiter(this,void 0,void 0,function(){var n;return r.__generator(this,function(r){return n=o(e,t),[2,Array.from(n.values())]})})}t.find=u,t.count=function(e,t){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(n){switch(n.label){case 0:return[4,u(e,t)];case 1:return[2,n.sent().length]}})})},t.findById=function(e,t,n){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(r){switch(r.label){case 0:return[4,u(e,t)];case 1:return[2,r.sent().find(function(e){return e._id===n})]}})})},t.save=function(e,t,n){return void 0===n&&(n=[]),r.__awaiter(this,void 0,void 0,function(){var i;return r.__generator(this,function(r){return i=o(e,t),n.forEach(function(e){i.set(e._id,e)}),s(e,t,i),[2,n]})})},t.removeById=function(e,t,n){return r.__awaiter(this,void 0,void 0,function(){var i;return r.__generator(this,function(r){return(i=o(e,t)).delete(n)?(s(e,t,i),[2,1]):[2,0]})})},t.clear=function(e,t){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(n){return i.delete(e+"."+t),[2,!0]})})},t.clearDatabase=function(){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(e){return i.clear(),[2,!0]})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(11);function i(e,t){var n=window.sessionStorage.getItem(e+"."+t);if(n){var r=JSON.parse(n),i=new Map;return r.forEach(function(e){i.set(e._id,e)}),i}return new Map}function o(e,t,n){var r=[];n.forEach(function(e){return r.push(e)}),window.sessionStorage.setItem(e+"."+t,JSON.stringify(r))}function s(e,t){return r.__awaiter(this,void 0,void 0,function(){var n;return r.__generator(this,function(r){return(n=i(e,t))?[2,Array.from(n.values())]:[2,[]]})})}t.find=s,t.count=function(e,t){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(n){switch(n.label){case 0:return[4,s(e,t)];case 1:return[2,n.sent().length]}})})},t.findById=function(e,t,n){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(r){switch(r.label){case 0:return[4,s(e,t)];case 1:return[2,r.sent().find(function(e){return e._id===n})]}})})},t.save=function(e,t,n){return void 0===n&&(n=[]),r.__awaiter(this,void 0,void 0,function(){var s;return r.__generator(this,function(r){return s=i(e,t),n.forEach(function(e){s.set(e._id,e)}),o(e,t,s),[2,n]})})},t.removeById=function(e,t,n){return r.__awaiter(this,void 0,void 0,function(){var s;return r.__generator(this,function(r){return(s=i(e,t)).delete(n)?(o(e,t,s),[2,1]):[2,0]})})},t.clear=function(e,t){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(n){return window.sessionStorage.removeItem(e+"."+t),[2,!0]})})},t.clearDatabase=function(e,t){return void 0===t&&(t=[]),r.__awaiter(this,void 0,void 0,function(){var n,i,o;return r.__generator(this,function(r){for(n=[],i=0,o=window.sessionStorage.length;i=0&&-1===t.indexOf(n)&&window.sessionStorage.removeItem(n)}),[2,!0]})})}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(11),i=r.__importDefault(n(214)),o=n(19),s="sqlite_master",u=2097152;function a(e,t,n,r){void 0===r&&(r=!1);var c='"'+t+'"',l=t===s;return new Promise(function(f,h){try{var d=window.openDatabase(e,1,"Kinvey WebSQL",u);d[r||"function"!=typeof d.readTransaction?"transaction":"readTransaction"](function(e){new Promise(function(t){r&&!l?e.executeSql("CREATE TABLE IF NOT EXISTS "+c+" (key BLOB PRIMARY KEY NOT NULL, value BLOB NOT NULL)",[],function(){t()}):t()}).then(function(){return Promise.all(n.map(function(t){return new Promise(function(n){e.executeSql(t[0].replace("#{table}",c),t[1],function(e,t){var r={rowCount:t.rows.length||t.rowsAffected,result:[]};if(t.rows.length>0)for(var i=0,o=t.rows.length;i0?[4,Promise.all(i.map(function(n){return-1===t.indexOf(n)?a(e,n,[["DROP TABLE IF EXISTS #{table}"]],!0):null}))]:[3,3];case 2:r.sent(),r.label=3;case 3:return[2,!0]}})})}},function(e,t,n){var r=n(215),i=n(220),o=n(221),s="[object String]";e.exports=function(e){return"string"==typeof e||!i(e)&&o(e)&&r(e)==s}},function(e,t,n){var r=n(98),i=n(218),o=n(219),s="[object Null]",u="[object Undefined]",a=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?u:s:a&&a in Object(e)?i(e):o(e)}},function(e,t,n){var r=n(217),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();e.exports=o},function(e,t,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(this,n(20))},function(e,t,n){var r=n(98),i=Object.prototype,o=i.hasOwnProperty,s=i.toString,u=r?r.toStringTag:void 0;e.exports=function(e){var t=o.call(e,u),n=e[u];try{e[u]=void 0;var r=!0}catch(e){}var i=s.call(e);return r&&(t?e[u]=n:delete e[u]),i}},function(e,t){var n=Object.prototype.toString;e.exports=function(e){return n.call(e)}},function(e,t){var n=Array.isArray;e.exports=n},function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}}])});