@aws-amplify/core
Version:
Core category of aws-amplify
24 lines • 66.7 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("aws-sdk/global")):"function"==typeof define&&define.amd?define("aws_amplify_core",["aws-sdk/global"],t):"object"==typeof exports?exports.aws_amplify_core=t(require("aws-sdk/global")):e.aws_amplify_core=t(e["aws-sdk/global"])}(this,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{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 o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));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=14)}([function(e,t,n){"use strict";(function(e){var n=[{type:"text/plain",ext:"txt"},{type:"text/html",ext:"html"},{type:"text/javascript",ext:"js"},{type:"text/css",ext:"css"},{type:"text/csv",ext:"csv"},{type:"text/yaml",ext:"yml"},{type:"text/yaml",ext:"yaml"},{type:"text/calendar",ext:"ics"},{type:"text/calendar",ext:"ical"},{type:"image/png",ext:"png"},{type:"image/gif",ext:"gif"},{type:"image/jpeg",ext:"jpg"},{type:"image/jpeg",ext:"jpeg"},{type:"image/bmp",ext:"bmp"},{type:"image/x-icon",ext:"ico"},{type:"image/tiff",ext:"tif"},{type:"image/tiff",ext:"tiff"},{type:"image/svg+xml",ext:"svg"},{type:"application/json",ext:"json"},{type:"application/xml",ext:"xml"},{type:"application/x-sh",ext:"sh"},{type:"application/zip",ext:"zip"},{type:"application/x-rar-compressed",ext:"rar"},{type:"application/x-tar",ext:"tar"},{type:"application/x-bzip",ext:"bz"},{type:"application/x-bzip2",ext:"bz2"},{type:"application/pdf",ext:"pdf"},{type:"application/java-archive",ext:"jar"},{type:"application/msword",ext:"doc"},{type:"application/vnd.ms-excel",ext:"xls"},{type:"application/vnd.ms-excel",ext:"xlsx"},{type:"message/rfc822",ext:"eml"}],r=function(){function t(){}return t.isEmpty=function(e){return 0===Object.keys(e).length},t.sortByField=function(e,t,n){if(!e||!e.sort)return!1;var r=n&&"desc"===n?-1:1;return e.sort((function(e,n){var o=e[t],i=n[t];return void 0===i?void 0===o?0:1*r:void 0===o?-1*r:o<i?-1*r:o>i?1*r:0})),!0},t.objectLessAttributes=function(e,t){var n=Object.assign({},e);return t&&("string"==typeof t?delete n[t]:t.forEach((function(e){delete n[e]}))),n},t.filenameToContentType=function(e,t){void 0===t&&(t="application/octet-stream");var r=e.toLowerCase(),o=n.filter((function(e){return r.endsWith("."+e.ext)}));return o.length>0?o[0].type:t},t.isTextFile=function(e){var t=e.toLowerCase();return!!t.startsWith("text/")||("application/json"===t||"application/xml"===t||"application/sh"===t)},t.generateRandomString=function(){for(var e="",t="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=32;n>0;n-=1)e+=t[Math.floor(Math.random()*t.length)];return e},t.makeQuerablePromise=function(e){if(e.isResolved)return e;var t=!0,n=!1,r=!1,o=e.then((function(e){return r=!0,t=!1,e}),(function(e){throw n=!0,t=!1,e}));return o.isFullfilled=function(){return r},o.isPending=function(){return t},o.isRejected=function(){return n},o},t.browserOrNode=function(){return{isBrowser:"undefined"!=typeof window&&void 0!==window.document,isNode:void 0!==e&&null!=e.versions&&null!=e.versions.node}},t.transferKeyToLowerCase=function(e,n,r){if(void 0===n&&(n=[]),void 0===r&&(r=[]),!t.isStrictObject(e))return e;var o={};for(var i in e){if(e.hasOwnProperty(i))o[n.includes(i)?i:i[0].toLowerCase()+i.slice(1)]=r.includes(i)?e[i]:t.transferKeyToLowerCase(e[i],n,r)}return o},t.transferKeyToUpperCase=function(e,n,r){if(void 0===n&&(n=[]),void 0===r&&(r=[]),!t.isStrictObject(e))return e;var o={};for(var i in e){if(e.hasOwnProperty(i))o[n.includes(i)?i:i[0].toUpperCase()+i.slice(1)]=r.includes(i)?e[i]:t.transferKeyToUpperCase(e[i],n,r)}return o},t.isStrictObject=function(e){return!(!(e instanceof Object)||e instanceof Array||e instanceof Function||e instanceof Number||e instanceof String||e instanceof Boolean)},t}();t.a=r}).call(this,n(3))},function(t,n){t.exports=e},function(e,t,n){e.exports=n(4).Observable},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var u,c=[],l=!1,f=-1;function h(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&p())}function p(){if(!l){var e=a(h);l=!0;for(var t=c.length;t;){for(u=c,c=[];++f<t;)u&&u[f].run();f=-1,t=c.length}u=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function g(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new d(e,t)),1!==c.length||l||a(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=g,o.addListener=g,o.once=g,o.off=g,o.removeListener=g,o.removeAllListeners=g,o.emit=g,o.prependListener=g,o.prependOnceListener=g,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}Object.defineProperty(t,"__esModule",{value:!0}),t.Observable=void 0;var s=function(){return"function"==typeof Symbol},a=function(e){return s()&&Boolean(Symbol[e])},u=function(e){return a(e)?Symbol[e]:"@@"+e};s()&&!a("observable")&&(Symbol.observable=Symbol("observable"));var c=u("iterator"),l=u("observable"),f=u("species");function h(e,t){var n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function p(e){var t=e.constructor;return void 0!==t&&null===(t=t[f])&&(t=void 0),void 0!==t?t:k}function d(e){return e instanceof k}function g(e){g.log?g.log(e):setTimeout((function(){throw e}))}function y(e){Promise.resolve().then((function(){try{e()}catch(e){g(e)}}))}function v(e){var t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{var n=h(t,"unsubscribe");n&&n.call(t)}}catch(e){g(e)}}function b(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function m(e,t,n){e._state="running";var r=e._observer;try{var o=h(r,t);switch(t){case"next":o&&o.call(r,n);break;case"error":if(b(e),!o)throw n;o.call(r,n);break;case"complete":b(e),o&&o.call(r)}}catch(e){g(e)}"closed"===e._state?v(e):"running"===e._state&&(e._state="ready")}function w(e,t,n){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:n}],void y((function(){return function(e){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var n=0;n<t.length&&(m(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e)}))):void m(e,t,n);e._queue.push({type:t,value:n})}}var _=function(){function e(t,n){r(this,e),this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var o=new x(this);try{this._cleanup=n.call(void 0,o)}catch(e){o.error(e)}"initializing"===this._state&&(this._state="ready")}return i(e,[{key:"unsubscribe",value:function(){"closed"!==this._state&&(b(this),v(this))}},{key:"closed",get:function(){return"closed"===this._state}}]),e}(),x=function(){function e(t){r(this,e),this._subscription=t}return i(e,[{key:"next",value:function(e){w(this._subscription,"next",e)}},{key:"error",value:function(e){w(this._subscription,"error",e)}},{key:"complete",value:function(){w(this._subscription,"complete")}},{key:"closed",get:function(){return"closed"===this._subscription._state}}]),e}(),k=function(){function e(t){if(r(this,e),!(this instanceof e))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof t)throw new TypeError("Observable initializer must be a function");this._subscriber=t}return i(e,[{key:"subscribe",value:function(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new _(e,this._subscriber)}},{key:"forEach",value:function(e){var t=this;return new Promise((function(n,r){if("function"==typeof e)var o=t.subscribe({next:function(t){try{e(t,i)}catch(e){r(e),o.unsubscribe()}},error:r,complete:n});else r(new TypeError(e+" is not a function"));function i(){o.unsubscribe(),n()}}))}},{key:"map",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(p(this))((function(n){return t.subscribe({next:function(t){try{t=e(t)}catch(e){return n.error(e)}n.next(t)},error:function(e){n.error(e)},complete:function(){n.complete()}})}))}},{key:"filter",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(p(this))((function(n){return t.subscribe({next:function(t){try{if(!e(t))return}catch(e){return n.error(e)}n.next(t)},error:function(e){n.error(e)},complete:function(){n.complete()}})}))}},{key:"reduce",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=p(this),r=arguments.length>1,o=!1,i=arguments[1],s=i;return new n((function(n){return t.subscribe({next:function(t){var i=!o;if(o=!0,!i||r)try{s=e(s,t)}catch(e){return n.error(e)}else s=t},error:function(e){n.error(e)},complete:function(){if(!o&&!r)return n.error(new TypeError("Cannot reduce an empty sequence"));n.next(s),n.complete()}})}))}},{key:"concat",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=p(this);return new o((function(t){var r,i=0;return function e(s){r=s.subscribe({next:function(e){t.next(e)},error:function(e){t.error(e)},complete:function(){i===n.length?(r=void 0,t.complete()):e(o.from(n[i++]))}})}(e),function(){r&&(r.unsubscribe(),r=void 0)}}))}},{key:"flatMap",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=p(this);return new n((function(r){var o=[],i=t.subscribe({next:function(t){if(e)try{t=e(t)}catch(e){return r.error(e)}var i=n.from(t).subscribe({next:function(e){r.next(e)},error:function(e){r.error(e)},complete:function(){var e=o.indexOf(i);e>=0&&o.splice(e,1),s()}});o.push(i)},error:function(e){r.error(e)},complete:function(){s()}});function s(){i.closed&&0===o.length&&r.complete()}return function(){o.forEach((function(e){return e.unsubscribe()})),i.unsubscribe()}}))}},{key:l,value:function(){return this}}],[{key:"from",value:function(t){var n="function"==typeof this?this:e;if(null==t)throw new TypeError(t+" is not an object");var r=h(t,l);if(r){var o=r.call(t);if(Object(o)!==o)throw new TypeError(o+" is not an object");return d(o)&&o.constructor===n?o:new n((function(e){return o.subscribe(e)}))}if(a("iterator")&&(r=h(t,c)))return new n((function(e){y((function(){if(!e.closed){var n=!0,o=!1,i=void 0;try{for(var s,a=r.call(t)[Symbol.iterator]();!(n=(s=a.next()).done);n=!0){var u=s.value;if(e.next(u),e.closed)return}}catch(e){o=!0,i=e}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}e.complete()}}))}));if(Array.isArray(t))return new n((function(e){y((function(){if(!e.closed){for(var n=0;n<t.length;++n)if(e.next(t[n]),e.closed)return;e.complete()}}))}));throw new TypeError(t+" is not observable")}},{key:"of",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o="function"==typeof this?this:e;return new o((function(e){y((function(){if(!e.closed){for(var t=0;t<n.length;++t)if(e.next(n[t]),e.closed)return;e.complete()}}))}))}},{key:f,get:function(){return this}}]),e}();t.Observable=k,s()&&Object.defineProperty(k,Symbol("extensions"),{value:{symbol:l,hostReportError:g},configurable:!0})},function(e,t,n){"use strict";var r=n(6),o=n(9);function i(){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=m,t.resolve=function(e,t){return m(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?m(e,!1,!0).resolveObject(t):t},t.format=function(e){o.isString(e)&&(e=m(e));return e instanceof i?e.format():i.prototype.format.call(e)},t.Url=i;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),f=["%","/","?",";","#"].concat(l),h=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},b=n(10);function m(e,t,n){if(e&&o.isObject(e)&&e instanceof i)return e;var r=new i;return r.parse(e,t,n),r}i.prototype.parse=function(e,t,n){if(!o.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),a=-1!==i&&i<e.indexOf("#")?"?":"#",c=e.split(a);c[0]=c[0].replace(/\\/g,"/");var m=e=c.join(a);if(m=m.trim(),!n&&1===e.split("#").length){var w=u.exec(m);if(w)return this.path=m,this.href=m,this.pathname=w[1],w[2]?(this.search=w[2],this.query=t?b.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var _=s.exec(m);if(_){var x=(_=_[0]).toLowerCase();this.protocol=x,m=m.substr(_.length)}if(n||_||m.match(/^\/\/[^@\/]+@[^@\/]+/)){var k="//"===m.substr(0,2);!k||_&&y[_]||(m=m.substr(2),this.slashes=!0)}if(!y[_]&&(k||_&&!v[_])){for(var j,S,C=-1,O=0;O<h.length;O++){-1!==(A=m.indexOf(h[O]))&&(-1===C||A<C)&&(C=A)}-1!==(S=-1===C?m.lastIndexOf("@"):m.lastIndexOf("@",C))&&(j=m.slice(0,S),m=m.slice(S+1),this.auth=decodeURIComponent(j)),C=-1;for(O=0;O<f.length;O++){var A;-1!==(A=m.indexOf(f[O]))&&(-1===C||A<C)&&(C=A)}-1===C&&(C=m.length),this.host=m.slice(0,C),m=m.slice(C),this.parseHost(),this.hostname=this.hostname||"";var I="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!I)for(var P=this.hostname.split(/\./),E=(O=0,P.length);O<E;O++){var T=P[O];if(T&&!T.match(p)){for(var N="",R=0,L=T.length;R<L;R++)T.charCodeAt(R)>127?N+="x":N+=T[R];if(!N.match(p)){var F=P.slice(0,O),W=P.slice(O+1),U=T.match(d);U&&(F.push(U[1]),W.unshift(U[2])),W.length&&(m="/"+W.join(".")+m),this.hostname=F.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=r.toASCII(this.hostname));var q=this.port?":"+this.port:"",z=this.hostname||"";this.host=z+q,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==m[0]&&(m="/"+m))}if(!g[x])for(O=0,E=l.length;O<E;O++){var B=l[O];if(-1!==m.indexOf(B)){var H=encodeURIComponent(B);H===B&&(H=escape(B)),m=m.split(B).join(H)}}var D=m.indexOf("#");-1!==D&&(this.hash=m.substr(D),m=m.slice(0,D));var M=m.indexOf("?");if(-1!==M?(this.search=m.substr(M),this.query=m.substr(M+1),t&&(this.query=b.parse(this.query)),m=m.slice(0,M)):t&&(this.search="",this.query={}),m&&(this.pathname=m),v[x]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){q=this.pathname||"";var G=this.search||"";this.path=q+G}return this.href=this.format(),this},i.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",n=this.pathname||"",r=this.hash||"",i=!1,s="";this.host?i=e+this.host:this.hostname&&(i=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&o.isObject(this.query)&&Object.keys(this.query).length&&(s=b.stringify(this.query));var a=this.search||s&&"?"+s||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||v[t])&&!1!==i?(i="//"+(i||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):i||(i=""),r&&"#"!==r.charAt(0)&&(r="#"+r),a&&"?"!==a.charAt(0)&&(a="?"+a),t+i+(n=n.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(a=a.replace("#","%23"))+r},i.prototype.resolve=function(e){return this.resolveObject(m(e,!1,!0)).format()},i.prototype.resolveObject=function(e){if(o.isString(e)){var t=new i;t.parse(e,!1,!0),e=t}for(var n=new i,r=Object.keys(this),s=0;s<r.length;s++){var a=r[s];n[a]=this[a]}if(n.hash=e.hash,""===e.href)return n.href=n.format(),n;if(e.slashes&&!e.protocol){for(var u=Object.keys(e),c=0;c<u.length;c++){var l=u[c];"protocol"!==l&&(n[l]=e[l])}return v[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(e.protocol&&e.protocol!==n.protocol){if(!v[e.protocol]){for(var f=Object.keys(e),h=0;h<f.length;h++){var p=f[h];n[p]=e[p]}return n.href=n.format(),n}if(n.protocol=e.protocol,e.host||y[e.protocol])n.pathname=e.pathname;else{for(var d=(e.pathname||"").split("/");d.length&&!(e.host=d.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==d[0]&&d.unshift(""),d.length<2&&d.unshift(""),n.pathname=d.join("/")}if(n.search=e.search,n.query=e.query,n.host=e.host||"",n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,n.pathname||n.search){var g=n.pathname||"",b=n.search||"";n.path=g+b}return n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var m=n.pathname&&"/"===n.pathname.charAt(0),w=e.host||e.pathname&&"/"===e.pathname.charAt(0),_=w||m||n.host&&e.pathname,x=_,k=n.pathname&&n.pathname.split("/")||[],j=(d=e.pathname&&e.pathname.split("/")||[],n.protocol&&!v[n.protocol]);if(j&&(n.hostname="",n.port=null,n.host&&(""===k[0]?k[0]=n.host:k.unshift(n.host)),n.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===d[0]?d[0]=e.host:d.unshift(e.host)),e.host=null),_=_&&(""===d[0]||""===k[0])),w)n.host=e.host||""===e.host?e.host:n.host,n.hostname=e.hostname||""===e.hostname?e.hostname:n.hostname,n.search=e.search,n.query=e.query,k=d;else if(d.length)k||(k=[]),k.pop(),k=k.concat(d),n.search=e.search,n.query=e.query;else if(!o.isNullOrUndefined(e.search)){if(j)n.hostname=n.host=k.shift(),(I=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=I.shift(),n.host=n.hostname=I.shift());return n.search=e.search,n.query=e.query,o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!k.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var S=k.slice(-1)[0],C=(n.host||e.host||k.length>1)&&("."===S||".."===S)||""===S,O=0,A=k.length;A>=0;A--)"."===(S=k[A])?k.splice(A,1):".."===S?(k.splice(A,1),O++):O&&(k.splice(A,1),O--);if(!_&&!x)for(;O--;O)k.unshift("..");!_||""===k[0]||k[0]&&"/"===k[0].charAt(0)||k.unshift(""),C&&"/"!==k.join("/").substr(-1)&&k.push("");var I,P=""===k[0]||k[0]&&"/"===k[0].charAt(0);j&&(n.hostname=n.host=P?"":k.length?k.shift():"",(I=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=I.shift(),n.host=n.hostname=I.shift()));return(_=_||n.host&&k.length)&&!P&&k.unshift(""),k.length?n.pathname=k.join("/"):(n.pathname=null,n.path=null),o.isNull(n.pathname)&&o.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},i.prototype.parseHost=function(){var e=this.host,t=a.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){(function(e,r){var o;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(i){t&&t.nodeType,e&&e.nodeType;var s="object"==typeof r&&r;s.global!==s&&s.window!==s&&s.self;var a,u=2147483647,c=/^xn--/,l=/[^\x20-\x7E]/,f=/[\x2E\u3002\uFF0E\uFF61]/g,h={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=Math.floor,d=String.fromCharCode;function g(e){throw new RangeError(h[e])}function y(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function v(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+y((e=e.replace(f,".")).split("."),t).join(".")}function b(e){for(var t,n,r=[],o=0,i=e.length;o<i;)(t=e.charCodeAt(o++))>=55296&&t<=56319&&o<i?56320==(64512&(n=e.charCodeAt(o++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),o--):r.push(t);return r}function m(e){return y(e,(function(e){var t="";return e>65535&&(t+=d((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=d(e)})).join("")}function w(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function _(e,t,n){var r=0;for(e=n?p(e/700):e>>1,e+=p(e/t);e>455;r+=36)e=p(e/35);return p(r+36*e/(e+38))}function x(e){var t,n,r,o,i,s,a,c,l,f,h,d=[],y=e.length,v=0,b=128,w=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&g("not-basic"),d.push(e.charCodeAt(r));for(o=n>0?n+1:0;o<y;){for(i=v,s=1,a=36;o>=y&&g("invalid-input"),((c=(h=e.charCodeAt(o++))-48<10?h-22:h-65<26?h-65:h-97<26?h-97:36)>=36||c>p((u-v)/s))&&g("overflow"),v+=c*s,!(c<(l=a<=w?1:a>=w+26?26:a-w));a+=36)s>p(u/(f=36-l))&&g("overflow"),s*=f;w=_(v-i,t=d.length+1,0==i),p(v/t)>u-b&&g("overflow"),b+=p(v/t),v%=t,d.splice(v++,0,b)}return m(d)}function k(e){var t,n,r,o,i,s,a,c,l,f,h,y,v,m,x,k=[];for(y=(e=b(e)).length,t=128,n=0,i=72,s=0;s<y;++s)(h=e[s])<128&&k.push(d(h));for(r=o=k.length,o&&k.push("-");r<y;){for(a=u,s=0;s<y;++s)(h=e[s])>=t&&h<a&&(a=h);for(a-t>p((u-n)/(v=r+1))&&g("overflow"),n+=(a-t)*v,t=a,s=0;s<y;++s)if((h=e[s])<t&&++n>u&&g("overflow"),h==t){for(c=n,l=36;!(c<(f=l<=i?1:l>=i+26?26:l-i));l+=36)x=c-f,m=36-f,k.push(d(w(f+x%m,0))),c=p(x/m);k.push(d(w(c,0))),i=_(n,v,r==o),n=0,++r}++n,++t}return k.join("")}a={version:"1.4.1",ucs2:{decode:b,encode:m},decode:x,encode:k,toASCII:function(e){return v(e,(function(e){return l.test(e)?"xn--"+k(e):e}))},toUnicode:function(e){return v(e,(function(e){return c.test(e)?x(e.slice(4).toLowerCase()):e}))}},void 0===(o=function(){return a}.call(t,n,t,e))||(e.exports=o)}()}).call(this,n(7)(e),n(8))},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){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},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(11),t.encode=t.stringify=n(12)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,i){t=t||"&",n=n||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var u=1e3;i&&"number"==typeof i.maxKeys&&(u=i.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var l=0;l<c;++l){var f,h,p,d,g=e[l].replace(a,"%20"),y=g.indexOf(n);y>=0?(f=g.substr(0,y),h=g.substr(y+1)):(f=g,h=""),p=decodeURIComponent(f),d=decodeURIComponent(h),r(s,p)?o(s[p])?s[p].push(d):s[p]=[s[p],d]:s[p]=d}return s};var o=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,a){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?i(s(e),(function(s){var a=encodeURIComponent(r(s))+n;return o(e[s])?i(e[s],(function(e){return a+encodeURIComponent(r(e))})).join(t):a+encodeURIComponent(r(e[s]))})).join(t):a?encodeURIComponent(r(a))+n+encodeURIComponent(r(e)):""};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function i(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var s=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}},function(e){e.exports=JSON.parse('{"name":"@aws-amplify/core","version":"2.2.3","description":"Core category of aws-amplify","main":"./lib/index.js","module":"./lib-esm/index.js","typings":"./lib-esm/index.d.ts","publishConfig":{"access":"public"},"scripts":{"test":"tslint \'src/**/*.ts\' && jest -w 1 --coverage","build-with-test":"npm test && npm run build","build:cjs":"node ./build es5 && webpack && webpack --config ./webpack.config.dev.js","build:esm":"node ./build es6","build:cjs:watch":"node ./build es5 --watch","build:esm:watch":"node ./build es6 --watch","build":"npm run clean && npm run build:esm && npm run build:cjs","clean":"rimraf lib-esm lib dist","format":"echo \\"Not implemented\\"","lint":"tslint \'src/**/*.ts\'"},"react-native":{"./index":"./lib/index.js","./lib/ClientDevice":"./lib/ClientDevice/reactnative.js","./lib/RNComponents":"./lib/RNComponents/reactnative.js","./lib/StorageHelper":"./lib/StorageHelper/reactnative.js"},"repository":{"type":"git","url":"https://github.com/aws-amplify/amplify-js.git"},"author":"Amazon Web Services","license":"Apache-2.0","bugs":{"url":"https://github.com/aws/aws-amplify/issues"},"homepage":"https://aws-amplify.github.io/","devDependencies":{"find":"^0.2.7","prepend-file":"^1.3.1"},"dependencies":{"aws-sdk":"2.518.0","url":"^0.11.0","zen-observable":"^0.8.6"},"jest":{"globals":{"ts-jest":{"diagnostics":false,"tsConfig":{"lib":["es5","es2015","dom","esnext.asynciterable","es2017.object"],"allowJs":true}}},"transform":{"^.+\\\\.(js|jsx|ts|tsx)$":"ts-jest"},"testRegex":"(/__tests__/.*|\\\\.(test|spec))\\\\.(tsx?|jsx?)$","moduleFileExtensions":["ts","tsx","js","json","jsx"],"testEnvironment":"jsdom","coverageThreshold":{"global":{"branches":0,"functions":0,"lines":0,"statements":0}},"testURL":"http://localhost/","coveragePathIgnorePatterns":["/node_modules/"]}}')},function(e,t,n){"use strict";n.r(t);var r=n(1),o=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],s=0,a=i.length;s<a;s++,o++)r[o]=i[s];return r},i={VERBOSE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5},s=function(){function e(e,t){void 0===t&&(t="WARN"),this.name=e,this.level=t}return e.prototype._padding=function(e){return e<10?"0"+e:""+e},e.prototype._ts=function(){var e=new Date;return[this._padding(e.getMinutes()),this._padding(e.getSeconds())].join(":")+"."+e.getMilliseconds()},e.prototype._log=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=this.level;e.LOG_LEVEL&&(o=e.LOG_LEVEL),"undefined"!=typeof window&&window.LOG_LEVEL&&(o=window.LOG_LEVEL);var s=i[o],a=i[t];if(a>=s){var u=console.log.bind(console);"ERROR"===t&&console.error&&(u=console.error.bind(console)),"WARN"===t&&console.warn&&(u=console.warn.bind(console));var c="["+t+"] "+this._ts()+" "+this.name;if(1===n.length&&"string"==typeof n[0])u(c+" - "+n[0]);else if(1===n.length)u(c,n[0]);else if("string"==typeof n[0]){var l=n.slice(1);1===l.length&&(l=l[0]),u(c+" - "+n[0],l)}else u(c,n)}},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,o(["INFO"],e))},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,o(["INFO"],e))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,o(["WARN"],e))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,o(["ERROR"],e))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,o(["DEBUG"],e))},e.prototype.verbose=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,o(["VERBOSE"],e))},e.LOG_LEVEL=null,e}(),a=new s("Amplify"),u=function(){function e(){}return e.register=function(t){a.debug("component registered in amplify",t),this._components.push(t),"function"==typeof t.getModuleName?e[t.getModuleName()]=t:a.debug("no getModuleName method for component",t)},e.configure=function(e){var t=this;return e?(this._config=Object.assign(this._config,e),a.debug("amplify config",this._config),this._components.map((function(e){e.configure(t._config)})),this._config):this._config},e.addPluggable=function(e){e&&e.getCategory&&"function"==typeof e.getCategory&&this._components.map((function(t){t.addPluggable&&"function"==typeof t.addPluggable&&t.addPluggable(e)}))},e._components=[],e._config={},e.Auth=null,e.Analytics=null,e.API=null,e.Storage=null,e.I18n=null,e.Cache=null,e.PubSub=null,e.Interactions=null,e.Pushnotification=null,e.UI=null,e.XR=null,e.Predictions=null,e.Logger=s,e.ServiceWorker=null,e}(),c=new s("ClientDevice_Browser");function l(){return"undefined"==typeof window?{}:function(){if("undefined"==typeof window)return c.warn("No window object available to get browser client info"),{};var e=window.navigator;if(!e)return c.warn("No navigator object available to get browser client info"),{};var t=e.platform,n=e.product,r=e.vendor,o=e.userAgent,i=e.language,s=function(e){var t=/.+(Opera[\s[A-Z]*|OPR[\sA-Z]*)\/([0-9\.]+).*/i.exec(e);if(t)return{type:t[1],version:t[2]};var n=/.+(Trident|Edge)\/([0-9\.]+).*/i.exec(e);if(n)return{type:n[1],version:n[2]};var r=/.+(Chrome|Firefox|FxiOS)\/([0-9\.]+).*/i.exec(e);if(r)return{type:r[1],version:r[2]};var o=/.+(Safari)\/([0-9\.]+).*/i.exec(e);if(o)return{type:o[1],version:o[2]};var i=/.+(AppleWebKit)\/([0-9\.]+).*/i.exec(e);if(i)return{type:i[1],version:i[2]};var s=/.*([A-Z]+)\/([0-9\.]+).*/i.exec(e);if(s)return{type:s[1],version:s[2]};return{type:"",version:""}}(o),a=(u=/\(([A-Za-z\s].*)\)/.exec((new Date).toString()),u&&u[1]||"");var u;return{platform:t,make:n||r,model:s.type,version:s.version,appVersion:[s.type,s.version].join("/"),language:i,timezone:a}}()}var f=function(){function e(){}return e.clientInfo=function(){return l()},e.dimension=function(){return"undefined"==typeof window?(c.warn("No window object available to get browser client info"),{width:320,height:320}):{width:window.innerWidth,height:window.innerHeight}},e}();function h(e){return new Error("Missing config value of "+e)}function p(e){return new Error("Invalid parameter value of "+e)}var d=function(){return(d=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},g=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],s=0,a=i.length;s<a;s++,o++)r[o]=i[s];return r},y=new s("Hub"),v="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default";var b=new(function(){function e(e){this.listeners=[],this.patterns=[],this.protectedChannels=["core","auth","api","analytics","interactions","pubsub","storage","xr"],this.name=e}return e.prototype.remove=function(e,t){if(e instanceof RegExp){var n=this.patterns.find((function(t){return t.pattern.source===e.source}));if(!n)return void y.warn("No listeners for "+e);this.patterns=g(this.patterns.filter((function(e){return e!==n})))}else{var r=this.listeners[e];if(!r)return void y.warn("No listeners for "+e);this.listeners[e]=g(r.filter((function(e){return e.callback!==t})))}},e.prototype.dispatch=function(e,t,n,r){(void 0===n&&(n=""),this.protectedChannels.indexOf(e)>-1)&&(r===v||y.warn("WARNING: "+e+" is protected and dispatching on it can have unintended consequences"));var o={channel:e,payload:d({},t),source:n,patternInfo:[]};try{this._toListeners(o)}catch(e){y.error(e)}},e.prototype.listen=function(e,t,n){var r;if(void 0===n&&(n="noname"),function(e){return void 0!==e.onHubCapsule}(t))y.warn("WARNING onHubCapsule is Deprecated. Please pass in a callback."),r=t.onHubCapsule.bind(t);else{if("function"!=typeof t)throw new Error("No callback supplied to Hub");r=t}if(e instanceof RegExp)this.patterns.push({pattern:e,callback:r});else{var o=this.listeners[e];o||(o=[],this.listeners[e]=o),o.push({name:n,callback:r})}},e.prototype._toListeners=function(e){var t=e.channel,n=e.payload,r=this.listeners[t];if(r&&r.forEach((function(r){y.debug("Dispatching to "+t+" with ",n);try{r.callback(e)}catch(e){y.error(e)}})),this.patterns.length>0){if(!n.message)return void y.warn("Cannot perform pattern matching without a message key");var o=n.message;this.patterns.forEach((function(t){var n=o.match(t.pattern);if(n){var r=n.slice(1),i=d(d({},e),{patternInfo:r});try{t.callback(i)}catch(e){y.error(e)}}}))}},e}())("__default__"),m=new s("I18n"),w=function(){function e(e){this._options=null,this._lang=null,this._dict={},this._options=Object.assign({},e),this._lang=this._options.language,!this._lang&&"undefined"!=typeof window&&window&&window.navigator&&(this._lang=window.navigator.language),m.debug(this._lang)}return e.prototype.setLanguage=function(e){this._lang=e},e.prototype.get=function(e,t){if(void 0===t&&(t=void 0),!this._lang)return void 0!==t?t:e;var n=this._lang,r=this.getByLanguage(e,n);return r||(n.indexOf("-")>0&&(r=this.getByLanguage(e,n.split("-")[0])),r||(void 0!==t?t:e))},e.prototype.getByLanguage=function(e,t,n){if(void 0===n&&(n=null),!t)return n;var r=this._dict[t];return r?r[e]:n},e.prototype.putVocabulariesForLanguage=function(e,t){var n=this._dict[e];n||(n=this._dict[e]={}),Object.assign(n,t)},e.prototype.putVocabularies=function(e){var t=this;Object.keys(e).map((function(n){t.putVocabulariesForLanguage(n,e[n])}))},e}(),_=new s("I18n"),x=null,k=null,j=function(){function e(){}return e.configure=function(t){return _.debug("configure I18n"),t?(x=Object.assign({},x,t.I18n||t),e.createInstance(),x):x},e.getModuleName=function(){return"I18n"},e.createInstance=function(){_.debug("create I18n instance"),k||(k=new w(x))},e.setLanguage=function(t){return e.checkConfig(),k.setLanguage(t)},e.get=function(t,n){return e.checkConfig()?k.get(t,n):void 0===n?t:n},e.putVocabulariesForLanguage=function(t,n){return e.checkConfig(),k.putVocabulariesForLanguage(t,n)},e.putVocabularies=function(t){return e.checkConfig(),k.putVocabularies(t)},e.checkConfig=function(){return k||(k=new w(x)),!0},e}();u.register(j);var S,C=j,O=n(0),A=(S=function(e,t){return(S=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(e,t){function n(){this.constructor=e}S(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),I=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{u(r.next(e))}catch(e){i(e)}}function a(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},P=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},E=new s("Util"),T=function(e){function t(t){var n=e.call(this,t)||this;return n.nonRetryable=!0,n}return A(t,e),t}(Error);function N(e,t,n,r){return void 0===r&&(r=1),I(this,void 0,void 0,(function(){var o,i;return P(this,(function(s){switch(s.label){case 0:if("function"!=typeof e)throw Error("functionToRetry must be a function");E.debug(e.name+" attempt #"+r+" with this vars: "+JSON.stringify(t)),s.label=1;case 1:return s.trys.push([1,3,,8]),[4,e.apply(void 0,t)];case 2:return[2,s.sent()];case 3:if(o=s.sent(),E.debug("error on "+e.name+": "+o+" "),(a=o)&&a.nonRetryable)throw E.debug(e.name+" non retryable error "+o),o;return i=n(r,t,o),E.debug(e.name+" retrying in "+i+" ms"),!1===i?[3,6]:[4,new Promise((function(e){return setTimeout(e,i)}))];case 4:return s.sent(),[4,N(e,t,n,r+1)];case 5:return[2,s.sent()];case 6:throw o;case 7:return[3,8];case 8:return[2]}var a}))}))}var R=function(e,t,n){return void 0===n&&(n=3e5),N(e,t,function(e){return function(t){var n=100*Math.pow(2,t)+100*Math.random();return!(n>e)&&n}}(n))},L=function(){function e(){this._queue=[],this._pending=!1}return e.prototype.isLocked=function(){return this._pending},e.prototype.acquire=function(){var e=this,t=new Promise((function(t){return e._queue.push(t)}));return this._pending||this._dispatchNext(),t},e.prototype.runExclusive=function(e){return this.acquire().then((function(t){var n;try{n=e()}catch(e){throw t(),e}return Promise.resolve(n).then((function(e){return t(),e}),(function(e){throw t(),e}))}))},e.prototype._dispatchNext=function(){this._queue.length>0?(this._pending=!0,this._queue.shift()(this._dispatchNext.bind(this))):this._pending=!1},e}(),F=n(2),W=function(){function e(){}return e.prototype.networkMonitor=function(){return new F((function(e){e.next({online:window.navigator.onLine});var t=function(){return e.next({online:!0})},n=function(){return e.next({online:!1})};return window.addEventListener("online",t),window.addEventListener("offline",n),function(){window.removeEventListener("online",t),window.removeEventListener("offline",n)}}))},e}(),U={clockOffset:0,getDateWithClockOffset:function(){return U.clockOffset?new Date((new Date).getTime()+U.clockOffset):new Date},getClockOffset:function(){return U.clockOffset},setClockOffset:function(e){U.clockOffset=e}};
/*!
* The MIT License (MIT)
*
* Copyright (c) 2016 Christian Speckner <cnspeckn@googlemail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/function q(e){return(q="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})(e)}var z=function(){return(z=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},B=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n},H=new s("Signer"),D=n(5),M=r.util.crypto,G=function(e,t,n){return M.lib.createHmac("sha256",e).update(t,"utf8").digest(n)},V=function(e){var t=e||"";return M.createHash("sha256").update(t,"utf8").digest("hex")},K=function(e){return Object.keys(e).map((function(e){return e.toLowerCase()})).sort().join(";")},X=function(e){var t,n,r=D.parse(e.url);return[e.method||"/",encodeURIComponent(r.pathname).replace(/%2F/gi,"/"),(n=r.query,n&&0!==n.length?n.split("&").map((function(e){var t=e.split("=");if(1===t.length)return e;var n=t[1].replace(/[!'()*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}));return t[0]+"="+n})).sort((function(e,t){var n=e.split("=")[0],r=t.split("=")[0];return n===r?e<t?-1:1:n<r?-1:1})).join("&"):""),(t=e.headers,t&&0!==Object.keys(t).length?Object.keys(t).map((function(e){return{key:e.toLowerCase(),value:t[e]?t[e].trim().replace(/\s+/g," "):""}})).sort((function(e,t){return e.key<t.key?-1:1})).map((function(e){return e.key+":"+e.value})).join("\n")+"\n":""),K(e.headers),V(e.data)].join("\n")},J=function(e){var t=(D.parse(e.url).host.match(/([^\.]+)\.(?:([^\.]*)\.)?amazonaws\.com$/)||[]).slice(1,3);return"es"===t[1]&&(t=t.reverse()),{service:e.service||t[0],region:e.region||t[1]}},Y=function(e,t,n){return[e,t,n,"aws4_request"].join("/")},Z=function(e,t,n,r){return[e,n,r,V(t)].join("\n")},$=function(e,t,n){H.debug(n);var r=G("AWS4"+e,t),o=G(r,n.region),i=G(o,n.service);return G(i,"aws4_request")},Q=function(e,t){return G(e,t,"hex")},ee=function(){function e(){}return e.sign=function(e,t,n){void 0===n&&(n=null),e.headers=e.headers||{};var r=U.getDateWithClockOffset().toISOString().replace(/[:\-]|\.\d{3}/g,""),o=r.substr(0,8),i=D.parse(e.url);e.headers.host=i.host,e.headers["x-amz-date"]=r,t.session_token&&(e.headers["X-Amz-Security-Token"]=t.session_token);var s=X(e);H.debug(s);var a=n||J(e),u=Y(o,a.region,a.service),c=Z("AWS4-HMAC-SHA256",s,r,u),l=$(t.secret_key,o,a),f=Q(l,c),h=function(e,t,n,r,o){return[e+" Credential="+t+"/"+n,"SignedHeaders="+r,"Signature="+o].join(", ")}("AWS4-HMAC-SHA256",t.access_key,u,K(e.headers),f);return e.headers.Authorization=h,e},e.signUrl=function(e,t,n,r){var o="object"===q(e)?e.url:e,i="object"===q(e)?e.method:"GET",s="object"===q(e)?e.body:void 0,a=U.getDateWithClockOffset().toISOString().replace(/[:\-]|\.\d{3}/g,""),u=a.substr(0,8),c=D.parse(o,!0,!0),l=(c.search,B(c,["search"])),f={host:l.host},h=n||J({url:D.format(l)}),p=h.region,d=h.service,g=Y(u,p,d),y=t.session_token&&"iotdevicegateway"!==d,v=z(z(z({"X-Amz-Algorithm":"AWS4-HMAC-SHA256","X-Amz-Credential":[t.access_key,g].join("/"),"X-Amz-Date":a.substr(0,16)},y?{"X-Amz-Security-Token":""+t.session_token}:{}),r?{"X-Amz-Expires":""+r}:{}),{"X-Amz-SignedHeaders":Object.keys(f).join(",")}),b=X({method:i,url:D.format(z(z({},l),{query:z(z({},l.query),v)})),headers:f,data:s}),m=Z("AWS4-HMAC-SHA256",b,a,g),w=$(t.secret_key,u,{region:p,service:d}),_=Q(w,m),x=z({"X-Amz-Signature":_},t.session_token&&{"X-Amz-Security-Token":t.session_token});return D.format({protocol:l.protocol,slashes:!0,hostname:l.hostname,port:l.port,pathname:l.pathname,query:z(z(z({},l.query),v),x)})},e}(),te=new s("Parser"),ne=function(){function e(){}return e.parseMobilehubConfig=function(e){var t,n={};if(e.aws_mobile_analytics_app_id){var r={AWSPinpoint:{appId:e.aws_mobile_analytics_app_id,region:e.aws_mobile_analytics_app_region}};n.Analytics=r}if(e.aws_cognito_identity_pool_id||e.aws_user_pools_id){var o={userPoolId:e.aws_user_pools_id,userPoolWebClientId:e.aws_user_pools_web_client_id,region:e.aws_cognito_region,identityPoolId:e.aws_cognito_identity_pool_id,identityPoolRegion:e.aws_cognito_region,mandatorySignIn:"enable"===e.aws_mandatory_sign_in};n.Auth=o}return t=e.aws_user_files_s3_bucket?{AWSS3:{bucket:e.aws_user_files_s3_bucket,region:e.aws_user_files_s3_bucket_region,dangerouslyConnectToHttpEndpointForTesting:e.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing}}:e?e.Storage||e:{},n.Analytics=Object.assign({},n.Analytics,e.Analytics),n.Auth=Object.assign({},n.Auth,e.Auth),n.Storage=Object.assign({},t),te.debug("parse config",e,"to amplifyconfig",n),n},e}(),re=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{u(r.next(e))}catch(e){i(e)}}function a(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},oe=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},ie=new s("CognitoCredentials"),se=new Promise((function(e,t){return O.a.browserOrNode().isBrowser?(window.gapi&&window.gapi.auth2?window.gapi.auth2:null)?(ie.debug("google api already loaded"),e()):void setTimeout((function(){return e()}),2e3):(ie.debug("not in the browser, directly resolved"),e())})),ae=function(){function e(){this.initialized=!1,this.refreshGoogleToken=this.refreshGoogleToken.bind(this),this._refreshGoogleTokenImpl=this._refreshGoogleTokenImpl.bind(this)}return e.prototype.refreshGoogleToken=function(){return re(this,void 0,void 0,(function(){return oe(this,(function(e){switch(e.label){case 0:return this.initialized?[3,2]:(ie.debug("need to wait for the Google SDK loaded"),[4,se]);case 1:e.sent(),this.initialized=!0,ie.debug("finish waiting"),e.label=2;case 2:return[2,this._refreshGoogleTokenImpl()]}}))}))},e.prototype._refreshGoogleTokenImpl=function(){var e=null;return O.a.browserOrNode().isBrowser&&(e=window.gapi&&window.gapi.auth2?window.gapi.auth2:null),e?new Promise((function(t,n){e.getAuthInstance().then((function(e){e||(console.log("google Auth undefiend"),n("google Auth undefiend"));var r=e.currentUser.get();r.isSignedIn()?(ie.debug("refreshing the google access token"),r.reloadAuthResponse().then((function(e){var n=e.id_token,o=e.expires_at,i=r.getBasicProfile();i.getEmail(),i.getName();t({token:n,expires_at:o})}))):n("User is not signed in with Google")})).catch((function(e){ie.debug("Failed to refresh google token",e),n("Failed to refresh google token")}))})):(ie.debug("no gapi auth2 available"),Promise.reject("no gapi auth2 available"))},e}(),ue=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{u(r.next(e))}catch(e){i(e)}}function a(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},ce=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},le=new s("CognitoCredentials"),fe=new Promise((function(e,t){return O.a.browserOrNode().isBrowser?window.FB?(le.debug("FB SDK already loaded"),e()):void setTimeout((function(){return e()}),2e3):(le.debug("not in the browser, directly resolved"),e())})),he=func