PageSourceSearch

https://www.fortuneidn.com/_next/static/chunks/amplify.ff4a9e9fddd2e361.js

js fortuneidn.com collected 2026-10-02 17:06:55 UTC 496,412 bytes, 1 lines download raw bytes

1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="535aceb1-8119-4103-a0e9-85479a8ca160",e._sentryDebugIdIdentifier="sentry-dbid-535aceb1-8119-4103-a0e9-85479a8ca160")}()}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2640],{66964:function(e,t,n){"use strict";n.d(t,{c:function(){return Z}});var r=n(25049),i=n(69276),o=n(52674),s=n(30587),a=n(98922),u=function(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},c=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(u(arguments[t]));return e},l=[],f=function(){function e(e,t){this.context=e,this.methodName=t,this._originalMethod=e[t].bind(e)}return e.add=function(e,t,n){d(e,t).set(n)},e.remove=function(e,t){d(e,t).remove()},e.prototype.set=function(e){var t=this;this.context[this.methodName]=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return e(t._originalMethod.apply(t,c(n)))}},e.prototype.remove=function(){this.context[this.methodName]=this._originalMethod},e}();function d(e,t){var n=l.filter(function(n){return n.context===e&&n.methodName===t})[0];return n||(n=new f(e,t),l.push(n)),n}var h=n(96141),p=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},g=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},y=new r.k("PageViewTracker"),v="aws-amplify-analytics-prevUrl",b={enable:!1,provider:"AWSPinpoint",getUrl:function(){return h.JS.browserOrNode().isBrowser?window.location.origin+window.location.pathname:""}},m=function(){function e(e,t){y.debug("initialize pageview tracker with opts",t),this._config=Object.assign({},b,t),this._tracker=e,this._hasEnabled=!1,this._trackFunc=this._trackFunc.bind(this),"SPA"===this._config.type?this._pageViewTrackSPA():this._pageViewTrackDefault()}return e.prototype.configure=function(e){return Object.assign(this._config,e),"SPA"===this._config.type&&this._pageViewTrackSPA(),this._config},e.prototype._isSameUrl=function(){return sessionStorage.getItem(v)===this._config.getUrl()&&(y.debug("the url is same"),!0)},e.prototype._pageViewTrackDefault=function(){return p(this,void 0,void 0,function(){var e,t,n;return g(this,function(r){switch(r.label){case 0:if(!h.JS.browserOrNode().isBrowser||!window.addEventListener||!window.sessionStorage)return y.debug("not in the supported web enviroment"),[2];if(e=this._config.getUrl(),"function"!=typeof this._config.attributes)return[3,2];return[4,this._config.attributes()];case 1:return t=r.sent(),[3,3];case 2:t=this._config.attributes,r.label=3;case 3:return n=Object.assign({url:e},t),this._config.enable&&!this._isSameUrl()&&(this._tracker({name:this._config.eventName||"pageView",attributes:n},this._config.provider).catch(function(e){y.debug("Failed to record the page view event",e)}),sessionStorage.setItem(v,e)),[2]}})})},e.prototype._trackFunc=function(){return p(this,void 0,void 0,function(){var e,t,n;return g(this,function(r){switch(r.label){case 0:if(!h.JS.browserOrNode().isBrowser||!window.addEventListener||!history.pushState||!window.sessionStorage)return y.debug("not in the supported web enviroment"),[2];if(e=this._config.getUrl(),"function"!=typeof this._config.attributes)return[3,2];return[4,this._config.attributes()];case 1:return t=r.sent(),[3,3];case 2:t=this._config.attributes,r.label=3;case 3:return n=Object.assign({url:e},t),this._isSameUrl()||(this._tracker({name:this._config.eventName||"pageView",attributes:n},this._config.provider).catch(function(e){y.debug("Failed to record the page view event",e)}),sessionStorage.setItem(v,e)),[2]}})})},e.prototype._pageViewTrackSPA=function(){if(!h.JS.browserOrNode().isBrowser||!window.addEventListener||!history.pushState){y.debug("not in the supported web enviroment");return}this._config.enable&&!this._hasEnabled?(f.add(history,"pushState",this._trackFunc),f.add(history,"replaceState",this._trackFunc),window.addEventListener("popstate",this._trackFunc),this._trackFunc(),this._hasEnabled=!0):(f.remove(history,"pushState"),f.remove(history,"replaceState"),window.removeEventListener("popstate",this._trackFunc),this._hasEnabled=!1)},e}(),_=h.JS.browserOrNode().isBrowser&&window.Element?window.Element.prototype:null,w=_?_.matches||_.matchesSelector||_.webkitMatchesSelector||_.mozMatchesSelector||_.msMatchesSelector||_.oMatchesSelector:null;function S(e,t){if(e&&1===e.nodeType&&t){if("string"==typeof t||1===t.nodeType)return e===t||E(e,t);if("length"in t){for(var n=0,r=void 0;r=t[n];n++)if(e===r||E(e,r))return!0}}return!1}function E(e,t){if("string"!=typeof t)return!1;if(w)return w.call(e,t);for(var n=e.parentNode.querySelectorAll(t),r=0,i=void 0;i=n[r];r++)if(i===e)return!0;return!1}var I=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;
1function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},P=new r.k("EventTracker"),C={enable:!1,events:["click"],selectorPrefix:"data-amplify-analytics-",provider:"AWSPinpoint"},O=function(){function e(e,t){if(!h.JS.browserOrNode().isBrowser||!window.addEventListener){P.debug("not in the supported web environment");return}this._config=Object.assign({},C,t),this._tracker=e,this._delegates={},this._trackFunc=this._trackFunc.bind(this),P.debug("initialize pageview tracker with opts",this._config),this.configure(this._config)}return e.prototype.configure=function(e){var t=this;if(Object.assign(this._config,e),this._config.enable){if(this._config.enable&&0===Object.keys(this._delegates).length){var n="["+this._config.selectorPrefix+"on]";this._config.events.forEach(function(e){var r,i,o,s;t._delegates[e]=(r=document,i=t._trackFunc,o={composed:!0,useCapture:!0},s=function(e){var t;if(o.composed&&"function"==typeof e.composedPath)for(var r=e.composedPath(),s=0,a=void 0;a=r[s];s++)1===a.nodeType&&S(a,n)&&(t=a);else t=function(e,t,n){if(void 0===n&&(n=!1),e&&1===e.nodeType&&t){for(var r,i=(n?[e]:[]).concat(function(e){for(var t=[],n=e;n&&n.parentNode&&1===n.parentNode.nodeType;)t.push(n=n.parentNode);return t}(e)),o=0;r=i[o];o++)if(S(r,t))return r}}(e.target,n,!0);t&&i.call(t,e,t)},r.addEventListener(e,s,o.useCapture),{destroy:function(){r.removeEventListener(e,s,o.useCapture)}})})}}else Object.keys(this._delegates).forEach(function(e){"function"==typeof t._delegates[e].destroy&&t._delegates[e].destroy()}),this._delegates={};return this._config},e.prototype._trackFunc=function(e,t){var n,r,i,o;return n=this,r=void 0,i=void 0,o=function(){var n,r,i,o,s,a,u;return I(this,function(c){switch(c.label){case 0:if(n={},r=t.getAttribute(this._config.selectorPrefix+"on").split(/\s*,\s*/),i=t.getAttribute(this._config.selectorPrefix+"name"),(o=t.getAttribute(this._config.selectorPrefix+"attrs"))&&o.split(/\s*,\s*/).forEach(function(e){var t=e.trim().split(/\s*:\s*/);n[t[0]]=t[1]}),"function"!=typeof this._config.attributes)return[3,2];return[4,this._config.attributes()];case 1:return a=c.sent(),[3,3];case 2:a=this._config.attributes,c.label=3;case 3:if(s=a,u=Object.assign({type:e.type,target:e.target.localName+" with id "+e.target.id},s,n),P.debug("events needed to be recorded",r),P.debug("attributes needed to be attached",n),0>r.indexOf(e.type))return P.debug("event "+e.type+" is not selected to be recorded"),[2];return this._tracker({name:i||"event",attributes:u},this._config.provider).catch(function(t){P.debug("Failed to record the "+e.type+" event', "+t)}),[2]}})},new(i||(i=Promise))(function(e,t){function s(e){try{u(o.next(e))}catch(e){t(e)}}function a(e){try{u(o.throw(e))}catch(e){t(e)}}function u(t){var n;t.done?e(t.value):((n=t.value)instanceof i?n:new i(function(e){e(n)})).then(s,a)}u((o=o.apply(n,r||[])).next())})},e}(),A=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},k=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;
1function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},T=new r.k("SessionTracker"),N={enable:!1,provider:"AWSPinpoint"},x=!1,M=function(){function e(e,t){this._config=Object.assign({},N,t),this._tracker=e,this._hasEnabled=!1,this._trackFunc=this._trackFunc.bind(this),this._trackBeforeUnload=this._trackBeforeUnload.bind(this),this.configure(this._config)}return e.prototype._envCheck=function(){if(!h.JS.browserOrNode().isBrowser)return!1;if(!document||!document.addEventListener)return T.debug("not in the supported web environment"),!1;if(void 0!==document.hidden)this._hidden="hidden",this._visibilityChange="visibilitychange";else if(void 0!==document.msHidden)this._hidden="msHidden",this._visibilityChange="msvisibilitychange";else{if(void 0===document.webkitHidden)return T.debug("not in the supported web environment"),!1;this._hidden="webkitHidden",this._visibilityChange="webkitvisibilitychange"}return!0},e.prototype._trackFunc=function(){return A(this,void 0,void 0,function(){var e,t;return k(this,function(n){switch(n.label){case 0:if("function"!=typeof this._config.attributes)return[3,2];return[4,this._config.attributes()];case 1:return e=n.sent(),[3,3];case 2:e=this._config.attributes,n.label=3;case 3:return t=Object.assign({},e),document.visibilityState===this._hidden?this._tracker({name:"_session.stop",attributes:t},this._config.provider).catch(function(e){T.debug("record session stop event failed.",e)}):this._tracker({name:"_session.start",attributes:t},this._config.provider).catch(function(e){T.debug("record session start event failed.",e)}),[2]}})})},e.prototype._trackBeforeUnload=function(e){var t=this;("function"==typeof this._config.attributes?Promise.resolve(this._config.attributes()):Promise.resolve(this._config.attributes)).then(function(e){var n=Object.assign({},e);t._tracker({name:"_session.stop",attributes:n,immediate:!0},t._config.provider).catch(function(e){T.debug("record session stop event failed.",e)})})},e.prototype._sendInitialEvent=function(){return A(this,void 0,void 0,function(){var e,t;return k(this,function(n){switch(n.label){case 0:if(x)return T.debug("the start session has been sent when the page is loaded"),[2];if(x=!0,"function"!=typeof this._config.attributes)return[3,2];return[4,this._config.attributes()];case 1:return e=n.sent(),[3,3];case 2:e=this._config.attributes,n.label=3;case 3:return t=Object.assign({},e),this._tracker({name:"_session.start",attributes:t},this._config.provider).catch(function(e){T.debug("record session start event failed.",e)}),[2]}})})},e.prototype.configure=function(e){return this._envCheck()&&(Object.assign(this._config,e),this._config.enable&&!this._hasEnabled?(this._sendInitialEvent(),document.addEventListener(this._visibilityChange,this._trackFunc,!1),window.addEventListener("beforeunload",this._trackBeforeUnload,!1),this._hasEnabled=!0):!this._config.enable&&this._hasEnabled&&(document.removeEventListener(this._visibilityChange,this._trackFunc,!1),window.removeEventListener("beforeunload",this._trackBeforeUnload,!1),this._hasEnabled=!1)),this._config},e}(),R=function(){return(R=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)}
1,j=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},U=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},D=new r.k("AnalyticsClass"),L="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",F=function(e,t,n){i.Xb.dispatch("analytics",{event:e,data:t,message:n},"Analytics",L)},B={pageView:m,event:O,session:M},G=null,q=function(){function e(){this._config={},this._pluggables=[],this._disabled=!1,this._trackers={},G=this,this.record=this.record.bind(this),i.Xb.listen("auth",H),i.Xb.listen("storage",H),i.Xb.listen("analytics",H)}return e.prototype.getModuleName=function(){return"Analytics"},e.prototype.configure=function(e){var t=this;if(!e)return this._config;D.debug("configure Analytics",e);var n=o._b.parseMobilehubConfig(e);return this._config=Object.assign({},this._config,n.Analytics,e),this._config.disabled&&(this._disabled=!0),void 0===this._config.autoSessionRecord&&(this._config.autoSessionRecord=!0),this._pluggables.forEach(function(e){var n="AWSPinpoint"!==e.getProviderName()||t._config.AWSPinpoint?t._config[e.getProviderName()]:t._config;e.configure(R({disabled:t._config.disabled,autoSessionRecord:t._config.autoSessionRecord},n))}),0===this._pluggables.length&&this.addPluggable(new a.Y),F("configured",null,"The Analytics category has been configured successfully"),D.debug("current configuration",this._config),this._config},e.prototype.addPluggable=function(e){if(e&&"Analytics"===e.getCategory()){this._pluggables.push(e);var t="AWSPinpoint"!==e.getProviderName()||this._config.AWSPinpoint?this._config[e.getProviderName()]:this._config,n=R({disabled:this._config.disabled},t);return e.configure(n),n}},e.prototype.getPluggable=function(e){for(var t=0;t<this._pluggables.length;t+=1){var n=this._pluggables[t];if(n.getProviderName()===e)return n}return D.debug("No plugin found with providerName",e),null},e.prototype.removePluggable=function(e){for(var t=0;t<this._pluggables.length&&this._pluggables[t].getProviderName()!==e;)t+=1;if(t===this._pluggables.length){D.debug("No plugin found with providerName",e);return}this._pluggables.splice(t,t+1)},e.prototype.disable=function(){this._disabled=!0},e.prototype.enable=function(){this._disabled=!1},e.prototype.startSession=function(e){return j(this,void 0,void 0,function(){var t;return U(this,function(n){return t={event:{name:"_session.start"},provider:e},[2,this._sendEvent(t)]})})},e.prototype.stopSession=function(e){return j(this,void 0,void 0,function(){var t;return U(this,function(n){return t={event:{name:"_session.stop"},provider:e},[2,this._sendEvent(t)]})})},e.prototype.record=function(e,t,n){return j(this,void 0,void 0,function(){var r;return U(this,function(i){return r=null,r="string"==typeof e?{event:{name:e,attributes:t,metrics:n},provider:"AWSPinpoint"}:{event:e,provider:t},[2,this._sendEvent(r)]})})},e.prototype.updateEndpoint=function(e,t){return j(this,void 0,void 0,function(){var n;return U(this,function(r){return n=R(R({},e),{name:"_update_endpoint"}),[2,this.record(n,t)]})})},e.prototype._sendEvent=function(e){var t=this;if(this._disabled)return D.debug("Analytics has been disabled"),Promise.resolve();var n=e.provider?e.provider:"AWSPinpoint";
1return new Promise(function(r,i){t._pluggables.forEach(function(t){t.getProviderName()===n&&t.record(e,{resolve:r,reject:i})})})},e.prototype.autoTrack=function(e,t){if(!B[e]){D.debug("invalid tracker type");return}"session"===e&&(this._config.autoSessionRecord=t.enable);var n=this._trackers[e];n?n.configure(t):this._trackers[e]=new B[e](this.record,t)},e}(),z=!1,W=!1,K=!1,H=function(e){var t=e.channel,n=e.payload;switch(D.debug("on hub capsule "+t,n),t){case"auth":V(n);break;case"storage":Y(n);break;case"analytics":Q(n)}},Y=function(e){var t=e.data,n=t.attrs,r=t.metrics;n&&K&&G.record({name:"Storage",attributes:n,metrics:r}).catch(function(e){D.debug("Failed to send the storage event automatically",e)})},V=function(e){var t=e.event;if(t){var n=function(e){return j(void 0,void 0,void 0,function(){var t;return U(this,function(n){switch(n.label){case 0:if(!(W&&K))return[3,4];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,G.record({name:"_userauth."+e})];case 2:return[2,n.sent()];case 3:return t=n.sent(),D.debug("Failed to send the "+e+" event automatically",t),[3,4];case 4:return[2]}})})};switch(t){case"signIn":return n("sign_in");case"signUp":return n("sign_up");case"signOut":return n("sign_out");case"signIn_failure":return n("auth_fail");case"configured":W=!0,K&&J()}}},Q=function(e){var t=e.event;t&&"pinpointProvider_configured"===t&&(K=!0,W&&K&&J())},J=function(){var e=G.configure();!z&&e.autoSessionRecord&&(G.updateEndpoint({immediate:!0}).catch(function(e){D.debug("Failed to update the endpoint",e)}),z=!0),G.autoTrack("session",{enable:e.autoSessionRecord})},Z=new q;s.dQ.register(Z)},41346:function(e,t,n){"use strict";n.d(t,{s:function(){return f}});var r,i=n(25049),o=n(21368),s=n(96784),a=n(203),u=n(14752),c=(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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),l=new i.k("AWSKineisFirehoseProvider"),f=function(e){function t(t){return e.call(this,t)||this}return c(t,e),t.prototype.getProviderName=function(){return"AWSKinesisFirehose"},t.prototype._sendEvents=function(e){var t=this;if(0!==e.length){var n=e[0],r=n.config,i=n.credentials;if(!this._init(r,i))return!1;var o={};e.map(function(e){var t=e.event,n=t.streamName,r=t.data;void 0===o[n]&&(o[n]=[]);var i=r&&"string"!=typeof r?JSON.stringify(r):r,s=(0,u.fromUtf8)(i);o[n].push({Data:s})}),Object.keys(o).map(function(e){l.debug("putting records to kinesis",e,"with records",o[e]),t._kinesisFirehose.send(new s.L({Records:o[e],DeliveryStreamName:e})).then(function(t){return l.debug("Upload records to stream",e)}).catch(function(e){return l.debug("Failed to upload records to Kinesis",e)})})}},t.prototype._init=function(e,t){if(l.debug("init clients"),this._kinesisFirehose&&this._config.credentials&&this._config.credentials.sessionToken===t.sessionToken&&this._config.credentials.identityId===t.identityId)return l.debug("no change for analytics config, directly return from init"),!0;this._config.credentials=t;var n=e.region;return this._initFirehose(n,t)},t.prototype._initFirehose=function(e,t){return l.debug("initialize kinesis firehose with credentials",t),this._kinesisFirehose=new a.u({apiVersion:"2015-08-04",region:e,credentials:t}),!0},t}(o.s)},21368:function(e,t,n){"use strict";n.d(t,{s:function(){return d}});var r=n(25049),i=n(15047),o=n(22485),s=n(22412),a=n(91307),u=n(14752),c=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},l=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;
1function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},f=new r.k("AWSKinesisProvider"),d=function(){function e(e){this._buffer=[],this._config=e||{},this._config.bufferSize=this._config.bufferSize||1e3,this._config.flushSize=this._config.flushSize||100,this._config.flushInterval=this._config.flushInterval||5e3,this._config.resendLimit=this._config.resendLimit||5,this._setupTimer()}return e.prototype._setupTimer=function(){var e=this;this._timer&&clearInterval(this._timer);var t=this._config,n=t.flushSize,r=t.flushInterval;this._timer=setInterval(function(){for(var t=e._buffer.length<n?e._buffer.length:n,r=[],i=0;i<t;i+=1){var o=e._buffer.shift();r.push(o)}e._sendFromBuffer(r)},r)},e.prototype.getCategory=function(){return"Analytics"},e.prototype.getProviderName=function(){return"AWSKinesis"},e.prototype.configure=function(e){f.debug("configure Analytics",e);var t=e||{};return this._config=Object.assign({},this._config,t),this._setupTimer(),this._config},e.prototype.record=function(e){return c(this,void 0,void 0,function(){var t;return l(this,function(n){switch(n.label){case 0:return[4,this._getCredentials()];case 1:if(!(t=n.sent()))return[2,Promise.resolve(!1)];return Object.assign(e,{config:this._config,credentials:t}),[2,this._putToBuffer(e)]}})})},e.prototype.updateEndpoint=function(){return f.debug("updateEndpoint is not implemented in Kinesis provider"),Promise.resolve(!0)},e.prototype._putToBuffer=function(e){return this._buffer.length<1e3?(this._buffer.push(e),Promise.resolve(!0)):(f.debug("exceed analytics events buffer size"),Promise.reject(!1))},e.prototype._sendFromBuffer=function(e){for(var t=this,n=[],r=null,i=[],o=0;o<e.length;o+=1){var s=e[o].credentials;0===o?(i.push(e[o]),r=s):s.sessionToken===r.sessionToken&&s.identityId===r.identityId?(f.debug("no change for cred, put event in the same group"),i.push(e[o])):(n.push(i),(i=[]).push(e[o]),r=s)}n.push(i),n.map(function(e){t._sendEvents(e)})},e.prototype._sendEvents=function(e){var t=this;if(0!==e.length){var n=e[0],r=n.config,i=n.credentials;if(!this._init(r,i))return!1;var o={};e.map(function(e){var t=e.event,n=t.streamName;void 0===o[n]&&(o[n]=[]);var r=t.data&&"string"!=typeof t.data?JSON.stringify(t.data):t.data,s=(0,u.fromUtf8)(r),a=t.partitionKey||"partition-"+i.identityId;o[n].push({Data:s,PartitionKey:a})}),Object.keys(o).map(function(e){return c(t,void 0,void 0,function(){var t,n;return l(this,function(r){switch(r.label){case 0:f.debug("putting records to kinesis with records",o[e]),r.label=1;case 1:return r.trys.push([1,3,,4]),t=new s.w({Records:o[e],StreamName:e}),[4,this._kinesis.send(t)];case 2:return r.sent(),f.debug("Upload records to stream",e),[3,4];case 3:return n=r.sent(),f.debug("Failed to upload records to Kinesis",n),[3,4];case 4:return[2]}})})})}},e.prototype._init=function(e,t){if(f.debug("init clients"),this._kinesis&&this._config.credentials&&this._config.credentials.sessionToken===t.sessionToken&&this._config.credentials.identityId===t.identityId)return f.debug("no change for analytics config, directly return from init"),!0;this._config.credentials=t;var n=e.region,r=e.endpoint;return this._initKinesis(n,r,t)},e.prototype._initKinesis=function(e,t,n){return f.debug("initialize kinesis with credentials",n),this._kinesis=new a.Y({region:e,credentials:n,customUserAgent:(0,i.Zm)(),endpoint:t}),!0},e.prototype._getCredentials=function(){var e=this;return o.cN.get().then(function(t){return t?(f.debug("set credentials for analytics",e._config.credentials),o.cN.shear(t)):null}).catch(function(e){return f.debug("ensure credentials error",e),null})},e}()},98922:function(e,t,n){"use strict";n.d(t,{Y:function(){return R}});var r=n(69276),i=n(25049),o=n(63115),s=n(95436),a=n(96141),u=n(15047),c=n(22485),l=n(69880),f=n(28662),d=n(6562),h=n(69249),p=n(60012),g=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;
1function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},y=function(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},v=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(y(arguments[t]));return e},b=new i.k("EventsBuffer"),m=[429,500],_=[202],w=function(){function e(e,t){this._pause=!1,this._flush=!1,b.debug("Instantiating buffer with config:",t),this._buffer=[],this._client=e,this._config=t,this._sendBatch=this._sendBatch.bind(this),this._startLoop()}return e.prototype.push=function(e){if(this._buffer.length>=this._config.bufferSize)return b.debug("Exceeded analytics events buffer size"),e.handlers.reject(Error("Exceeded the size of analytics events buffer"));var t,n=e.params.event.eventId,r=((t={})[n]=e,t);this._buffer.push(r)},e.prototype.pause=function(){this._pause=!0},e.prototype.resume=function(){this._pause=!1},e.prototype.updateClient=function(e){this._client=e},e.prototype.flush=function(){this._flush=!0},e.prototype._startLoop=function(){this._interval&&clearInterval(this._interval);var e=this._config.flushInterval;this._interval=setInterval(this._sendBatch,e)},e.prototype._sendBatch=function(){var e=this._buffer.length;if(this._flush&&!e&&clearInterval(this._interval),!this._pause&&e){var t=this._config.flushSize,n=this._buffer.splice(0,Math.min(t,e));this._putEvents(n)}},e.prototype._putEvents=function(e){var t,n,r,i;return t=this,n=void 0,r=void 0,i=function(){var t,n,r,i,o;return g(this,function(s){switch(s.label){case 0:t=this._bufferToMap(e),n=this._generateBatchEventParams(t),s.label=1;case 1:return s.trys.push([1,3,,4]),r=new l.W(n),[4,this._client.send(r)];case 2:return i=s.sent(),this._processPutEventsSuccessResponse(i,t),[3,4];case 3:return o=s.sent(),[2,this._handlePutEventsFailure(o,t)];case 4:return[2]}})},new(r||(r=Promise))(function(e,o){function s(e){try{u(i.next(e))}catch(e){o(e)}}function a(e){try{u(i.throw(e))}catch(e){o(e)}}function u(t){var n;t.done?e(t.value):((n=t.value)instanceof r?n:new r(function(e){e(n)})).then(s,a)}u((i=i.apply(t,n||[])).next())})},e.prototype._generateBatchEventParams=function(e){var t={ApplicationId:"",EventsRequest:{BatchItem:{}}};return Object.values(e).forEach(function(e){var n=e.params,r=n.event,i=n.timestamp,o=n.config,s=r.name,a=r.attributes,u=r.metrics,c=r.eventId,l=r.session,f=o.appId,d=o.endpointId,h=t.EventsRequest.BatchItem;t.ApplicationId=t.ApplicationId||f,h[d]||(h[d]={Endpoint:{},Events:{}}),h[d].Events[c]={EventType:s,Timestamp:new Date(i).toISOString(),Attributes:a,Metrics:u,Session:l}}),t},e.prototype._handlePutEventsFailure=function(e,t){b.debug("_putEvents Failed: ",e);var n=e.$metadata&&e.$metadata.httpStatusCode;if(m.includes(n)){var r=Object.values(t);this._retry(r);return}},e.prototype._processPutEventsSuccessResponse=function(e,t){var n=e.EventsResponse.Results,r=[];Object.entries(n).forEach(function(e){var n=y(e,2),i=n[0];Object.entries(n[1].EventsItemResponse).forEach(function(e){var n,o,s=y(e,2),a=s[0],u=s[1],c=u.StatusCode,l=u.Message,f=t[a],d={EventsResponse:{Results:((n={})[i]={EventsItemResponse:((o={})[a]={StatusCode:c,Message:l},o)},n)}};if(_.includes(c)){f.handlers.resolve(d);return}if(m.includes(c)){r.push(f);return}var h=f.params.event.name;return b.error("event "+a+" : "+h+" failed with error: "+l),f.handlers.reject(d)})}),r.length&&this._retry(r)},e.prototype._retry=function(e){var t,n=[];e.forEach(function(e){var t,r=e.params,i=r.event,o=i.eventId,s=i.name;if(r.resendLimit-- >0){b.debug("resending event "+o+" : "+s+" with "+r.resendLimit+" retry attempts remaining"),n.push(((t={})[o]=e,t));return}b.debug("no retry attempts remaining for event "+o+" : "+s)}),(t=this._buffer).unshift.apply(t,v(n))},e.prototype._bufferToMap=function(e){return e.reduce(function(e,t){var n=y(Object.entries(t),1),r=y(n[0],2),i=r[0],o=r[1];return e[i]=o,e},{})},e}(),S=function(){return(S=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)}
1,E=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},I=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},P=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},C="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",O=function(e,t){r.Xb.dispatch("analytics",{event:e,data:t},"Analytics",C)},A=new i.k("AWSPinpointProvider"),k=[429,500],T=[202],N="_update_endpoint",x="_session.stop",M="undefined"!=typeof navigator&&navigator&&"function"==typeof navigator.sendBeacon,R=function(){function e(e){this._endpointGenerating=!0,this._endpointUpdateInProgress=!1,this._buffer=null,this._endpointBuffer=[],this._config=e||{},this._config.bufferSize=this._config.bufferSize||1e3,this._config.flushSize=this._config.flushSize||100,this._config.flushInterval=this._config.flushInterval||5e3,this._config.resendLimit=this._config.resendLimit||5,this._clientInfo=o._.clientInfo()}return e.prototype.getCategory=function(){return e.category},e.prototype.getProviderName=function(){return e.providerName},e.prototype.configure=function(e){var t=this;A.debug("configure Analytics",e);var n=e||{};if(this._config=Object.assign({},this._config,n),this._endpointGenerating=!!e.autoSessionRecord,this._config.appId&&!this._config.disabled){if(this._config.endpointId)O("pinpointProvider_configured",null);else{var r=this.getProviderName()+"_"+this._config.appId;this._getEndpointId(r).then(function(e){A.debug("setting endpoint id from the cache",e),t._config.endpointId=e,O("pinpointProvider_configured",null)}).catch(function(e){A.debug("Failed to generate endpointId",e)})}}else this._flushBuffer();return this._config},e.prototype.record=function(e,t){return E(this,void 0,void 0,function(){var n,r;return I(this,function(i){switch(i.label){case 0:return A.debug("_public record",e),[4,this._getCredentials()];case 1:if(!(n=i.sent())||!this._config.appId||!this._config.region)return A.debug("cannot send events without credentials, applicationId or region"),[2,t.reject(Error("No credentials, applicationId or region"))];if(this._initClients(n),r=new Date().getTime(),this._generateSession(e),e.event.eventId=(0,p.v1)(),Object.assign(e,{timestamp:r,config:this._config}),e.event.immediate)return[2,this._send(e,t)];return this._putToBuffer(e,t),[2]}})})},e.prototype._sendEndpointUpdate=function(e){return E(this,void 0,void 0,function(){var t;return I(this,function(n){switch(n.label){case 0:if(this._endpointUpdateInProgress)return this._endpointBuffer.push(e),[2];return this._endpointUpdateInProgress=!0,[4,this._updateEndpoint(e)];case 1:return n.sent(),t=this._endpointBuffer.shift(),this._endpointUpdateInProgress=!1,t&&this._sendEndpointUpdate(t),[2]}})})},e.prototype._putToBuffer=function(e,t){if(e.event.name===N){this._sendEndpointUpdate({params:e,handlers:t});return}this._buffer&&this._buffer.push({params:e,handlers:t})},e.prototype._generateSession=function(e){this._sessionId=this._sessionId||
1(0,p.v1)();var t=e.event;switch(t.name){case"_session.start":this._sessionStartTimestamp=new Date().getTime(),this._sessionId=(0,p.v1)(),t.session={Id:this._sessionId,StartTimestamp:new Date(this._sessionStartTimestamp).toISOString()};break;case x:var n=new Date().getTime();this._sessionStartTimestamp=this._sessionStartTimestamp||new Date().getTime(),this._sessionId=this._sessionId||(0,p.v1)(),t.session={Id:this._sessionId,Duration:n-this._sessionStartTimestamp,StartTimestamp:new Date(this._sessionStartTimestamp).toISOString(),StopTimestamp:new Date(n).toISOString()},this._sessionId=void 0,this._sessionStartTimestamp=void 0;break;default:this._sessionStartTimestamp=this._sessionStartTimestamp||new Date().getTime(),this._sessionId=this._sessionId||(0,p.v1)(),t.session={Id:this._sessionId,StartTimestamp:new Date(this._sessionStartTimestamp).toISOString()}}},e.prototype._send=function(e,t){return E(this,void 0,void 0,function(){return I(this,function(n){switch(e.event.name){case N:return[2,this._updateEndpoint({params:e,handlers:t})];case x:return[2,this._pinpointSendStopSession(e,t)];default:return[2,this._pinpointPutEvents(e,t)]}return[2]})})},e.prototype._generateBatchItemContext=function(e){var t,n=e.event,r=e.timestamp,i=e.config,o=n.name,s=n.attributes,a=n.metrics,u=n.eventId,c=n.session,l=i.appId,f=i.endpointId,d={ApplicationId:l,EventsRequest:{BatchItem:{}}},h={};return h.Endpoint={},h.Events=((t={})[u]={EventType:o,Timestamp:new Date(r).toISOString(),Attributes:s,Metrics:a,Session:c},t),d.EventsRequest.BatchItem[f]=h,d},e.prototype._pinpointPutEvents=function(e,t){return E(this,void 0,void 0,function(){var n,r,i,o,s,a,u,c,f,d,h,p;return I(this,function(g){switch(g.label){case 0:n=e.event.eventId,r=e.config.endpointId,i=this._generateBatchItemContext(e),o=new l.W(i),g.label=1;case 1:return g.trys.push([1,3,,4]),[4,this.pinpointClient.send(o)];case 2:if(a=s=g.sent(),u=r,c=n,d=(f=a.EventsResponse.Results[u].EventsItemResponse[c]).StatusCode,h=f.Message,T.includes(d))return A.debug("record event success. ",s),[2,t.resolve(s)];if(!k.includes(d))return A.error("Event "+n+" is not accepted, the error is "+h),[2,t.reject(s)];return this._retry(e,t),[3,4];case 3:return p=g.sent(),this._eventError(p),[2,t.reject(p)];case 4:return[2]}})})},e.prototype._pinpointSendStopSession=function(e,t){if(!M){this._pinpointPutEvents(e,t);return}var n=this._generateBatchItemContext(e),r=this._config.region,i=n.ApplicationId,o=n.EventsRequest,a={secret_key:this._config.credentials.secretAccessKey,access_key:this._config.credentials.accessKeyId,session_token:this._config.credentials.sessionToken},u=JSON.stringify(o),c=s.E.signUrl({url:"https://pinpoint."+r+".amazonaws.com/v1/apps/"+i+"/events/legacy",body:u,method:"POST"},a,{region:r,service:"mobiletargeting"},null);return navigator.sendBeacon(c,u)?t.resolve("sendBeacon success"):t.reject("sendBeacon failure")},e.prototype._retry=function(e,t){var n=e.config.resendLimit;e.resendLimit="number"==typeof e.resendLimit?e.resendLimit:n,e.resendLimit-- >0?(A.debug("resending event "+e.eventName+" with "+e.resendLimit+" retry times left"),this._pinpointPutEvents(e,t)):A.debug("retry times used up for event "+e.eventName)},e.prototype._updateEndpoint=function(e){return E(this,void 0,void 0,function(){var t,n,r,i,o,s,u,c;return I(this,function(l){switch(l.label){case 0:t=e.params,n=e.handlers,r=t.config,i=t.event,o={ApplicationId:r.appId,EndpointId:r.endpointId,EndpointRequest:this._endpointRequest(r,a.JS.transferKeyToLowerCase(i,[],["attributes","userAttributes","Attributes","UserAttributes"]))},l.label=1;case 1:return l.trys.push([1,3,,4]),s=new f.E(o),[4,this.pinpointClient.send(s)];case 2:return u=l.sent(),A.debug("updateEndpoint success",u),this._endpointGenerating=!1,this._resumeBuffer(),n.resolve(u),[2];case 3:return c={err:l.sent(),update_params:o,endpointObject:e},[2,this._handleEndpointUpdateFailure(c)];case 4:return[2]}})})},e.prototype._handleEndpointUpdateFailure=function(e){return E(this,void 0,void 0,function(){var t,n,r;return I(this,function(i){return(t=e.err,n=e.endpointObject,r=t.$metadata&&t.$metadata.httpStatusCode,A.debug("updateEndpoint error",t),403===r)?[2,this._handleEndpointUpdateForbidden(e)]:k.includes(r)?[2,this._retryEndpointUpdate(n,!0)]:(A.error("updateEndpoint failed",t),n.handlers.reject(t),[2])})})},e.prototype._handleEndpointUpdateForbidden=function(e){var t=e.err,n=e.endpointObject,r=t.code,i=t.retryable;if("ExpiredTokenException"!==r&&!i)return n.handlers.reject(t);this._retryEndpointUpdate(n)},e.prototype._retryEndpointUpdate=function(e,t){void 0===t&&(t=!1),A.debug("_retryEndpointUpdate",e);var n=e.params,r=n.config.resendLimit;if(n.resendLimit="number"==typeof n.resendLimit?n.resendLimit:r,n.resendLimit-- >0){A.debug("resending endpoint update "+n.event.eventId+" with "+n.resendLimit+" retry attempts remaining"),this._endpointBuffer.length?this._endpointBuffer.unshift(e):this._updateEndpoint(e);return}A.warn("resending endpoint update "+n.event.eventId+" failed after "+n.config.resendLimit+" attempts"),this._endpointGenerating&&A.error("Initial endpoint update failed. ")},e.prototype._initClients=function(e){return E(this,void 0,void 0,function(){var t,n;return I(this,function(r){return(A.debug("init clients"),this.pinpointClient&&this._config.credentials&&this._config.credentials.sessionToken===e.sessionToken&&this._config.credentials.identityId===e.identityId)?A.debug("no change for aws credentials, directly return from init"):(t=this._config.credentials?this._config.credentials.identityId:null,this._config.credentials=e,n=this._config.region,A.debug("init clients with credentials",e),this.pinpointClient=new d.c({region:n,credentials:e,customUserAgent:(0,u.Zm)()}),this.pinpointClient.middlewareStack.addRelativeTo(function(e){return function(t){return delete t.request.headers["amz-sdk-invocation-id"],delete t.request.headers["amz-sdk-request"],e(t)}},{step:"finalizeRequest",relation:"after",toMiddleware:"retryMiddleware"}),this._bufferExists()&&t===e.identityId?this._updateBufferClient():this._initBuffer(),this._customizePinpointClientReq()),[2]})})},e.prototype._bufferExists=function(){return this._buffer&&this._buffer instanceof w},e.prototype._initBuffer=function(){this._bufferExists()&&this._flushBuffer(),this._buffer=new w(this.pinpointClient,this._config),this._endpointGenerating&&this._buffer.pause()},e.prototype._updateBufferClient=function(){this._bufferExists()&&this._buffer.updateClient(this.pinpointClient)},e.prototype._flushBuffer=function(){this._bufferExists()&&(this._buffer.flush(),this._buffer=null)},e.prototype._resumeBuffer=function(){this._bufferExists()&&this._buffer.resume()},e.prototype._customizePinpointClientReq=function(){},e.prototype._getEndpointId=function(e){return E(this,void 0,void 0,function(){var t,n;return I(this,function(r){switch(r.label){case 0:return[4,h.ZP.getItem(e)];case 1:return t=r.sent(),A.debug("endpointId from cache",t,"type",typeof t),t||(t=(0,p.v1)(),n=new Date().getTime()+31536e8,h.ZP.setItem(e,t,{expires:n,priority:1})),[2,t]}})})},e.prototype._endpointRequest=function(e,t){var n=e.credentials,r=this._clientInfo||{},i=e.clientContext||{},o=e.endpoint||{},s={appVersion:r.appVersion,make:r.make,model:r.model,modelVersion:r.version,platform:r.platform};i.clientId,i.appTitle,i.appVersionName,i.appVersionCode,i.appPackageName;var u=P(i,["clientId","appTitle","appVersionName","appVersionCode","a
1ppPackageName"]),c=t.address?"android"===r.platform?"GCM":"APNS":void 0,l=S(S(S({channelType:c,requestId:(0,p.v1)(),effectiveDate:new Date().toISOString()},o),t),{attributes:S(S({},o.attributes),t.attributes),demographic:S(S(S(S({},s),u),o.demographic),t.demographic),location:S(S({},o.location),t.location),metrics:S(S({},o.metrics),t.metrics),user:{userId:t.userId||o.userId||n.identityId,userAttributes:S(S({},o.userAttributes),t.userAttributes)}});l.userId,l.userAttributes,l.name,l.session,l.eventId,l.immediate;var f=P(l,["userId","userAttributes","name","session","eventId","immediate"]);return a.JS.transferKeyToUpperCase(f,[],["metrics","userAttributes","attributes"])},e.prototype._eventError=function(e){A.error("record event failed.",e),A.warn('Please ensure you have updated your Pinpoint IAM Policy with the Action: "mobiletargeting:PutEvents" in order to record events')},e.prototype._getCredentials=function(){return E(this,void 0,void 0,function(){var e,t;return I(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,c.cN.get()];case 1:if(!(e=n.sent()))return[2,null];return A.debug("set credentials for analytics",e),[2,c.cN.shear(e)];case 2:return t=n.sent(),A.debug("ensure credentials error",t),[2,null];case 3:return[2]}})})},e.category="Analytics",e.providerName="AWSPinpoint",e}()},80398:function(e,t,n){"use strict";n.d(t,{C:function(){return k}});var r,i,o,s,a,u,c=n(25049),l=n(96141),f=n(15047),d=n(22485),h=n(86013),p=n(36933),g=n(18158),y=n.n(g),v=n(82660),b=n.n(v),m=n(60012),_=n(69249),w="_awsct_uid",S="_awsct_sid";new c.k("AmazonPersonalizeProvider");var E=function(){function e(e){void 0===e&&(e=""),this._isBrowser=l.JS.browserOrNode().isBrowser,this._timerKey=(0,m.v1)().substr(0,15),this._refreshTimer()}return e.prototype._refreshTimer=function(){this._timer&&clearInterval(this._timer);var e=this;this._timer=setInterval(function(){e._timerKey=(0,m.v1)().substr(0,15)},3e4)},e.prototype.storeValue=function(e,t){var n=new Date,r=new Date;r.setTime(n.getTime()+6048e5),_.ZP.setItem(this._getCachePrefix(e),t,{expires:r.getTime()})},e.prototype.retrieveValue=function(e){return _.ZP.getItem(this._getCachePrefix(e))},e.prototype._getCachePrefix=function(e){return this._isBrowser?e+"."+window.location.host:"peronslize"},e.prototype.getTimerKey=function(){return this._timerKey},e.prototype.updateSessionInfo=function(e,t){var n=t.userId,r=t.sessionId;if(this._isRequireNewSession(e,n,r)){var i=(0,m.v1)();this.storeValue(w,e),this.storeValue(S,i),t.sessionId=i}else this._isRequireUpdateSessionInfo(e,n,r)&&this.storeValue(w,e);t.userId=e},e.prototype._isRequireUpdateSessionInfo=function(e,t,n){return!y()(n)&&y()(t)&&!y()(e)},e.prototype.retrieveSessionInfo=function(e){var t={};return t.trackingId=e,t.sessionId=this.retrieveValue(S),t.userId=this.retrieveValue(w),y()(t.sessionId)&&(t.sessionId=(0,m.v1)(),this.storeValue(S,t.sessionId)),this.storeValue("_awsct",e),t},e.prototype._isRequireNewSession=function(e,t,n){var r=y()(n),i=y()(e)&&!y()(t),o=!y()(e)&&!y()(t)&&!b()(e,t);return r||i||o},e}();(r=s||(s={})).PLAY="play",r.PAUSE="pause",r.ENDED="Ended",(i=a||(a={})).IFRAME="IFRAME",i.VIDEO="VIDEO",i.AUDIO="AUDIO",(o=u||(u={})).PLAY="Play",o.ENDED="Ended",o.PAUSE="Pause",o.TIME_WATCHED="TimeWatched";var I=function(){function e(e,t){this.eventActionMapping=((n={})[u.ENDED]=this.endedEventAction.bind(this),n[u.PLAY]=this.playEventAction.bind(this),n[u.PAUSE]=this.pauseEventAction.bind(this),n);var n,r=e.eventData;this._params=e,this._mediaElement=document.getElementById(r.properties.domElementId),this._started=!1,this._provider=t,({IFRAME:this._iframeMediaTracker,VIDEO:this._html5MediaTracker,AUDIO:this._html5MediaTracker})[this._mediaElement.tagName].bind(this)(),this._initYoutubeFrame()}return e.prototype._initYoutubeFrame=function(){this._youTubeIframeLoader={src:"https://www.youtube.com/iframe_api",loading:!1,loaded:!1,listeners:[],load:function(e){var t=this;if(this.listeners.push(e),this.loaded){setTimeout(function(){t.done()});return}if(!this.loading){this.loading=!0,window.onYouTubeIframeAPIReady=function(){t.loaded=!0,t.done()};var n=document.createElement("script");n.type="text/javascript",n.src=this.src,document.body.appendChild(n)}},done:function(){for(delete window.onYouTubeIframeAPIReady;this.listeners.length;)this.listeners.pop()(window.YT)}}},e.prototype._iframeMediaTracker=function(){var e=this;setInterval(function(){e._started&&e.recordEvent(a.IFRAME,u.TIME_WATCHED)},3e3),this._youTubeIframeLoader.load(function(t){e._iframePlayer=new t.Player(e._mediaElement.id,{events:{onStateChange:e._onPlayerStateChange.bind(e)}})})},e.prototype._onPlayerStateChange=function(e){var t={0:u.ENDED,1:u.PLAY,2:u.PAUSE}[e.data];t&&this.eventActionMapping[t](a.IFRAME)},e.prototype._html5MediaTracker=function(){var e=this;setInterval(function(){e._started&&e.recordEvent(a.VIDEO,u.TIME_WATCHED)},3e3),this._mediaElement.addEventListener(s.PLAY,function(){e.eventActionMapping[u.PLAY](a.VIDEO)},!1),this._mediaElement.addEventListener(s.PAUSE,function(){e.eventActionMapping[u.PAUSE](a.VIDEO)},!1),this._mediaElement.addEventListener(s.ENDED,function(){e.eventActionMapping[u.ENDED](a.VIDEO)},!1)},e.prototype.playEventAction=function(e){this._started=!0,this.recordEvent(e,u.PLAY)},e.prototype.pauseEventAction=function(e){this._started=!1,this.recordEvent(e,u.PAUSE)},e.prototype.endedEventAction=function(e){this._started=!1,this.recordEvent(e,u.ENDED)},e.prototype.recordEvent=function(e,t){var n=Object.assign({},this._params),r=n.eventData;r.eventType=t,e===a.VIDEO?(r.properties.timestamp=this._mediaElement.currentTime,r.properties.duration=this._mediaElement.duration):(r.properties.timestamp=this._financial(this._iframePlayer.getCurrentTime()),r.properties.duration=this._financial(this._iframePlayer.getDuration()));var i=parseFloat(r.properties.timestamp)/parseFloat(r.properties.duration);r.properties.eventValue=Number(i.toFixed(4)),delete r.properties.domElementId,this._provider.putToBuffer(n)},e.prototype._financial=function(e){return Number.parseFloat(e).toFixed(4)},e}(),P=n(63744),C=n.n(P),O=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;
1function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},A=new c.k("AmazonPersonalizeProvider"),k=function(){function e(e){this._buffer=[],this._config=e||{},this._config.flushSize=this._config.flushSize>0&&this._config.flushSize<=10?this._config.flushSize:5,this._config.flushInterval=this._config.flushInterval||5e3,this._sessionManager=new E,y()(this._config.trackingId)||(this._sessionInfo=this._sessionManager.retrieveSessionInfo(this._config.trackingId)),this._isBrowser=l.JS.browserOrNode().isBrowser,this._setupTimer()}return e.prototype._setupTimer=function(){this._timer&&clearInterval(this._timer);var e=this._config.flushInterval,t=this;this._timer=setInterval(function(){t._sendFromBuffer()},e)},e.prototype.record=function(e){var t,n,r,i;return t=this,n=void 0,r=void 0,i=function(){var t,n,r,i,o;return O(this,function(s){switch(s.label){case 0:return[4,this._getCredentials()];case 1:if(!(t=s.sent()))return[2,Promise.resolve(!1)];if(Object.assign(e,{config:this._config,credentials:t,sentAt:new Date}),r=(n=e.event).eventType,i=n.properties,"Identify"===r)return this._sessionManager.updateSessionInfo(i&&i.userId?i.userId:"",this._sessionInfo),[2];if(y()(e.event.userId)||this._sessionManager.updateSessionInfo(e.event.userId,this._sessionInfo),o=this.generateRequestParam
1s(e,this._sessionInfo),"MediaAutoTrack"!==r)return[3,7];if(!this._isBrowser)return[3,5];if(y()(C()(o,"eventData.properties.domElementId",null)))return[3,3];return[4,this.isElementFullyLoaded(this.loadElement,o.eventData.properties.domElementId,500,5)];case 2:return s.sent()?new I(o,this):A.debug("Cannot find the media element."),[3,4];case 3:A.debug("Missing domElementId field in 'properties' for MediaAutoTrack event type."),s.label=4;case 4:return[3,6];case 5:A.debug("MediaAutoTrack only for browser"),s.label=6;case 6:return[2];case 7:return[2,this.putToBuffer(o)]}})},new(r||(r=Promise))(function(e,o){function s(e){try{u(i.next(e))}catch(e){o(e)}}function a(e){try{u(i.throw(e))}catch(e){o(e)}}function u(t){var n;t.done?e(t.value):((n=t.value)instanceof r?n:new r(function(e){e(n)})).then(s,a)}u((i=i.apply(t,n||[])).next())})},e.prototype.loadElement=function(e){return new Promise(function(t,n){return document.getElementById(e)&&document.getElementById(e).clientHeight?t(!0):n(!0)})},e.prototype.isElementFullyLoaded=function(e,t,n,r){var i=this;return new Promise(function(o,s){return e(t).then(o).catch(function(a){return r-1>0?new Promise(function(e){return setTimeout(e,n)}).then(i.isElementFullyLoaded.bind(null,e,t,n,r-1)).then(o).catch(s):s(a)})})},e.prototype.getCategory=function(){return"Analytics"},e.prototype.getProviderName=function(){return"AmazonPersonalize"},e.prototype.configure=function(e){A.debug("configure Analytics",e);var t=e||{};return this._config=Object.assign({},this._config,t),y()(this._config.trackingId)||(this._sessionInfo=this._sessionManager.retrieveSessionInfo(this._config.trackingId)),this._setupTimer(),this._config}
1,e.prototype.generateRequestParams=function(e,t){var n={},r=e.event,i=r.eventType,o=r.properties;return n.eventData={eventType:i,properties:o},n.sessionInfo=t,n.sentAt=e.sentAt,n.credentials=e.credentials,n.config=e.config,n},e.prototype._sendEvents=function(e){var t=e.length;if(0===t){A.debug("events array is empty, directly return");return}var n=e[0],r=n.config,i=n.credentials,o=n.sessionInfo;if(!this._init(r,i))return!1;if(t>0){for(var s=[],a=0;a<t;a+=1){var u=e.shift(),c=this._generateSingleRecordPayload(u,o);s.push(c)}var l={};l.trackingId=o.trackingId,l.sessionId=o.sessionId,l.userId=o.userId,l.eventList=[],s.forEach(function(e){l.eventList.push(e)});var f=new h.W(l);this._personalize.send(f,function(e){e?A.debug("Failed to call putEvents in Personalize",e):A.debug("Put events")})}},e.prototype.putToBuffer=function(e){return this._buffer.length<this._config.flushSize?this._buffer.push(e):(this._buffer.push(e),this._sendFromBuffer()),Promise.resolve(!0)},e.prototype._sendFromBuffer=function(){var e=this,t=this._buffer.length;if(!(t<=0)){for(var n=[],r=null,i=[],o=0;o<t;o+=1){var s=this._buffer.shift(),a=s.credentials,u=s.sessionInfo;0===o?(i.push(s),r=a):b()(u,this._sessionInfo)&&a.sessionToken===r.sessionToken&&a.identityId===r.identityId?(A.debug("no change for cred, put event in the same group"),i.push(s)):(n.push(i),(i=[]).push(s),r=a,this._sessionInfo=u)}n.push(i),n.map(function(t){e._sendEvents(t)})}},e.prototype._generateSingleRecordPayload=function(e,t){var n=e.eventData,r=e.sentAt,i={};return i.sentAt=r,i.properties=n.properties&&JSON.stringify(n.properties),i.eventId=this._sessionManager.getTimerKey()+t.sessionId,i.eventType=n.eventType,i},e.prototype._init=function(e,t){if(A.debug("init clients"),this._personalize&&this._config.credentials&&this._config.credentials.sessionToken===t.sessionToken&&this._config.credentials.identityId===t.identityId)return A.debug("no change for analytics config, directly return from init"),!0;this._config.credentials=t;var n=e.region;return A.debug("initialize personalize with credentials",t),this._personalize=new p.h({region:n,credentials:t,customUserAgent:(0,f.Zm)()}),!0},e.prototype._getCredentials=function(){var e=this;return d.cN.get().then(function(t){return t?(A.debug("set credentials for analytics",e._config.credentials),d.cN.shear(t)):null}).catch(function(e){return A.debug("ensure credentials error",e),null})},e}()},58032:function(e,t,n){"use strict";n.d(t,{wT:function(){return S},xC:function(){return E}});var r=n(66654),i=n(52493),o=n(16655),s=n(25049),a=n(22485),u=n(15047),c=n(81846),l=n(30587),f=n(92843),d=n(46375),h=n(69249),p=n(44977),g=n(20734),y=function(){return(y=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},v=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},b=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},m=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},_=function(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},w=new s.k("GraphQLAPI"),S=function(e,t,n,r){return void 0===t&&(t={}),{query:e,variables:t,authToken:n,userAgentSuffix:r}},E=function(){function e(e){this._api=null,this.Auth=d.ZP,this.Cache=h.ZP,this.Credentials=a.cN,this._options=e,w.debug("API Options",this._options)}return e.prototype.getModuleName=function(){return"GraphQLAPI"},e.prototype.configure=function(e){var t=e||{},n=t.API,r=m(t,["API"]),i=y(y({},r),void 0===n?{}:n);return w.debug("configure GraphQL API",{opt:i}),i.aws_project_region&&(i=Object.assign({},i,{region:i.aws_project_region,header:{}})),void 0!==i.graphql_headers&&"function"!=typeof i.graphql_headers&&(w.warn("graphql_headers should be a function"),i.graphql_headers=void 0),this._options=Object.assign({},this._options,i),this.createInstance(),this._options},e.prototype.createInstance=function(){return(w.debug("create Rest instance"),this._options)?(this._api=new g.H(this._options),this._api.Credentials=this.Credentials,!0):Promise.reject("API not configured")},e.prototype._headerBasedAuth=function(e,t){return void 0===t&&(t={}),v(this,void 0,void 0,function(){var n,r,i,o,s,a,u;return b(this,function(c){switch(c.label){case 0:switch(r=(n=this._options).aws_appsync_authenticationType,i=n.aws_appsync_apiKey,o={},e||r||"AWS_IAM"){case"API_KEY":return[3,1];case"AWS_IAM":return[3,2];case"OPENID_CONNECT":return[3,4];case"AMAZON_COGNITO_USER_POOLS":return[3,11];case"AWS_LAMBDA":return[3,15]}
1return[3,16];case 1:if(!i)throw Error(p.j.NO_API_KEY);return o={Authorization:null,"X-Api-Key":i},[3,17];case 2:return[4,this._ensureCredentials()];case 3:if(!c.sent())throw Error(p.j.NO_CREDENTIALS);return[3,17];case 4:return c.trys.push([4,9,,10]),s=void 0,[4,h.ZP.getItem("federatedInfo")];case 5:if(!(a=c.sent()))return[3,6];return s=a.token,[3,8];case 6:return[4,d.ZP.currentAuthenticatedUser()];case 7:(u=c.sent())&&(s=u.token),c.label=8;case 8:if(!s)throw Error(p.j.NO_FEDERATED_JWT);return o={Authorization:s},[3,10];case 9:case 13:throw c.sent(),Error(p.j.NO_CURRENT_USER);case 10:case 14:return[3,17];case 11:return c.trys.push([11,13,,14]),[4,this.Auth.currentSession()];case 12:return o={Authorization:c.sent().getAccessToken().getJwtToken()},[3,14];case 15:if(!t.Authorization)throw Error(p.j.NO_AUTH_TOKEN);return o={Authorization:t.Authorization},[3,17];case 16:return o={Authorization:null},[3,17];case 17:return[2,o]}})})},e.prototype.getGraphqlOperationType=function(e){return _((0,r.Qc)(e).definitions,1)[0].operation},e.prototype.graphql=function(e,t){var n=e.query,o=e.variables,s=void 0===o?{}:o,a=e.authMode,u=e.authToken,c=e.userAgentSuffix,l="string"==typeof n?(0,r.Qc)(n):(0,r.Qc)((0,i.S)(n)),f=_(l.definitions.filter(function(e){return"OperationDefinition"===e.kind}),1)[0],d=(void 0===f?{}:f).operation,h=t||{};switch(u&&(h.Authorization=u),d){case"query":case"mutation":var p=this._api.getCancellableToken(),g=this._graphql({query:l,variables:s,authMode:a,userAgentSuffix:c},h,{cancellableToken:p});return this._api.updateRequestToBeCancellable(g,p),g;case"subscription":return this._graphqlSubscribe({query:l,variables:s,authMode:a},h);default:throw Error("invalid operation type: "+d)}},e.prototype._graphql=function(e,t,n){var r=e.query,s=e.variables,a=e.authMode,c=e.userAgentSuffix;return void 0===t&&(t={}),void 0===n&&(n={}),v(this,void 0,void 0,function(){var e,l,f,d,h,p,g,v,m,_,w,S,E,I,P,C,O,A,k;return b(this,function(b){switch(b.label){case 0:if(this._api)return[3,2];return[4,this.createInstance()];case 1:b.sent(),b.label=2;case 2:if(l=(e=this._options).aws_appsync_region,f=e.aws_appsync_graphqlEndpoint,h=void 0===(d=e.graphql_headers)?function(){return{}}:d,p=e.graphql_endpoint,g=e.graphql_endpoint_iam_region,v=[{}],!(m=!p))return[3,4];return[4,this._headerBasedAuth(a,t)];case 3:m=b.sent(),b.label=4;case 4:if(_=[y.apply(void 0,v.concat([m]))],!(w=p))return[3,8];if(!g)return[3,6];return[4,this._headerBasedAuth(a,t)];case 5:return S=b.sent(),[3,7];case 6:S={Authorization:null},b.label=7;case 7:w=S,b.label=8;case 8:return E=[y.apply(void 0,_.concat([w]))],[4,h({query:r,variables:s})];case 9:if(I=Object.assign({headers:y.apply(void 0,[y.apply(void 0,[y.apply(void 0,E.concat([b.sent()])),t]),!p&&((k={})["x-amz-user-agent"]=(0,u.Zm)(c),k)]),body:{query:(0,i.S)(r),variables:s},signerServiceInfo:{service:p?"execute-api":"appsync",region:p?g:l}},n),!(P=p||f))throw{data:{},errors:[new o._("No graphql endpoint provided.")]};b.label=10;case 10:return b.trys.push([10,12,,13]),[4,this._api.post(P,I)];case 11:return C=b.sent(),[3,13];case 12:if(O=b.sent(),this._api.isCancel(O))throw O;return C={data:{},errors:[new o._(O.message,null,null,null,null,O)]},[3,13];case 13:if((A=C.errors)&&A.length)throw C;return[2,C]}})})},e.prototype.isCancel=function(e){return this._api.isCancel(e)},e.prototype.cancel=function(e,t){return this._api.cancel(e,t)},e.prototype.hasCancelToken=function(e){return this._api.hasCancelToken(e)},e.prototype._graphqlSubscribe=function(e,t){var n=e.query,r=e.variables,o=e.authMode,s=e.authToken;void 0===t&&(t={});var a=this._options,u=a.aws_appsync_region,l=a.aws_appsync_graphqlEndpoint,d=a.aws_appsync_authenticationType,h=a.aws_appsync_apiKey,p=a.graphql_headers;if(f.p&&"function"==typeof f.p.subscribe)return f.p.subscribe("",{provider:c.om,appSyncGraphqlEndpoint:l,authenticationType:o||d||"AWS_IAM",apiKey:h,query:(0,i.S)(n),region:u,variables:r,graphql_headers:void 0===p?function(){return{}}:p,additionalHeaders:t,authToken:s});throw w.debug("No pubsub module applied for subscription"),Error("No pubsub module applied for subscription")},e.prototype._ensureCredentials=function(){var e=this;return this.Credentials.get().then(function(t){if(!t)return!1;var n=e.Credentials.shear(t);return w.debug("set credentials for api",n),!0}).catch(function(e){return w.warn("ensure credentials error",e),!1})},e}(),I=new E(null);l.dQ.register(I)},44977:function(e,t,n){"use strict";var r,i;n.d(t,{j:function(){return r}}),(i=r||(r={})).NO_API_KEY="No api-key configured",i.NO_CURRENT_USER="No current user",i.NO_C
1REDENTIALS="No credentials",i.NO_FEDERATED_JWT="No federated jwt",i.NO_AUTH_TOKEN="No auth token specified"},20734:function(e,t,n){"use strict";n.d(t,{H:function(){return g}});var r=n(25049),i=n(22485),o=n(15047),s=n(80094),a=n(95436),u=n(24588),c=n.n(u),l=n(8452),f=function(){return(f=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},d=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},h=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},p=new r.k("RestClient"),g=function(){function e(e){this._region="us-east-1",this._service="execute-api",this._custom_header=void 0,this._cancelTokenMap=null,this.Credentials=i.cN,this._options=e,p.debug("API Options",this._options),null==this._cancelTokenMap&&(this._cancelTokenMap=new WeakMap)}return e.prototype.ajax=function(e,t,n){var r,i,a,u;return r=this,i=void 0,a=void 0,u=function(){var r,i,a,u,c,g,y,v,b,m,_,w,S,E=this;return d(this,function(d){switch(d.label){case 0:if(p.debug(t,e),a="us-east-1",u="execute-api",c=void 0,"string"==typeof e?(r=this._parseUrl(e),i=e):(i=e.endpoint,c=e.custom_header,a=e.region,u=e.service,r=this._parseUrl(e.endpoint)),g={method:t,url:i,host:r.host,path:r.path,headers:{},data:null,responseType:"json",timeout:0,cancelToken:null},y={},o.t4.isReactNative&&(y={"User-Agent":o.t4.userAgent||"aws-amplify/0.1.x"}),b=(v=Object.assign({},n)).response,v.body&&("function"==typeof FormData&&v.body instanceof FormData?(y["Content-Type"]="multipart/form-data",g.data=v.body):(y["Content-Type"]="application/json; charset=UTF-8",g.data=JSON.stringify(v.body))),v.responseType&&(g.responseType=v.responseType),v.withCredentials&&(g.withCredentials=v.withCredentials),v.timeout&&(g.timeout=v.timeout),v.cancellableToken&&(g.cancelToken=v.cancellableToken.token),g.signerServiceInfo=v.signerServiceInfo,"function"!=typeof c)return[3,2];return[4,c()];case 1:return _=d.sent(),[3,3];case 2:_=void 0,d.label=3;case 3:if(m=_,g.headers=f(f(f({},y),m),v.headers),(w=(0,l.parse)(i,!0,!0)).search,S=h(w,["search"]),g.url=(0,l.format)(f(f({},S),{query:f(f({},S.query),v.queryStringParameters||{})})),void 0!==g.headers.Authorization)return g.headers=Object.keys(g.headers).reduce(function(e,t){return g.headers[t]&&(e[t]=g.headers[t]),e},{}),[2,this._request(g,b)];return[2,this.Credentials.get().then(function(r){return E._signed(f({},g),r,b,{region:a,service:u}).catch(function(r){if(s.E.isClockSkewError(r)){var i=r.response.headers,o=new Date(i&&(i.date||i.Date)),a=s.E.getDateFromHeaderString(g.headers["x-amz-date"]);if(s.E.isClockSkewed(o))return s.E.setClockOffset(o.getTime()-a.getTime()),E.ajax(e,t,n)}throw r})},function(e){return p.debug("No credentials available, the request will be unsigned"),E._request(g,b)})]}})},new(a||(a=Promise))(function(e,t){function n(e){try{s(u.next(e))}catch(e){t(e)}}function o(e){try{s(u.throw(e))}catch(e){t(e)}}function s(t){var r;t.done?e(t.value):((r=t.value)instanceof a?r:new a(function(e){e(r)})).then(n,o)}s((u=u.apply(r,i||[])).next())})},e.prototype.get=function(e,t){return this.ajax(e,"GET",t)},e.prototype.put=function(e,t){return this.ajax(e,"PUT",t)},e.prototype.patch=function(e,t){return this.ajax(e,"PATCH",t)},e.prototype.post=function(e,t){return this.ajax(e,"POST",t)},e.prototype.del=function(e,t){return this.ajax(e,"DELETE",t)},e.prototype.head=function(e,t){return this.ajax(e,"HEAD",t)},e.prototype.cancel=function(e,t){var n=this._cancelTokenMap.get(e);return!!n&&(n.cancel(t),!0)},e.prototype.hasCancelToken=function(e){return this._cancelTokenMap.has(e)},e.prototype.isCancel=function(e){return c().isCancel(e)},e.prototype.getCancellableToken=function(){return c().CancelToken.source()},e.prototype.updateRequestToBeCancellable=function(e,t){this._cancelTokenMap.set(e,t)},e.prototype.endpoint=function(e){var t=this,n=this._options.endpoints,r="";
1return Array.isArray(n)&&n.forEach(function(n){n.name===e&&(r=n.endpoint,"string"==typeof n.region?t._region=n.region:"string"==typeof t._options.region&&(t._region=t._options.region),"string"==typeof n.service?t._service=n.service||"execute-api":t._service="execute-api","function"==typeof n.custom_header?t._custom_header=n.custom_header:t._custom_header=void 0)}),r},e.prototype._signed=function(e,t,n,r){var i=r.service,o=r.region,s=e.signerServiceInfo,u=h(e,["signerServiceInfo"]),l=o||this._region||this._options.region,f=i||this._service||this._options.service,d={secret_key:t.secretAccessKey,access_key:t.accessKeyId,session_token:t.sessionToken},g=Object.assign({region:l,service:f},s),y=a.E.sign(u,d,g);return y.data&&(y.body=y.data),p.debug("Signed Request: ",y),delete y.headers.host,c()(y).then(function(e){return n?e:e.data}).catch(function(e){throw p.debug(e),e})},e.prototype._request=function(e,t){return void 0===t&&(t=!1),c()(e).then(function(e){return t?e:e.data}).catch(function(e){throw p.debug(e),e})},e.prototype._parseUrl=function(e){var t=e.split("/");return{host:t[2],path:"/"+t.slice(3).join("/")}},e}()},11260:function(e,t,n){"use strict";n.d(t,{b:function(){return _},Y:function(){return m}});var r=n(37260),i=n(69249),o=n(20734),s=n(25049),a=n(22485),u=n(30587),c=function(){return(c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},l=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},f=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},d=new s.k("RestAPI"),h=function(){function e(e){this._api=null,this.Credentials=a.cN,this._options=e,d.debug("API Options",this._options)}return e.prototype.getModuleName=function(){return"RestAPI"},e.prototype.configure=function(e){var t=e||{},n=t.API,r=f(t,["API"]),i=c(c({},r),void 0===n?{}:n);if(d.debug("configure Rest API",{opt:i}),i.aws_project_region){if(i.aws_cloud_logic_custom){var o=i.aws_cloud_logic_custom;i.endpoints="string"==typeof o?JSON.parse(o):o}i=Object.assign({},i,{region:i.aws_project_region,header:{}})}return Array.isArray(i.endpoints)?i.endpoints.forEach(function(e){void 0!==e.custom_header&&"function"!=typeof e.custom_header&&(d.warn("Rest API "+e.name+", custom_header should be a function"),e.custom_header=void 0)}):this._options&&Array.isArray(this._options.endpoints)?i.endpoints=this._options.endpoints:i.endpoints=[],this._options=Object.assign({},this._options,i),this.createInstance(),this._options},e.prototype.createInstance=function(){return d.debug("create Rest API instance"),this._api=new o.H(this._options),this._api.Credentials=this.Credentials,!0},e.prototype.get=function(e,t,n){try{var r=this.getEndpointInfo(e,t),i=this._api.getCancellableToken(),o=Object.assign({},n);o.cancellableToken=i;var s=this._api.get(r,o);return this._api.updateRequestToBeCancellable(s,i),s}catch(e){return Promise.reject(e.message)}},e.prototype.post=function(e,t,n){try{var r=this.getEndpointInfo(e,t),i=this._api.getCancellableToken(),o=Object.assign({},n);o.cancellableToken=i;var s=this._api.post(r,o);return this._api.updateRequestToBeCancellable(s,i),s}catch(e){return Promise.reject(e.message)}},e.prototype.put=function(e,t,n){try{var r=this.getEndpointInfo(e,t),i=this._api.getCancellableToken(),o=Object.assign({},n);o.cancellableToken=i;var s=this._api.put(r,o);return this._api.updateRequestToBeCancellable(s,i),s}catch(e){return Promise.reject(e.message)}},e.prototype.patch=function(e,t,n){try{var r=this.getEndpointInfo(e,t),i=this._api.getCancellableToken(),o=Object.assign({},n);o.cancellableToken=i;var s=this._api.patch(r,o);return this._api.updateRequestToBeCancellable(s,i),s}catch(e){return Promise.reject(e.message)}},e.prototype.del=function(e,t,n){try{var r=this.getEndpointInfo(e,t),i=this._api.getCancellableToken(),o=Object.assign({},n);o.cancellableToken=i;var s=this._api.del(r,o);return this._api.updateRequestToBeCancellable(s,i),s}catch(e){return Promise.reject(e.message)}},e.prototype.head=function(e,t,n){try{var r=this.getEndpointInfo(e,t),i=this._api.getCancellableToken(),o=Object.assign({},n);o.cancellableToken=i;var s=this._api.head(r,o);return this._api.updateRequestToBeCancellable(s,i),s}catch(e){return Promise.reject(e.message)}},e.prototype.isCancel=function(e){return this._api.isCancel(e)},e.prototype.cancel=function(e,t){return this._api.cancel(e,t)},e.prototype.hasCancelToken=function(e){return this._api.hasCancelToken(e)},e.prototype.endpoint=function(e){var t,n,r,i;return t=this,n=void 0,r=void 0,i=function(){return l(this,function(t){return[2,this._api.endpoint(e)]})},new(r||(r=Promise))(function(e,o){function s(e){try{u(i.next(e))}catch(e){o(e)}}function a(e){try{u(i.throw(e))}catch(e){o(e)}}function u(t){var n;t.done?e(t.value):((n=t.value)instanceof r?n:new r(function(e){e(n)})).then(s,a)}u((i=i.apply(t,n||[])).next())})},e.prototype.getEndpointInfo=function(e,t){var n=this._options.endpoints;if(!Array.isArray(n))throw Error("API category not configured");var r=n.find(function(t){return t.name===e});if(!r)throw Error("API "+e+" does not exist");var i={endpoint:r.endpoint+t};return"string"==typeof r.region?i.region=r.region:"string"==typeof this._options.region&&(i.region=this._options.region),"string"==typeof r.service?i.service=r.service||"execute-api":i.service="execute-api","function"==typeof r.custom_header?i.custom_header=r.custom_header:i.custom_header=void 0,i},e}(),p=new h(null);u.dQ.register(p);var g=n(58032),y=function(){return(y=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},v=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;
1function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},b=new s.k("API"),m=function(){function e(e){this.Auth=r.g,this.Cache=i.ZP,this.Credentials=a.cN,this._options=e,this._restApi=new h(e),this._graphqlApi=new g.xC(e),b.debug("API Options",this._options)}return e.prototype.getModuleName=function(){return"API"},e.prototype.configure=function(e){this._options=Object.assign({},this._options,e),this._restApi.Credentials=this.Credentials,this._graphqlApi.Auth=this.Auth,this._graphqlApi.Cache=this.Cache,this._graphqlApi.Credentials=this.Credentials;var t=this._restApi.configure(this._options),n=this._graphqlApi.configure(this._options);return y(y({},t),n)},e.prototype.get=function(e,t,n){return this._restApi.get(e,t,n)},e.prototype.post=function(e,t,n){return this._restApi.post(e,t,n)},e.prototype.put=function(e,t,n){return this._restApi.put(e,t,n)},e.prototype.patch=function(e,t,n){return this._restApi.patch(e,t,n
1)},e.prototype.del=function(e,t,n){return this._restApi.del(e,t,n)},e.prototype.head=function(e,t,n){return this._restApi.head(e,t,n)},e.prototype.isCancel=function(e){return this._restApi.isCancel(e)},e.prototype.cancel=function(e,t){return this._restApi.hasCancelToken(e)?this._restApi.cancel(e,t):!!this._graphqlApi.hasCancelToken(e)&&this._graphqlApi.cancel(e,t)},e.prototype.endpoint=function(e){var t,n,r,i;return t=this,n=void 0,r=void 0,i=function(){return v(this,function(t){return[2,this._restApi.endpoint(e)]})},new(r||(r=Promise))(function(e,o){function s(e){try{u(i.next(e))}catch(e){o(e)}}function a(e){try{u(i.throw(e))}catch(e){o(e)}}function u(t){var n;t.done?e(t.value):((n=t.value)instanceof r?n:new r(function(e){e(n)})).then(s,a)}u((i=i.apply(t,n||[])).next())})},e.prototype.getGraphqlOperationType=function(e){return this._graphqlApi.getGraphqlOperationType(e)},e.prototype.graphql=function(e,t){return this._graphqlApi.graphql(e,t)},e}(),_=new m(null);u.dQ.register(_)},3426:function(e,t,n){"use strict";var r=n(11260);t.ZP=r.b},37260:function(e,t,n){"use strict";n.d(t,{g:function(){return V}});var r,i,o,s=n(74634),a=n(25049),u=n(69276),c=n(22485),l=n(52674),f=n(2468),d=n(27406),h=n(96141),p=n(30587),g=n(23615),y=n(8452),v=function(e){var t=window.open(e,"_self");return t?Promise.resolve(t):Promise.reject()},b=function(e){window.sessionStorage.setItem("oauth_state",e)},m=function(){var e=window.sessionStorage.getItem("oauth_state");return window.sessionStorage.removeItem("oauth_state"),e},_=function(e){window.sessionStorage.setItem("ouath_pkce_key",e)},w=function(){var e=window.sessionStorage.getItem("ouath_pkce_key");return window.sessionStorage.removeItem("ouath_pkce_key"),e},S=n(90494),E=n.n(S),I=n(20182),P=n.n(I),C=function(){return(C=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},O=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},A=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},k=function(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},T="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",N=function(e,t,n){u.Xb.dispatch("auth",{event:e,data:t,message:n},"Auth",T)},x=new a.k("OAuth"),M=function(){function e(e){var t=e.config,n=e.cognitoClientId,r=e.scopes,i=void 0===r?[]:r;if(this._urlOpener=t.urlOpener||v,this._config=t,this._cognitoClientId=n,!this.isValidScopes(i))throw Error("scopes must be a String Array");this._scopes=i}return e.prototype.isValidScopes=function(e){return Array.isArray(e)&&e.every(function(e){return"string"==typeof e})},e.prototype.oauthSignIn=function(e,t,n,r,i,o){void 0===e&&(e="code"),void 0===i&&(i=s.JG.Cognito);var a=this._generateState(32),u=o?a+"-"+o.split("").map(function(e){return e.charCodeAt(0).toString(16).padStart(2,"0")}).join(""):a;b(u);var c=this._generateRandom(128);_(c);var l=this._generateChallenge(c),f=this._scopes.join(" "),d="https://"+t+"/oauth2/authorize?"+Object.entries(C(C({redirect_uri:n,response_type:e,client_id:r,identity_provider:i,scope:f,state:u},"code"===e?{code_challenge:l}:{}),"code"===e?{code_challenge_method:"S256"}:{})).map(function(e){var t=k(e,2),n=t[0],r=t[1];return encodeURIComponent(n)+"="+encodeURIComponent(r)}).join("&");x.debug("Redirecting to "+d),this._urlOpener(d,n)},e.prototype._handleCodeFlow=function(e){return O(this,void 0,void 0,function(){var t,n,r,i,o,a,u,c,l,f,d,h,p;return A(this,function(g){switch(g.label){case 0:if(t=((0,y.parse)(e).query||"").split("&").map(function(e){return e.split("=")}).reduce(function(e,t){var n,r=k(t,2),i=r[0],o=r[1];return C(C({},e),((n={})[i]=o,n))},{code:void 0}).code,n=(0,y.parse)(e).pathname||"/",r=(0,y.parse)(this._config.redirectSignIn).pathname||"/",!t||n!==r)return[2];return N("codeFlow",{},"Retrieving tokens from "+(i="https://"+this._config.domain+"/oauth2/token")),o=(0,s.ic)(this._config)?this._cognitoClientId:this._config.clientID,a=(0,s.ic)(this._config)?this._config.redirectSignIn:this._config.redirectUri,u=w(),c=C({grant_type:"authorization_code",code:t,client_id:o,redirect_uri:a}
1,u?{code_verifier:u}:{}),x.debug("Calling token endpoint: "+i+" with",c),[4,fetch(i,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:Object.entries(c).map(function(e){var t=k(e,2),n=t[0],r=t[1];return encodeURIComponent(n)+"="+encodeURIComponent(r)}).join("&")})];case 1:return[4,g.sent().json()];case 2:if(f=(l=g.sent()).access_token,d=l.refresh_token,h=l.id_token,p=l.error)throw Error(p);return[2,{accessToken:f,refreshToken:d,idToken:h}]}})})},e.prototype._handleImplicitFlow=function(e){return O(this,void 0,void 0,function(){var t,n,r;return A(this,function(i){return n=(t=((0,y.parse)(e).hash||"#").substr(1).split("&").map(function(e){return e.split("=")}).reduce(function(e,t){var n,r=k(t,2),i=r[0],o=r[1];return C(C({},e),((n={})[i]=o,n))},{id_token:void 0,access_token:void 0})).id_token,r=t.access_token,N("implicitFlow",{},"Got tokens from "+e),x.debug("Retrieving implicit tokens from "+e+" with"),[2,{accessToken:r,idToken:n,refreshToken:null}]})})},e.prototype.handleAuthResponse=function(e){return O(this,void 0,void 0,function(){var t,n,r,i,o,s,a;return A(this,function(u){switch(u.label){case 0:if(u.trys.push([0,5,,6]),n=(t=e?C(C({},((0,y.parse)(e).hash||"#").substr(1).split("&").map(function(e){return e.split("=")}).reduce(function(e,t){var n=k(t,2),r=n[0],i=n[1];return e[r]=i,e},{})),((0,y.parse)(e).query||"").split("&").map(function(e){return e.split("=")}).reduce(function(e,t){var n=k(t,2),r=n[0],i=n[1];return e[r]=i,e},{})):{}).error,r=t.error_description,n)throw Error(r);if(i=this._validateState(t),x.debug("Starting "+this._config.responseType+" flow with "+e),"code"!==this._config.responseType)return[3,2];return o=[{}],[4,this._handleCodeFlow(e)];case 1:return[2,C.apply(void 0,[C.apply(void 0,o.concat([u.sent()])),{state:i}])];case 2:return s=[{}],[4,this._handleImplicitFlow(e)];case 3:return[2,C.apply(void 0,[C.apply(void 0,s.concat([u.sent()])),{state:i}])];case 4:return[3,6];case 5:throw a=u.sent(),x.error("Error handling auth response.",a),a;case 6:return[2]}})})},e.prototype._validateState=function(e){if(e){var t=m(),n=e.state;if(t&&t!==n)throw Error("Invalid state in OAuth flow");return n}},e.prototype.signOut=function(){return O(this,void 0,void 0,function(){var e,t,n;return A(this,function(r){return e="https://"+this._config.domain+"/logout?",t=(0,s.ic)(this._config)?this._cognitoClientId:this._config.oauth.clientID,n=(0,s.ic)(this._config)?this._config.redirectSignOut:this._config.returnTo,N("oAuthSignOut",{oAuth:"signOut"},"Signing out from "+(e+=Object.entries({client_id:t,logout_uri:encodeURIComponent(n)}).map(function(e){var t=k(e,2);return t[0]+"="+t[1]}).join("&"))),x.debug("Signing out from "+e),[2,this._urlOpener(e,n)]})})},e.prototype._generateState=function(e){for(var t="",n=e,r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";n>0;--n)t+=r[Math.round(Math.random()*(r.length-1))];return t},e.prototype._generateChallenge=function(e){return this._base64URL(E()(e))},e.prototype._base64URL=function(e){return e.toString(P()).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},e.prototype._generateRandom=function(e){var t=new Uint8Array(e);if("undefined"!=typeof window&&window.crypto)window.crypto.getRandomValues(t);else for(var n=0;n<e;n+=1)t[n]=66*Math.random()|0;return this._bufferToString(t)},e.prototype._bufferToString=function(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=[],r=0;r<e.byteLength;r+=1){var i=e[r]%t.length;n.push(t[i])}return n.join("")},e}(),R=function(e){if((0,h.lC)().isBrowser&&window.location)e({url:window.location.href});else if((0,h.lC)().isNode);else throw Error("Not supported")};(r=o||(o={})).DEFAULT_MSG="Authentication Error",r.EMPTY_EMAIL="Email cannot be empty",r.EMPTY_PHONE="Phone number cannot be empty",r.EMPTY_USERNAME="Username cannot be empty",r.INVALID_USERNAME="The username should either be a string or one of the sign in types",r.EMPTY_PASSWORD="Password cannot be empty",r.EMPTY_CODE="Confirmation code cannot be empty",r.SIGN_UP_ERROR="Error creating account",r.NO_MFA="No valid MFA method provided",r.INVALID_MFA="Invalid MFA type",r.EMPTY_CHALLENGE="Challenge response cannot be empty",r.NO_USER_SESSION="Failed to get the session because the user is empty",r.NETWORK_E
1RROR="Network Error",r.DEVICE_CONFIG="Device tracking has not been configured in this User Pool",r.AUTOSIGNIN_ERROR="Please use your credentials to sign in";var j=(i=function(e,t){return(i=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}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),U=new a.k("AuthError"),D=function(e){function t(n){var r=this,i=F[n],o=i.message,s=i.log;return(r=e.call(this,o)||this).constructor=t,Object.setPrototypeOf(r,t.prototype),r.name="AuthError",r.log=s||o,U.error(r.log),r}return j(t,e),t}(Error),L=function(e){function t(n){var r=e.call(this,n)||this;return r.constructor=t,Object.setPrototypeOf(r,t.prototype),r.name="NoUserPoolError",r}return j(t,e),t}(D),F={noConfig:{message:o.DEFAULT_MSG,log:"\n            Error: Amplify has not been configured correctly.\n            This error is typically caused by one of the following scenarios:\n\n            1. Make sure you're passing the awsconfig object to Amplify.configure() in your app's entry point\n                See https://aws-amplify.github.io/docs/js/authentication#configure-your-app for more information\n            \n            2. There might be multiple conflicting versions of amplify packages in your node_modules.\n				Refer to our docs site for help upgrading Amplify packages (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js)\n        "},missingAuthConfig:{message:o.DEFAULT_MSG,log:"\n            Error: Amplify has not been configured correctly. \n            The configuration object is missing required auth properties.\n            This error is typically caused by one of the following scenarios:\n\n            1. Did you run `amplify push` after adding auth via `amplify add auth`?\n                See https://aws-amplify.github.io/docs/js/authentication#amplify-project-setup for more information\n\n            2. This could also be caused by multiple conflicting versions of amplify packages, see (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js) for help upgrading Amplify packages.\n        "},emptyUsername:{message:o.EMPTY_USERNAME},invalidUsername:{message:o.INVALID_USERNAME},emptyPassword:{message:o.EMPTY_PASSWORD},emptyCode:{message:o.EMPTY_CODE},signUpError:{message:o.SIGN_UP_ERROR,log:"The first parameter should either be non-null string or object"},noMFA:{message:o.NO_MFA},invalidMFA:{message:o.INVALID_MFA},emptyChallengeResponse:{message:o.EMPTY_CHALLENGE},noUserSession:{message:o.NO_USER_SESSION},deviceConfig:{message:o.DEVICE_CONFIG},networkError:{message:o.NETWORK_ERROR},autoSignInError:{message:o.AUTOSIGNIN_ERROR},default:{message:o.DEFAULT_MSG}},B=function(){return(B=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},G=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},q=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},z=function(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},W=new a.k("AuthClass"),K="aws.cognito.signin.user.admin",H="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",Y=function(e,t,n){u.Xb.dispatch("auth",{event:e,data:t,message:n},"Auth",H)},V=new(function(){function e(e){var t=this;this.userPool=null,this.user=null,this.oAuthFlowInProgress=!1,this.autoSignInInitiated=!1,this.Credentials=c.cN,this.wrapRefreshSessionCallback=function(e){return function(t,n){return n?Y("token
1Refresh",void 0,"New token retrieved"):Y("tokenRefresh_failure",t,"Failed to retrieve new token"),e(t,n)}},this.configure(e),this.currentCredentials=this.currentCredentials.bind(this),this.currentUserCredentials=this.currentUserCredentials.bind(this),u.Xb.listen("auth",function(e){switch(e.payload.event){case"signIn":t._storage.setItem("amplify-signin-with-hostedUI","false");break;case"signOut":t._storage.removeItem("amplify-signin-with-hostedUI");break;case"cognitoHostedUI":t._storage.setItem("amplify-signin-with-hostedUI","true")}})}return e.prototype.getModuleName=function(){return"Auth"},e.prototype.configure=function(e){var t=this;if(!e)return this._config||{};W.debug("configure Auth");var n=Object.assign({},this._config,l._b.parseMobilehubConfig(e).Auth,e);this._config=n;var r=this._config,i=r.userPoolId,o=r.userPoolWebClientId,a=r.cookieStorage,u=r.oauth,c=r.region,h=r.identityPoolId,p=r.mandatorySignIn,y=r.refreshHandlers,v=r.identityPoolRegion,b=r.clientMetadata,m=r.endpoint;if(this._config.storage){if(!this._isValidAuthStorage(this._config.storage))throw W.error("The storage in the Auth config is not valid!"),Error("Empty storage object");this._storage=this._config.storage}else a?this._storage=new g.eR(a):this._storage=e.ssr?new f.N:new d.c4().getStorage();if(this._storageSync=Promise.resolve(),"function"==typeof this._storage.sync&&(this._storageSync=this._storage.sync()),i){var _={UserPoolId:i,ClientId:o,endpoint:m};_.Storage=this._storage,this.userPool=new g.AM(_,this.wrapRefreshSessionCallback)}this.Credentials.configure({mandatorySignIn:p,region:v||c,userPoolId:i,identityPoolId:h,refreshHandlers:y,storage:this._storage});var w=u?(0,s.ic)(this._config.oauth)?u:u.awsCognito:void 0;if(w){var S=Object.assign({cognitoClientId:o,UserPoolId:i,domain:w.domain,scopes:w.scope,redirectSignIn:w.redirectSignIn,redirectSignOut:w.redirectSignOut,responseType:w.responseType,Storage:this._storage,urlOpener:w.urlOpener,clientMetadata:b},w.options);this._oAuthHandler=new M({scopes:S.scopes,config:S,cognitoClientId:S.cognitoClientId});var E={};R(function(e){var n=e.url;E[n]||(E[n]=!0,t._handleAuthResponse(n))})}return Y("configured",null,"The Auth category has been configured successfully"),this.autoSignInInitiated||"function"!=typeof this._storage.getItem||(this.isTrueStorageValue("amplify-polling-started")&&(Y("autoSignIn_failure",null,s.Qg.AutoSignInError),this._storage.removeItem("amplify-auto-sign-in")),this._storage.removeItem("amplify-polling-started")),this._config},e.prototype.signUp=function(e){for(var t,n,r,i,o=this,a=[],u=1;u<arguments.length;u++)a[u-1]=arguments[u];if(!this.userPool)return this.rejectNoUserPool();var c=null,l=null,f=[],d=null,h={enabled:!1},p={},y={};if(e&&"string"==typeof e){c=e,l=a?a[0]:null;var v=a?a[1]:null,b=a?a[2]:null;v&&f.push(new g.KC({Name:"email",Value:v})),b&&f.push(new g.KC({Name:"phone_number",Value:b}))}else{if(!e||"object"!=typeof e)return this.rejectAuthError(s.Qg.SignUpError);c=e.username,l=e.password,e&&e.clientMetadata?i=e.clientMetadata:this._config.clientMetadata&&(i=this._config.clientMetadata);var m=e.attributes;m&&Object.keys(m).map(function(e){f.push(new g.KC({Name:e,Value:m[e]}))});var _=e.validationData;_&&(d=[],Object.keys(_).map(function(e){d.push(new g.KC({Name:e,Value:_[e]}))})),(h=null!==(t=e.autoSignIn)&&void 0!==t?t:{enabled:!1}).enabled&&(this._storage.setItem("amplify-auto-sign-in","true"),p=null!==(n=h.validationData)&&void 0!==n?n:{},y=null!==(r=h.clientMetaData)&&void 0!==r?r:{})}return c?l?(W.debug("signUp attrs:",f),W.debug("signUp validation data:",d),new Promise(function(e,t){o.userPool.signUp(c,l,f,d,function(n,r){n?(Y("signUp_failure",n,c+" failed to signup"),t(n)):(Y("signUp",r,c+" has signed up successfully"),h.enabled&&o.handleAutoSignIn(c,l,p,y,r),e(r))},i)})):this.rejectAuthError(s.Qg.EmptyPassword):this.rejectAuthError(s.Qg.EmptyUsername)}
1,e.prototype.handleAutoSignIn=function(e,t,n,r,i){this.autoSignInInitiated=!0;var o=new g.sD({Username:e,Password:t,ValidationData:n,ClientMetadata:r});i.userConfirmed?this.signInAfterUserConfirmed(o):"link"===this._config.signUpVerificationMethod?this.handleLinkAutoSignIn(o):this.handleCodeAutoSignIn(o)},e.prototype.handleCodeAutoSignIn=function(e){var t=this,n=function(r){"confirmSignUp"===r.payload.event&&t.signInAfterUserConfirmed(e,n)};u.Xb.listen("auth",n)},e.prototype.handleLinkAutoSignIn=function(e){var t=this;this._storage.setItem("amplify-polling-started","true");var n=Date.now(),r=setInterval(function(){Date.now()-n>18e4?(clearInterval(r),Y("autoSignIn_failure",null,"Please confirm your account and use your credentials to sign in."),t._storage.removeItem("amplify-auto-sign-in")):t.signInAfterUserConfirmed(e,null,r)},5e3)},e.prototype.signInAfterUserConfirmed=function(e,t,n){return G(this,void 0,void 0,function(){var r,i,o=this;return q(this,function(s){switch(s.label){case 0:r=this.createCognitoUser(e.getUsername()),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,r.authenticateUser(e,this.authCallbacks(r,function(r){Y("autoSignIn",r,e.getUsername()+" has signed in successfully"),t&&u.Xb.remove("auth",t),n&&(clearInterval(n),o._storage.removeItem("amplify-polling-started")),o._storage.removeItem("amplify-auto-sign-in")},function(e){W.error(e),o._storage.removeItem("amplify-auto-sign-in")}))];case 2:return s.sent(),[3,4];case 3:return i=s.sent(),W.error(i),[3,4];case 4:return[2]}})})},e.prototype.confirmSignUp=function(e,t,n){var r,i=this;if(!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(s.Qg.EmptyUsername);if(!t)return this.rejectAuthError(s.Qg.EmptyCode);var o=this.createCognitoUser(e),a=!n||"boolean"!=typeof n.forceAliasCreation||n.forceAliasCreation;return n&&n.clientMetadata?r=n.clientMetadata:this._config.clientMetadata&&(r=this._config.clientMetadata),new Promise(function(n,u){o.confirmRegistration(t,a,function(t,r){t?u(t):(Y("confirmSignUp",r,e+" has been confirmed successfully"),i.isTrueStorageValue("amplify-auto-sign-in")&&!i.autoSignInInitiated&&(Y("autoSignIn_failure",null,s.Qg.AutoSignInError),i._storage.removeItem("amplify-auto-sign-in")),n(r))},r)})},e.prototype.isTrueStorageValue=function(e){var t=this._storage.getItem(e);return!!t&&"true"===t},e.prototype.resendSignUp=function(e,t){if(void 0===t&&(t=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(s.Qg.EmptyUsername);var n=this.createCognitoUser(e);return new Promise(function(e,r){n.resendConfirmationCode(function(t,n){t?r(t):e(n)},t)})},e.prototype.signIn=function(e,t,n){if(void 0===n&&(n=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();var r=null,i=null,o={};if("string"==typeof e)r=e,i=t;else{if(!(0,s.lg)(e))return this.rejectAuthError(s.Qg.InvalidUsername);void 0!==t&&W.warn("The password should be defined under the first parameter object!"),r=e.username,i=e.password,o=e.validationData}if(!r)return this.rejectAuthError(s.Qg.EmptyUsername);var a=new g.sD({Username:r,Password:i,ValidationData:o,ClientMetadata:n});return i?this.signInWithPassword(a):this.signInWithoutPassword(a)},e.prototype.authCallbacks=function(e,t,n){var r=this,i=this;return{onSuccess:function(o){return G(r,void 0,void 0,function(){var r,s,a,u;return q(this,function(c){switch(c.label){case 0:W.debug(o),delete e.challengeName,delete e.challengeParam,c.label=1;case 1:return c.trys.push([1,4,5,9]),[4,this.Credentials.clear()];case 2:return c.sent(),[4,this.Credentials.set(o,"session")];case 3:return r=c.sent(),W.debug("succeed to get cognito credentials",r),[3,9];case 4:return s=c.sent(),W.debug("cannot get cognito credentials",s),[3,9];case 5:return c.trys.push([5,7,,8]),[4,this.currentUserPoolUser()];case 6:return a=c.sent(),i.user=a,Y("signIn",a,"A user "+e.getUsername()+" has been signed in"),t(a),[3,8];case 7:return u=c.sent(),W.error("Failed to get the signed in user",u),n(u),[3,8];case 8:return[7];case 9:return[2]}})})},onFailure:function(t){W.debug("signIn failure",t),Y("signIn_failure",t,e.getUsername()+" failed to signin"),n(t)},customChallenge:function(n){W.debug("signIn custom challenge answer required"),e.challengeName="CUSTOM_CHALLENGE",e.challengeParam=n,t(e)},mfaRequired:function(n,r){W.debug("signIn MFA required"),e.challengeName=n,e.challengeParam=r,t(e)},mfaSetup:function(n,r){W.debug("signIn mfa setup",n),e.challengeName=n,e.challengeParam=r,t(e)},newPasswordRequired:function(n,r){W.debug("signIn new password"),e.challengeName="NEW_PASSWORD_REQUIRED",e.challengeParam={userAttributes:n,requiredAttributes:r},t(e)},totpRequired:function(n,r){W.debug("signIn totpRequired"),e.challengeName=n,e.challengeParam=r,t(e)},selectMFAType:function(n,r){W.debug("signIn selectMFAType",n),e.challengeName=n,e.challengeParam=r,t(e)}}},e.prototype.signInWithPassword=function(e){var t=this;if(this.pendingSignIn)throw Error("Pending sign-in attempt already in progress");var n=this.createCognitoUser(e.getUsername());return this.pendingSignIn=new Promise(function(r,i){n.authenticateUser(e,t.authCallbacks(n,function(e){t.pendingSignIn=null,r(e)},function(e){t.pendingSignIn=null,i(e)}))}),this.pendingSignIn},e.prototype.signInWithoutPassword=function(e){var t=this,n=this.createCognitoUser(e.getUsername());return n.setAuthenticationFlowType("CUSTOM_AUTH"),new Promise(function(r,i){n.initiateAuth(e,t.authCallbacks(n,r,i))})},e.prototype.getMFAOptions=function(e){return new Promise(function(t,n){e.getMFAOptions(function(e,r){if(e){W.debug("get MFA Options failed",e),n(e);return}W.debug("get MFA options success",r),t(r)})})},e.prototype.getPreferredMFA=function(e,t){var n=this,r=this;return new Promise(function(i,o){var s=n._config.clientMetadata,a=!!t&&t.bypassCache;e.getUserData(function(t,s){return G(n,void 0,void 0,function(){var n,a;return q(this,function(u){switch(u.label){case 0:if(!t)return[3,5];if(W.debug("getting preferred mfa failed",t),!this.isSessionInvalid(t))return[3,4];u.label=1;case 1:return u.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return u.sent(),[3,4];
1case 3:return n=u.sent(),o(Error("Session is invalid due to: "+t.message+" and failed to clean up invalid session: "+n.message)),[2];case 4:return o(t),[2];case 5:if(!(a=r._getMfaTypeFromUserData(s)))return o("invalid MFA Type"),[2];return i(a),[2]}})})},{bypassCache:a,clientMetadata:s})})},e.prototype._getMfaTypeFromUserData=function(e){var t=null,n=e.PreferredMfaSetting;if(n)t=n;else{var r=e.UserMFASettingList;r?0===r.length?t="NOMFA":W.debug("invalid case for getPreferredMFA",e):t=e.MFAOptions?"SMS_MFA":"NOMFA"}return t},e.prototype._getUserData=function(e,t){var n=this;return new Promise(function(r,i){e.getUserData(function(t,o){return G(n,void 0,void 0,function(){var n;return q(this,function(s){switch(s.label){case 0:if(!t)return[3,5];if(W.debug("getting user data failed",t),!this.isSessionInvalid(t))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return s.sent(),[3,4];case 3:return n=s.sent(),i(Error("Session is invalid due to: "+t.message+" and failed to clean up invalid session: "+n.message)),[2];case 4:return i(t),[2];case 5:r(o),s.label=6;case 6:return[2]}})})},t)})},e.prototype.setPreferredMFA=function(e,t){return G(this,void 0,void 0,function(){var n,r,i,o,a,u,c=this;return q(this,function(l){switch(l.label){case 0:return n=this._config.clientMetadata,[4,this._getUserData(e,{bypassCache:!0,clientMetadata:n})];case 1:switch(r=l.sent(),i=null,o=null,t){case"TOTP":case"SOFTWARE_TOKEN_MFA":return[3,2];case"SMS":case"SMS_MFA":return[3,3];case"NOMFA":return[3,4]}return[3,6];case 2:return o={PreferredMfa:!0,Enabled:!0},[3,7];case 3:return i={PreferredMfa:!0,Enabled:!0},[3,7];case 4:return a=r.UserMFASettingList,[4,this._getMfaTypeFromUserData(r)];case 5:if("NOMFA"===(u=l.sent()))return[2,Promise.resolve("No change for mfa type")];if("SMS_MFA"===u)i={PreferredMfa:!1,Enabled:!1};else{if("SOFTWARE_TOKEN_MFA"!==u)return[2,this.rejectAuthError(s.Qg.InvalidMFA)];o={PreferredMfa:!1,Enabled:!1}}return a&&0!==a.length&&a.forEach(function(e){"SMS_MFA"===e?i={PreferredMfa:!1,Enabled:!1}:"SOFTWARE_TOKEN_MFA"===e&&(o={PreferredMfa:!1,Enabled:!1})}),[3,7];case 6:return W.debug("no validmfa method provided"),[2,this.rejectAuthError(s.Qg.NoMFA)
1];case 7:return[2,new Promise(function(t,r){e.setUserMfaPreference(i,o,function(i,o){if(i)return W.debug("Set user mfa preference error",i),r(i);W.debug("Set user mfa success",o),W.debug("Caching the latest user data into local"),e.getUserData(function(n,i){return G(c,void 0,void 0,function(){var i;return q(this,function(s){switch(s.label){case 0:if(!n)return[3,5];if(W.debug("getting user data failed",n),!this.isSessionInvalid(n))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return s.sent(),[3,4];case 3:return i=s.sent(),r(Error("Session is invalid due to: "+n.message+" and failed to clean up invalid session: "+i.message)),[2];case 4:return[2,r(n)];case 5:return[2,t(o)]}})})},{bypassCache:!0,clientMetadata:n})})})]}})})},e.prototype.disableSMS=function(e){return new Promise(function(t,n){e.disableMFA(function(e,r){if(e){W.debug("disable mfa failed",e),n(e);return}W.debug("disable mfa succeed",r),t(r)})})},e.prototype.enableSMS=function(e){return new Promise(function(t,n){e.enableMFA(function(e,r){if(e){W.debug("enable mfa failed",e),n(e);return}W.debug("enable mfa succeed",r),t(r)})})},e.prototype.setupTOTP=function(e){return new Promise(function(t,n){e.associateSoftwareToken({onFailure:function(e){W.debug("associateSoftwareToken failed",e),n(e)},associateSecretCode:function(e){W.debug("associateSoftwareToken sucess",e),t(e)}})})},e.prototype.verifyTotpToken=function(e,t){return W.debug("verification totp token",e,t),new Promise(function(n,r){e.verifySoftwareToken(t,"My TOTP device",{onFailure:function(e){W.debug("verifyTotpToken failed",e),r(e)},onSuccess:function(t){Y("signIn",e,"A user "+e.getUsername()+" has been signed in"),W.debug("verifyTotpToken success",t),n(t)}})})},e.prototype.confirmSignIn=function(e,t,n,r){var i=this;if(void 0===r&&(r=this._config.clientMetadata),!t)return this.rejectAuthError(s.Qg.EmptyCode);var o=this;return new Promise(function(s,a){e.sendMFACode(t,{onSuccess:function(t){return G(i,void 0,void 0,function(){var n,r;return q(this,function(i){switch(i.label){case 0:W.debug(t),i.label=1;case 1:return i.trys.push([1,4,5,6]),[4,this.Credentials.clear()];case 2:return i.sent(),[4,this.Credentials.set(t,"session")];case 3:return n=i.sent(),W.debug("succeed to get cognito credentials",n),[3,6];case 4:return r=i.sent(),W.debug("cannot get cognito credentials",r),[3,6];case 5:return o.user=e,Y("signIn",e,"A user "+e.getUsername()+" has been signed in"),s(e),[7];case 6:return[2]}})})},onFailure:function(e){W.debug("confirm signIn failure",e),a(e)}},n,r)})},e.prototype.completeNewPassword=function(e,t,n,r){var i=this;if(void 0===n&&(n={}),void 0===r&&(r=this._config.clientMetadata),!t)return this.rejectAuthError(s.Qg.EmptyPassword);var o=this;return new Promise(function(s,a){e.completeNewPasswordChallenge(t,n,{onSuccess:function(t){return G(i,void 0,void 0,function(){var n,r;return q(this,function(i){switch(i.label){case 0:W.debug(t),i.label=1;case 1:return i.trys.push([1,4,5,6]),[4,this.Credentials.clear()];case 2:return i.sent(),[4,this.Credentials.set(t,"session")];case 3:return n=i.sent(),W.debug("succeed to get cognito credentials",n),[3,6];case 4:return r=i.sent(),W.debug("cannot get cognito credentials",r),[3,6];case 5:return o.user=e,Y("signIn",e,"A user "+e.getUsername()+" has been signed in"),s(e),[7];case 6:return[2]}})})},onFailure:function(e){W.debug("completeNewPassword failure",e),Y("completeNewPassword_failure",e,i.user+" failed to complete the new password flow"),a(e)},mfaRequired:function(t,n){W.debug("signIn MFA required"),e.challengeName=t,e.challengeParam=n,s(e)},mfaSetup:function(t,n){W.debug("signIn mfa setup",t),e.challengeName=t,e.challengeParam=n,s(e)},totpRequired:function(t,n){W.debug("signIn mfa setup",t),e.challengeName=t,e.challengeParam=n,s(e)}},r)})},e.prototype.sendCustomChallengeAnswer=function(e,t,n){var r=this;return(void 0===n&&(n=this._config.clientMetadata),this.userPool)?t?new Promise(function(i,o){e.sendCustomChallengeAnswer(t,r.authCallbacks(e,i,o),n)}):this.rejectAuthError(s.Qg.EmptyChallengeResponse):this.rejectNoUserPool()},e.prototype.deleteUserAttributes=function(e,t){var n=this;return new Promise(function(r,i){n.userSession(e).then(function(n){e.deleteAttributes(t,function(e,t){return e?i(e):r(t)})})})},e.prototype.deleteUser=function(){return G(this,void 0,void 0,function(){var e,t,n=this;return q(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this._storageSync];case 1:return r.sent(),[3,3];case 2:throw e=r.sent(),W.debug("Failed to sync cache info into memory",e),Error(e);case 3:return t=this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI"),[2,new Promise(function(e,r){return G(n,void 0,void 0,function(){var n,i=this;
1return q(this,function(o){if(this.userPool){if(!(n=this.userPool.getCurrentUser()))return W.debug("Failed to get user from user pool"),[2,r(Error("No current user."))];n.getSession(function(o,s){return G(i,void 0,void 0,function(){var i,s=this;return q(this,function(a){switch(a.label){case 0:if(!o)return[3,5];if(W.debug("Failed to get the user session",o),!this.isSessionInvalid(o))return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(n)];case 2:return a.sent(),[3,4];case 3:return i=a.sent(),r(Error("Session is invalid due to: "+o.message+" and failed to clean up invalid session: "+i.message)),[2];case 4:return[2,r(o)];case 5:n.deleteUser(function(i,o){if(i)r(i);else{Y("userDeleted",o,"The authenticated user has been deleted."),n.signOut(),s.user=null;try{s.cleanCachedItems()}catch(e){W.debug("failed to clear cached items")}t?s.oAuthSignOutRedirect(e,r):(Y("signOut",s.user,"A user has been signed out"),e(o))}}),a.label=6;case 6:return[2]}})})})}else W.debug("no Congito User pool"),r(Error("Cognito User pool does not exist"));return[2]})})})]}})})},e.prototype.updateUserAttributes=function(e,t,n){void 0===n&&(n=this._config.clientMetadata);var r=[],i=this;return new Promise(function(o,s){i.userSession(e).then(function(i){for(var a in t)if("sub"!==a&&0>a.indexOf("_verified")){var u={Name:a,Value:t[a]};r.push(u)}e.updateAttributes(r,function(e,t){return e?s(e):o(t)},n)})})},e.prototype.userAttributes=function(e){var t=this;return new Promise(function(n,r){t.userSession(e).then(function(t){e.getUserAttributes(function(e,t){e?r(e):n(t)})})})},e.prototype.verifiedContact=function(e){var t=this;return this.userAttributes(e).then(function(e){var n=t.attributesToObject(e),r={},i={};return n.email&&(n.email_verified?i.email=n.email:r.email=n.email),n.phone_number&&(n.phone_number_verified?i.phone_number=n.phone_number:r.phone_number=n.phone_number),{verified:i,unverified:r}})},e.prototype.isErrorWithMessage=function(e){return"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"message")},e.prototype.isTokenRevokedError=function(e){return this.isErrorWithMessage(e)&&"Access Token has been revoked"===e.message},e.prototype.isRefreshTokenRevokedError=function(e){return this.isErrorWithMessage(e)&&"Refresh Token has been revoked"===e.message},e.prototype.isUserDisabledError=function(e){return this.isErrorWithMessage(e)&&"User is disabled."===e.message},e.prototype.isUserDoesNotExistError=function(e){return this.isErrorWithMessage(e)&&"User does not exist."===e.message},e.prototype.isRefreshTokenExpiredError=function(e){return this.isErrorWithMessage(e)&&"Refresh Token has expired"===e.message},e.prototype.isSignedInHostedUI=function(){return this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI")},e.prototype.isSessionInvalid=function(e){return this.isUserDisabledError(e)||this.isUserDoesNotExistError(e)||this.isTokenRevokedError(e)||this.isRefreshTokenRevokedError(e)||this.isRefreshTokenExpiredError(e)},e.prototype.cleanUpInvalidSession=function(e){return G(this,void 0,void 0,function(){var t=this;return q(this,function(n){switch(n.label){case 0:e.signOut(),this.user=null,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.cleanCachedItems()];case 2:return n.sent(),[3,4];case 3:return n.sent(),W.debug("failed to clear cached items"),[3,4];case 4:if(this.isSignedInHostedUI())return[2,new Promise(function(e,n){t.oAuthSignOutRedirect(e,n)})];return Y("signOut",this.user,"A user has been signed out"),[2]}})})},e.prototype.currentUserPoolUser=function(e){var t=this;return this.userPool?new Promise(function(n,r){t._storageSync.then(function(){return G(t,void 0,void 0,function(){var t,i,o=this;return q(this,function(s){switch(s.label){case 0:if(!this.isOAuthInProgress())return[3,2];return W.debug("OAuth signIn in progress, waiting for resolution..."),[4,new Promise(function(e){var t=setTimeout(function(){W.debug("OAuth signIn in progress timeout"),u.Xb.remove("auth",n),e()},1e4);function n(r){var i=r.payload.event;("cognitoHostedUI"===i||"cognitoHostedUI_failure"===i)&&(W.debug("OAuth signIn resolved: "+i),clearTimeout(t),u.Xb.remove("auth",n),e())}u.Xb.listen("auth",n)})];case 1:s.sent(),s.label=2;case 2:if(!(t=this.userPool.getCurrentUser()))return W.debug("Failed to get user from user pool"),r("No current user"),[2];return i=this._config.clientMetadata,t.getSession(function(i,s){return G(o,void 0,void 0,function(){var o,a,u,c,l=this;return q(this,function(f){switch(f.label){case 0:if(!i)return[3,5];if(W.debug("Failed to get the user session",i),!this.isSessionInvalid(i))return[3,4];f.label=1;case 1:return f.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return f.sent(),[3,4];
1case 3:return o=f.sent(),r(Error("Session is invalid due to: "+i.message+" and failed to clean up invalid session: "+o.message)),[2];case 4:return r(i),[2];case 5:if(!(a=!!e&&e.bypassCache))return[3,7];return[4,this.Credentials.clear()];case 6:f.sent(),f.label=7;case 7:if(u=this._config.clientMetadata,!(void 0===(c=s.getAccessToken().decodePayload().scope)?"":c).split(" ").includes(K))return W.debug("Unable to get the user data because the "+K+" is not in the scopes of the access token"),[2,n(t)];return t.getUserData(function(e,i){return G(l,void 0,void 0,function(){var o,s,a,u,c,l;return q(this,function(f){switch(f.label){case 0:if(!e)return[3,7];if(W.debug("getting user data failed",e),!this.isSessionInvalid(e))return[3,5];f.label=1;case 1:return f.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return f.sent(),[3,4];case 3:return o=f.sent(),r(Error("Session is invalid due to: "+e.message+" and failed to clean up invalid session: "+o.message)),[2];case 4:return r(e),[3,6];case 5:n(t),f.label=6;case 6:return[2];case 7:for(u=0,s=i.PreferredMfaSetting||"NOMFA",a=[];u<i.UserAttributes.length;u++)c={Name:i.UserAttributes[u].Name,Value:i.UserAttributes[u].Value},l=new g.KC(c),a.push(l);return Object.assign(t,{attributes:this.attributesToObject(a),preferredMFA:s}),[2,n(t)]}})})},{bypassCache:a,clientMetadata:u}),[2]}})})},{clientMetadata:i}),[2]}})})}).catch(function(e){return W.debug("Failed to sync cache info into memory",e),r(e)})}):this.rejectNoUserPool()},e.prototype.isOAuthInProgress=function(){return this.oAuthFlowInProgress},e.prototype.currentAuthenticatedUser=function(e){return G(this,void 0,void 0,function(){var t,n,r,i,o;return q(this,function(s){switch(s.label){case 0:W.debug("getting current authenticated user"),t=null,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._storageSync];case 2:return s.sent(),[3,4];case 3:throw n=s.sent(),W.debug("Failed to sync cache info into memory",n),n;case 4:try{(r=JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")))&&(t=B(B({},r.user),{token:r.token}))}catch(e){W.debug("cannot load federated user from auth storage")}if(!t)return[3,5];return this.user=t,W.debug("get current authenticated federated user",this.user),[2,this.user];case 5:W.debug("get current authenticated userpool user"),i=null,s.label=6;case 6:return s.trys.push([6,8,,9]),[4,this.currentUserPoolUser(e)];case 7:return i=s.sent(),[3,9];case 8:return"No userPool"===(o=s.sent())&&W.error("Cannot get the current user because the user pool is missing. Please make sure the Auth module is configured with a valid Cognito User Pool ID"),W.debug("The user is not authenticated by the error",o),[2,Promise.reject("The user is not authenticated")];case 9:return this.user=i,[2,this.user]}})})},e.prototype.currentSession=function(){var e=this;return(W.debug("Getting current session"),this.userPool)?new Promise(function(t,n){e.currentUserPoolUser().then(function(r){e.userSession(r).then(function(e){t(e)}).catch(function(e){W.debug("Failed to get the current session",e),n(e)})}).catch(function(e){W.debug("Failed to get the current user",e),n(e)})}):Promise.reject(Error("No User Pool in the configuration."))},e.prototype.userSession=function(e){var t=this;if(!e)return W.debug("the user is null"),this.rejectAuthError(s.Qg.NoUserSession);var n=this._config.clientMetadata;return new Promise(function(r,i){W.debug("Getting the session from this user:",e),e.getSession(function(n,o){return G(t,void 0,void 0,function(){var t;return q(this,function(s){switch(s.label){case 0:if(!n)return[3,5];if(W.debug("Failed to get the session from user",e),!this.isSessionInvalid(n))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return s.sent(),[3,4];case 3:return t=s.sent(),i(Error("Session is invalid due to: "+n.message+" and failed to clean up invalid session: "+t.message)),[2];case 4:return i(n),[2];case 5:return W.debug("Succeed to get the user session",o),r(o),[2]}})})},{clientMetadata:n})})},e.prototype.currentUserCredentials=function(){return G(this,void 0,void 0,function(){var e,t,n=this;return q(this,function(r){switch(r.label){case 0:W.debug("Getting current user credentials"),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._storageSync];case 2:return r.sent(),[3,4];case 3:throw e=r.sent(),W.debug("Failed to sync cache info into memory",e),e;case 4:t=null;try{t=JSON.parse(this._storage.getItem("aws-amplify-federatedInfo"))}catch(e){W.debug("failed to get or parse item aws-amplify-federatedInfo",e)}if(t)return[2,this.Credentials.refreshFederatedToken(t)];return[2,this.currentSession().then(function(e){return W.debug("getting session success",e),n.Credentials.set(e,"session")}
1).catch(function(){return W.debug("getting guest credentials"),n.Credentials.set(null,"guest")})]}})})},e.prototype.currentCredentials=function(){return W.debug("getting current credentials"),this.Credentials.get()},e.prototype.verifyUserAttribute=function(e,t,n){return void 0===n&&(n=this._config.clientMetadata),new Promise(function(r,i){e.getAttributeVerificationCode(t,{onSuccess:function(e){return r(e)},onFailure:function(e){return i(e)}},n)})},e.prototype.verifyUserAttributeSubmit=function(e,t,n){return n?new Promise(function(r,i){e.verifyAttribute(t,n,{onSuccess:function(e){r(e)},onFailure:function(e){i(e)}})}):this.rejectAuthError(s.Qg.EmptyCode)},e.prototype.verifyCurrentUserAttribute=function(e){var t=this;return t.currentUserPoolUser().then(function(n){return t.verifyUserAttribute(n,e)})},e.prototype.verifyCurrentUserAttributeSubmit=function(e,t){var n=this;return n.currentUserPoolUser().then(function(r){return n.verifyUserAttributeSubmit(r,e,t)})},e.prototype.cognitoIdentitySignOut=function(e,t){return G(this,void 0,void 0,function(){var n,r,i=this;return q(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this._storageSync];case 1:return o.sent(),[3,3];case 2:throw n=o.sent(),W.debug("Failed to sync cache info into memory",n),n;case 3:return r=this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI"),[2,new Promise(function(n,o){if(e&&e.global){W.debug("user global sign out",t);var s=i._config.clientMetadata;t.getSession(function(e,s){return G(i,void 0,void 0,function(){var i,s=this;return q(this,function(a){switch(a.label){case 0:if(!e)return[3,5];if(W.debug("failed to get the user session",e),!this.isSessionInvalid(e))return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return a.sent(),[3,4];case 3:return i=a.sent(),o(Error("Session is invalid due to: "+e.message+" and failed to clean up invalid session: "+i.message)),[2];case 4:return[2,o(e)];case 5:return t.globalSignOut({onSuccess:function(e){if(W.debug("global sign out success"),!r)return n();s.oAuthSignOutRedirect(n,o)},onFailure:function(e){return W.debug("global sign out failed",e),o(e)}}),[2]}})})},{clientMetadata:s})}else W.debug("user sign out",t),t.signOut(function(){if(!r)return n();i.oAuthSignOutRedirect(n,o)})})]}})})},e.prototype.oAuthSignOutRedirect=function(e,t){(0,h.lC)().isBrowser?this.oAuthSignOutRedirectOrReject(t):this.oAuthSignOutAndResolve(e)},e.prototype.oAuthSignOutAndResolve=function(e){this._oAuthHandler.signOut(),e()},e.prototype.oAuthSignOutRedirectOrReject=function(e){this._oAuthHandler.signOut(),setTimeout(function(){return e(Error("Signout timeout fail"))},3e3)},e.prototype.signOut=function(e){return G(this,void 0,void 0,function(){var t;return q(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.cleanCachedItems()];case 1:return n.sent(),[3,3];case 2:return n.sent(),W.debug("failed to clear cached items"),[3,3];case 3:if(!this.userPool)return[3,7];if(!(t=this.userPool.getCurrentUser()))return[3,5];return[4,this.cognitoIdentitySignOut(e,t)];case 4:return n.sent(),[3,6];case 5:W.debug("no current Cognito user"),n.label=6;case 6:return[3,8];case 7:W.debug("no Cognito User pool"),n.label=8;case 8:return Y("signOut",this.user,"A user has been signed out"),this.user=null,[2]}})})},e.prototype.cleanCachedItems=function(){return G(this,void 0,void 0,function(){return q(this,function(e){switch(e.label){case 0:return[4,this.Credentials.clear()];case 1:return e.sent(),[2]}})})},e.prototype.changePassword=function(e,t,n,r){var i=this;return void 0===r&&(r=this._config.clientMetadata),new Promise(function(o,s){i.userSession(e).then(function(i){e.changePassword(t,n,function(e,t){return e?(W.debug("change password failure",e),s(e)):o(t)},r)})})},e.prototype.forgotPassword=function(e,t){if(void 0===t&&(t=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(s.Qg.EmptyUsername);var n=this.createCognitoUser(e);return new Promise(function(r,i){n.forgotPassword({onSuccess:function(){r()},onFailure:function(t){W.debug("forgot password failure",t),Y("forgotPassword_failure",t,e+" forgotPassword failed"),i(t)},inputVerificationCode:function(t){Y("forgotPassword",n,e+" has initiated forgot password flow"),r(t)}},t)})},e.prototype.forgotPasswordSubmit=function(e,t,n,r){if(void 0===r&&(r=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(s.Qg.EmptyUsername);if(!t)return this.rejectAuthError(s.Qg.EmptyCode);if(!n)return this.rejectAuthError(s.Qg.EmptyPassword);var i=this.createCognitoUser(e);return new Promise(function(o,s){i.confirmPassword(t,n,{onSuccess:function(t){Y("forgotPasswordSubmit",i,e+" forgotPasswordSubmit successful"),o(t)}
1,onFailure:function(t){Y("forgotPasswordSubmit_failure",t,e+" forgotPasswordSubmit failed"),s(t)}},r)})},e.prototype.currentUserInfo=function(){return G(this,void 0,void 0,function(){var e,t,n,r,i,o,s;return q(this,function(a){switch(a.label){case 0:if(!(!(e=this.Credentials.getCredSource())||"aws"===e||"userPool"===e))return[3,9];return[4,this.currentUserPoolUser().catch(function(e){return W.error(e)})];case 1:if(!(t=a.sent()))return[2,null];a.label=2;case 2:return a.trys.push([2,8,,9]),[4,this.userAttributes(t)];case 3:n=a.sent(),r=this.attributesToObject(n),i=null,a.label=4;case 4:return a.trys.push([4,6,,7]),[4,this.currentCredentials()];case 5:return i=a.sent(),[3,7];case 6:return o=a.sent(),W.debug("Failed to retrieve credentials while getting current user info",o),[3,7];case 7:return[2,{id:i?i.identityId:void 0,username:t.getUsername(),attributes:r}];case 8:return s=a.sent(),W.error("currentUserInfo error",s),[2,{}];case 9:if("federated"===e)return[2,(t=this.user)||{}];return[2]}})})},e.prototype.federatedSignIn=function(e,t,n){return G(this,void 0,void 0,function(){var r,i,o,a,u,c,l,f,d,h,p;return q(this,function(g){switch(g.label){case 0:if(!this._config.identityPoolId&&!this._config.userPoolId)throw Error("Federation requires either a User Pool or Identity Pool in config");if(void 0===e&&this._config.identityPoolId&&!this._config.userPoolId)throw Error("Federation with Identity Pools requires tokens passed as arguments");if(!((0,s.SU)(e)||(0,s.zB)(e)||(0,s.Ay)(e)||void 0===e))return[3,1];return r=e||{provider:s.JG.Cognito},i=(0,s.SU)(r)?r.provider:r.customProvider,(0,s.SU)(r),o=r.customState,this._config.userPoolId&&(a=(0,s.ic)(this._config.oauth)?this._config.userPoolWebClientId:this._config.oauth.clientID,u=(0,s.ic)(this._config.oauth)?this._config.oauth.redirectSignIn:this._config.oauth.redirectUri,this._oAuthHandler.oauthSignIn(this._config.oauth.responseType,this._config.oauth.domain,u,a,i,o)),[3,4];case 1:i=e;try{(c=JSON.stringify(JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")).user))&&W.warn("There is already a signed in user: "+c+" in your app.\n																	You should not call Auth.federatedSignIn method again as it may cause unexpected behavior.")}catch(e){}return l=t.token,f=t.identity_id,d=t.expires_at,[4,this.Credentials.set({provider:i,token:l,identity_id:f,user:n,expires_at:d},"federation")];case 2:return h=g.sent(),[4,this.currentAuthenticatedUser()];case 3:return Y("signIn",p=g.sent(),"A user "+p.username+" has been signed in"),W.debug("federated sign in credentials",h),[2,h];case 4:return[2]}})})},e.prototype._handleAuthResponse=function(e){return G(this,void 0,void 0,function(){var t,n,r,i,o,s,a,u,c,l,f,d,p;return q(this,function(v){switch(v.label){case 0:if(this.oAuthFlowInProgress)return W.debug("Skipping URL "+e+" current flow in progress"),[2];v.label=1;case 1:if(v.trys.push([1,,8,9]),this.oAuthFlowInProgress=!0,!this._config.userPoolId)throw Error("OAuth responses require a User Pool defined in config");if(Y("parsingCallbackUrl",{url:e},"The callback url is being parsed"),t=e||((0,h.lC)().isBrowser?window.location.href:""),n=!!((0,y.parse)(t).query||"").split("&").map(function(e){return e.split("=")}).find(function(e){var t=z(e,1)[0];return"code"===t||"error"===t}),r=!!((0,y.parse)(t).hash||"#").substr(1).split("&").map(function(e){return e.split("=")}).find(function(e){var t=z(e,1)[0];return"access_token"===t||"error"===t}),!(n||r))return[3,7];this._storage.setItem("amplify-redirected-from-hosted-ui","true"),v.label=2;case 2:return v.trys.push([2,6,,7]),[4,this._oAuthHandler.handleAuthResponse(t)];case 3:if(o=(i=v.sent()).accessToken,s=i.idToken,a=i.refreshToken,u=i.state,c=new g.MZ({IdToken:new g.xk({IdToken:s}),RefreshToken:new g.bR({RefreshToken:a}),AccessToken:new g.ZA({AccessToken:o})}),l=void 0,!this._config.identityPoolId)return[3,5];return[4,this.Credentials.set(c,"session")];case 4:l=v.sent(),W.debug("AWS credentials",l),v.label=5;case 5:return f=/-/.test(u),(d=this.createCognitoUser(c.getIdToken().decodePayload()["cognito:username"])).setSignInUserSession(c),window&&void 0!==window.history&&window.history.replaceState({},null,this._config.oauth.redirectSignIn),Y("signIn",d,"A user "+d.getUsername()+" has been signed in"),Y("cognitoHostedUI",d,"A user "+d.getUsername()+" has been signed in via Cognito Hosted UI"),f&&Y("customOAuthState",u.split("-").splice(1).join("-").match(/.{2}/g).map(function(e){return String.fromCharCode(parseInt(e,16))}).join(""),"State for user "+d.getUsername()),[2,l];case 6:return p=v.sent(),W.debug("Error in cognito hosted auth response",p),window&&void 0!==window.history&&window.history.replaceState({},null,this._config.oauth.redirectSignIn),Y("signIn_failure",p,"The OAuth response flow failed"),Y("cognitoHostedUI_failure",p,"A failure occurred when returning to the Cognito Hosted UI"),Y("customState_failure",p,"A failure occurred when returning state"),[3,7];case 7:return[3,9];case 8:return this.oAuthFlowInProgress=!1,[7];case 9:return[2]}})})},e.prototype.essentialCredentials=function(e){return{accessKeyId:e.accessKeyId,sessionToken:e.sessionToken,secretAccessKey:e.secretAccessKey,identityId:e.identityId,authenticated:e.authenticated}},e.prototype.attributesToObject=function(e){var t=this,n={};return e&&e.map(function(e){"email_verified"===e.Name||"phone_number_verified"===e.Name?n[e.Name]=t.isTruthyString(e.Value)||!0===e.Value:n[e.Name]=e.Value}),n},e.prototype.isTruthyString=function(e){return"function"==typeof e.toLowerCase&&"true"===e.toLowerCase()},e.prototype.createCognitoUser=function(e){var t={Username:e,Pool:this.userPool};t.Storage=this._storage;var n=this._config.authenticationFlowType,r=new g.ws(t);return n&&r.setAuthenticationFlowType(n),r},e.prototype._isValidAuthStorage=function(e){return!!e&&"function"==typeof e.getItem&&"function"==typeof e.setItem&&"function"==typeof e.removeItem&&"function"==typeof e.clear},e.prototype.noUserPoolErrorHandler=function(e){return!e||e.userPoolId&&e.identityPoolId?s.Qg.NoConfig:s.Qg.MissingAuthConfig},e.prototype.rejectAuthError=function(e){return Promise.reject(new D(e))},e.prototype.rejectNoUserPool=function(){return Promise.reject(new L(this.noUserPoolErrorHandler(this._config)))},e.prototype.rememberDevice=function(){return G(this,void 0,void 0,function(){var e,t;return q(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.currentUserPoolUser()];case 1:return e=n.sent(),[3,3];case 2:return t=n.sent(),W.debug("The user is not authenticated by the error",t),[2,Promise.reject("The user is not authenticated")];case 3:return e.getCachedDeviceKeyAndPassword(),[2,new Promise(function(t,n){e.setDeviceStatusRemembered({onSuccess:function(e){t(e)},onFailure:function(e){"InvalidParameterException"===e.code?n(new D(s.Qg.DeviceConfig)):"NetworkError"===e.code?n(new D(s.Qg.NetworkError)):n(e)}})})]}})})},e.prototype.forgetDevice=function(){return G(this,void 0,void 0,function(){var e,t;return q(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.currentUserPoolUser()];case 1:return e=n.sent(),[3,3];case 2:return t=n.sent(),W.debug("The user is not authenticated by the error",t),[2,Promise.reject("The user is not authenticated")];case 3:return e.getCachedDeviceKeyAndPassword(),[2,new Promise(function(t,n){e.forgetDevice({onSuccess:function(e){t(e)},onFailure:function(e){"InvalidParameterException"===e.code?n(new D(s.Qg.DeviceConfig)):"NetworkError"===e.code?n(new D(s.Qg.NetworkError)):n(e)}})})]}})})},e.prototype.fetchDevices=function(){return G(this,void 0,void 0,function(){var e,t;return q(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.currentUserPoolUser()];case 1:return e=n.sent(),[3,3];case 2:throw t=n.sent(),W.debug("The user is not authenticated by the error",t),Error("The user is not authenticated");case 3:return e.getCachedDeviceKeyAndPassword(),[2,new Promise(function(t,n){e.listDevices(60,null,{onSuccess:function(e){t(e.Devices.map(function(e){var t=e.DeviceAttributes.find(function(e){return"device_name"===e.Name})||{};return{id:e.DeviceKey,name:t.Value}}))},onFailure:function(e){"InvalidParameterException"===e.code?n(new D(s.Qg.DeviceConfig)):"NetworkError"===e.code?n(new D(s.Qg.NetworkError)):n(e)}})})]}})})},e}())(null);p.dQ.register(V)},46375:function(e,t,n){"use strict";var r=n(37260);n(23615),t.ZP=r.g},74634:function(e,t,n){"use strict";var r,i,o,s,a,u;function c(e){return e&&!!["provider"].find(function(t){return e.hasOwnProperty(t)})}function l(e){return e&&!!["customProvider"].find(function(t){return e.hasOwnProperty(t)})}function f(e){return e&&!!["customState"].find(function(t){return e.hasOwnProperty(t)})}function d(e){return void 0!==e.redirectSignIn}function h(e){return!!e.username}n.d(t,{Ay:function(){return f},JG:function(){return r},Qg:function(){return i},SU:function(){return c},ic:function(){return d},lg:function(){return h},si:function(){return o},zB:function(){return l}}),(s=r||(r={})).Cognito="COGNITO",s.Google="Google",s.Facebook="Facebook",s.Amazon="LoginWithAmazon",s.Apple="Sign
1InWithApple",(a=i||(i={})).NoConfig="noConfig",a.MissingAuthConfig="missingAuthConfig",a.EmptyUsername="emptyUsername",a.InvalidUsername="invalidUsername",a.EmptyPassword="emptyPassword",a.EmptyCode="emptyCode",a.SignUpError="signUpError",a.NoMFA="noMFA",a.InvalidMFA="invalidMFA",a.EmptyChallengeResponse="emptyChallengeResponse",a.NoUserSession="noUserSession",a.Default="default",a.DeviceConfig="deviceConfig",a.NetworkError="networkError",a.AutoSignInError="autoSignInError",(u=o||(o={})).API_KEY="API_KEY",u.AWS_IAM="AWS_IAM",u.OPENID_CONNECT="OPENID_CONNECT",u.AMAZON_COGNITO_USER_POOLS="AMAZON_COGNITO_USER_POOLS",u.AWS_LAMBDA="AWS_LAMBDA"},69249:function(e,t,n){"use strict";n.d(t,{_m:function(){return g},ZP:function(){return y}});var r,i=n(30587),o={keyPrefix:"aws-amplify-cache",capacityInBytes:1048576,itemMaxSize:21e4,defaultTTL:2592e5,defaultPriority:5,warningThreshold:.8,storage:new(n(27406)).c4().getStorage()};function s(e){var t=0;t=e.length;for(var n=e.length;n>=0;n-=1){var r=e.charCodeAt(n);r>127&&r<=2047?t+=1:r>2047&&r<=65535&&(t+=2),r>=56320&&r<=57343&&(n-=1)}return t}function a(){return new Date().getTime()}function u(e){return Number.isInteger?Number.isInteger(e):"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}var c={};!function(){function e(){}e.clear=function(){c={}},e.getItem=function(e){return c[e]||null},e.setItem=function(e,t){c[e]=t},e.removeItem=function(e){delete c[e]}}();var l=n(25049),f=new l.k("StorageCache"),d=function(){function e(e){this.config=Object.assign({},e),this.cacheCurSizeKey=this.config.keyPrefix+"CurSize",this.checkConfig()}return e.prototype.getModuleName=function(){return"Cache"},e.prototype.checkConfig=function(){u(this.config.capacityInBytes)||(f.error("Invalid parameter: capacityInBytes. It should be an Integer. Setting back to default."),this.config.capacityInBytes=o.capacityInBytes),u(this.config.itemMaxSize)||(f.error("Invalid parameter: itemMaxSize. It should be an Integer. Setting back to default."),this.config.itemMaxSize=o.itemMaxSize),u(this.config.defaultTTL)||(f.error("Invalid parameter: defaultTTL. It should be an Integer. Setting back to default."),this.config.defaultTTL=o.defaultTTL),u(this.config.defaultPriority)||(f.error("Invalid parameter: defaultPriority. It should be an Integer. Setting back to default."),this.config.defaultPriority=o.defaultPriority),this.config.itemMaxSize>this.config.capacityInBytes&&(f.error("Invalid parameter: itemMaxSize. It should be smaller than capacityInBytes. Setting back to default."),this.config.itemMaxSize=o.itemMaxSize),(this.config.defaultPriority>5||this.config.defaultPriority<1)&&(f.error("Invalid parameter: defaultPriority. It should be between 1 and 5. Setting back to default."),this.config.defaultPriority=o.defaultPriority),(Number(this.config.warningThreshold)>1||0>Number(this.config.warningThreshold))&&(f.error("Invalid parameter: warningThreshold. It should be between 0 and 1. Setting back to default."),this.config.warningThreshold=o.warningThreshold),this.config.capacityInBytes>5242880&&(f.error("Cache Capacity should be less than 5MB. Setting back to default. Setting back to default."),this.config.capacityInBytes=o.capacityInBytes)},e.prototype.fillCacheItem=function(e,t,n){var r={key:e,data:t,timestamp:a(),visitedTime:a(),priority:n.priority,expires:n.expires,type:typeof t,byteSize:0};return r.byteSize=s(JSON.stringify(r)),r.byteSize=s(JSON.stringify(r)),r},e.prototype.configure=function(e){return e&&(e.keyPrefix&&f.warn("Don't try to configure keyPrefix!"),this.config=Object.assign({},this.config,e,e.Cache),this.checkConfig()),this.config},e}(),h=(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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),p=new l.k("Cache"),g=new(function(e){function t(t){var n=this,r=t?Object.assign({},o,t):o;return(n=e.call(this,r)||this).config.storage=r.storage,n.getItem=n.getItem.bind(n),n.setItem=n.setItem.bind(n),n.removeItem=n.removeItem.bind(n),n}return h(t,e),t.prototype._decreaseCurSizeInBytes=function(e){var t=this.getCacheCurSize();this.config.storage.setItem(this.cacheCurSizeKey,(t-e).toString())},t.prototype._increaseCurSizeInBytes=function(e){var t=this.getCacheCurSize();this.config.storage.setItem(this.cacheCurSizeKey,(t+e).toString())},t.prototype._refreshItem=function(e,t){return e.visitedTime=a(),this.config.storage.setItem(t,JSON.stringify(e)),e},t.prototype._isExpired=function(e){var t=JSON.parse(this.config.storage.getItem(e));return a()>=t.expires},t.prototype._removeItem=function(e,t){var n=t||JSON.parse(this.config.storage.getItem(e)).byteSize;this._decreaseCurSizeInBytes(n),this.config.storage.removeItem(e)},t.prototype._setItem=function(e,t){this._increaseCurSizeInBytes(t.byteSize);try{this.config.storage.setItem(e,JSON.stringify(t))}catch(e){this._decreaseCurSizeInBytes(t.byteSize),p.error("Failed to set item "+e)}},t.prototype._sizeToPop=function(e){var t=this.getCacheCurSize()+e-this.config.capacityInBytes,n=(1-this.config.warningThreshold)*this.config.capacityInBytes;return t>n?t:n},t.prototype._isCacheFull=function(e){return e+this.getCacheCurSize()>this.config.capacityInBytes},t.prototype._findValidKeys=function(){for(var e=[],t=[],n=0;n<this.config.storage.length;n+=1)t.push(this.config.storage.key(n));for(var n=0;n<t.length;n+=1){var r=t[n];0===r.indexOf(this.config.keyPrefix)&&r!==this.cacheCurSizeKey&&(this._isExpired(r)?this._removeItem(r):e.push(r))}return e},t.prototype._popOutItems=function(e,t){for(var n=[],r=t,i=0;i<e.length;i+=1){var o=this.config.storage.getItem(e[i]);if(null!=o){var s=JSON.parse(o);n.push(s)}}n.sort(function(e,t){return e.priority>t.priority?-1:e.priority<t.priority?1:e.visitedTime<t.visitedTime?-1:1});for(var i=0;i<n.length;i+=1)if(this._removeItem(n[i].key,n[i].byteSize),(r-=n[i].byteSize)<=0)return},t.prototype.setItem=function(e,t,n){p.log("Set item: key is "+e+", value is "+t+" with options: "+n);var r=this.config.keyPrefix+e;if(r===this.config.keyPrefix||r===this.cacheCurSizeKey){p.warn("Invalid key: should not be empty or 'CurSize'");return}if(void 0===t){p.warn("The value of item should not be undefined!");return}var i={priority:n&&void 0!==n.priority?n.priority:this.config.defaultPriority,expires:n&&void 0!==n.expires?n.expires:this.config.defaultTTL+a()};if(i.priority<1||i.priority>5){p.warn("Invalid parameter: priority due to out or range. It should be within 1 and 5.");return}var o=this.fillCacheItem(r,t,i);if(o.byteSize>this.config.itemMaxSize){p.warn("Item with key: "+e+" you are trying to put into is too big!");return}try{var s=this.config.storage.getItem(r);if(s&&this._removeItem(r,JSON.parse(s).byteSize),this._isCacheFull(o.byteSize)){var u=this._findValidKeys();if(this._isCacheFull(o.byteSize)){var c=this._sizeToPop(o.byteSize);this._popOutItems(u,c)}}this._setItem(r,o)}catch(e){p.warn("setItem failed! "+e)}},t.prototype.getItem=function(e,t){p.log("Get item: key is "+e+" with options "+t);var n=null,r=this.config.keyPrefix+e;if(r===this.config.keyPrefix||r===this.cacheCurSizeKey)return p.warn("Invalid key: should not be empty or 'CurSize'"),null;try{if(n=this.config.storage.getItem(r),null!=n){if(this._isExpired(r))this._removeItem(r,JSON.parse(n).byteSize),n=null;else{var i=JSON.parse(n);return(i=this._refreshItem(i,r)).data}}if(t&&void 0!==t.callback){var o=t.callback();return null!==o&&this.setItem(e,o,t),o}return null}catch(e){return p.warn("getItem failed! "+e),null}},t.prototype.removeItem=function(e){p.log("Remove item: key is "+e);var t=this.config.keyPrefix+e;if(t!==this.config.keyPrefix&&t!==this.cacheCurSizeKey)try{var n=this.config.storage.getItem(t);n&&this._removeItem(t,JSON.parse(n).byteSize)}catch(e){p.warn("removeItem failed! "+e)}},t.prototype.clear=function(){p.log("Clear Cache");for(var e=[],t=0;t<this.config.storage.length;t+=1){var n=this.config.storage.key(t);0===n.indexOf(this.config.keyPrefix)&&e.push(n)}try{for(var t=0;t<e.length;t+=1)this.config.storage.removeItem(e[t])}catch(e){p.warn("clear failed! "+e)}},t.prototype.getAllKeys=function(){for(var e=[],t=0;t<this.config.storage.length;t+=1){var n=this.config.storage.key(t);0===n.indexOf(this.config.keyPrefix)&&n!==this.cacheCurSizeKey&&e.push(n.substring(this.config.keyPrefix.length))}return e},t.prototype.getCacheCurSize=function(){var e=this.config.storage.getItem(this.cacheCurSizeKey);return e||(this.config.storage.setItem(this.cacheCurSizeKey,"0"),e="0"),Number(e)},t.prototype.createInstance=function(e){return e.keyPrefix&&e.keyPrefix!==o.keyPrefix||(p.error("invalid keyPrefix, setting keyPrefix with timeStamp"),e.keyPrefix=a.toString()),new t(e)},t}(d)),y=g;i.dQ.register(g)},30587:function(e,t,n){"use strict";n.d(t,{bY:function(){return s},dQ:function(){return a}});var r=n(25049),i=function(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},o=new r.k("Amplify"),s=function(){function e(){this._components=[],this._config={},this._modules={},this.Auth=null,this.Analytics=null,this.API=null,this.Credentials=null,this.Storage=null,this.I18n=null,this.Cache=null,this.PubSub=null,this.Interactions=null,this.Pushnotification=null,this.UI=null,this.XR=null,this.Predictions=null,this.DataStore=null,this.Geo=null,this.Logger=r.k,this.ServiceWorker=null}return e.prototype.register=function(e){o.debug("component registered in amplify",e),this._components.push(e),"function"==typeof e.getModuleName?(this._modules[e.getModuleName()]=e,this[e.getModuleName()]=e):o.debug("no getModuleName method for component",e),e.configure(this._config)},e.prototype.configure=function(e){var t=this;return e&&(this._config=Object.assign(this._config,e),o.debug("amplify config",this._config),Object.entries(this._modules).forEac
1h(function(e){var n=i(e,2),r=(n[0],n[1]);Object.keys(r).forEach(function(e){t._modules[e]&&(r[e]=t._modules[e])})}),this._components.map(function(e){e.configure(t._config)})),this._config},e.prototype.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}(),a=new s},63115:function(e,t,n){"use strict";n.d(t,{_:function(){return i}});var r=new(n(25049)).k("ClientDevice_Browser"),i=function(){function e(){}return e.clientInfo=function(){return"undefined"==typeof window?{}:function(){if("undefined"==typeof window)return r.warn("No window object available to get browser client info"),{};var e,t=window.navigator;if(!t)return r.warn("No navigator object available to get browser client info"),{};var n=t.platform,i=t.product,o=t.vendor,s=t.userAgent,a=t.language,u=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 i=/.+(Safari)\/([0-9\.]+).*/i.exec(e);if(i)return{type:i[1],version:i[2]};var o=/.+(AppleWebKit)\/([0-9\.]+).*/i.exec(e);if(o)return{type:o[1],version:o[2]};var s=/.*([A-Z]+)\/([0-9\.]+).*/i.exec(e);return s?{type:s[1],version:s[2]}:{type:"",version:""}}(s),c=(e=/\(([A-Za-z\s].*)\)/.exec(new Date().toString()))&&e[1]||"";return{platform:n,make:i||o,model:u.type,version:u.version,appVersion:[u.type,u.version].join("/"),language:a,timezone:c}}()},e.dimension=function(){return"undefined"==typeof window?(r.warn("No window object available to get browser client info"),{width:320,height:320}):{width:window.innerWidth,height:window.innerHeight}},e}()},22485:function(e,t,n){"use strict";n.d(t,{cN:function(){return A}});var r=n(25049),i=n(27406),o=n(96141),s=n(58399),a=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},u=new r.k("CognitoCredentials"),c=new Promise(function(e,t){return(0,o.lC)().isBrowser?(window.gapi&&window.gapi.auth2?window.gapi.auth2:null)?(u.debug("google api already loaded"),e()):void setTimeout(function(){return e()},2e3):(u.debug("not in the browser, directly resolved"),e())}),l=function(){function e(){this.initialized=!1,this.refreshGoogleToken=this.refreshGoogleToken.bind(this),this._refreshGoogleTokenImpl=this._refreshGoogleTokenImpl.bind(this)}return e.prototype.refreshGoogleToken=function(){var e,t,n,r;return e=this,t=void 0,n=void 0,r=function(){return a(this,function(e){switch(e.label){case 0:if(this.initialized)return[3,2];return u.debug("need to wait for the Google SDK loaded"),[4,c];case 1:e.sent(),this.initialized=!0,u.debug("finish waiting"),e.label=2;case 2:return[2,this._refreshGoogleTokenImpl()]}})},new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},e.prototype._refreshGoogleTokenImpl=function(){var e=null;return((0,o.lC)().isBrowser&&(e=window.gapi&&window.gapi.auth2?window.gapi.auth2:null),e)?new Promise(function(t,n){e.getAuthInstance().then(function(e){e||(u.debug("google Auth undefined"),n(new s.V2("google Auth undefined")));var r=e.currentUser.get();r.isSignedIn()?(u.debug("refreshing the google access token"),r.reloadAuthResponse().then(function(e){t({token:e.id_token,expires_at:e.expires_at})}).catch(function(e){e&&"network_error"===e.error?n("Network error reloading google auth response"):n(new s.V2("Failed to reload google auth response"))})):n(new s.V2("User is not signed in with Google"))}).catch(function(e){u.debug("Failed to refresh google token",e),n(new s.V2("Failed to refresh google token"))})}):(u.debug("no gapi auth2 available"),Promise.reject("no gapi auth2 available"))},e}(),f=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;
1function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},d=new r.k("CognitoCredentials"),h=new Promise(function(e,t){return(0,o.lC)().isBrowser?window.FB?(d.debug("FB SDK already loaded"),e()):void setTimeout(function(){return e()},2e3):(d.debug("not in the browser, directly resolved"),e())}),p=function(){function e(){this.initialized=!1,this.refreshFacebookToken=this.refreshFacebookToken.bind(this),this._refreshFacebookTokenImpl=this._refreshFacebookTokenImpl.bind(this)}return e.prototype.refreshFacebookToken=function(){var e,t,n,r;return e=this,t=void 0,n=void 0,r=function(){return f(this,function(e){switch(e.label){case 0:if(this.initialized)return[3,2];return d.debug("need to wait for the Facebook SDK loaded"),[4,h];case 1:e.sent(),this.initialized=!0,d.debug("finish waiting"),e.label=2;case 2:return[2,this._refreshFacebookTokenImpl()]}})},new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},e.prototype._refreshFacebookTokenImpl=function(){var e=null;if((0,o.lC)().isBrowser&&(e=window.FB),!e){var t="no fb sdk available";return d.debug(t),Promise.reject(new s.V2(t))}return new Promise(function(t,n){e.getLoginStatus(function(e){if(e&&e.authResponse){var r=e.authResponse,i=r.accessToken,o=1e3*r.expiresIn+new Date().getTime();if(!i){var a="the jwtToken is undefined";d.debug(a),n(new s.V2(a))}t({token:i,expires_at:o})}else{var a="no response from facebook when refreshing the jwt token";d.debug(a),n(new s.V2(a))}},{scope:"public_profile,email"})})},e}(),g=new l,y=new p,v=n(15047),b=n(30587),m=n(7669),_=n(1760),w=n(43077),S=n(4749),E=n(44722),I=function(){return(I=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},P=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},C=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},O=new r.k("Credentials"),A=new(function(){function e(e){this._gettingCredPromise=null,this._refreshHandlers={},this.Auth=void 0,this.configure(e),this._refreshHandlers.google=g.refreshGoogleToken,this._refreshHandlers.facebook=y.refreshFacebookToken}return e.prototype.getModuleName=function(){return"Credentials"},e.prototype.getCredSource=function(){return this._credentials_source},e.prototype.configure=function(e){if(!e)return this._config||{};this._config=Object.assign({},this._config,e);var t=this._config.refreshHandlers;return t&&(this._refreshHandlers=I(I({},this._refreshHandlers),t)),this._storage=this._config.storage,this._storage||(this._storage=new i.c4().getStorage()),this._storageSync=Promise.resolve(),"function"==typeof this._storage.sync&&(this._storageSync=this._storage.sync()),this._config},e.prototype.get=function(){return O.debug("getting credentials"),this._pickupCredentials()},e.prototype._getCognitoIdentityIdStorageKey=function(e){return"CognitoIdentityId-"+e},e.prototype._pickupCredentials=function(){return O.debug("picking up credentials"),this._gettingCredPromise&&this._gettingCredPromise.isPending()?O.debug("getting old cred promise"):(O.debug("getting new cred promise"),this._gettingCredPromise=(0,o.ML)(this._keepAlive())),this._gettingCredPromise},e.prototype._keepAlive=function(){return P(this,void 0,void 0,function(){var e,t,n,r,i,o;return C(this,function(s){switch(s.label){case 0:if(O.debug("checking if credentials exists and not expired"),(e=this._credentials)&&!this._isExpired(e)&&!this._isPastTTL())return O.debug("credentials not changed and not expired, directly return"),[2,Promise.resolve(e)];if(O.debug("need to get a new credential or refresh the existing one"),!(n=void 0===(t=this.Auth)?b.dQ.Auth:t)||"function"!=typeof n.currentUserCredentials)return[2,Promise.reject("No Auth module registered in Amplify")];
1if(!(!this._isExpired(e)&&this._isPastTTL()))return[3,6];O.debug("ttl has passed but token is not yet expired"),s.label=1;case 1:return s.trys.push([1,5,,6]),[4,n.currentUserPoolUser()];case 2:return r=s.sent(),[4,n.currentSession()];case 3:return i=s.sent().refreshToken,[4,new Promise(function(e,t){r.refreshSession(i,function(n,r){return n?t(n):e(r)})})];case 4:return s.sent(),[3,6];case 5:return o=s.sent(),O.debug("Error attempting to refreshing the session",o),[3,6];case 6:return[2,n.currentUserCredentials()]}})})},e.prototype.refreshFederatedToken=function(e){O.debug("Getting federated credentials");var t=e.provider,n=e.user,r=e.token,i=e.identity_id,o=e.expires_at;return(o=1970===new Date(o).getFullYear()?1e3*o:o,O.debug("checking if federated jwt token expired"),o>new Date().getTime())?(O.debug("token not expired"),this._setCredentialsFromFederation({provider:t,token:r,user:n,identity_id:i,expires_at:o})):this._refreshHandlers[t]&&"function"==typeof this._refreshHandlers[t]?(O.debug("getting refreshed jwt token from federation provider"),this._providerRefreshWithRetry({refreshHandler:this._refreshHandlers[t],provider:t,user:n})):(O.debug("no refresh handler for provider:",t),this.clear(),Promise.reject("no refresh handler for provider"))},e.prototype._providerRefreshWithRetry=function(e){var t=this,n=e.refreshHandler,r=e.provider,i=e.user;return(0,s.Xm)(n,[],1e4).then(function(e){return O.debug("refresh federated token sucessfully",e),t._setCredentialsFromFederation({provider:r,token:e.token,user:i,identity_id:e.identity_id,expires_at:e.expires_at})}).catch(function(e){return"string"==typeof e&&0===e.toLowerCase().lastIndexOf("network error",e.length)||t.clear(),O.debug("refresh federated token failed",e),Promise.reject("refreshing federation token failed: "+e)})},e.prototype._isExpired=function(e){if(!e)return O.debug("no credentials for expiration check"),!0;O.debug("are these credentials expired?",e);var t=Date.now();return e.expiration.getTime()<=t},e.prototype._isPastTTL=function(){return this._nextCredentialsRefresh<=Date.now()},e.prototype._setCredentialsForGuest=function(){return P(this,void 0,void 0,function(){var e,t,n,r,i,o,s,a,u=this;return C(this,function(c){switch(c.label){case 0:if(O.debug("setting credentials for guest"),t=(e=this._config).identityPoolId,n=e.region,e.mandatorySignIn)return[2,Promise.reject("cannot get guest credentials when mandatory signin enabled")];if(!t)return O.debug("No Cognito Identity pool provided for unauthenticated access"),[2,Promise.reject("No Cognito Identity pool provided for unauthenticated access")];if(!n)return O.debug("region is not configured for getting the credentials"),[2,Promise.reject("region is not configured for getting the credentials")];return i=this,[4,this._getGuestIdentityId()];case 1:return r=i._identityId=c.sent(),o=new w.Q({region:n,customUserAgent:(0,v.Zm)()}),s=void 0,r?(a={identityId:r,client:o},s=(0,m.o)(a)()):s=P(u,void 0,void 0,function(){var e,n;return C(this,function(r){switch(r.label){case 0:return[4,o.send(new S.n({IdentityPoolId:t}))];case 1:return e=r.sent().IdentityId,this._identityId=e,n={client:o,identityId:e},[2,(0,m.o)(n)()]}})}).catch(function(e){return P(u,void 0,void 0,function(){return C(this,function(t){throw e})})}),[2,this._loadCredentials(s,"guest",!1,null).then(function(e){return e}).catch(function(e){return P(u,void 0,void 0,function(){var n=this;return C(this,function(i){switch(i.label){case 0:if(!("ResourceNotFoundException"===e.name&&e.message==="Identity '"+r+"' not found."))return[3,2];return O.debug("Failed to load guest credentials"),[4,this._removeGuestIdentityId()];case 1:return i.sent(),s=P(n,void 0,void 0,function(){var e,n;return C(this,function(r){switch(r.label){case 0:return[4,o.send(new S.n({IdentityPoolId:t}))];case 1:return e=r.sent().IdentityId,this._identityId=e,n={client:o,identityId:e},[2,(0,m.o)(n)()]}})}).catch(function(e){return P(n,void 0,void 0,function(){return C(this,function(t){throw e})})}),[2,this._loadCredentials(s,"guest",!1,null)];case 2:return[2,e]}})})})]}})})},e.prototype._setCredentialsFromFederation=function(e){var t=e.provider,n=e.token,r=e.identity_id,i={google:"accounts.google.com",facebook:"graph.facebook.com",amazon:"www.amazon.com",developer:"cognito-identity.amazonaws.com"}[t]||t;if(!i)return Promise.reject("You must specify a federated provider");var o={};o[i]=n;var s=this._config,a=s.identityPoolId,u=s.region;if(!a)return O.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");
1if(!u)return O.debug("region is not configured for getting the credentials"),Promise.reject("region is not configured for getting the credentials");var c=new w.Q({region:u,customUserAgent:(0,v.Zm)()}),l=void 0;if(r){var f={identityId:r,logins:o,client:c};l=(0,m.o)(f)()}else{var f={logins:o,identityPoolId:a,client:c};l=(0,_.s)(f)()}return this._loadCredentials(l,"federated",!0,e)},e.prototype._setCredentialsFromSession=function(e){var t=this;O.debug("set credentials from session");var n=e.getIdToken().getJwtToken(),r=this._config,i=r.region,o=r.userPoolId,s=r.identityPoolId;if(!s)return O.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");if(!i)return O.debug("region is not configured for getting the credentials"),Promise.reject("region is not configured for getting the credentials");var a={};a["cognito-idp."+i+".amazonaws.com/"+o]=n;var u=new w.Q({region:i,customUserAgent:(0,v.Zm)()}),c=P(t,void 0,void 0,function(){var e,t,n,r,i,o,c,l,f;return C(this,function(d){switch(d.label){case 0:return[4,this._getGuestIdentityId()];case 1:if(e=d.sent())return[3,3];return[4,u.send(new S.n({IdentityPoolId:s,Logins:a}))];case 2:t=d.sent().IdentityId,d.label=3;case 3:return[4,u.send(new E.L({IdentityId:e||t,Logins:a}))];case 4:if(i=(r=(n=d.sent()).Credentials).AccessKeyId,o=r.Expiration,c=r.SecretKey,l=r.SessionToken,f=n.IdentityId,this._identityId=f,!e)return[3,6];return O.debug("The guest identity "+e+" has been successfully linked to the logins"),e===f&&O.debug("The guest identity "+e+" has become the primary identity"),[4,this._removeGuestIdentityId()];case 5:d.sent(),d.label=6;case 6:return[2,{accessKeyId:i,secretAccessKey:c,sessionToken:l,expiration:o,identityId:f}]}})}).catch(function(e){return P(t,void 0,void 0,function(){return C(this,function(t){throw e})})});return this._loadCredentials(c,"userPool",!0,null)},e.prototype._loadCredentials=function(e,t,n,r){var i=this,o=this;return new Promise(function(s,a){e.then(function(e){return P(i,void 0,void 0,function(){var i,a,u,c,l;return C(this,function(f){switch(f.label){case 0:if(O.debug("Load credentials successfully",e),this._identityId&&!e.identityId&&(e.identityId=this._identityId),o._credentials=e,o._credentials.authenticated=n,o._credentials_source=t,o._nextCredentialsRefresh=new Date().getTime()+3e6,"federated"===t){i=Object.assign({id:this._credentials.identityId},r.user),a=r.provider,u=r.token,c=r.expires_at,l=r.identity_id;try{this._storage.setItem("aws-amplify-federatedInfo",JSON.stringify({provider:a,token:u,user:i,expires_at:c,identity_id:l}))}catch(e){O.debug("Failed to put federated info into auth storage",e)}}if("guest"!==t)return[3,2];return[4,this._setGuestIdentityId(e.identityId)];case 1:f.sent(),f.label=2;case 2:return s(o._credentials),[2]}})})}).catch(function(t){if(t){O.debug("Failed to load credentials",e),O.debug("Error loading credentials",t),a(t);return}})})},e.prototype.set=function(e,t){return"session"===t?this._setCredentialsFromSession(e):"federation"===t?this._setCredentialsFromFederation(e):"guest"===t?this._setCredentialsForGuest():(O.debug("no source specified for setting credentials"),Promise.reject("invalid source"))},e.prototype.clear=function(){return P(this,void 0,void 0,function(){return C(this,function(e){return this._credentials=null,this._credentials_source=null,O.debug("removing aws-amplify-federatedInfo from storage"),this._storage.removeItem("aws-amplify-federatedInfo"),[2]})})},e.prototype._getGuestIdentityId=function(){return P(this,void 0,void 0,function(){var e,t;return C(this,function(n){switch(n.label){case 0:e=this._config.identityPoolId,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._storageSync];case 2:return n.sent(),[2,this._storage.getItem(this._getCognitoIdentityIdStorageKey(e))];case 3:return t=n.sent(),O.debug("Failed to get the cached guest identityId",t),[3,4];case 4:return[2]}})})},e.prototype._setGuestIdentityId=function(e){return P(this,void 0,void 0,function(){var t,n;return C(this,function(r){switch(r.label){case 0:t=this._config.identityPoolId,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._storageSync];case 2:return r.sent(),this._storage.setItem(this._getCognitoIdentityIdStorageKey(t),e),[3,4];case 3:return n=r.sent(),O.debug("Failed to cache guest identityId",n),[3,4];case 4:return[2]}})})},e.prototype._removeGuestIdentityId=function(){return P(this,void 0,void 0,function(){var e;return C(this,function(t){return e=this._config.identityPoolId,O.debug("removing "+this._getCognitoIdentityIdStorageKey(e)+" from storage"),this._storage.removeItem(this._getCognitoIdentityIdStorageKey(e)),[2]})})},e.prototype.shear=function(e){return{accessKeyId:e.accessKeyId,sessionToken:e.sessionToken,secretAccessKey:e.secretAccessKey,identityId:e.identityId,authenticated:e.authenticated}},e}())(null);b.dQ.register(A)},69276:function(e,t,n){"use strict";n.d(t,{Xb:function(){return c}});var r=n(25049),i=function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},o=function(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},s=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(o(arguments[t]));return e},a=new r.k("Hub"),u="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",c=new(function(){function e(e){this.listeners=[],this.patterns=[],this.protectedChannels=["core","auth","api","analytics","interactions","pubsub","storage","ui","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){a.warn("No listeners for "+e);return}this.patterns=s(this.patterns.filter(function(e){return e!==n}))}else{var r=this.listeners[e];if(!r){a.warn("No listeners for "+e);return}this.listeners[e]=s(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!==u&&a.warn("WARNING: "+e+" is protected and dispatching on it can have unintended consequences");var o={channel:e,payload:i({},t),source:n,patternInfo:[]};try{this._toListeners(o)}catch(e){a.error(e)}},e.prototype.listen=function(e,t,n){var r,i=this;if(void 0===n&&(n="noname"),void 0!==t.onHubCapsule)a.warn("WARNING onHubCapsule is Deprecated. Please pass in a callback."),r=t.onHubCapsule.bind(t);else if("function"!=typeof t)throw Error("No callback supplied to Hub");else 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})}return function(){i.remove(e,r)}},e.prototype._toListeners=function(e){var t=e.channel,n=e.payload,r=this.listeners[t];if(r&&r.forEach(function(r){a.debug("Dispatching to "+t+" with ",n);try{r.callback(e)}catch(e){a.error(e)}}),this.patterns.length>0){if(!n.message){a.warn("Cannot perform pattern matching without a message 
1key");return}var s=n.message;this.patterns.forEach(function(t){var n=s.match(t.pattern);if(n){var r=o(n).slice(1),u=i(i({},e),{patternInfo:r});try{t.callback(u)}catch(e){a.error(e)}}})}},e}())("__default__")},63338:function(e,t,n){"use strict";n.d(t,{o:function(){return l}});var r=n(25049),i=new r.k("I18n"),o=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),i.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)?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}(),s=n(30587),a=new r.k("I18n"),u=null,c=null,l=function(){function e(){}return e.configure=function(t){return a.debug("configure I18n"),t&&(u=Object.assign({},u,t.I18n||t),e.createInstance()),u},e.getModuleName=function(){return"I18n"},e.createInstance=function(){a.debug("create I18n instance"),c||(c=new o(u))},e.setLanguage=function(t){return e.checkConfig(),c.setLanguage(t)},e.get=function(t,n){return e.checkConfig()?c.get(t,n):void 0===n?t:n},e.putVocabulariesForLanguage=function(t,n){return e.checkConfig(),c.putVocabulariesForLanguage(t,n)},e.putVocabularies=function(t){return e.checkConfig(),c.putVocabularies(t)},e.checkConfig=function(){return c||(c=new o(u)),!0},e}();s.dQ.register(l)},96141:function(e,t,n){"use strict";n.d(t,{JS:function(){return v},ML:function(){return f},lC:function(){return h},n2:function(){return d}});var r=n(32608),i=[{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/apng",ext:"apng"},{type:"image/bmp",ext:"bmp"},{type:"image/gif",ext:"gif"},{type:"image/x-icon",ext:"ico"},{type:"image/x-icon",ext:"cur"},{type:"image/jpeg",ext:"jpg"},{type:"image/jpeg",ext:"jpeg"},{type:"image/jpeg",ext:"jfif"},{type:"image/jpeg",ext:"pjp"},{type:"image/jpeg",ext:"pjpeg"},{type:"image/png",ext:"png"},{type:"image/svg+xml",ext:"svg"},{type:"image/tiff",ext:"tif"},{type:"image/tiff",ext:"tiff"},{type:"image/webp",ext:"webp"},{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"}],o=function(e){return void 0===e&&(e={}),0===Object.keys(e).length},s=function(e,t,n){if(!e||!e.sort)return!1;var r=n&&"desc"===n?-1:1;return e.sort(function(e,n){var i=e[t],o=n[t];return void 0===o?void 0===i?0:1*r:void 0===i||i<o?-1*r:i>o?1*r:0}),!0},a=function(e,t){var n=Object.assign({},e);return t&&("string"==typeof t?delete n[t]:t.forEach(function(e){delete n[e]})),n},u=function(e,t){void 0===t&&(t="application/octet-stream");var n=e.toLowerCase(),r=i.filter(function(e){return n.endsWith("."+e.ext)});return r.length>0?r[0].type:t},c=function(e){var t=e.toLowerCase();return!!t.startsWith("text/")||"application/json"===t||"application/xml"===t||"application/sh"===t},l=function(){for(var e="",t="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=32;n>0;n-=1)e+=t[Math.floor(Math.random()*t.length)];return e},f=function(e){if(e.isResolved)return e;var t=!0,n=!1,r=!1,i=e.then(function(e){return r=!0,t=!1,e},function(e){throw n=!0,t=!1,e});return i.isFullfilled=function(){return r},i.isPending=function(){return t},i.isRejected=function(){return n},i},d=function(){if("undefined"==typeof self)return!1;var e=self;return void 0!==e.WorkerGlobalScope&&self instanceof e.WorkerGlobalScope},h=function(){return{isBrowser:"undefined"!=typeof window&&void 0!==window.document,isNode:void 0!==r&&null!=r.versions&&null!=r.versions.node}},p=function(e,t,n){if(void 0===t&&(t=[]),void 0===n&&(n=[]),!y(e))return e;var r={};for(var i in e)e.hasOwnProperty(i)&&(r[t.includes(i)?i:i[0].toLowerCase()+i.slice(1)]=n.includes(i)?e[i]:p(e[i],t,n));return r},g=function(e,t,n){if(void 0===t&&(t=[]),void 0===n&&(n=[]),!y(e))return e;var r={};for(var i in e)e.hasOwnProperty(i)&&(r[t.includes(i)?i:i[0].toUpperCase()+i.slice(1)]=n.includes(i)?e[i]:g(e[i],t,n));return r},y=function(e){return e instanceof Object&&!(e instanceof Array)&&!(e instanceof Function)&&!(e instanceof Number)&&!(e instanceof String)&&!(e instanceof Boolean)},v=function(){function e(){}return e.isEmpty=o,e.sortByField=s,e.objectLessAttributes=a,e.filenameToContentType=u,e.isTextFile=c,e.generateRandomString=l,e.makeQuerablePromise=f,e.isWebWorker=d,e.browserOrNode=h,e.transferKeyToLowerCase=p,e.transferKeyToUpperCase=g,e.isStrictObject=y,e}()},25049:function(e,t,n){"use strict";n.d(t,{k:function(){return l}});var r,i,o=n(2983),s=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);
1if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=function(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},u=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(a(arguments[t]));return e},c={VERBOSE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5};(r=i||(i={})).DEBUG="DEBUG",r.ERROR="ERROR",r.INFO="INFO",r.WARN="WARN",r.VERBOSE="VERBOSE";var l=function(){function e(e,t){void 0===t&&(t=i.WARN),this.name=e,this.level=t,this._pluggables=[]}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.configure=function(e){return e&&(this._config=e),this._config},e.prototype._log=function(t){for(var n,r,o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];var u=this.level;e.LOG_LEVEL&&(u=e.LOG_LEVEL),"undefined"!=typeof window&&window.LOG_LEVEL&&(u=window.LOG_LEVEL);var l=c[u];if(c[t]>=l){var f=console.log.bind(console);t===i.ERROR&&console.error&&(f=console.error.bind(console)),t===i.WARN&&console.warn&&(f=console.warn.bind(console));var d="["+t+"] "+this._ts()+" "+this.name,h="";if(1===o.length&&"string"==typeof o[0])f(h=d+" - "+o[0]);else if(1===o.length)h=d+" "+o[0],f(d,o[0]);else if("string"==typeof o[0]){var p=o.slice(1);1===p.length&&(p=p[0]),h=d+" - "+o[0]+" "+p,f(d+" - "+o[0],p)}else h=d+" "+o,f(d,o);try{for(var g=s(this._pluggables),y=g.next();!y.done;y=g.next()){var v=y.value,b={message:h,timestamp:Date.now()};v.pushLogs([b])}}catch(e){n={error:e}}finally{try{y&&!y.done&&(r=g.return)&&r.call(g)}finally{if(n)throw n.error}}}},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,u([i.INFO],e))},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,u([i.INFO],e))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,u([i.WARN],e))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,u([i.ERROR],e))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,u([i.DEBUG],e))},e.prototype.verbose=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,u([i.VERBOSE],e))},e.prototype.addPluggable=function(e){e&&e.getCategoryName()===o.YG&&(this._pluggables.push(e),e.configure(this._config))},e.prototype.listPluggables=function(){return this._pluggables},e.LOG_LEVEL=null,e}()},52674:function(e,t,n){"use strict";n.d(t,{_b:function(){return a},gi:function(){return s}});var r=n(25049),i=function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},o=new r.k("Parser"),s=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}return(e.aws_cognito_identity_pool_id||e.aws_user_pools_id)&&(n.Auth={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,signUpVerificationMethod:e.aws_cognito_sign_up_verification_method||"code"}),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:{},e.Logging&&(n.Logging=i(i({},e.Logging),{region:e.aws_project_region})),e.geo&&(n.Geo=Object.assign({},e.geo),e.geo.amazon_location_service&&(n.Geo={AmazonLocationService:e.geo.amazon_location_service})),n.Analytics=Object.assign({},n.Analytics,e.Analytics),n.Auth=Object.assign({},n.Auth,e.Auth),n.Storage=Object.assign({},t),n.Logging=Object.assign({},n.Logging,e.Logging),o.debug("parse config",e,"to amplifyconfig",n),n},a=function(){function e(){}return e.parseMobilehubConfig=s,e}()},15047:function(e,t,n){"use strict";n.d(t,{t4:function(){return i},Zm:function(){return o}});var r="aws-amplify/4.7.5",i={userAgent:r+" js",product:"",navigator:null,isReactNative:!1};"undefined"!=typeof navigator&&navigator.product&&((i.product=navigator.product||"",i.navigator=navigator||null,"ReactNative"===navigator.product)?(i.userAgent=r+" react-native",i.isReactNative=!0):(i.userAgent=r+" js",i.isReactNative=!1));var o=function(e){return""+i.userAgent+(e||"")}},3001:function(e,t,n){"use strict";n.d(t,{P:function(){return _}});var r=n(4540),i=n(31538),o=n(60680),s=n(24919),a=n(87219),u=n(15263),c=n(94232),l=n(22485),f=n(25049),d=n(15047),h=n(52674),p=n(2983),g=function(e,t,n,r){return new(n||(n=Prom
1ise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},y=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},v=function(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},b=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(v(arguments[t]));return e},m=new f.k("AWSCloudWatch"),_=function(){function e(e){this.configure(e),this._dataTracker={eventUploadInProgress:!1,logEvents:[]},this._currentLogBatch=[],this._initiateLogPushInterval()}return e.prototype.getProviderName=function(){return e.PROVIDER_NAME},e.prototype.getCategoryName=function(){return e.CATEGORY},e.prototype.getLogQueue=function(){return this._dataTracker.logEvents},e.prototype.configure=function(e){if(!e)return this._config||{};var t=Object.assign({},this._config,(0,h.gi)(e).Logging,e);return this._config=t,this._config},e.prototype.createLogGroup=function(e){return g(this,void 0,void 0,function(){var t,n;return y(this,function(i){switch(i.label){case 0:m.debug("creating new log group in CloudWatch - ",e.logGroupName),t=new r.K(e),i.label=1;case 1:return i.trys.push([1,4,,5]),[4,this._ensureCredentials()];case 2:if(!i.sent())throw Error(p.I6);return[4,this._initCloudWatchLogs().send(t)];case 3:return[2,i.sent()];case 4:throw n=i.sent(),m.error("error creating log group - "+n),n;case 5:return[2]}})})},e.prototype.getLogGroups=function(e){return g(this,void 0,void 0,function(){var t,n;return y(this,function(r){switch(r.label){case 0:m.debug("getting list of log groups"),t=new i.C(e),r.label=1;case 1:return r.trys.push([1,4,,5]),[4,this._ensureCredentials()];case 2:if(!r.sent())throw Error(p.I6);return[4,this._initCloudWatchLogs().send(t)];case 3:return[2,r.sent()];case 4:throw n=r.sent(),m.error("error getting log group - "+n),n;case 5:return[2]}})})},e.prototype.createLogStream=function(e){return g(this,void 0,void 0,function(){var t,n;return y(this,function(r){switch(r.label){case 0:m.debug("creating new log stream in CloudWatch - ",e.logStreamName),t=new o.N(e),r.label=1;case 1:return r.trys.push([1,4,,5]),[4,this._ensureCredentials()];case 2:if(!r.sent())throw Error(p.I6);return[4,this._initCloudWatchLogs().send(t)];case 3:return[2,r.sent()];case 4:throw n=r.sent(),m.error("error creating log stream - "+n),n;case 5:return[2]}})})},e.prototype.getLogStreams=function(e){return g(this,void 0,void 0,function(){var t,n;return y(this,function(r){switch(r.label){case 0:m.debug("getting list of log streams"),t=new s.z(e),r.label=1;case 1:return r.trys.push([1,4,,5]),[4,this._ensureCredentials()];case 2:if(!r.sent())throw Error(p.I6);return[4,this._initCloudWatchLogs().send(t)];case 3:return[2,r.sent()];case 4:throw n=r.sent(),m.error("error getting log stream - "+n),n;case 5:return[2]}})})},e.prototype.getLogEvents=function(e){return g(this,void 0,void 0,function(){var t,n;return y(this,function(r){switch(r.label){case 0:m.debug("getting log events from stream - ",e.logStreamName),t=new a.r(e),r.label=1;case 1:return r.trys.push([1,4,,5]),[4,this._ensureCredentials()];case 2:if(!r.sent())throw Error(p.I6);return[4,this._initCloudWatchLogs().send(t)];case 3:return[2,r.sent()];case 4:throw n=r.sent(),m.error("error getting log events - "+n),n;case 5:return[2]}})})},e.prototype.pushLogs=function(e){m.debug("pushing log events to Cloudwatch..."),this._dataTracker.logEvents=b(this._dataTracker.logEvents,e)},e.prototype._validateLogGroupExistsAndCreate=function(e){return g(this,void 0,void 0,function(){var t,n,r,i;return y(this,function(o){switch(o.label){case 0:if(this._dataTracker.verifiedLogGroup)return[2,this._dataTracker.verifiedLogGroup];o.label=1;case 1:return o.trys.push([1,5,,6]),[4,this._ensureCredentials()];case 2:if(!o.sent())throw Error(p.I6);return[4,this.getLogGroups({logGroupNamePrefix:e})];case 3:if("string"!=typeof(t=o.sent())&&t.logGroups&&(n=t.logGroups.filter(function(t){return t.logGroupName===e})).length>0)return this._dataTracker.verifiedLogGroup=n[0],[2,n[0]];return[4,this.createLogGroup({logGroupName:e})];case 4:return o.sent(),[2,null];case 5:throw i="failure during log group search: "+(r=o.sent()),m.error(i),r;case 6:return[2]}})})},e.prototype._validateLogStreamExists=function(e,t){return g(this,void 0,void 0,function(){var n,r,i,o;return y(this,function(s){switch(s.label){case 0:return s.trys.push([0,4,,5]),[4,this._ensureCredentials()];case 1:if(!s.sent())throw Error(p.I6);return[4,this.getLogStreams({logGroupName:e,logStreamNamePrefix:t})];case 2:if((n=s.sent()).logStreams&&(r=n.logStreams.filter(function(e){return e.logStreamName===t})).length>0)return this._nextSequenceToken=r[0].uploadSequenceToken,[2,r[0]];return[4,this.createLogStream({logGroupName:e,logStreamName:t})];case 3:return s.sent(),[2,null];case 4:throw o="failure during log stream search: "+(i=s.sent()),m.error(o),i;case 5:return[2]}})})},e.prototype._sendLogEvents=function(e){return g(this,void 0,void 0,function(){var t,n;return y(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),[4,this._ensureCredentials()];case 1:if(!r.sent())throw Error(p.I6);return m.debug("sending log events to stream - ",e.logStreamName),t=new u.v(e),[4,this._initCloudWatchLogs().send(t)];case 2:return[2,r.sent()];case 3:return n="failure during log push: "+r.sent(),m.error(n),[3,4];case 4:return[2]}})})},e.prototype._initCloudWatchLogs=function(){return new c.m({region:this._config.region,credentials:this._config.credentials,customUserAgent:(0,d.Zm)(),endpoint:this._config.endpoint})},e.prototype._ensureCredentials=function(){return g(this,void 0,void 0,function(){var e=this;return y(this,function(t){switch(t.label){case 0:return[4,l.cN.get().then(function(t){if(!t)return!1;var n=l.cN.shear(t);return m.debug("set credentials for logging",n),e._config.credentials=n,!0}).catch(function(e){return m.warn("ensure credentials error",e),!1})];case 1:return[2,t.sent()]}})})},e.prototype._getNextSequenceToken=function(){return g(this,void 0,void 0,function(){var e,t;return y(this,function(n){switch(n.label){case 0:if(this._nextSequenceToken&&this._nextSequenceToken.length>0)return[2,this._nextSequenceToken];n.label=1;
1case 1:return n.trys.push([1,4,,5]),[4,this._validateLogGroupExistsAndCreate(this._config.logGroupName)];case 2:return n.sent(),this._nextSequenceToken=void 0,[4,this._validateLogStreamExists(this._config.logGroupName,this._config.logStreamName)];case 3:return(e=n.sent())&&(this._nextSequenceToken=e.uploadSequenceToken),[2,this._nextSequenceToken];case 4:throw t=n.sent(),m.error("failure while getting next sequence token: "+t),t;case 5:return[2]}})})},e.prototype._safeUploadLogEvents=function(){return g(this,void 0,void 0,function(){var e,t,n,r,i;return y(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this._getNextSequenceToken()];case 1:return e=o.sent(),t=0===this._currentLogBatch.length?this._getBufferedBatchOfLogs():this._currentLogBatch,n={logGroupName:this._config.logGroupName,logStreamName:this._config.logStreamName,logEvents:t,sequenceToken:e},this._dataTracker.eventUploadInProgress=!0,[4,this._sendLogEvents(n)];case 2:return r=o.sent(),this._nextSequenceToken=r.nextSequenceToken,this._dataTracker.eventUploadInProgress=!1,this._currentLogBatch=[],[2,r];case 3:if(i=o.sent(),m.error("error during _safeUploadLogEvents: "+i),p.PZ.includes(i.name))this._getNewSequenceTokenAndSubmit({logEvents:this._currentLogBatch,logGroupName:this._config.logGroupName,logStreamName:this._config.logStreamName});else throw this._dataTracker.eventUploadInProgress=!1,i;return[3,4];case 4:return[2]}})})},e.prototype._getBufferedBatchOfLogs=function(){for(var e=0,t=0;e<this._dataTracker.logEvents.length;){var n=this._dataTracker.logEvents[e],r=n?new TextEncoder().encode(n.message).length+p.x7:0;if(r>p.HF){var i="Log entry exceeds maximum size for CloudWatch logs. Log size: "+r+". Truncating log message.";m.warn(i),n.message=n.message.substring(0,r)}if(t+r>p.CO)break;t+=r,e++}return this._currentLogBatch=this._dataTracker.logEvents.splice(0,e),this._currentLogBatch},e.prototype._getNewSequenceTokenAndSubmit=function(e){return g(this,void 0,void 0,function(){var t,n,r;return y(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),this._nextSequenceToken=void 0,this._dataTracker.eventUploadInProgress=!0,[4,this._getNextSequenceToken()];case 1:return t=i.sent(),e.sequenceToken=t,[4,this._sendLogEvents(e)];case 2:return n=i.sent(),this._dataTracker.eventUploadInProgress=!1,this._currentLogBatch=[],[2,n];case 3:throw r=i.sent(),m.error("error when retrying log submission with new sequence token: "+r),this._dataTracker.eventUploadInProgress=!1,r;case 4:return[2]}})})},e.prototype._initiateLogPushInterval=function(){var e=this;this._timer&&clearInterval(this._timer),this._timer=setInterval(function(){return g(e,void 0,void 0,function(){var e;return y(this,function(t){switch(t.label){case 0:if(t.trys.push([0,3,,4]),!this._getDocUploadPermissibility())return[3,2];return[4,this._safeUploadLogEvents()];case 1:t.sent(),t.label=2;case 2:return[3,4];case 3:return e=t.sent(),m.error("error when calling _safeUploadLogEvents in the timer interval - "+e),[3,4];case 4:return[2]}})})},2e3)},e.prototype._getDocUploadPermissibility=function(){return(0!==this._dataTracker.logEvents.length||0!==this._currentLogBatch.length)&&!this._dataTracker.eventUploadInProgress},e.PROVIDER_NAME=p.yB,e.CATEGORY=p.YG,e}()},90352:function(e,t,n){"use strict";n.d(t,{f:function(){return s}});var r=n(25049),i=n(96141),o=n(30587),s=function(){function e(){this._logger=new r.k("ServiceWorker")}return Object.defineProperty(e.prototype,"serviceWorker",{get:function(){return this._serviceWorker},enumerable:!0,configurable:!0}),e.prototype.register=function(e,t){var n=this;return void 0===e&&(e="/service-worker.js"),void 0===t&&(t="/"),this._logger.debug("registering "+e),this._logger.debug("registering service worker with scope "+t),new Promise(function(r,i){if(!(navigator&&"serviceWorker"in navigator))return i(Error("Service Worker not available"));navigator.serviceWorker.register(e,{scope:t}).then(function(e){return e.installing?n._serviceWorker=e.installing:e.waiting?n._serviceWorker=e.waiting:e.active&&(n._serviceWorker=e.active),n._registration=e,n._setupListeners(),n._logger.debug("Service Worker Registration Success: "+e),r(e)}).catch(function(e){return n._logger.debug("Service Worker Registration Failed "+e),i(e)})})},e.prototype.enablePush=function(e){var t=this;if(!this._registration)throw Error("Service Worker not registered");return this._publicKey=e,new Promise(function(n,r){if(!(0,i.lC)().isBrowser)return r(Error("Service Worker not available"));t._registration.pushManager.getSubscription().then(function(r){if(!r)return t._logger.debug("User is NOT subscribed to push"),t._registration.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:t._urlB64ToUint8Array(e)}).then(function(e){t._subscription=e,t._logger.debug("User subscribed: "+JSON.stringify(e)),n(e)}).catch(function(e){t._logger.error(e)});t._subscription=r,t._logger.debug("User is subscribed to push: "+JSON.stringify(r)),n(r)})})},e.prototype._urlB64ToUint8Array=function(e){for(var t="=".repeat((4-e.length%4)%4),n=(e+t).replace(/\-/g,"+").replace(/_/g,"/"),r=window.atob(n),i=new Uint8Array(r.length),o=0;o<r.length;++o)i[o]=r.charCodeAt(o);return i},e.prototype.send=function(e){this._serviceWorker&&this._serviceWorker.postMessage("object"==typeof e?JSON.stringify(e):e)},e.prototype._setupListeners=function(){var e=this;this._serviceWorker.addEventListener("statechange",function(t){var n=e._serviceWorker.state;e._logger.debug("ServiceWorker statechange: "+n),o.dQ.Analytics&&"function"==typeof o.dQ.Analytics.record&&o.dQ.Analytics.record({name:"ServiceWorker",attributes:{state:n}})}),this._serviceWorker.addEventListener("message",function(t){e._logger.debug("ServiceWorker message event: "+t)})},e}()},95436:function(e,t,n){"use strict";n.d(t,{E:function(){return w}});var r=n(25049),i=n(24951),o=n(11093),s=n(8452),a=n(80094),u=function(){return(u=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},c=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},l=new r.k("Signer"),f="AWS4-HMAC-SHA256",d=function(e,t){var n=new i.Sha256(e);return n.update(t),n.digestSync()},h=function(e){var t=new i.Sha256;return t.update(e||""),(0,o.N)(t.digestSync())},p=function(e){return Object.keys(e).map(function(e){return e.toLowerCase()}).sort().join(";")},g=function(e){var t,n,r=(0,s.parse)(e.url);return[e.method||"/",encodeURIComponent(r.pathname).replace(/%2F/gi,"/"),(t=r.query)&&0!==t.length?t.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("&"):"",(n=e.headers)&&0!==Object.keys(n).length?Object.keys(n).map(function(e){return{key:e.toLowerCase(),value:n[e]?
1n[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":"",p(e.headers),h(e.data)].join("\n")},y=function(e){var t=((0,s.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]}},v=function(e,t,n){return[e,t,n,"aws4_request"].join("/")},b=function(e,t,n,r){return[e,n,r,h(t)].join("\n")},m=function(e,t,n){l.debug(n);var r=d("AWS4"+e,t),i=d(r,n.region),o=d(i,n.service);return d(o,"aws4_request")},_=function(e,t){return(0,o.N)(d(e,t))},w=function(){function e(){}return e.sign=function(e,t,n){if(void 0===n&&(n=null),e.headers=e.headers||{},e.body&&!e.data)throw Error('The attribute "body" was found on the request object. Please use the attribute "data" instead.');var r=a.E.getDateWithClockOffset().toISOString().replace(/[:\-]|\.\d{3}/g,""),i=r.substr(0,8),o=(0,s.parse)(e.url);e.headers.host=o.host,e.headers["x-amz-date"]=r,t.session_token&&(e.headers["X-Amz-Security-Token"]=t.session_token);var u=g(e);l.debug(u);var c=n||y(e),d=v(i,c.region,c.service),h=b(f,u,r,d),w=_(m(t.secret_key,i,c),h),S=[f+" Credential="+t.access_key+"/"+d,"SignedHeaders="+p(e.headers),"Signature="+w].join(", ");return e.headers.Authorization=S,e},e.signUrl=function(e,t,n,r){var i="object"==typeof e?e.url:e,o="object"==typeof e?e.method:"GET",l="object"==typeof e?e.body:void 0,d=a.E.getDateWithClockOffset().toISOString().replace(/[:\-]|\.\d{3}/g,""),h=d.substr(0,8),p=(0,s.parse)(i,!0,!0),w=(p.search,c(p,["search"])),S={host:w.host},E=n||y({url:(0,s.format)(w)}),I=E.region,P=E.service,C=v(h,I,P),O=t.session_token&&"iotdevicegateway"!==P,A=u(u(u({"X-Amz-Algorithm":f,"X-Amz-Credential":[t.access_key,C].join("/"),"X-Amz-Date":d.substr(0,16)},O?{"X-Amz-Security-Token":""+t.session_token}:{}),r?{"X-Amz-Expires":""+r}:{}),{"X-Amz-SignedHeaders":Object.keys(S).join(",")}),k=b(f,g({method:o,url:(0,s.format)(u(u({},w),{query:u(u({},w.query),A)})),headers:S,data:l}),d,C),T=_(m(t.secret_key,h,{region:I,service:P}),k),N=u({"X-Amz-Signature":T},t.session_token&&{"X-Amz-Security-Token":t.session_token});return(0,s.format)({protocol:w.protocol,slashes:!0,hostname:w.hostname,port:w.port,pathname:w.pathname,query:u(u(u({},w.query),A),N)})},e}()},27406:function(e,t,n){"use strict";n.d(t,{c4:function(){return o}});var r={},i=function(){function e(){}return e.setItem=function(e,t){return r[e]=t,r[e]},e.getItem=function(e){return Object.prototype.hasOwnProperty.call(r,e)?r[e]:void 0},e.removeItem=function(e){return delete r[e]},e.clear=function(){return r={}},e}(),o=function(){function e(){try{this.storageWindow=window.localStorage,this.storageWindow.setItem("aws.amplify.test-ls",1),this.storageWindow.removeItem("aws.amplify.test-ls")}catch(e){this.storageWindow=i}}return e.prototype.getStorage=function(){return this.storageWindow},e}()},2468:function(e,t,n){"use strict";n.d(t,{N:function(){return o}});var r=n(66014),i=(0,n(96141).lC)().isBrowser,o=function(){function e(e){void 0===e&&(e={}),this.cookies=new r.Z,this.store=i?window.localStorage:Object.create(null),this.cookies=e.req?new r.Z(e.req.headers.cookie):new r.Z,Object.assign(this.store,this.cookies.getAll())}return Object.defineProperty(e.prototype,"length",{get:function(){return Object.entries(this.store).length},enumerable:!0,configurable:!0}),e.prototype.clear=function(){var e=this;Array.from(Array(this.length)).map(function(t,n){return e.key(n)}).forEach(function(t){return e.removeItem(t)})},e.prototype.getItem=function(e){return this.getLocalItem(e)},e.prototype.getLocalItem=function(e){return Object.prototype.hasOwnProperty.call(this.store,e)?this.store[e]:null},e.prototype.getUniversalItem=function(e){return this.cookies.get(e)},e.prototype.key=function(e){return Object.keys(this.store)[e]},e.prototype.removeItem=function(e){this.removeLocalItem(e),this.removeUniversalItem(e)},e.prototype.removeLocalItem=function(e){delete this.store[e]},e.prototype.removeUniversalItem=function(e){this.cookies.remove(e,{path:"/"})},e.prototype.setItem=function(e,t){switch(this.setLocalItem(e,t),e.split(".").pop()){case"LastAuthUser":case"accessToken":case"refreshToken":case"idToken":i?this.setUniversalItem(e,t):this.setLocalItem(e,t)}},e.prototype.setLocalItem=function(e,t){this.store[e]=t},e.prototype.setUniversalItem=function(e,t){this.cookies.set(e,t,{path:"/",sameSite:!0,secure:"localhost"!==window.location.hostname})},e}()},2983:function(e,t,n){"use strict";n.d(t,{CO:function(){return i},HF:function(){return o},I6:function(){return u},PZ:function(){return c},YG:function(){return s},x7:function(){return r},yB:function(){return a}});var r=26,i=1048576,o=256e3,s="Logging",a="AWSCloudWatch",u="No credentials",c=["ResourceNotFoundException","InvalidSequenceTokenException"]},80094:function(e,t,n){"use strict";n.d(t,{E:function(){return i}});var r=function(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},i={clockOffset:0,getDateWithClockOffset:function(){return i.clockOffset?new Date(new Date().getTime()+i.clockOffset):new Date},getClockOffset:function(){return i.clockOffset},getHeaderStringFromDate:function(e){return void 0===e&&(e=i.getDateWithClockOffset()),e.toISOString().replace(/[:\-]|\.\d{3}/g,"")},getDateFromHeaderString:function(e){var t=r(e.match(/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2}).+/),7),n=t[1],i=t[2],o=t[3],s=t[4],a=t[5],u=t[6];return new Date(Date.UTC(Number(n),Number(i)-1,Number(o),Number(s),Number(a),Number(u)))},isClockSkewed:function(e){return Math.abs(e.getTime()-i.getDateWithClockOffset().getTime())>=3e5},isClockSkewError:function(e){if(!e.response||!e.response.headers)return!1;var t=e.response.headers;return!!(["BadRequestException","InvalidSignatureException"].includes(t["x-amzn-errortype"])&&(t.date||t.Date))},setClockOffset:function(e){i.clockOffset=e}}},53150:function(e,t,n){"use strict";var r=n(96141),i=n(8941),o=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);
1if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},s=function(){function e(){}return e.prototype.networkMonitor=function(t){if((0,r.lC)().isNode)return i.Z.from([{online:!0}]);var n=(0,r.n2)()?self:window;return new i.Z(function(t){t.next({online:n.navigator.onLine});var r=function(){return t.next({online:!0})},i=function(){return t.next({online:!1})};return n.addEventListener("online",r),n.addEventListener("offline",i),e._observers.push(t),function(){n.removeEventListener("online",r),n.removeEventListener("offline",i),e._observers=e._observers.filter(function(e){return e!==t})}})},e._observerOverride=function(t){var n,r,i=function(n){if(n.closed)return e._observers=e._observers.filter(function(e){return e!==n}),"continue";n.next(t)};try{for(var s=o(e._observers),a=s.next();!a.done;a=s.next()){var u=a.value;i(u)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}},e._observers=[],e}();t.Z=s},58399:function(e,t,n){"use strict";n.d(t,{V2:function(){return l},XD:function(){return f},Xm:function(){return h},kD:function(){return d}});var r,i=n(25049),o=(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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},a=function(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},u=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(a(arguments[t]));return e},c=new i.k("Util"),l=function(e){function t(t){var n=e.call(this,t)||this;return n.nonRetryable=!0,n}return o(t,e),t}(Error);function f(e,t,n,r){var i,o,a,l;return void 0===r&&(r=1),i=this,o=void 0,a=void 0,l=function(){var i,o;return s(this,function(s){switch(s.label){case 0:if("function"!=typeof e)throw Error("functionToRetry must be a function");c.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,u(t))];case 2:case 5:return[2,s.sent()];case 3:var a;if(i=s.sent(),c.debug("error on "+e.name,i),(a=i)&&a.nonRetryable)throw c.debug(e.name+" non retryable error",i),i;if(o=n(r,t,i),c.debug(e.name+" retrying in "+o+" ms"),!(!1!==o))return[3,6];return[4,new Promise(function(e){return setTimeout(e,o)})];case 4:return s.sent(),[4,f(e,t,n,r+1)];case 6:throw i;case 7:return[3,8];case 8:return[2]}})},new(a||(a=Promise))(function(e,t){function n(e){try{s(l.next(e))}catch(e){t(e)}}function r(e){try{s(l.throw(e))}catch(e){t(e)}}function s(t){var i;t.done?e(t.value):((i=t.value)instanceof a?i:new a(function(e){e(i)})).then(n,r)}s((l=l.apply(i,o||[])).next())})}function d(e){return void 0===e&&(e=3e5),function(t){var n=100*Math.pow(2,t)+100*Math.random();return!(n>e)&&n}}var h=function(e,t,n){return void 0===n&&(n=3e5),f(e,t,d(n))}},81846:function(e,t,n){"use strict";n.d(t,{Mt:function(){return s},om:function(){return o},yL:function(){return i}});var r="undefined"!=typeof Symbol&&"function"==typeof Symbol.for,i=r?Symbol.for("INT
1ERNAL_AWS_APPSYNC_PUBSUB_PROVIDER"):"@@INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER",o=r?Symbol.for("INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER"):"@@INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER",s="x-amz-user-agent"},3908:function(e,t,n){"use strict";n.d(t,{gT:function(){return i}});var r=n(15047);n(63338),n(22485);var i={userAgent:r.t4.userAgent}},38282:function(e,t,n){"use strict";n.d(t,{KT:function(){return t4}});var r,i,o,s,a,u,c,l,f,d,h,p,g,y,v,b=n(3426),m=n(25049),_=n(96141),w=n(69276),S=n(30587),E=n(37260),I=n(69249),P=n(55462);n(63143);var C=n(8941),O=n(46375),A=n(74634),k=n(42734),T=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},N=function(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},x=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(N(arguments[t]));return e};function M(e){return"private"!==e.allow||e.provider?"public"!==e.allow||e.provider?e.provider:k.j6.API_KEY:k.j6.USER_POOLS}var R=function(){return[]},j=n(47279),U=function(){function e(){}return e.createPredicateBuilder=function(t){var n=t.name,r=new Set(Object.keys(t.fields)),i=new Proxy({},{get:function(t,i,o){if(!r.has(i))throw Error("Invalid field for model. field: "+i+", model: "+n);return function(t){return e.sortPredicateGroupsMap.get(o).push({field:i,sortDirection:t}),o}}});return e.sortPredicateGroupsMap.set(i,[]),i},e.isValidPredicate=function(t){return e.sortPredicateGroupsMap.has(t)},e.getPredicates=function(t,n){if(void 0===n&&(n=!0),n&&!e.isValidPredicate(t))throw Error("The predicate is not valid");return e.sortPredicateGroupsMap.get(t)},e.createFromExisting=function(t,n){if(n&&t)return n(e.createPredicateBuilder(t))},e.sortPredicateGroupsMap=new WeakMap,e}(),D=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>
10?(this._pending=!0,this._queue.shift()(this._dispatchNext.bind(this))):this._pending=!1},e}(),L=n(48617),F=n.n(L),B=n(64944),G=n(54792),q=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},z=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},W=function(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof K?K(e):e[Symbol.iterator](),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)})}}},K=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},H=function(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},Y=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(H(arguments[t]));return e},V=new m.k("DataStore"),Q="amplify-datastore",J=new(function(){function e(){this.dbName=Q}return e.prototype.checkPrivate=function(){return q(this,void 0,void 0,function(){return z(this,function(e){switch(e.label){case 0:return[4,(0,B.D0)().then(function(e){return e})];case 1:if(e.sent())return V.error("IndexedDB not supported in this browser's private mode"),[2,Promise.reject("IndexedDB not supported in this browser's private mode")];return[2,Promise.resolve()]}})})},e.prototype.getStorenameForModel=function(e){var t=this.namespaceResolver(e),n=e.name;return this.getStorename(t,n)},e.prototype.getStorename=function(e,t){return e+"_"+t},e.prototype.setUp=function(e,t,n,r,i){return q(this,void 0,void 0,function(){var o,s,a=this;return z(this,function(u){switch(u.label){case 0:return[4,this.checkPrivate()];case 1:if(u.sent(),this.initPromise)return[3,2];return this.initPromise=new Promise(function(e,t){a.resolve=e,a.reject=t}),[3,4];case 2:return[4,this.initPromise];case 3:u.sent(),u.label=4;case 4:i&&(this.dbName=Q+"-"+i),this.schema=e,this.namespaceResolver=t,this.modelInstanceCreator=n,this.getModelConstructorByModelName=r,u.label=5;case 5:if(u.trys.push([5,8,,9]),this.db)return[3,7];return o=this,[4,G.X3(this.dbName,2,{upgrade:function(t,n,r,i){return q(a,void 0,void 0,function(){var o,s,a,u,c,l,f,d,h,p,g,y=this;return z(this,function(v){switch(v.label){case 0:if(0===n)return Object.keys(e.namespaces).forEach(function(n){Object.keys(e.namespaces[n].models).forEac
1h(function(e){var r=y.getStorename(n,e);y.createObjectStoreForModel(t,n,r,e)})}),[2];if(!(1===n&&2===r))return[3,16];v.label=1;case 1:v.trys.push([1,14,,15]),v.label=2;case 2:v.trys.push([2,11,12,13]),s=(o=K(i.objectStoreNames)).next(),v.label=3;case 3:if(s.done)return[3,10];return a=s.value,u=i.objectStore(a),c="tmp_"+a,u.name=c,(l=t.createObjectStore(a,{keyPath:void 0,autoIncrement:!0})).createIndex("byId","id",{unique:!0}),[4,u.openCursor()];case 4:f=v.sent(),d=0,v.label=5;case 5:if(!(f&&f.value))return[3,8];return[4,l.put(f.value)];case 6:return v.sent(),[4,f.continue()];case 7:return f=v.sent(),d++,[3,5];case 8:t.deleteObjectStore(c),V.debug(d+" "+a+" records migrated"),v.label=9;case 9:return s=o.next(),[3,3];case 10:return[3,13];case 11:return p={error:v.sent()},[3,13];case 12:try{s&&!s.done&&(g=o.return)&&g.call(o)}finally{if(p)throw p.error}return[7];case 13:return Object.keys(e.namespaces).forEach(function(n){var r=e.namespaces[n],o=new Set(i.objectStoreNames);Object.keys(r.models).map(function(e){return[e,y.getStorename(n,e)]}).filter(function(e){var t=H(e,2)[1];return!o.has(t)}).forEach(function(e){var r=H(e,2),i=r[0],o=r[1];y.createObjectStoreForModel(t,n,o,i)})}),[3,15];case 14:throw h=v.sent(),V.error("Error migrating IndexedDB data",h),i.abort(),h;case 15:case 16:return[2]}})})}})];case 6:o.db=u.sent(),this.resolve(),u.label=7;case 7:return[3,9];case 8:return s=u.sent(),this.reject(s),[3,9];case 9:return[2]}})})},e.prototype._get=function(e,t){return q(this,void 0,void 0,function(){var n,r;return z(this,function(i){switch(i.label){case 0:return"string"==typeof e?(r=e,n=this.db.transaction(r,"readonly").store.index("byId")):n=e.index("byId"),[4,n.get(t)];case 1:return[2,i.sent()]}})})},e.prototype.save=function(e,t){var n,r;return q(this,void 0,void 0,function(){var i,o,s,a,u,c,l,f,d,h,p,g,y,v,b,m,_,w,S,E,I,P,C,O,A=this;return z(this,function(T){switch(T.label){case 0:return[4,this.checkPrivate()];case 1:return T.sent(),i=Object.getPrototypeOf(e).constructor,o=this.getStorenameForModel(i),s=(0,B.jl)(i.name,e,this.schema.namespaces[this.namespaceResolver(i)],this.modelInstanceCreator,this.getModelConstructorByModelName),a=this.namespaceResolver(i),u=new Set,c=Object.values(s).map(function(e){var t=e.modelName,n=e.item,r=e.instance,i=A.getStorename(a,t);return u.add(i),{storeName:i,item:n,instance:r}}),f=(l=this.db.transaction(Y([o],Array.from(u.values())),"readwrite")).objectStore(o),[4,this._get(f,e.id)];case 2:if(d=T.sent(),t&&d&&(p=(h=j.OY.getPredicates(t)).predicates,g=h.type,!(0,B.u8)(d,g,p)))throw y="Conditional update failed",V.error(y,{model:d,condition:p}),Error(y);v=[],T.label=3;case 3:T.trys.push([3,11,12,17]),b=W(c),T.label=4;case 4:return[4,b.next()];case 5:if((m=T.sent()).done)return[3,10];return w=(_=m.value).storeName,S=_.item,E=_.instance,I=l.objectStore(w),P=S.id,[4,this._get(I,P)];case 6:if(C=void 0===T.sent()?k.HP.INSERT:k.HP.UPDATE,!(P===e.id||C===k.HP.INSERT))return[3,9];return[4,I.index("byId").getKey(S.id)];case 7:return O=T.sent(),[4,I.put(S,O)];case 8:T.sent(),v.push([E,C]),T.label=9;case 9:return[3,4];case 10:return[3,17];case 11:return n={error:T.sent()},[3,17];case 12:if(T.trys.push([12,,15,16]),!(m&&!m.done&&(r=b.return)))return[3,14];return[4,r.call(b)];case 13:T.sent(),T.label=14;case 14:return[3,16];case 15:if(n)throw n.error;return[7];case 16:return[7];case 17:return[4,l.done];case 18:return T.sent(),[2,v]}})})},e.prototype.load=function(e,t,n){var r,i,o,s,a,u,c,l,f,d;return q(this,void 0,void 0,function(){var h,p,g,y,v,b,m,_,w,S,E,I,P,C,O,A,k=this;return z(this,function(T){switch(T.label){case 0:if(p=(h=this.schema.namespaces[e].relationships[t].relationTypes).map(function(t){var n=t.modelName;return k.getStorename(e,n)}),g=this.getModelConstructorByModelName(e,t),0===p.length)return[2,n.map(function(e){return k.modelInstanceCreator(g,e)})];y=this.db.transaction(Y(p),"readonly"),T.label=1;case 1:T.trys.push([1,34,35,40]),v=W(h),T.label=2;case 2:return[4,v.next()];case 3:if((b=T.sent()).done)return[3,33];switch(_=(m=b.value).fieldName,w=m.modelName,S=m.targetName,E=this.getStorename(e,w),I=y.objectStore(E),P=this.getModelConstructorByModelName(e,w),m.relationType){case"HAS_ONE":return[3,4];case"BELONGS_TO":return[3,17];case"HAS_MANY":return[3,30]}return[3,31];case 4:T.trys.push([4,10,11,16]),r=W(n),T.label=5;case 5:return[4,r.next()];case 6:if((i=T.sent()).done||(O=(C=i.value)[S]?S:_,!C[O]))return[3,9];
1return[4,this._get(I,C[O])];case 7:A=T.sent(),C[_]=A&&this.modelInstanceCreator(P,A),T.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return c={error:T.sent()},[3,16];case 11:if(T.trys.push([11,,14,15]),!(i&&!i.done&&(l=r.return)))return[3,13];return[4,l.call(r)];case 12:T.sent(),T.label=13;case 13:return[3,15];case 14:if(c)throw c.error;return[7];case 15:return[7];case 16:return[3,32];case 17:T.trys.push([17,23,24,29]),o=W(n),T.label=18;case 18:return[4,o.next()];case 19:if((s=T.sent()).done)return[3,22];if(!(C=s.value)[S])return[3,21];return[4,this._get(I,C[S])];case 20:A=T.sent(),C[_]=A&&this.modelInstanceCreator(P,A),delete C[S],T.label=21;case 21:return[3,18];case 22:return[3,29];case 23:return f={error:T.sent()},[3,29];case 24:if(T.trys.push([24,,27,28]),!(s&&!s.done&&(d=o.return)))return[3,26];return[4,d.call(o)];case 25:T.sent(),T.label=26;case 26:return[3,28];case 27:if(f)throw f.error;return[7];case 28:return[7];case 29:case 30:return[3,32];case 31:return(0,B.y0)(m.relationType),[3,32];case 32:return[3,2];case 33:return[3,40];case 34:return a={error:T.sent()},[3,40];case 35:if(T.trys.push([35,,38,39]),!(b&&!b.done&&(u=v.return)))return[3,37];return[4,u.call(v)];case 36:T.sent(),T.label=37;case 37:return[3,39];case 38:if(a)throw a.error;return[7];case 39:return[7];case 40:return[2,n.map(function(e){return k.modelInstanceCreator(g,e)})]}})})},e.prototype.query=function(e,t,n){return q(this,void 0,void 0,function(){var r,i,o,s,a,u,c,l=this;return z(this,function(f){switch(f.label){case 0:return[4,this.checkPrivate()];case 1:return f.sent(),r=this.getStorenameForModel(e),i=this.namespaceResolver(e),s=(o=t&&j.OY.getPredicates(t))&&this.idFromPredicate(o),a=n&&n.sort,u=n&&n.limit,[4,q(l,void 0,void 0,function(){var e,t,i;return z(this,function(c){switch(c.label){case 0:if(!s)return[3,2];return[4,this.getById(r,s)];case 1:return[2,(e=c.sent())?[e]:[]];case 2:if(!o)return[3,4];return[4,this.filterOnPredicate(r,o)];case 3:return t=c.sent(),[2,this.inMemoryPagination(t,n)];case 4:if(!a)return[3,6];return[4,this.getAll(r)];case 5:return i=c.sent(),[2,this.inMemoryPagination(i,n)];case 6:if(u)return[2,this.enginePagination(r,n)];return[2,this.getAll(r)]}})})];case 2:return c=f.sent(),[4,this.load(i,e.name,c)];case 3:return[2,f.sent()]}})})},e.prototype.getById=function(e,t){return q(this,void 0,void 0,function(){return z(this,function(n){switch(n.label){case 0:return[4,this._get(e,t)];case 1:return[2,n.sent()]}})})},e.prototype.getAll=function(e){return q(this,void 0,void 0,function(){return z(this,function(t){switch(t.label){case 0:return[4,this.db.getAll(e)];case 1:return[2,t.sent()]}})})},e.prototype.idFromPredicate=function(e){var t=e.predicates,n=1===t.length&&t.find(function(e){return(0,k.w5)(e)&&"id"===e.field&&"eq"===e.operator});return n&&n.operand},e.prototype.filterOnPredicate=function(e,t){return q(this,void 0,void 0,function(){var n,r,i;return z(this,function(o){switch(o.label){case 0:return n=t.predicates,r=t.type,[4,this.getAll(e)];case 1:return i=o.sent(),[2,n?i.filter(function(e){return(0,B.u8)(e,r,n)}):i]}})})},e.prototype.inMemoryPagination=function(e,t){if(t&&e.length>1){if(t.sort){var n=U.getPredicates(t.sort);if(n.length){var r=(0,B.z8)(n);e.sort(r)}}var i=t.page,o=t.limit,s=void 0===o?0:o,a=Math.max(0,(void 0===i?0:i)*s)||0,u=s>0?a+s:e.length;return e.slice(a,u)}return e},e.prototype.enginePagination=function(e,t){return q(this,void 0,void 0,function(){var n,r,i,o,s,a,u,c;return z(this,function(l){switch(l.label){case 0:if(!t)return[3,7];return s=Math.max(0,(void 0===(r=t.page)?0:r)*(o=void 0===(i=t.limit)?0:i))||0,[4,this.db.transaction(e).objectStore(e).openCursor()];case 1:if(!((a=l.sent())&&s>0))return[3,3];return[4,a.advance(s)];case 2:l.sent(),l.label=3;case 3:u=[],c="number"==typeof o&&o>0,l.label=4;case 4:if(!(a&&a.value)||(u.push(a.value),c&&u.length===o))return[3,6];return[4,a.continue()];case 5:return a=l.sent(),[3,4];case 6:return n=u,[3,9];case 7:return[4,this.db.getAll(e)];case 8:n=l.sent(),l.label=9;case 9:return[2,n]}})})},e.prototype.queryOne=function(e,t){return void 0===t&&(t=k.fI.FIRST),q(this,void 0,void 0,function(){var n,r,i;return z(this,function(o){switch(o.label){case 0:return[4,this.checkPrivate()];case 1:return o.sent(),n=this.getStorenameForModel(e),[4,this.db.transaction([n],"readonly").objectStore(n).openCursor(void 0,t===k.fI.FIRST?"next":"prev")];case 2:return[2,(i=(r=o.sent())?r.value:void 0)&&this.modelInstanceCreator(e,i)]}})})},e.prototype.delete=function(e,t){return q(this,void 0,void 0,function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,g,y;return z(this,function(v){switch(v.label){case 0:return[4,this.checkPrivate()];
1case 1:if(v.sent(),n=[],!(0,B.hK)(e))return[3,9];return r=e,i=this.namespaceResolver(r),o=this.getStorenameForModel(r),[4,this.query(r,t)];case 2:if(s=v.sent(),a=this.schema.namespaces[i].relationships[r.name].relationTypes,!(void 0!==t))return[3,5];return[4,this.deleteTraverse(a,s,r.name,i,n)];case 3:return v.sent(),[4,this.deleteItem(n)];case 4:return v.sent(),u=n.reduce(function(e,t){var n=t.items;return e.concat(n)},[]),[2,[s,u]];case 5:return[4,this.deleteTraverse(a,s,r.name,i,n)];case 6:return v.sent(),[4,this.db.transaction([o],"readwrite").objectStore(o).clear()];case 7:return v.sent(),u=n.reduce(function(e,t){var n=t.items;return e.concat(n)},[]),[2,[s,u]];case 8:return[3,17];case 9:if(r=Object.getPrototypeOf(c=e).constructor,i=this.namespaceResolver(r),o=this.getStorenameForModel(r),!t)return[3,13];return f=(l=this.db.transaction([o],"readwrite")).objectStore(o),[4,this._get(f,c.id)];case 10:if(void 0===(d=v.sent()))return h="Model instance not found in storage",V.warn(h,{model:c}),[2,[[c],[]]];if(g=(p=j.OY.getPredicates(t)).predicates,y=p.type,!(0,B.u8)(d,y,g))throw h="Conditional update failed",V.error(h,{model:d,condition:g}),Error(h);return[4,l.done];case 11:return v.sent(),a=this.schema.namespaces[i].relationships[r.name].relationTypes,[4,this.deleteTraverse(a,[c],r.name,i,n)];case 12:return v.sent(),[3,15];case 13:return a=this.schema.namespaces[i].relationships[r.name].relationTypes,[4,this.deleteTraverse(a,[c],r.name,i,n)];case 14:v.sent(),v.label=15;case 15:return[4,this.deleteItem(n)];case 16:return v.sent(),u=n.reduce(function(e,t){var n=t.items;return e.concat(n)},[]),[2,[[c],u]];case 17:return[2]}})})},e.prototype.deleteItem=function(e){var t,n,r,i,o,s;return q(this,void 0,void 0,function(){var a,u,c,l,f,d,h,p,g,y;return z(this,function(v){switch(v.label){case 0:a=e.map(function(e){return e.storeName}),u=this.db.transaction(Y(a),"readwrite"),v.label=1;case 1:v.trys.push([1,22,23,28]),t=W(e),v.label=2;case 2:return[4,t.next()];case 3:if((n=v.sent()).done)return[3,21];l=(c=n.value).storeName,f=c.items,d=u.objectStore(l),v.label=4;case 4:v.trys.push([4,14,15,20]),h=W(f),v.label=5;case 5:return[4,h.next()];case 6:if((p=v.sent()).done)return[3,13];if(!(g=p.value))return[3,12];if(y=void 0,"object"!=typeof g)return[3,8];return[4,d.index("byId").getKey(g.id)];case 7:return y=v.sent(),[3,10];case 8:return[4,d.index("byId").getKey(g.toString())];case 9:y=v.sent(),v.label=10;case 10:if(!(void 0!==y))return[3,12];return[4,d.delete(y)];case 11:v.sent(),v.label=12;case 12:return[3,5];case 13:return[3,20];case 14:return o={error:v.sent()},[3,20];case 15:if(v.trys.push([15,,18,19]),!(p&&!p.done&&(s=h.return)))return[3,17];return[4,s.call(h)];case 16:v.sent(),v.label=17;case 17:return[3,19];case 18:if(o)throw o.error;return[7];case 19:return[7];case 20:return[3,2];case 21:return[3,28];case 22:return r={error:v.sent()},[3,28];case 23:if(v.trys.push([23,,26,27]),!(n&&!n.done&&(i=t.return)))return[3,25];return[4,i.call(t)];case 24:v.sent(),v.label=25;case 25:return[3,27];case 26:if(r)throw r.error;return[7];case 27:return[7];case 28:return[2]}})})},e.prototype.deleteTraverse=function(e,t,n,r,i){var o,s,a,u,c,l,f,d,h,p,g,y;return q(this,void 0,void 0,function(){var v,b,m,_,w,S,E,I,P,C,O,A=this;return z(this,function(k){switch(k.label){case 0:k.trys.push([0,35,36,41]),o=W(e),k.label=1;case 1:return[4,o.next()];case 2:if((s=k.sent()).done)return[3,34];switch(b=(v=s.value).relationType,v.fieldName,m=v.modelName,_=v.targetName,w=this.getStorename(r,m),S=(0,B.rw)(this.schema.namespaces[r].relationships[m].relationTypes,n)||(0,B.NA)(this.schema.namespaces[r].relationships[m].indexes,v.associatedWith),b){case"HAS_ONE":return[3,3];case"HAS_MANY":return[3,17];case"BELONGS_TO":return[3,31]}return[3,32];case 3:k.trys.push([3,10,11,16]),a=W(t),k.label=4;case 4:return[4,a.next()];case 5:if((u=k.sent()).done||(E=u.value,I=S||"byId",!(P=_ in E?E[_]:E.id)))return[3,9];return[4,this.db.transaction(w,"readwrite").objectStore(w).index(I).get(P)];case 6:return C=k.sent(),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[m].relationTypes,C?[C]:[],m,r,i)];case 7:k.sent(),k.label=8;case 8:return[3,4];
1case 9:return[3,16];case 10:return h={error:k.sent()},[3,16];case 11:if(k.trys.push([11,,14,15]),!(u&&!u.done&&(p=a.return)))return[3,13];return[4,p.call(a)];case 12:k.sent(),k.label=13;case 13:return[3,15];case 14:if(h)throw h.error;return[7];case 15:return[7];case 16:return[3,33];case 17:k.trys.push([17,24,25,30]),c=W(t),k.label=18;case 18:return[4,c.next()];case 19:if((l=k.sent()).done)return[3,23];return E=l.value,[4,this.db.transaction(w,"readwrite").objectStore(w).index(S).getAll(E.id)];case 20:return O=k.sent(),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[m].relationTypes,O,m,r,i)];case 21:k.sent(),k.label=22;case 22:return[3,18];case 23:return[3,30];case 24:return g={error:k.sent()},[3,30];case 25:if(k.trys.push([25,,28,29]),!(l&&!l.done&&(y=c.return)))return[3,27];return[4,y.call(c)];case 26:k.sent(),k.label=27;case 27:return[3,29];case 28:if(g)throw g.error;return[7];case 29:return[7];case 30:case 31:return[3,33];case 32:return(0,B.y0)(b),[3,33];case 33:return[3,1];case 34:return[3,41];case 35:return f={error:k.sent()},[3,41];case 36:if(k.trys.push([36,,39,40]),!(s&&!s.done&&(d=o.return)))return[3,38];return[4,d.call(o)];case 37:k.sent(),k.label=38;case 38:return[3,40];case 39:if(f)throw f.error;return[7];case 40:return[7];case 41:return i.push({storeName:this.getStorename(r,n),items:t.map(function(e){return A.modelInstanceCreator(A.getModelConstructorByModelName(r,n),e)})}),[2]}})})},e.prototype.clear=function(){var e;return q(this,void 0,void 0,function(){return z(this,function(t){switch(t.label){case 0:return[4,this.checkPrivate()];case 1:return t.sent(),null===(e=this.db)||void 0===e||e.close(),[4,G.Lj(this.dbName)];case 2:return t.sent(),this.db=void 0,this.initPromise=void 0,[2]}})})},e.prototype.batchSave=function(e,t){return q(this,void 0,void 0,function(){var n,r,i,o,s,a,u,c,l,f,d;return z(this,function(h){switch(h.label){case 0:if(0===t.length)return[2,[]];return[4,this.checkPrivate()];case 1:h.sent(),n=[],r=this.getStorenameForModel(e),o=(i=this.db.transaction(r,"readwrite")).store,s=function(t){var r,i,s,u,c;return z(this,function(l){switch(l.label){case 0:return r=(0,B.jl)(e.name,a.modelInstanceCreator(e,t),a.schema.namespaces[a.namespaceResolver(e)],a.modelInstanceCreator,a.getModelConstructorByModelName),i=t.id,s=t._deleted,[4,o.index("byId").getKey(i)];case 1:if(u=l.sent(),s)return[3,3];return c=r.find(function(e){return e.instance.id===i}).instance,n.push([c,u?k.HP.UPDATE:k.HP.INSERT]),[4,o.put(c,u)];case 2:return l.sent(),[3,5];case 3:if(n.push([t,k.HP.DELETE]),!u)return[3,5];return[4,o.delete(u)];case 4:l.sent(),l.label=5;case 5:return[2]}})},a=this,h.label=2;case 2:h.trys.push([2,7,8,9]),c=(u=K(t)).next(),h.label=3;case 3:if(c.done)return[3,6];return l=c.value,[5,s(l)];case 4:h.sent(),h.label=5;case 5:return c=u.next(),[3,3];case 6:return[3,9];case 7:return f={error:h.sent()},[3,9];case 8:try{c&&!c.done&&(d=u.return)&&d.call(u)}finally{if(f)throw f.error}return[7];case 9:return[4,i.done];case 10:return h.sent(),[2,n]}})})},e.prototype.createObjectStoreForModel=function(e,t,n,r){return q(this,void 0,void 0,function(){var i;return z(this,function(o){return i=e.createObjectStore(n,{autoIncrement:!0}),this.schema.namespaces[t].relationships[r].indexes.forEach(function(e){return i.createIndex(e,e)}),i.createIndex("byId","id",{unique:!0}),[2]})})},e}()),Z=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},X=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},$=function(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},ee=function(){var e=this;this.db=new Map,this.getAllKeys=function(){return Z(e,void 0,void 0,function(){return X(this,function(e){return[2,Array.from(this.db.keys())]})})},this.multiGet=function(t){return Z(e,void 0,void 0,function(){var e=this;return X(this,function(n){return[2,t.reduce(function(t,n){return t.push([n,e.db.get(n)]),t},[])]})})},this.multiRemove=function(t,n){return Z(e,void 0,void 0,function(){var e=this;return X(this,function(r){return t.forEach(function(t){return e.db.delete(t)}),"function"==typeof n&&n(),[2]})})},this.multiSet=function(t,n){return Z(e,void 0,void 0,function(){var e=this;return X(this,function(r){return t.forEach(function(t){var n=$(t,2),r=n[0],i=n[1];e.setItem(r,i)}),"function"==typeof n&&n(),[2]})})},this.setItem=function(t,n){return Z(e,void 0,void 0,function(){return X(this,function(e){return[2,this.db.set(t,n)]})})},this.removeItem=function(t){return Z(e,void 0,void 0,function(){return X(this,function(e){return[2,this.db.delete(t)]})})},this.getItem=function(t){return Z(e,void 0,void 0,function(){return X(this,function(e){return[2,this.db.get(t)]})})}}
1,et=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},en=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},er=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ei=function(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},eo="@AmplifyDatastore",es="Data",ea=new Map,eu=function(){function e(){this._collectionInMemoryIndex=new Map,this.storage=new ee}return e.prototype.getCollectionIndex=function(e){return this._collectionInMemoryIndex.has(e)||this._collectionInMemoryIndex.set(e,new Map),this._collectionInMemoryIndex.get(e)},e.prototype.getMonotonicFactory=function(e){return ea.has(e)||ea.set(e,(0,B.c6)()),ea.get(e)},e.prototype.init=function(){return et(this,void 0,void 0,function(){var e,t,n,r,i,o,s,a,u,c,l,f,d,h,p,g,y,v,b;return en(this,function(m){switch(m.label){case 0:return this._collectionInMemoryIndex.clear(),[4,this.storage.getAllKeys()];case 1:e=m.sent(),t=[],m.label=2;case 2:m.trys.push([2,12,13,14]),r=(n=er(e)).next(),m.label=3;case 3:if(r.done)return[3,11];if(s=(o=ei((i=r.value).split("::"),5))[0],a=o[1],u=o[2],c=o[3],l=o[4],s!==eo)return[3,10];if(u!==es)return[3,9];if(f=void 0,void 0!==l)return[3,7];return d=c,h=this.getMonotonicFactory(a)(),p=this.getLegacyKeyForItem(a,d),g=this.getKeyForItem(a,d,h),[4,this.storage.getItem(p)];case 4:return y=m.sent(),[4,this.storage.setItem(g,y)];case 5:return m.sent(),[4,this.storage.removeItem(p)];case 6:return m.sent(),f=h,[3,8];case 7:f=c,m.label=8;case 8:return this.getCollectionIndex(a).set(l,f),[3,10];case 9:"Collection"===u&&t.push(i),m.label=10;case 10:return r=n.next(),[3,3];case 11:return[3,14];case 12:return v={error:m.sent()},[3,14];case 13:try{r&&!r.done&&(b=n.return)&&b.call(n)}finally{if(v)throw v.error}return[7];case 14:if(!(t.length>0))return[3,16];return[4,this.storage.multiRemove(t)];case 15:m.sent(),m.label=16;case 16:return[2]}})})},e.prototype.save=function(e,t){return et(this,void 0,void 0,function(){var n,r;return en(this,function(i){switch(i.label){case 0:return n=this.getCollectionIndex(t).get(e.id)||this.getMonotonicFactory(t)(),r=this.getKeyForItem(t,e.id,n),this.getCollectionIndex(t).set(e.id,n),[4,this.storage.setItem(r,JSON.stringify(e))];case 1:return i.sent(),[2]}})})},e.prototype.batchSave=function(e,t){return et(this,void 0,void 0,function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,g,y,v,b,m,_,w,S=this;return en(this,function(E){switch(E.label){case 0:if(0===t.length)return[2,[]];n=[],r=this.getCollectionIndex(e),i=new Set,o=new Set,s=[],a={};try{for(c=(u=er(t)).next();!c.done;c=u.next())f=(l=c.value).id,d=l._deleted,h=r.get(f)||this.getMonotonicFactory(e)(),p=this.getKeyForItem(e,f,h),s.push(p),a[p]={ulid:h,model:l},d?i.add(p):o.add(p)}catch(e){b={error:e}}finally{try{c&&!c.done&&(m=u.return)&&m.call(u)}finally{if(b)throw b.error}}return[4,this.storage.multiGet(s)];
1case 1:return g=E.sent().filter(function(e){return!!ei(e,2)[1]}).reduce(function(e,t){var n=ei(t,1)[0];return e.add(n)},new Set),[4,new Promise(function(e,t){if(0===i.size){e();return}var n=Array.from(i);n.forEach(function(e){return r.delete(a[e].model.id)}),S.storage.multiRemove(n,function(n){n&&n.length>0?t(n):e()})})];case 2:return E.sent(),[4,new Promise(function(e,t){if(0===o.size){e();return}var n=Array.from(o).map(function(e){return[e,JSON.stringify(a[e].model)]});o.forEach(function(e){var t=a[e],n=t.model.id,i=t.ulid;r.set(n,i)}),S.storage.multiSet(n,function(n){n&&n.length>0?t(n):e()})})];case 3:E.sent();try{for(v=(y=er(s)).next();!v.done;v=y.next())p=v.value,i.has(p)&&g.has(p)?n.push([a[p].model,k.HP.DELETE]):o.has(p)&&n.push([a[p].model,g.has(p)?k.HP.UPDATE:k.HP.INSERT])}catch(e){_={error:e}}finally{try{v&&!v.done&&(w=y.return)&&w.call(y)}finally{if(_)throw _.error}}return[2,n]}})})},e.prototype.get=function(e,t){return et(this,void 0,void 0,function(){var n,r,i;return en(this,function(o){switch(o.label){case 0:return n=this.getCollectionIndex(t).get(e),r=this.getKeyForItem(t,e,n),[4,this.storage.getItem(r)];case 1:return[2,(i=o.sent())&&JSON.parse(i)]}})})},e.prototype.getOne=function(e,t){return et(this,void 0,void 0,function(){var n,r,i,o,s,a,u;return en(this,function(c){switch(c.label){case 0:if(n=this.getCollectionIndex(t),i=(r=ei(e===k.fI.FIRST?function(){try{for(var e,t,r,i,o,s=er(n),a=s.next();!a.done;a=s.next()){i=(r=ei(a.value,2))[0],o=r[1];break}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return[i,o]}():function(){try{for(var e,t,r,i,o,s=er(n),a=s.next();!a.done;a=s.next())i=(r=ei(a.value,2))[0],o=r[1]}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return[i,o]}(),2))[0],o=r[1],!(u=s=this.getKeyForItem(t,i,o)))return[3,2];return[4,this.storage.getItem(s)];case 1:u=c.sent(),c.label=2;case 2:return[2,(a=u)&&JSON.parse(a)||void 0]}})})},e.prototype.getAll=function(e,t){return et(this,void 0,void 0,function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,g,y,v;return en(this,function(b){switch(b.label){case 0:n=this.getCollectionIndex(e),a=Math.max(0,(void 0===(i=(r=t||{}).page)?0:i)*(s=void 0===(o=r.limit)?0:o))||0,u=s>0?a+s:void 0,c=[],l=0;try{for(d=(f=er(n)).next();!d.done&&(p=(h=ei(d.value,2))[0],g=h[1],++l<=a||(c.push(this.getKeyForItem(e,p,g)),l!==u));d=f.next());}catch(e){y={error:e}}finally{try{d&&!d.done&&(v=f.return)&&v.call(f)}finally{if(y)throw y.error}}return[4,this.storage.multiGet(c)];case 1:return[2,b.sent().filter(function(e){return ei(e,2)[1]}).map(function(e){return JSON.parse(ei(e,2)[1])})]}})})},e.prototype.delete=function(e,t){return et(this,void 0,void 0,function(){var n,r;return en(this,function(i){switch(i.label){case 0:return n=this.getCollectionIndex(t).get(e),r=this.getKeyForItem(t,e,n),this.getCollectionIndex(t).delete(e),[4,this.storage.removeItem(r)];case 1:return i.sent(),[2]}})})},e.prototype.clear=function(){return et(this,void 0,void 0,function(){var e;return en(this,function(t){switch(t.label){case 0:return[4,this.storage.getAllKeys()];case 1:return e=t.sent().filter(function(e){return e.startsWith(eo)}),[4,this.storage.multiRemove(e)];case 2:return t.sent(),this._collectionInMemoryIndex.clear(),[2]}})})},e.prototype.getKeyForItem=function(e,t,n){return this.getKeyPrefixForStoreItems(e)+"::"+n+"::"+t},e.prototype.getLegacyKeyForItem=function(e,t){return this.getKeyPrefixForStoreItems(e)+"::"+t},e.prototype.getKeyPrefixForStoreItems=function(e){return eo+"::"+e+"::"+es},e}(),ec=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},el=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;
1function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},ef=function(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof ed?ed(e):e[Symbol.iterator](),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)})}}},ed=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},eh=new m.k("DataStore"),ep=new(function(){function e(){}return e.prototype.getStorenameForModel=function(e){var t=this.namespaceResolver(e),n=e.name;return this.getStorename(t,n)},e.prototype.getStorename=function(e,t){return e+"_"+t},e.prototype.setUp=function(e,t,n,r){return ec(this,void 0,void 0,function(){var i,o=this;return el(this,function(s){switch(s.label){case 0:if(this.initPromise)return[3,1];return this.initPromise=new Promise(function(e,t){o.resolve=e,o.reject=t}),[3,3];case 1:return[4,this.initPromise];case 2:return s.sent(),[2];case 3:this.schema=e,this.namespaceResolver=t,this.modelInstanceCreator=n,this.getModelConstructorByModelName=r,s.label=4;case 4:if(s.trys.push([4,7,,8]),this.db)return[3,6];return this.db=new eu,[4,this.db.init()];case 5:s.sent(),this.resolve(),s.label=6;case 6:return[3,8];case 7:return i=s.sent(),this.reject(i),[3,8];case 8:return[2]}})})},e.prototype.save=function(e,t){var n,r;return ec(this,void 0,void 0,function(){var i,o,s,a,u,c,l,f,d,h,p,g,y,v,b,m,_,w,S,E,I=this;return el(this,function(P){switch(P.label){case 0:return i=Object.getPrototypeOf(e).constructor,o=this.getStorenameForModel(i),s=(0,B.jl)(i.name,e,this.schema.namespaces[this.namespaceResolver(i)],this.modelInstanceCreator,this.getModelConstructorByModelName),a=this.namespaceResolver(i),u=new Set,c=Object.values(s).map(function(e){var t=e.modelName,n=e.item,r=e.instance,i=I.getStorename(a,t);return u.add(i),{storeName:i,item:n,instance:r}}),[4,this.db.get(e.id,o)];case 1:if(l=P.sent(),t&&l&&(d=(f=j.OY.getPredicates(t)).predicates,h=f.type,!(0,B.u8)(l,h,d)))throw p="Conditional update failed",eh.error(p,{model:l,condition:d}),Error(p);g=[],P.label=2;case 2:P.trys.push([2,9,10,15]),y=ef(c),P.label=3;case 3:return[4,y.next()];case 4:if((v=P.sent()).done)return[3,8];return m=(b=v.value).storeName,_=b.item,w=b.instance,S=_.id,[4,this.db.get(S,m)];case 5:if(E=P.sent()?k.HP.UPDATE:k.HP.INSERT,!(S===e.id||E===k.HP.INSERT))return[3,7];return[4,this.db.save(_,m)];case 6:P.sent(),g.push([w,E]),P.label=7;case 7:return[3,3];case 8:return[3,15];case 9:return n={error:P.sent()},[3,15];case 10:if(P.trys.push([10,,13,14]),!(v&&!v.done&&(r=y.return)))return[3,12];return[4,r.call(y)];case 11:P.sent(),P.label=12;case 12:return[3,14];case 13:if(n)throw n.error;return[7];case 14:return[7];case 15:return[2,g]}})})},e.prototype.load=function(e,t,n){var r,i,o,s,a,u,c,l,f,d;return ec(this,void 0,void 0,function(){var h,p,g,y,v,b,m,_,w,S,E,I,P,C,O,A=this;return el(this,function(k){switch(k.label){case 0:if(p=(h=this.schema.namespaces[e].relationships[t].relationTypes).map(function(t){var n=t.modelName;return A.getStorename(e,n)}),g=this.getModelConstructorByModelName(e,t),0===p.length)return[2,n.map(function(e){return A.modelInstanceCreator(g,e)})];k.label=1;case 1:k.trys.push([1,34,35,40]),y=ef(h),k.label=2;case 2:return[4,y.next()];case 3:if((v=k.sent()).done)return[3,33];switch(m=(b=v.value).fieldName,_=b.modelName,w=b.targetName,S=b.relationType,E=this.getStorename(e,_),I=this.getModelConstructorByModelName(e,_),S){case"HAS_ONE":return[3,4];case"BELONGS_TO":return[3,17];case"HAS_MANY":return[3,30]}return[3,31];case 4:k.trys.push([4,10,11,16]),r=ef(n),k.label=5;case 5:return[4,r.next()];case 6:if((i=k.sent()).done||(C=(P=i.value)[w]?w:m,!P[C]))return[3,9];return[4,this.db.get(P[C],E)];case 7:O=k.sent(),P[m]=O&&this.modelInstanceCreator(I,O),k.label=8;case 8:return[3,5];
1case 9:return[3,16];case 10:return c={error:k.sent()},[3,16];case 11:if(k.trys.push([11,,14,15]),!(i&&!i.done&&(l=r.return)))return[3,13];return[4,l.call(r)];case 12:k.sent(),k.label=13;case 13:return[3,15];case 14:if(c)throw c.error;return[7];case 15:return[7];case 16:return[3,32];case 17:k.trys.push([17,23,24,29]),o=ef(n),k.label=18;case 18:return[4,o.next()];case 19:if((s=k.sent()).done)return[3,22];if(!(P=s.value)[w])return[3,21];return[4,this.db.get(P[w],E)];case 20:O=k.sent(),P[m]=O&&this.modelInstanceCreator(I,O),delete P[w],k.label=21;case 21:return[3,18];case 22:return[3,29];case 23:return f={error:k.sent()},[3,29];case 24:if(k.trys.push([24,,27,28]),!(s&&!s.done&&(d=o.return)))return[3,26];return[4,d.call(o)];case 25:k.sent(),k.label=26;case 26:return[3,28];case 27:if(f)throw f.error;return[7];case 28:return[7];case 29:case 30:return[3,32];case 31:return(0,B.y0)(S),[3,32];case 32:return[3,2];case 33:return[3,40];case 34:return a={error:k.sent()},[3,40];case 35:if(k.trys.push([35,,38,39]),!(v&&!v.done&&(u=y.return)))return[3,37];return[4,u.call(y)];case 36:k.sent(),k.label=37;case 37:return[3,39];case 38:if(a)throw a.error;return[7];case 39:return[7];case 40:return[2,n.map(function(e){return A.modelInstanceCreator(g,e)})]}})})},e.prototype.query=function(e,t,n){return ec(this,void 0,void 0,function(){var r,i,o,s,a,u,c,l=this;return el(this,function(f){switch(f.label){case 0:return r=this.getStorenameForModel(e),i=this.namespaceResolver(e),s=(o=t&&j.OY.getPredicates(t))&&this.idFromPredicate(o),a=n&&n.sort,u=n&&n.limit,[4,ec(l,void 0,void 0,function(){var e,t,i;return el(this,function(c){switch(c.label){case 0:if(!s)return[3,2];return[4,this.getById(r,s)];case 1:return[2,(e=c.sent())?[e]:[]];case 2:if(!o)return[3,4];return[4,this.filterOnPredicate(r,o)];case 3:return t=c.sent(),[2,this.inMemoryPagination(t,n)];case 4:if(!(a||u))return[3,6];return[4,this.getAll(r)];case 5:return i=c.sent(),[2,this.inMemoryPagination(i,n)];case 6:return[2,this.getAll(r)]}})})];case 1:return c=f.sent(),[4,this.load(i,e.name,c)];case 2:return[2,f.sent()]}})})},e.prototype.getById=function(e,t){return ec(this,void 0,void 0,function(){return el(this,function(n){switch(n.label){case 0:return[4,this.db.get(t,e)];case 1:return[2,n.sent()]}})})},e.prototype.getAll=function(e){return ec(this,void 0,void 0,function(){return el(this,function(t){switch(t.label){case 0:return[4,this.db.getAll(e)];case 1:return[2,t.sent()]}})})},e.prototype.idFromPredicate=function(e){var t=e.predicates,n=1===t.length&&t.find(function(e){return(0,k.w5)(e)&&"id"===e.field&&"eq"===e.operator});return n&&n.operand},e.prototype.filterOnPredicate=function(e,t){return ec(this,void 0,void 0,function(){var n,r,i;return el(this,function(o){switch(o.label){case 0:return n=t.predicates,r=t.type,[4,this.getAll(e)];case 1:return i=o.sent(),[2,n?i.filter(function(e){return(0,B.u8)(e,r,n)}):i]}})})},e.prototype.inMemoryPagination=function(e,t){if(t&&e.length>1){if(t.sort){var n=U.getPredicates(t.sort);if(n.length){var r=(0,B.z8)(n);e.sort(r)}}var i=t.page,o=t.limit,s=void 0===o?0:o,a=Math.max(0,(void 0===i?0:i)*s)||0,u=s>0?a+s:e.length;return e.slice(a,u)}return e},e.prototype.queryOne=function(e,t){return void 0===t&&(t=k.fI.FIRST),ec(this,void 0,void 0,function(){var n,r;return el(this,function(i){switch(i.label){case 0:return n=this.getStorenameForModel(e),[4,this.db.getOne(t,n)];case 1:return[2,(r=i.sent())&&this.modelInstanceCreator(e,r)]}})})},e.prototype.delete=function(e,t){return ec(this,void 0,void 0,function(){var n,r,i,o,s,a,u,c,l,f,d,h,p;return el(this,function(g){switch(g.label){case 0:if(n=[],!(0,B.hK)(e))return[3,8];return r=e,i=this.namespaceResolver(r),[4,this.query(r,t)];case 1:if(o=g.sent(),s=this.schema.namespaces[i].relationships[r.name].relationTypes,!(void 0!==t))return[3,4];return[4,this.deleteTraverse(s,o,r.name,i,n)];case 2:case 5:return g.sent(),[4,this.deleteItem(n)];case 3:return g.sent(),a=n.reduce(function(e,t){var n=t.items;return e.concat(n)},[]),[2,[o,a]];case 4:return[4,this.deleteTraverse(s,o,r.name,i,n)];case 6:return g.sent(),a=n.reduce(function(e,t){var n=t.items;return e.concat(n)},[]),[2,[o,a]];case 7:return[3,15];case 8:if(r=Object.getPrototypeOf(u=e).constructor,i=this.namespaceResolver(r),c=this.getStorenameForModel(r),!t)return[3,11];return[4,this.db.get(u.id,c)];case 9:if(void 0===(l=g.sent()))return f="Model instance not found in storage",eh.warn(f,{model:u}),[2,[[u],[]]];if(h=(d=j.OY.getPredicates(t)).predicates,p=d.type,!(0,B.u8)(l,p,h))throw f
1="Conditional update failed",eh.error(f,{model:l,condition:h}),Error(f);return s=this.schema.namespaces[i].relationships[r.name].relationTypes,[4,this.deleteTraverse(s,[u],r.name,i,n)];case 10:return g.sent(),[3,13];case 11:return s=this.schema.namespaces[i].relationships[r.name].relationTypes,[4,this.deleteTraverse(s,[u],r.name,i,n)];case 12:g.sent(),g.label=13;case 13:return[4,this.deleteItem(n)];case 14:return g.sent(),a=n.reduce(function(e,t){var n=t.items;return e.concat(n)},[]),[2,[[u],a]];case 15:return[2]}})})},e.prototype.deleteItem=function(e){var t,n,r,i,o,s;return ec(this,void 0,void 0,function(){var a,u,c,l,f,d,h;return el(this,function(p){switch(p.label){case 0:p.trys.push([0,17,18,23]),t=ef(e),p.label=1;case 1:return[4,t.next()];case 2:if((n=p.sent()).done)return[3,16];u=(a=n.value).storeName,c=a.items,p.label=3;case 3:p.trys.push([3,9,10,15]),l=ef(c),p.label=4;case 4:return[4,l.next()];case 5:if((f=p.sent()).done)return[3,8];if(!(d=f.value)||"object"!=typeof d)return[3,7];return h=d.id,[4,this.db.delete(h,u)];case 6:p.sent(),p.label=7;case 7:return[3,4];case 8:return[3,15];case 9:return o={error:p.sent()},[3,15];case 10:if(p.trys.push([10,,13,14]),!(f&&!f.done&&(s=l.return)))return[3,12];return[4,s.call(l)];case 11:p.sent(),p.label=12;case 12:return[3,14];case 13:if(o)throw o.error;return[7];case 14:return[7];case 15:return[3,1];case 16:return[3,23];case 17:return r={error:p.sent()},[3,23];case 18:if(p.trys.push([18,,21,22]),!(n&&!n.done&&(i=t.return)))return[3,20];return[4,i.call(t)];case 19:p.sent(),p.label=20;case 20:return[3,22];case 21:if(r)throw r.error;return[7];
1case 22:return[7];case 23:return[2]}})})},e.prototype.deleteTraverse=function(e,t,n,r,i){var o,s,a,u,c,l,f,d,h,p,g,y;return ec(this,void 0,void 0,function(){var v,b,m,_,w,S,E,I,P,C,O,A=this;return el(this,function(k){switch(k.label){case 0:k.trys.push([0,35,36,41]),o=ef(e),k.label=1;case 1:return[4,o.next()];case 2:if((s=k.sent()).done)return[3,34];switch(b=(v=s.value).relationType,m=v.modelName,_=v.targetName,w=this.getStorename(r,m),S=(0,B.rw)(this.schema.namespaces[r].relationships[m].relationTypes,n)||(0,B.NA)(this.schema.namespaces[r].relationships[m].indexes,v.associatedWith),b){case"HAS_ONE":return[3,3];case"HAS_MANY":return[3,17];case"BELONGS_TO":return[3,31]}return[3,32];case 3:k.trys.push([3,10,11,16]),a=ef(t),k.label=4;case 4:return[4,a.next()];case 5:if((u=k.sent()).done||(E=u.value,I=S||"byId",!(P=_ in E?E[_]:E.id)))return[3,9];return[4,this.db.getAll(w)];case 6:return C=k.sent().filter(function(e){return e[I]===P}),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[m].relationTypes,C,m,r,i)];case 7:k.sent(),k.label=8;case 8:return[3,4];case 9:return[3,16];case 10:return h={error:k.sent()},[3,16];case 11:if(k.trys.push([11,,14,15]),!(u&&!u.done&&(p=a.return)))return[3,13];return[4,p.call(a)];case 12:k.sent(),k.label=13;case 13:return[3,15];case 14:if(h)throw h.error;return[7];case 15:return[7];case 16:return[3,33];case 17:k.trys.push([17,24,25,30]),c=ef(t),k.label=18;case 18:return[4,c.next()];case 19:if((l=k.sent()).done)return[3,23];return E=l.value,[4,this.db.getAll(w)];case 20:return O=k.sent().filter(function(e){return e[S]===E.id}),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[m].relationTypes,O,m,r,i)];case 21:k.sent(),k.label=22;case 22:return[3,18];case 23:return[3,30];case 24:return g={error:k.sent()},[3,30];case 25:if(k.trys.push([25,,28,29]),!(l&&!l.done&&(y=c.return)))return[3,27];return[4,y.call(c)];case 26:k.sent(),k.label=27;case 27:return[3,29];case 28:if(g)throw g.error;return[7];case 29:return[7];case 30:case 31:return[3,33];case 32:return(0,B.y0)(b),[3,33];case 33:return[3,1];case 34:return[3,41];case 35:return f={error:k.sent()},[3,41];case 36:if(k.trys.push([36,,39,40]),!(s&&!s.done&&(d=o.return)))return[3,38];return[4,d.call(o)];case 37:k.sent(),k.label=38;case 38:return[3,40];case 39:if(f)throw f.error;return[7];case 40:return[7];case 41:return i.push({storeName:this.getStorename(r,n),items:t.map(function(e){return A.modelInstanceCreator(A.getModelConstructorByModelName(r,n),e)})}),[2]}})})},e.prototype.clear=function(){return ec(this,void 0,void 0,function(){return el(this,function(e){switch(e.label){case 0:return[4,this.db.clear()];case 1:return e.sent(),this.db=void 0,this.initPromise=void 0,[2]}})})},e.prototype.batchSave=function(e,t){return ec(this,void 0,void 0,function(){var n,r,i,o,s,a,u,c,l,f,d;return el(this,function(h){switch(h.label){case 0:n=e.name,r=this.namespaceResolver(e),i=this.getStorename(r,n),o=[],s=function(t){var n=t.id,r=(0,B.jl)(e.name,a.modelInstanceCreator(e,t),a.schema.namespaces[a.namespaceResolver(e)],a.modelInstanceCreator,a.getModelConstructorByModelName).find(function(e){return e.instance.id===n}).instance;o.push(r)},a=this;try{for(c=(u=ed(t)).next();!c.done;c=u.next())l=c.value,s(l)}catch(e){f={error:e}}finally{try{c&&!c.done&&(d=u.return)&&d.call(u)}finally{if(f)throw f.error}}return[4,this.db.batchSave(i,o)];case 1:return[2,h.sent()]}})})},e}()),eg=function(){return(eg=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},ey=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},ev=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;
1function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},eb=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},em=function(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},e_=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ew=new m.k("DataStore"),eS=function(){function e(e,t,n,r,i,o){this.schema=e,this.namespaceResolver=t,this.getModelConstructorByModelName=n,this.modelInstanceCreator=r,this.adapter=i,this.sessionId=o,this.adapter=this.adapter||((0,_.lC)().isBrowser&&window.indexedDB||(0,_.n2)()&&self.indexedDB?J:ep),this.pushStream=new(F())}return e.getNamespace=function(){return{name:B.P_,relationships:{},enums:{},models:{},nonModels:{}}},e.prototype.init=function(){return ey(this,void 0,void 0,function(){var e,t;return ev(this,function(n){switch(n.label){case 0:if(!(void 0!==this.initialized))return[3,2];return[4,this.initialized];case 1:case 3:return n.sent(),[2];case 2:return ew.debug("Starting Storage"),this.initialized=new Promise(function(n,r){e=n,t=r}),this.adapter.setUp(this.schema,this.namespaceResolver,this.modelInstanceCreator,this.getModelConstructorByModelName,this.sessionId).then(e,t),[4,this.initialized]}})})},e.prototype.save=function(e,t,n,r){return ey(this,void 0,void 0,function(){var i,o=this;return ev(this,function(s){switch(s.label){case 0:return[4,this.init()];case 1:return s.sent(),[4,this.adapter.save(e,t)];case 2:return(i=s.sent()).forEach(function(s){var a,u=em(s,2),c=u[0],l=u[1],f=!!n;if(l===k.HP.UPDATE&&!f&&null===(a=o.getUpdateMutationInput(e,c,r)))return i;var d=a||c,h=Object.getPrototypeOf(c).constructor;o.pushStream.next({model:h,opType:l,element:d,mutator:n,condition:j.OY.getPredicates(t,!1),savedElement:c})}),[2,i]}})})},e.prototype.delete=function(e,t,n){return ey(this,void 0,void 0,function(){var r,i,o,s,a=this;return ev(this,function(u){switch(u.label){case 0:return[4,this.init()];case 1:return u.sent(),[4,this.adapter.delete(e,t)];case 2:return i=(s=em.apply(void 0,[u.sent(),2]))[0],r=s[1],o=new Set(i.map(function(e){return e.id})),(0,B.hK)(e)||Array.isArray(r)||(r=[r]),r.forEach(function(r){var i,s=Object.getPrototypeOf(r).constructor;(0,B.hK)(e)||(i=o.has(r.id)?j.OY.getPredicates(t,!1):void 0),a.pushStream.next({model:s,opT
1ype:k.HP.DELETE,element:r,mutator:n,condition:i})}),[2,[i,r]]}})})},e.prototype.query=function(e,t,n){return ey(this,void 0,void 0,function(){return ev(this,function(r){switch(r.label){case 0:return[4,this.init()];case 1:return r.sent(),[4,this.adapter.query(e,t,n)];case 2:return[2,r.sent()]}})})},e.prototype.queryOne=function(e,t){return void 0===t&&(t=k.fI.FIRST),ey(this,void 0,void 0,function(){return ev(this,function(n){switch(n.label){case 0:return[4,this.init()];case 1:return n.sent(),[4,this.adapter.queryOne(e,t)];case 2:return[2,n.sent()]}})})},e.prototype.observe=function(e,t,n){var r=j.OY.getPredicates(t,!1)||{},i=r.predicates,o=r.type,s=!!i,a=this.pushStream.observable.filter(function(e){var t=e.mutator;return!n||t!==n}).map(function(e){return e.mutator,eb(e,["mutator"])});return e&&(a=a.filter(function(t){var n=t.model,r=t.element;return e===n&&(!s||(0,B.u8)(r,o,i))})),a},e.prototype.clear=function(e){return void 0===e&&(e=!0),ey(this,void 0,void 0,function(){return ev(this,function(t){switch(t.label){case 0:return this.initialized=void 0,[4,this.adapter.clear()];case 1:return t.sent(),e&&this.pushStream.complete(),[2]}})})},e.prototype.batchSave=function(e,t,n){return ey(this,void 0,void 0,function(){var r,i=this;return ev(this,function(o){switch(o.label){case 0:return[4,this.init()];case 1:return o.sent(),[4,this.adapter.batchSave(e,t)];case 2:return(r=o.sent()).forEach(function(t){var r=em(t,2),o=r[0],s=r[1];i.pushStream.next({model:e,opType:s,element:o,mutator:n,condition:void 0})}),[2,r]}})})},e.prototype.getUpdateMutationInput=function(e,t,n){if(!(n&&n.length))return null;var r,i,o=em(n,2),s=o[0],a=o[1],u={},c=s.map(function(e){return e.path&&e.path[0]}),l=Object.getPrototypeOf(e).constructor,f=this.namespaceResolver(l),d=this.schema.namespaces[f].models[l.name].fields,h=this.schema.namespaces[f].keys[l.name],p=h.primaryKey,g=h.compositeKeys,y=void 0===g?[]:g;if(c.forEach(function(e){var n,r,i,o,s,c=(0,k.Fr)(null===(s=d[e])||void 0===s?void 0:s.association)||e;if(!(0,B.Vg)(a[c],t[c])){u[c]=void 0===t[c]?null:t[c];try{for(var l=e_(y),f=l.next();!f.done;f=l.next()){var h=f.value;if(h.has(c))try{for(var p=(i=void 0,e_(h)),g=p.next();!g.done;g=p.next()){var v=g.value;u[v]=t[v]}}catch(e){i={error:e}}finally{try{g&&!g.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}}),p&&p.length)try{for(var v=e_(p),b=v.next();!b.done;b=v.next()){var m=b.value;u[m]=t[m]}}catch(e){r={error:e}}finally{try{b&&!b.done&&(i=v.return)&&i.call(v)}finally{if(r)throw r.error}}if(0===Object.keys(u).length)return null;var _=t.id,w=t._version,S=t._lastChangedAt,E=t._deleted;return eg(eg({},u),{id:_,_version:w,_lastChangedAt:S,_deleted:E})},e}(),eE=function(){function e(e,t,n,r,i,o){this.mutex=new D,this.storage=new eS(e,t,n,r,i,o)}return e.prototype.runExclusive=function(e){return this.mutex.runExclusive(e.bind(this,this.storage))},e.prototype.save=function(e,t,n,r){return ey(this,void 0,void 0,function(){return ev(this,function(i){return[2,this.runExclusive(function(i){return i.save(e,t,n,r)})]})})},e.prototype.delete=function(e,t,n){return ey(this,void 0,void 0,function(){return ev(this,function(r){return[2,this.runExclusive(function(r){return(0,B.hK)(e),r.delete(e,t,n)})]})})},e.prototype.query=function(e,t,n){return ey(this,void 0,void 0,function(){return ev(this,function(r){return[2,this.runExclusive(function(r){return r.query(e,t,n)})]})})},e.prototype.queryOne=function(e,t){return void 0===t&&(t=k.fI.FIRST),ey(this,void 0,void 0,function(){return ev(this,function(n){return[2,this.runExclusive(function(n){return n.queryOne(e,t)})]})})},e.getNamespace=function(){return eS.getNamespace()},e.prototype.observe=function(e,t,n){return this.storage.observe(e,t,n)},e.prototype.clear=function(){return ey(this,void 0,void 0,function(){return ev(this,function(e){switch(e.label){case 0:return[4,this.storage.clear()];case 1:return e.sent(),[2]}})})},e.prototype.batchSave=function(e,t){return this.storage.batchSave(e,t)},e.prototype.init=function(){return ey(this,void 0,void 0,function(){return ev(this,function(e){return[2,this.storage.init(
1)]})})},e}(),eI=n(98834),eP=new(n(53150)).Z().networkMonitor(),eC=function(){return(eC=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};new m.k("DataStore");var eO=function(){function e(){this.connectionStatus={online:!1}}return e.prototype.status=function(){var e=this;if(this.observer)throw Error("Subscriber already exists");return new C.Z(function(t){return e.observer=t,e.subscription=eP.subscribe(function(n){var r=n.online;e.connectionStatus.online=r;var i=eC({},e.connectionStatus);t.next(i)}),function(){clearTimeout(e.timeout),e.unsubscribe()}})},e.prototype.unsubscribe=function(){this.subscription&&(clearTimeout(this.timeout),this.subscription.unsubscribe())},e.prototype.socketDisconnected=function(){var e=this;this.observer&&"function"==typeof this.observer.next&&(this.observer.next({online:!1}),this.timeout=setTimeout(function(){var t=eC({},e.connectionStatus);e.observer.next(t)},5e3))},e}(),eA=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},ek=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},eT=function(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},eN=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ex=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(eT(arguments[t]));return e},eM=function(){function e(e,t){this.outbox=e,this.ownSymbol=t}return e.prototype.merge=function(e,t){return eA(this,void 0,void 0,function(){var n,r,i,o;return ek(this,function(s){switch(s.label){case 0:return[4,this.outbox.getForModel(e,t)];case 1:if(r=s.sent(),i=t._deleted,0!==r.length)return[3,5];if(!i)return[3,3];return n=k.HP.DELETE,[4,e.delete(t,void 0,this.ownSymbol)];case 2:return s.sent(),[3,5];case 3:return[4,e.save(t,void 0,this.ownSymbol)];case 4:o=eT.apply(void 0,[s.sent(),1]),n=eT(o[0],2)[1],s.label=5;case 5:return[2,n]}})})},e.prototype.mergePage=function(e,t,n){return eA(this,void 0,void 0,function(){var r,i,o,s,a,u,c;return ek(this,function(l){switch(l.label){case 0:r=new Map;try{for(o=(i=eN(n)).next();!o.done;o=i.next())s=o.value,r.set(s.id,s)}catch(e){u={error:e}}finally{try{o&&!o.done&&(c=i.return)&&c.call(i)}finally{if(u)throw u.error}}return a=ex(r.values()),[4,e.batchSave(t,a,this.ownSymbol)];case 1:return[2,l.sent()]}})})},e}(),eR=n(44977),ej=function(){return(ej=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)}
1,eU=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},eD=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},eL=new m.k("DataStore");(r=a||(a={})).LIST="query",r.CREATE="mutation",r.UPDATE="mutation",r.DELETE="mutation",r.GET="query",(i=u||(u={})).CREATE="Create",i.UPDATE="Update",i.DELETE="Delete",i.GET="Get";var eF=["_version","_lastChangedAt","_deleted"];function eB(e,t){var n,r,i,o,s=eG(t),a=(n=[],Object.values(t.fields).forEach(function(t){var r=t.name,i=t.type;if((0,k.$v)(i)){var o=e.nonModels[i.nonModel],s=Object.values(eG(o)).map(function(e){return e.name}),a=[];Object.values(o.fields).forEach(function(t){var n=t.type,r=t.name;if((0,k.$v)(n)){var i=e.nonModels[n.nonModel];a.push(r+" { "+eB(e,i)+" }")}}),n.push(r+" { "+s.join(" ")+" "+a.join(" ")+" }")}}),n),u=(r=[],(0,k.aQ)(t)&&t.attributes&&t.attributes.forEach(function(e){if(e.properties&&e.properties.rules){var t=e.properties.rules.find(function(e){return"owner"===e.allow});t&&t.ownerField&&r.push(t.ownerField)}}),i=r,!s.owner&&i.includes("owner")?["owner"]:[]),c=Object.values(s).map(function(e){return e.name}).concat(u).concat(a);return(0,k.aQ)(t)&&(c=c.concat(eF).concat((o=[],Object.values(t.fields).filter(function(e){var t=e.association;return t&&Object.keys(t).length}).forEach(function(e){var t=e.name,n=e.association,r=n.connectionType;switch(r){case"HAS_ONE":case"HAS_MANY":break;case"BELONGS_TO":(0,k.Fr)(n)&&o.push(t+" { id _deleted }");break;default:(0,B.y0)(r)}}),o))),c.join("\n")}function eG(e){return Object.values(e.fields).filter(function(e){return!!((0,k.BV)(e.type)||(0,k.g5)(e.type))}).reduce(function(e,t){return e[t.name]=t,e},{})}function eq(e,t,n){var r,i,o=eB(e,t),s=t.name,c=t.pluralName,l=" ",f=" ";switch(n){case"LIST":r="sync"+c,l="($limit: Int, $nextToken: String, $lastSync: AWSTimestamp, $filter: Model"+s+"FilterInput)",f="(limit: $limit, nextToken: $nextToken, lastSync: $lastSync, filter: $filter)",o="items {\n							"+o+"\n						}\n						nextToken\n						startedAt";break;case"CREATE":r="create"+s,l="($input: Create"+s+"Input!)",f="(input: $input)",i=u.CREATE;break;case"UPDATE":r="update"+s,l="($input: Update"+s+"Input!, $condition: Model"+s+"ConditionInput)",f="(input: $input, condition: $condition)",i=u.UPDATE;break;case"DELETE":r="delete"+s,l="($input: Delete"+s+"Input!, $condition: Model"+s+"ConditionInput)",f="(input: $input, condition: $condition)",i=u.DELETE;break;case"GET":r="get"+s,l="($id: ID!)",f="(id: $id)",i=u.GET;break;default:(0,B.y0)(n)}return[[i,r,a[n]+" operation"+l+"{\n		"+r+f+"{\n			"+o+"\n		}\n	}"]]}function ez(e,t,n,r,i,o,s,a,c){var l;switch(n){case k.HP.INSERT:l=u.CREATE;break;case k.HP.UPDATE:l=u.UPDATE;break;case k.HP.DELETE:l=u.DELETE;break;default:(0,B.y0)(n)}return a(s,ej(ej({},c?{id:c}:{}),{data:JSON.stringify(i,function(e,n){return e&&null!==n&&"object"==typeof n&&t.fields[e]&&"AWSJSON"===t.fields[e].type?JSON.stringify(n):n}),modelId:i.id,model:r.name,operation:l,condition:JSON.stringify(o)}))}function eW(e,t){var n=e[t.groupClaim]||[];if("string"==typeof n){var r=void 0;try{r=JSON.parse(n)}catch(e){r=n}n=[].concat(r)}return n}function eK(e){var t=e.authModeStrategy,n=e.defaultAuthMode,r=e.modelName,i=e.schema;return eU(this,void 0,void 0,function(){var e,o,s,a=this;return eD(this,function(u){switch(u.label){case 0:e=Object.values(k.Z1),o={CREATE:[],READ:[],UPDATE:[],DELETE:[]},u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(e.map(function(e){return eU(a,void 0,void 0,function(){var s;return eD(this,function(a){switch(a.label){case 0:return[4,t({schema:i,modelName:r,operation:e})];case 1:return"string"==typeof(s=a.sent())?o[e]=[s]:Array.isArray(s)&&s.length?o[e]=s:o[e]=[n],[2]}})})}))];case 2:return u.sent(),[3,4];case 3:return s=u.sent(),eL.debug("Error getting auth modes for model: "+r,s),[3,4];case 4:return[2,o]}})})}function eH(e){var t,n=["Request failed with status code 401","Request failed with status code 403"];return(e&&e.errors?t=e.errors.find(function(e){return n.includes(e.message)}):e&&e.message&&(t=e),t)?t.message:null}function eY(e){var t=Object.values(eR.j);return e&&e.message&&t.find(function(t){return e.message.includes(t)})||null}function eV(e,t){return void 0===t&&(t={}),eU(this,void 0,void 0,function(){var n,r;return eD(this,function(i){switch(i.label){case 0:if(e!==A.si.AWS_LAMBDA)return[3,6];if(!((r=(void 0===(n=t.authProviders)?{functionAuthProvider:null}:n).functionAuthProvider)&&"function"==typeof r))return[3,5];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,r()];case 2:return[2,i.sent().token];case 3:throw Error("Error retrieving token from `functionAuthProvider`: "+i.sent());case 4:return[3,6];case 5:throw Error("You must provide a `functionAuthProvider` function to `DataStore.configure` when using "+A.si.AWS_LAMBDA);case 6:return[2]}})})}var eQ=function(){return(eQ=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)}
1,eJ=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},eZ=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},eX=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},e$=function(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},e0=function(){function e(e,t,n,r){this.schema=e,this.MutationEvent=t,this.modelInstanceCreator=n,this.ownSymbol=r}return e.prototype.enqueue=function(e,t){return eJ(this,void 0,void 0,function(){var n=this;return eZ(this,function(r){return e.runExclusive(function(e){return eJ(n,void 0,void 0,function(){var n,r,i,o,s,a,c,l=this;return eZ(this,function(f){switch(f.label){case 0:return n=this.schema.namespaces[B.J3].models.MutationEvent,r=j.OY.createFromExisting(n,function(e){return e.modelId("eq",t.modelId).id("ne",l.inProgressMutationEventId)}),[4,e.query(this.MutationEvent,r)];case 1:if(void 0!==(i=e$.apply(void 0,[f.sent(),1])[0]))return[3,3];return[4,e.save(t,void 0,this.ownSymbol)];case 2:return f.sent(),[2];case 3:if(o=t.operation,i.operation!==u.CREATE)return[3,8];if(o!==u.DELETE)return[3,5];return[4,e.delete(this.MutationEvent,r)];case 4:return f.sent(),[3,7];case 5:return s=this.mergeUserFields(i,t),[4,e.save(this.MutationEvent.copyOf(i,function(e){e.data=s.data}),void 0,this.ownSymbol)];case 6:f.sent(),f.label=7;case 7:return[3,12];case 8:if(a=JSON.parse(t.condition),c=void 0,0!==Object.keys(a).length)return[3,10];return c=this.mergeUserFields(i,t),[4,e.delete(this.MutationEvent,r)];case 9:f.sent(),f.label=10;case 10:return c=c||t,[4,e.save(c,void 0,this.ownSymbol)];case 11:f.sent(),f.label=12;case 12:return[2]}})})}),[2]})})},e.prototype.dequeue=function(e,t,n){return eJ(this,void 0,void 0,function(){var r;return eZ(this,function(i){switch(i.label){case 0:return[4,this.peek(e)];case 1:if(r=i.sent(),!t)return[3,3];return[4,this.syncOutboxVersionsOnDequeue(e,t,r,n)];case 2:i.sent(),i.label=3;case 3:return[4,e.delete(r)];case 4:return i.sent(),this.inProgressMutationEventId=void 0,[2,r]}})})},e.prototype.peek=function(e){return eJ(this,void 0,void 0,function(){var t;return eZ(this,function(n){switch(n.label){case 0:return[4,e.queryOne(this.MutationEvent,k.fI.FIRST)];case 1:return t=n.sent(),this.inProgressMutationEventId=t?t.id:void 0,[2,t]}})})},e.prototype.getForModel=function(e,t){return eJ(this,void 0,void 0,function(){var n;return eZ(this,function(r){switch(r.label){case 0:return n=this.schema.namespaces[B.J3].models.MutationEvent,[4,e.query(this.MutationEvent,j.OY.createFromExisting(n,function(e){return e.modelId("eq",t.id)}
1))];case 1:return[2,r.sent()]}})})},e.prototype.getModelIds=function(e){return eJ(this,void 0,void 0,function(){var t,n;return eZ(this,function(r){switch(r.label){case 0:return[4,e.query(this.MutationEvent)];case 1:return t=r.sent(),n=new Set,t.forEach(function(e){var t=e.modelId;return n.add(t)}),[2,n]}})})},e.prototype.syncOutboxVersionsOnDequeue=function(e,t,n,r){return eJ(this,void 0,void 0,function(){var i,o,s,a,u,c,l,f,d,h,p,g=this;return eZ(this,function(y){switch(y.label){case 0:if(n.operation!==r||(i=t._version,o=t._lastChangedAt,t._deleted,s=eX(t,["_version","_lastChangedAt","_deleted"]),a=this.removeTimestampFields(n.model,s),!(u=JSON.parse(n.data)))||(u._version,u._lastChangedAt,u._deleted,c=eX(u,["_version","_lastChangedAt","_deleted"]),l=this.removeTimestampFields(n.model,c),!(0,B.Vg)(a,l,!0)))return[2];return f=this.schema.namespaces[B.J3].models.MutationEvent,d=j.OY.createFromExisting(f,function(e){return e.modelId("eq",t.id).id("ne",g.inProgressMutationEventId)}),[4,e.query(this.MutationEvent,d)];case 1:if(!(h=y.sent()).length)return[2];return p=h.map(function(e){var t=JSON.parse(e.data),n=eQ(eQ({},t),{_version:i,_lastChangedAt:o});return g.MutationEvent.copyOf(e,function(e){e.data=JSON.stringify(n)})}),[4,e.delete(this.MutationEvent,d)];case 2:return y.sent(),[4,Promise.all(p.map(function(t){return eJ(g,void 0,void 0,function(){return eZ(this,function(n){switch(n.label){case 0:return[4,e.save(t,void 0,this.ownSymbol)];case 1:return[2,n.sent()]}})})}))];case 3:return y.sent(),[2]}})})},e.prototype.mergeUserFields=function(e,t){var n=JSON.parse(e.data),r=n._version,i=n.id,o=n._lastChangedAt,s=n._deleted,a=eX(n,["_version","id","_lastChangedAt","_deleted"]),u=JSON.parse(t.data),c=(u.id,u._version,u._lastChangedAt,u._deleted,eX(u,["id","_version","_lastChangedAt","_deleted"])),l=JSON.stringify(eQ(eQ({id:i,_version:r,_lastChangedAt:o,_deleted:s},a),c));return this.modelInstanceCreator(this.MutationEvent,eQ(eQ({},t),{data:l}))},e.prototype.removeTimestampFields=function(e,t){var n,r,i="createdAt",o="updatedAt",s=i,a=o,u=null===(n=this.schema.namespaces[B.xR].models[e].attributes)||void 0===n?void 0:n.find(function(e){return"model"===e.type}),c=null===(r=null==u?void 0:u.properties)||void 0===r?void 0:r.timestamps;return c&&(s=c[i],a=c[o]),delete t[s],delete t[a],t},e}(),e1=n(58399),e2=function(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},e3=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(e2(arguments[t]));return e},e4=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},e5=function(e){return/^Connection failed: Connection Timeout/.test(e.message)},e6=function(e){return/^Error: Request failed with status code 5\d\d/.test(e.message)},e7={BadModel:function(){return!1},BadRecord:function(e){var t=e.message;return/^Cannot return \w+ for [\w-_]+ type/.test(t)||/^Variable '.+' has coerced Null value for NonNull type/.test(t)},ConfigError:function(){return!1},Transient:function(e){return e5(e)||e6(e)},Unauthorized:function(e){return/^Request failed with status code 401/.test(e.message)}},e9={BadModel:function(){return!1},BadRecord:function(){return!1},ConfigError:function(){return!1},Transient:function(e){var t=te(e);return e5(t)||e6(t)},Unauthorized:function(e){var t=te(e);return/Connection failed.+Unauthorized/.test(t.message)}},e8={BadModel:function(){return!1},BadRecord:function(e){return/^Cannot return \w+ for [\w-_]+ type/.test(e.message)},ConfigError:function(){return!1},Transient:function(e){return e5(e)||e6(e)},Unauthorized:function(){return!1}};function te(e){var t=e.error;return e2((void 0===t?{errors:[]}:t).errors,1)[0]}function tt(e,t){var n,r,i=e3(Object.keys(e));try{for(var o=e4(i),s=o.next();!s.done;s=o.next()){var a=s.value;if((0,e[a])(t))return a}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return"Unknown"}var tn=function(){return(tn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)}
1,tr=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},ti=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},to=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},ts=function(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},ta=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},tu=new m.k("DataStore"),tc=function(){function e(e,t,n,r,i,o,s,a,u,c,l){void 0===s&&(s={}),this.schema=e,this.storage=t,this.userClasses=n,this.outbox=r,this.modelInstanceCreator=i,this.MutationEvent=o,this.amplifyConfig=s,this.authModeStrategy=a,this.errorHandler=u,this.conflictHandler=c,this.amplifyContext=l,this.typeQuery=new WeakMap,this.processing=!1,this.amplifyContext.API=this.amplifyContext.API||b.ZP,this.generateQueries()}return e.prototype.generateQueries=function(){var e=this;Object.values(this.schema.namespaces).forEach(function(t){Object.values(t.models).filter(function(e){return e.syncable}
1).forEach(function(n){var r=ts(eq(t,n,"CREATE"),1)[0],i=ts(eq(t,n,"UPDATE"),1)[0],o=ts(eq(t,n,"DELETE"),1)[0];e.typeQuery.set(n,[r,i,o])})})},e.prototype.isReady=function(){return void 0!==this.observer},e.prototype.start=function(){var e=this;return new C.Z(function(t){return e.observer=t,e.resume(),function(){e.pause()}})},e.prototype.resume=function(){return tr(this,void 0,void 0,function(){var e,t,n,r,i,o=this;return ti(this,function(s){switch(s.label){case 0:if(this.processing||!this.isReady())return[2];this.processing=!0,t=B.xR,n=function(){var n,i,s,a,u,c,l,f,d,h,p,g,y,v,b;return ti(this,function(m){switch(m.label){case 0:n=e.model,i=e.operation,s=e.data,a=e.condition,u=r.userClasses[n],c=void 0,l=void 0,f=void 0,m.label=1;case 1:return m.trys.push([1,4,,5]),[4,eK({authModeStrategy:r.authModeStrategy,defaultAuthMode:r.amplifyConfig.aws_appsync_authenticationType,modelName:n,schema:r.schema})];case 2:return d=m.sent()[i.toUpperCase()],h=0,[4,(p=function(){return tr(o,void 0,void 0,function(){var r,o;return ti(this,function(c){switch(c.label){case 0:return c.trys.push([0,2,,4]),tu.debug("Attempting mutation with authMode: "+d[h]),[4,this.jitteredRetry(t,n,i,s,a,u,this.MutationEvent,e,d[h])];case 1:return r=c.sent(),tu.debug("Mutation sent successfully with authMode: "+d[h]),[2,r];case 2:if(o=c.sent(),++h>=d.length)throw tu.debug("Mutation failed with authMode: "+d[h-1]),o;return tu.debug("Mutation failed with authMode: "+d[h-1]+". Retrying with authMode: "+d[h]),[4,p()];case 3:return[2,c.sent()];case 4:return[2]}})})})()];case 3:return c=(b=ts.apply(void 0,[m.sent(),3]))[0],l=b[1],f=b[2],[3,5];case 4:if("Offline"===(g=m.sent()).message||"RetryMutation"===g.message)return[2,"continue"];return[3,5];case 5:if(void 0!==c)return[3,7];return tu.debug("done retrying"),[4,r.storage.runExclusive(function(e){return tr(o,void 0,void 0,function(){return ti(this,function(t){switch(t.label){case 0:return[4,this.outbox.dequeue(e)];case 1:return t.sent(),[2]}})})})];case 6:return m.sent(),[2,"continue"];case 7:return y=c.data[l],v=!1,[4,r.storage.runExclusive(function(e){return tr(o,void 0,void 0,function(){return ti(this,function(t){switch(t.label){case 0:return[4,this.outbox.dequeue(e,y,i)];case 1:return t.sent(),[4,this.outbox.peek(e)];case 2:return v=void 0!==t.sent(),[2]}})})})];case 8:return m.sent(),r.observer.next({operation:i,modelDefinition:f,model:y,hasMore:v}),[2]}})},r=this,s.label=1;case 1:if(!(i=this.processing))return[3,3];return[4,this.outbox.peek(this.storage)];case 2:i=void 0!==(e=s.sent()),s.label=3;case 3:if(!i)return[3,5];return[5,n()];case 4:return s.sent(),[3,1];case 5:return this.pause(),[2]}})})},e.prototype.jitteredRetry=function(e,t,n,r,i,o,s,a,u){return tr(this,void 0,void 0,function(){var c=this;return ti(this,function(l){switch(l.label){case 0:return[4,(0,e1.XD)(function(t,n,r,i,o,s,a){return tr(c,void 0,void 0,function(){var c,l,f,d,h,p,g,y,v,b,m,_,w,S,E,I,P,C,O,A,T,N,x,M,R;return ti(this,function(j){switch(j.label){case 0:return l=(c=ts(this.createQueryVariables(e,t,n,r,i),5))[0],f=c[1],d=c[2],h=c[3],p=c[4],[4,eV(u,this.amplifyConfig)];case 1:g=j.sent(),y={query:l,variables:f,authMode:u,authToken:g,userAgentSuffix:B.N6},v=0,b=this.opTypeFromTransformerOperation(n),j.label=2;case 2:return j.trys.push([2,4,,20]),[4,this.amplifyContext.API.graphql(y)];case 3:return[2,[j.sent(),h,p]];case 4:if(!((m=j.sent()).errors&&m.errors.length>0))return[3,18];if(E=void 0===(S=(void 0===(w=(_=ts(m.errors,1)[0]).originalError)?{}:w).code)?null:S,"Unauthorized"===_.errorType)throw new e1.V2("Unauthorized");if("Network Error"===_.message||"ECONNABORTED"===E){if(!this.processing)throw new e1.V2("Offline");throw Error("Network Error")}if("ConflictUnhandled"!==_.errorType)return[3,13];if(v++,I=void 0,!(v>10))return[3,5];return I=k.K5,[3,8];case 5:return j.trys.push([5,7,,8]),[4,this.conflictHandler({modelConstructor:o,localModel:this.modelInstanceCreator(o,f.input),remoteModel:this.modelInstanceCreator(o,_.data),operation:b,attempts:v})];case 6:return I=j.sent(),[3,8];case 7:return P=j.sent(),tu.warn("conflict trycatch",P),[3,20];case 8:if(I!==k.K5)return[3,11];return C=ts(eq(this.schema.namespaces[e],p,"GET"),1),A=(O=ts(C[0],3))[1],T=O[2],[4,eV(u,this.amplifyConfig)];case 9:return N=j.sent(),[4,this.amplifyContext.API.graphql({query:T,variables:{id:f.input.id},authMode:u,authToken:N,userAgentSuffix:B.N6})];case 10:return[2,[j.sent(),A,p]];case 11:return x=ez(this.schema.namespaces[e].relationships,p,b,o,I,d,s,this.modelInstanceCreator,a.id
1),[4,this.storage.save(x)];case 12:throw j.sent(),new e1.V2("RetryMutation");case 13:return j.trys.push([13,15,16,17]),[4,this.errorHandler({recoverySuggestion:"Ensure app code is up to date, auth directives exist and are correct on each model, and that server-side data has not been invalidated by a schema change. If the problem persists, search for or create an issue: https://github.com/aws-amplify/amplify-js/issues",localModel:f.input,message:_.message,operation:n,errorType:tt(e7,_),errorInfo:_.errorInfo,process:k.tv.mutate,cause:_,remoteModel:_.data?this.modelInstanceCreator(o,_.data):null})];case 14:return j.sent(),[3,17];case 15:return M=j.sent(),tu.warn("Mutation error handler failed with:",M),[3,17];case 16:return[2,_.data?[{data:((R={})[h]=_.data,R)},h,p]:[]];case 17:return[3,19];case 18:throw new e1.V2(m);case 19:return[3,20];case 20:if(y)return[3,2];j.label=21;case 21:return[2]}})})},[t,n,r,i,o,s,a],tf)];case 1:return[2,l.sent()]}})})},e.prototype.createQueryVariables=function(e,t,n,r,i){var o,s,a=this.schema.namespaces[e].models[t],c=this.schema.namespaces[e].keys[t].primaryKey,l=ts(this.typeQuery.get(a).find(function(e){return ts(e,1)[0]===n}),3),f=l[1],d=l[2],h=JSON.parse(r),p=h._version,g=to(h,["_version"]),y={};if(c&&c.length)try{for(var v=ta(c),b=v.next();!b.done;b=v.next()){var m=b.value;y[m]=g[m]}}catch(e){o={error:e}}finally{try{b&&!b.done&&(s=v.return)&&s.call(v)}finally{if(o)throw o.error}}else y.id=g.id;var _=n===u.DELETE?y:Object.values(a.fields).filter(function(e){var t=e.name,r=e.type,i=e.association;return(0,k.I7)(r)?!!(0,k.Fr)(i)&&"BELONGS_TO"===i.connectionType:n!==u.UPDATE||g.hasOwnProperty(t)}).map(function(e){var t=e.name,n=e.type,r=e.association,i=t,o=g[t];return(0,k.I7)(n)&&(0,k.Fr)(r)&&(o=g[i=r.targetName]),[i,o]}).reduce(function(e,t){var n=ts(t,2),r=n[0],i=n[1];return e[r]=i,e},{}),w=tn(tn({},_),{_version:p}),S=JSON.parse(i);return[d,tn({input:w},n===u.CREATE?{}:{condition:Object.keys(S).length>0?S:null}),S,f,a]},e.prototype.opTypeFromTransformerOperation=function(e){switch(e){case u.CREATE:return k.HP.INSERT;case u.DELETE:return k.HP.DELETE;case u.UPDATE:return k.HP.UPDATE;case u.GET:break;default:(0,B.y0)(e)}},e.prototype.pause=function(){this.processing=!1},e}(),tl=(0,e1.kD)(3e5),tf=function(e,t,n){var r=tl(e);return!1===r&&(null==n?void 0:n.message)==="Network Error"?3e5:r},td=n(94706).lW,th=function(){return(th=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},tp=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},tg=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},ty=function(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},tv=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(ty(arguments[t]));return e},tb=new m.k("DataStore");(c||(c={})).CONNECTED="CONNECTED",(o=l||(l={}))[o.none=0]="none",o[o.unauth=1]="unauth",o[o.auth=2]="auth";var tm=function(){function e(e,t,n,r,i,o){void 0===n&&(n={}),void 0===o&&(o={Auth:E.g,API:b.ZP,Cache:I.ZP}),this.schema=e,this.syncPredicates=t,this.amplifyConfig=n,this.authModeStrategy=r,this.errorHandler=i,this.amplifyContext=o,this.typeQuery=new WeakMap,this.buffer=[]}return e.prototype.buildSubscription=function(e,t,n,r,i,o,s){var a,u,c,l,f,d=this.amplifyConfig.aws_appsync_authenticationType,h=this.getAuthorizationInfo(t,r,d,i,o,s)||{},p=h.isOwner,g=h.ownerField,y=h.ownerValue,v=ty((a=eB(e,t),u=t.name,t.pluralName,c="on"+n+u,l="",f="",p&&(l="($"+g+": String!)",f="
1("+g+": $"+g+")"),[n,c,"subscription operation"+l+"{\n			"+c+f+"{\n				"+a+"\n			}\n		}"]),3);return{authMode:s,opType:v[0],opName:v[1],query:v[2],isOwner:p,ownerField:g,ownerValue:y}},e.prototype.getAuthorizationInfo=function(e,t,n,r,i,o){void 0===r&&(r={}),void 0===i&&(i={});var s,a,u,c,f=(a=(void 0===(s=([].concat(e.attributes).find(function(e){return e&&"auth"===e.type})||{}).properties)?{}:s).rules,u=[],(void 0===a?[]:a).forEach(function(t){var n=t.identityClaim,r=t.ownerField,i=t.operations,o=void 0===i?["create","update","delete","read"]:i,s=t.provider,a=t.groupClaim,c=t.allow,l=void 0===c?"iam":c,f=t.groups,d=o.includes("read"),h="owner"===l;if(d||h){var p={identityClaim:void 0===n?"cognito:username":n,ownerField:void 0===r?"owner":r,provider:void 0===s?"userPools":s,groupClaim:void 0===a?"cognito:groups":a,authStrategy:l,groups:void 0===f?[]:f,areSubscriptionsPublic:!1};if(h){var g=([].concat(e.attributes).find(function(e){return e&&"model"===e.type})||{}).properties,y=(void 0===g?{}:g).subscriptions,v=(void 0===y?{}:y).level;p.areSubscriptionsPublic=!o.includes("read")||"public"===(void 0===v?"on":v)}if(h){u.push(p);return}u.unshift(p)}}),u);if(o===A.si.AWS_IAM&&f.find(function(e){return"private"===e.authStrategy&&"iam"===e.provider})&&t===l.unauth)return null;var d=f.filter(function(e){return"groups"===e.authStrategy&&["userPools","oidc"].includes(e.provider)});return(o===A.si.AMAZON_COGNITO_USER_POOLS||o===A.si.OPENID_CONNECT)&&d.find(function(e){return tv(eW(r,e),eW(i,e)).find(function(t){return e.groups.find(function(e){return e===t})})})?{authMode:o,isOwner:!1}:((o===A.si.AMAZON_COGNITO_USER_POOLS?f.filter(function(e){return"owner"===e.authStrategy&&"userPools"===e.provider}):[]).forEach(function(e){var t=r[e.identityClaim];t&&(c={authMode:A.si.AMAZON_COGNITO_USER_POOLS,isOwner:!e.areSubscriptionsPublic,ownerField:e.ownerField,ownerValue:t})}),c)?c:((o===A.si.OPENID_CONNECT?f.filter(function(e){return"owner"===e.authStrategy&&"oidc"===e.provider}):[]).forEach(function(e){var t=i[e.identityClaim];t&&(c={authMode:A.si.OPENID_CONNECT,isOwner:!e.areSubscriptionsPublic,ownerField:e.ownerField,ownerValue:t})}),c)?c:{authMode:o||n,isOwner:!1}},e.prototype.hubQueryCompletionListener=function(e,t){t.payload.event===eI.u.SUBSCRIPTION_ACK&&e()},e.prototype.start=function(){var e=this;return[new C.Z(function(t){var n,r,i=[],o={},s=l.none;return tp(e,void 0,void 0,function(){var e,a,f,d,h,p,g,y,v=this;return tg(this,function(b){switch(b.label){case 0:return b.trys.push([0,2,,3]),[4,this.amplifyContext.Auth.currentCredentials()];case 1:return s=b.sent().authenticated?l.auth:l.unauth,[3,3];case 2:return b.sent(),[3,3];case 3:return b.trys.push([3,5,,6]),[4,this.amplifyContext.Auth.currentSession()];case 4:return n=b.sent().getIdToken().decodePayload(),[3,6];case 5:return b.sent(),[3,6];case 6:if(b.trys.push([6,11,,12]),a=(e=this.amplifyConfig).aws_cognito_region,f=e.Auth,!a||f&&!f.region)throw"Auth is not configured";return d=void 0,[4,this.amplifyContext.Cache.getItem("federatedInfo")];case 7:if(!(h=b.sent()))return[3,8];return d=h.token,[3,10];case 8:return[4,this.amplifyContext.Auth.currentAuthenticatedUser()];case 9:(p=b.sent())&&(d=p.token),b.label=10;case 10:return d&&(g=d.split(".")[1],r=JSON.parse(td.from(g,"base64").toString("utf8"))),[3,12];case 11:return y=b.sent(),tb.debug("error getting OIDC JWT",y),[3,12];case 12:return Object.values(this.schema.namespaces).forEach(function(e){Object.values(e.models).filter(function(e){return e.syncable}
1).forEach(function(a){return tp(v,void 0,void 0,function(){var c,l,f,d,h,p,g,y=this;return tg(this,function(v){switch(v.label){case 0:return[4,eK({authModeStrategy:this.authModeStrategy,defaultAuthMode:this.amplifyConfig.aws_appsync_authenticationType,modelName:a.name,schema:this.schema})];case 1:return c=v.sent().READ,o=th(th({},o),((h={})[a.name]=((p={})[u.CREATE]=[],p[u.UPDATE]=[],p[u.DELETE]=[],p),h)),l=[u.CREATE,u.UPDATE,u.DELETE],(g={})[u.CREATE]=0,g[u.UPDATE]=0,g[u.DELETE]=0,f=g,d=function(u){return tp(y,void 0,void 0,function(){var l,h,p,g,y,v,b,m,_,S,E,I,P,C=this;return tg(this,function(O){switch(O.label){case 0:return h=(l=this.buildSubscription(e,a,u,s,n,r,c[f[u]])).opType,p=l.opName,g=l.query,y=l.isOwner,v=l.ownerField,b=l.ownerValue,[4,eV(m=l.authMode,this.amplifyConfig)];case 1:if(_=O.sent(),S={},y){if(!b)return t.error("Owner field required, sign in is needed in order to perform this operation"),[2];S[v]=b}return tb.debug("Attempting "+u+" subscription with authMode: "+c[f[u]]),E=B.N6,I=this.amplifyContext.API.graphql(th(th({query:g,variables:S},{authMode:m}),{authToken:_,userAgentSuffix:E})),o[a.name][h].push(I.map(function(e){return e.value}).subscribe({next:function(e){var t=e.data,n=e.errors;if(Array.isArray(n)&&n.length>0){var r=n.map(function(e){return e.message});tb.warn("Skipping incoming subscription. Messages: "+r.join("\n")),C.drainBuffer();return}var i=j.OY.getPredicates(C.syncPredicates.get(a),!1),o=t[p];C.passesPredicateValidation(o,i)&&C.pushToBuffer(h,a,o),C.drainBuffer()},error:function(e){return tp(C,void 0,void 0,function(){var n,r,i,s,l;return tg(this,function(p){switch(p.label){case 0:if((s=void 0===(i=(void 0===(r=ty((void 0===(n=e.error)?{errors:[]}:n).errors,1)[0])?{}:r).message)?"":i).includes(eI.u.REALTIME_SUBSCRIPTION_INIT_ERROR)||s.includes(eI.u.CONNECTION_FAILED)){if(o[a.name][h].forEach(function(e){return e.unsubscribe()}),o[a.name][h]=[],f[u]++,!(f[u]>=c.length))return tb.debug(u+" subscription failed with authMode: "+c[f[u]-1]+". Retrying with authMode: "+c[f[u]]),d(u),[2];tb.debug(u+" subscription failed with authMode: "+c[f[u]-1])}tb.warn("subscriptionError",s),p.label=1;case 1:return p.trys.push([1,3,,4]),[4,this.errorHandler({recoverySuggestion:"Ensure app code is up to date, auth directives exist and are correct on each model, and that server-side data has not been invalidated by a schema change. If the problem persists, search for or create an issue: https://github.com/aws-amplify/amplify-js/issues",localModel:null,message:s,model:a.name,operation:u,errorType:tt(e9,e),process:k.tv.subscribe,remoteModel:null,cause:e})];case 2:return p.sent(),[3,4];case 3:return l=p.sent(),tb.error("Subscription error handler failed with:",l),[3,4];case 4:if("function"==typeof P&&P(),s.includes('"errorType":"Unauthorized"')||s.includes('"errorType":"OperationDisabled"'))return[2];return t.error(s),[2]}})})}})),i.push(tp(C,void 0,void 0,function(){var e,t=this;return tg(this,function(n){switch(n.label){case 0:return[4,new Promise(function(n){P=n,e=t.hubQueryCompletionListener.bind(t,n),w.Xb.listen("api",e)})];case 1:return n.sent(),w.Xb.remove("api",e),[2]}})})),[2]}})})},l.forEach(function(e){return d(e)}),[2]}})})})}),Promise.all(i).then(function(){return t.next(c.CONNECTED)}),[2]}})}),function(){Object.keys(o).forEach(function(e){o[e][u.CREATE].forEac
1h(function(e){return e.unsubscribe()}),o[e][u.UPDATE].forEach(function(e){return e.unsubscribe()}),o[e][u.DELETE].forEach(function(e){return e.unsubscribe()})})}}),new C.Z(function(t){return e.dataObserver=t,e.drainBuffer(),function(){e.dataObserver=null}})]},e.prototype.passesPredicateValidation=function(e,t){if(!t)return!0;var n=t.predicates,r=t.type;return(0,B.u8)(e,r,n)},e.prototype.pushToBuffer=function(e,t,n){this.buffer.push([e,t,n])},e.prototype.drainBuffer=function(){var e=this;this.dataObserver&&(this.buffer.forEach(function(t){return e.dataObserver.next(t)}),this.buffer=[])},e}(),t_=function(){return(t_=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},tw=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},tS=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},tE=function(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},tI=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},tP={items:[],nextToken:null,startedAt:null},tC=new m.k("DataStore"),tO=function(){function e(e,t,n,r,i,o){void 0===n&&(n={}),this.schema=e,this.syncPredicates=t,this.amplifyConfig=n,this.authModeStrategy=r,this.errorHandler=i,this.amplifyContext=o,this.typeQuery=new WeakMap,o.API=o.API||b.ZP,this.generateQueries()}return e.prototype.generateQueries=function(){var e=this;Object.values(this.schema.namespaces).forEach(function(t){Object.values(t.models).filter(function(e){return e.syncable}
1).forEach(function(n){var r=tE(eq(t,n,"LIST"),1),i=tE(r[0]).slice(1);e.typeQuery.set(n,i)})})},e.prototype.graphqlFilterFromPredicate=function(e){if(!this.syncPredicates)return null;var t=j.OY.getPredicates(this.syncPredicates.get(e),!1);return t?function e(t){var n={};if(!t||!Array.isArray(t.predicates))return n;var r=t.type,i=t.predicates,o="and"===r||"or"===r;n[r]=o?[]:{};var s=function(e){return o?n[r].push(e):n[r]=e};return i.forEach(function(t){var n,r;if((0,k.w5)(t)){var i=t.field,o=t.operator,a=t.operand;s(((n={})[i]=((r={})[o]=a,r),n));return}s(e(t))}),n}(t):null},e.prototype.retrievePage=function(e,t,n,r,i){return void 0===r&&(r=null),tw(this,void 0,void 0,function(){var o,s,a,u,c,l,f,d,h,p=this;return tS(this,function(g){switch(g.label){case 0:return s=(o=tE(this.typeQuery.get(e),2))[0],a=o[1],u={limit:r,nextToken:n,lastSync:t,filter:i},[4,eK({authModeStrategy:this.authModeStrategy,defaultAuthMode:this.amplifyConfig.aws_appsync_authenticationType,modelName:e.name,schema:this.schema})];case 1:return c=g.sent().READ,l=0,[4,(f=function(){return tw(p,void 0,void 0,function(){var t,n,r,i;return tS(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,4]),tC.debug("Attempting sync with authMode: "+c[l]),[4,this.jitteredRetry({query:a,variables:u,opName:s,modelDefinition:e,authMode:c[l]})];case 1:return t=o.sent(),tC.debug("Sync successful with authMode: "+c[l]),[2,t];case 2:if(n=o.sent(),++l>=c.length){if(r=c[l-1],tC.debug("Sync failed with authMode: "+r,n),eY(n)||eH(n))return tC.warn("User is unauthorized to query "+s+" with auth mode "+r+". No data could be returned."),[2,{data:((i={})[s]=tP,i)}];throw n}return tC.debug("Sync failed with authMode: "+c[l-1]+". Retrying with authMode: "+c[l]),[4,f()];case 3:return[2,o.sent()];case 4:return[2]}})})})()];case 2:return h=(d=g.sent().data[s]).items,[2,{nextToken:d.nextToken,startedAt:d.startedAt,items:h}]}})})},e.prototype.partialDataFeatureFlagEnabled=function(){try{return!!sessionStorage.getItem("datastorePartialData")}catch(e){return!1}},e.prototype.jitteredRetry=function(e){var t=e.query,n=e.variables,r=e.opName,i=e.modelDefinition,o=e.authMode;return tw(this,void 0,void 0,function(){var e=this;return tS(this,function(s){switch(s.label){case 0:return[4,(0,e1.Xm)(function(t,n){return tw(e,void 0,void 0,function(){var e,s,a,u,c,l=this;return tS(this,function(f){switch(f.label){case 0:return f.trys.push([0,3,,8]),[4,eV(o,this.amplifyConfig)];case 1:return e=f.sent(),[4,this.amplifyContext.API.graphql({query:t,variables:n,authMode:o,authToken:e,userAgentSuffix:B.N6})];case 2:return[2,f.sent()];case 3:if(a=eY(s=f.sent())||eH(s))throw new e1.V2(a);if(u=!!(s&&s.data&&s.data[r]&&s.data[r].items),!this.partialDataFeatureFlagEnabled())return[3,7];if(!u)return[3,6];if((c=s).data[r].items=c.data[r].items.filter(function(e){return null!==e}),!s.errors)return[3,5];return[4,Promise.all(s.errors.map(function(e){return tw(l,void 0,void 0,function(){var t;return tS(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.errorHandler({recoverySuggestion:"Ensure app code is up to date, auth directives exist and are correct on each model, and that server-side data has not been invalidated by a schema change. If the problem persists, search for or create an issue: https://github.com/aws-amplify/amplify-js/issues",localModel:null,message:e.message,model:i.name,operation:r,errorType:tt(e8,e),process:k.tv.sync,remoteModel:null,cause:e})];case 1:return n.sent(),[3,3];case 2:return t=n.sent(),tC.error("Sync error handler failed with:",t),[3,3];case 3:return[2]}})})}))];case 4:f.sent(),w.Xb.dispatch("datastore",{event:"syncQueriesPartialSyncError",data:{errors:s.errors,modelName:i.name}}),f.label=5;case 5:return[2,c];case 6:throw s;case 7:if(s&&s.errors&&s.errors.some(function(e){return"Unauthorized"===e.errorType}))return c=s,u?c.data[r].items=c.data[r].items.filter(function(e){return null!==e}):c.data[r]=t_(t_({},tP),c.data[r]),tC.warn("queryError","User is unauthorized to query "+r+", some items could not be returned."),[2,c];throw s;case 8:return[2]}})})},[t,n])];case 1:return[2,s.sent()]}})})},e.prototype.start=function(e){var t=this,n=!0,r=this.amplifyConfig,i=r.maxRecordsToSync,o=r.syncPageSize,s=new Map;return new C.Z(function(r){return Promise.all(Array.from(Object.values(t.schema.namespaces).reduce(function(t,n){var r,i;try{for(var o=tI(Array.from(n.modelTopologicalOrdering.keys())),s=o.next();!s.done;s=o.next()){var a=s.value,u=e.get(n.models[a]);t.set(n.models[a],u)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return t},new Map).entries()).filter(function(e){return tE(e,1)[0].syncable}).map(function(e){var a=tE(e,2),u=a[0],c=tE(a[1],2),l=c[0],f=c[1];return tw(t,void 0,void 0,function(){var e,t,a,c,d,h,p,g,y=this;return tS(this,function(v){switch(v.label){case 0:return e=!1,t=null,a=null,c=null,d=0,h=this.graphqlFilterFromPredicate(u),p=this.schema.namespaces[l].modelTopologicalOrdering.get(u.name).map(function(e){return s.get(l+"_"+e)}),g=new Promise(function(s){return tw(y,void 0,void 0,function(){var g,y;return tS(this,function(v){switch(v.label){case 0:return[4,Promise.all(p)];case 1:v.sent(),v.label=2;case 2:if(!n)return[2];return g=Math.min(i-d,o),[4,this.retrievePage(u,f,t,g,h)];case 3:c=(y=v.sent()).items,t=y.nextToken,a=y.startedAt,d+=c.length,e=null===t||d>=i,r.next({namespace:l,modelDefinition:u,items:c,done:e,startedAt:a,isFullSync:!f}),v.label=4;case 4:if(!e)return[3,2];v.label=5;case 5:return s(),[2]}})})}),s.set(l+"_"+u.name,g),[4,g];case 1:return v.sent(),[2]}})})})).then(function(){r.complete()}),function(){n=!1}})},e}
1(),tA=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},tk=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},tT=function(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},tN=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},tx=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(tT(arguments[t]));return e},tM=(0,_.lC)().isNode,tR=new m.k("DataStore"),tj=Symbol("sync");(s=f||(f={})).SYNC_ENGINE_STORAGE_SUBSCRIBED="storageSubscribed",s.SYNC_ENGINE_SUBSCRIPTIONS_ESTABLISHED="subscriptionsEstablished",s.SYNC_ENGINE_SYNC_QUERIES_STARTED="syncQueriesStarted",s.SYNC_ENGINE_SYNC_QUERIES_READY="syncQueriesReady",s.SYNC_ENGINE_MODEL_SYNCED="modelSynced",s.SYNC_ENGINE_OUTBOX_MUTATION_ENQUEUED="outboxMutationEnqueued",s.SYNC_ENGINE_OUTBOX_MUTATION_PROCESSED="outboxMutationProcessed",s.SYNC_ENGINE_OUTBOX_STATUS="outboxStatus",s.SYNC_ENGINE_NETWORK_STATUS="networkStatus",s.SYNC_ENGINE_READY="ready";var tU=function(){function e(e,t,n,r,i,o,s,a,u,c,l,f){void 0===c&&(c={}),this.schema=e,this.namespaceResolver=t,this.modelClasses=n,this.userModelClasses=r,this.storage=i,this.modelInstanceCreator=o,this.syncPredicates=u,this.amplifyConfig=c,this.authModeStrategy=l,this.amplifyContext=f,this.online=!1,this.modelSyncedStatus=new WeakMap;var d=this.modelClasses.MutationEvent;this.outbox=new e0(this.schema,d,o,tj),this.modelMerger=new eM(this.outbox,tj),this.syncQueriesProcessor=new tO(this.schema,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,a,this.amplifyContext),this.subscriptionsProcessor=new tm(this.schema,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,a,this.amplifyContext),this.mutationsProcessor=new tc(this.schema,this.storage,this.userModelClasses,this.outbox,this.modelInstanceCreator,d,this.amplifyConfig,this.authModeStrategy,a,s,this.amplifyContext),this.datastoreConnectivity=new eO}return e.prototype.getModelSyncedStatus=function(e){return this.modelSyncedStatus.get(e)},e.prototype.start=function(e){var t=this;return new C.Z(function(n){tR.log("starting sync engine...");var r=[];return tA(t,void 0,void 0,function(){var t,i,o,s=this;return tk(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.setupModels(e)];case 1:return a.sent(),[3,3];case 2:return t=a.sent(),n.error(t),[2];case 3:return i=new Promise(function(e){s.datastoreConnectivity.status().subscribe(function(t){var i=t.online;return tA(s,void 0,void 0,function(){var t,o,s,a,u,l=this;return tk(this,function(d){switch(d.label){case 0:if(!(i&&!this.online))return[3,10];if(this.online=i,n.next({type:f.SYNC_ENGINE_NETWORK_STATUS,data:{active:this.online}}),o=void 0,!tM)return[3,1];
1return tR.warn("Realtime disabled when in a server-side environment"),[3,6];case 1:t=(u=tT(this.subscriptionsProcessor.start(),2))[0],o=u[1],d.label=2;case 2:return d.trys.push([2,4,,5]),[4,new Promise(function(e,n){var i=t.subscribe({next:function(t){t===c.CONNECTED&&e()},error:function(e){n(e),l.disconnectionHandler()(e)}});r.push(i)})];case 3:return d.sent(),[3,5];case 4:return s=d.sent(),n.error(s),[2];case 5:tR.log("Realtime ready"),n.next({type:f.SYNC_ENGINE_SUBSCRIPTIONS_ESTABLISHED}),d.label=6;case 6:return d.trys.push([6,8,,9]),[4,new Promise(function(e,t){var i=l.syncQueriesObservable().subscribe({next:function(t){t.type===f.SYNC_ENGINE_SYNC_QUERIES_READY&&e(),n.next(t)},complete:function(){e()},error:function(e){t(e)}});i&&r.push(i)})];case 7:return d.sent(),[3,9];case 8:return a=d.sent(),n.error(a),[2];case 9:return r.push(this.mutationsProcessor.start().subscribe(function(e){var t=e.modelDefinition,r=e.model,i=e.hasMore,o=l.userModelClasses[t.name],s=l.modelInstanceCreator(o,r);l.storage.runExclusive(function(e){return l.modelMerger.merge(e,s)}),n.next({type:f.SYNC_ENGINE_OUTBOX_MUTATION_PROCESSED,data:{model:o,element:s}}),n.next({type:f.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:!i}})})),tM||r.push(o.subscribe(function(e){var t=tT(e,3),n=(t[0],t[1]),r=t[2],i=l.userModelClasses[n.name],o=l.modelInstanceCreator(i,r);l.storage.runExclusive(function(e){return l.modelMerger.merge(e,o)})})),[3,11];case 10:i||(this.online=i,n.next({type:f.SYNC_ENGINE_NETWORK_STATUS,data:{active:this.online}}),r.forEach(function(e){return e.unsubscribe()}),r=[]),d.label=11;case 11:return e(),[2]}})})})}),this.storage.observe(null,null,tj).filter(function(e){var t=e.model;return!0===s.getModelDefinition(t).syncable}).subscribe({next:function(e){var t=e.opType,r=e.model,o=e.element,a=e.condition;return tA(s,void 0,void 0,function(){var e,s,u,c;return tk(this,function(l){switch(l.label){case 0:return e=this.schema.namespaces[this.namespaceResolver(r)],s=this.modelClasses.MutationEvent,u=function e(t){var n={};return t&&Array.isArray(t.predicates)&&t.predicates.forEach(function(t){var r;if((0,k.w5)(t)){var i=t.field,o=t.operator,s=t.operand;if("id"===i)return;n[i]=((r={})[o]=s,r)}else n[t.type]=e(t)}),n}(a),c=ez(e.relationships,this.getModelDefinition(r),t,r,o,u,s,this.modelInstanceCreator),[4,this.outbox.enqueue(this.storage,c)];case 1:return l.sent(),n.next({type:f.SYNC_ENGINE_OUTBOX_MUTATION_ENQUEUED,data:{model:r,element:o}}),n.next({type:f.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:!1}}),[4,i];case 2:return l.sent(),this.online&&this.mutationsProcessor.resume(),[2]}})})}}),n.next({type:f.SYNC_ENGINE_STORAGE_SUBSCRIBED}),[4,this.outbox.peek(this.storage)];case 4:return o=void 0===a.sent(),n.next({type:f.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:o}}),[4,i];case 5:return a.sent(),n.next({type:f.SYNC_ENGINE_READY}),[2]}})}),function(){r.forEach(function(e){return e.unsubscribe()})}})},e.prototype.getModelsMetadataWithNextFullSync=function(e){return tA(this,void 0,void 0,function(){var t,n=this;return tk(this,function(r){switch(r.label){case 0:return t=Map.bind,[4,this.getModelsMetadata()];case 1:return[2,new(t.apply(Map,[void 0,r.sent().map(function(t){var r=t.namespace,i=t.model,o=t.lastSync,s=t.lastFullSync,a=t.fullSyncInterval;return t.lastSyncPredicate,[n.schema.namespaces[r].models[i],[r,!s||s+a<e?0:o]]})]))]}})})},e.prototype.syncQueriesObservable=function(){var e=this;return this.online?new C.Z(function(t){var n,r;return tA(e,void 0,void 0,function(){var e,i,o=this;return tk(this,function(s){switch(s.label){case 0:e=function(){var e,s,a,u,c,l,d,h,p;return tk(this,function(g){switch(g.label){case 0:return e=new WeakMap,[4,i.getModelsMetadataWithNextFullSync(Date.now())];case 1:return a=new Set((s=g.sent()).keys()),[4,new Promise(function(r){n=o.syncQueriesProcessor.start(s).subscribe({next:function(i){var s=i.namespace,p=i.modelDefinition,g=i.items,y=i.done,v=i.startedAt,b=i.isFullSync;return tA(o,void 0,void 0,function(){var i,o,m,_,w,S=this;return tk(this,function(E){switch(E.label){case 0:return i=this.userModelClasses[p.name],e.has(i)||(e.set(i,{new:0,updated:0,deleted:0}),l=(0,B.Iz)(),h=void 0===h?v:Math.max(h,v)),[4,this.storage.runExclusive(function(t){return tA(S,void 0,void 0,function(){var n,r,o,s,a,u,c,l,f,d,h,p,y,v;return tk(this,function(b){switch(b.label){case 0:return[4,this.outbox.getModelIds(t)];case 1:n=b.sent(),r=[],o=g.filter(function(e){return!n.has(e.id)||(r.push(e),!1)}),s=[],b.label=2;case 2:b.trys.push([2,7,8,9]),u=(a=tN(r)).next(),b.label=3;case 3:if(u.done)return[3,6];return c=u.value,[4,this.modelMerger.merge(t,c)];case 4:void 0!==(l=b.sent())&&s.push([c,l]),b.label=5;case 5:return u=a.next(),[3,3];case 6:return[3,9];case 7:return y={error:b.sent()},[3,9];
1case 8:try{u&&!u.done&&(v=a.return)&&v.call(a)}finally{if(y)throw y.error}return[7];case 9:return d=(f=s.push).apply,h=[s],[4,this.modelMerger.mergePage(t,i,o)];case 10:return d.apply(f,h.concat([tx.apply(void 0,[b.sent()])])),p=e.get(i),s.forEach(function(e){var t=tT(e,2)[1];switch(t){case k.HP.INSERT:p.new++;break;case k.HP.UPDATE:p.updated++;break;case k.HP.DELETE:p.deleted++;break;default:(0,B.y0)(t)}}),[2]}})})})];case 1:if(E.sent(),!y)return[3,4];return o=p.name,[4,this.getModelMetadata(s,o)];case 2:return _=(m=E.sent()).lastFullSync,c=m.fullSyncInterval,u=void 0===u?_:Math.max(u,b?v:_),m=this.modelClasses.ModelMetadata.copyOf(m,function(e){e.lastSync=v,e.lastFullSync=b?v:m.lastFullSync}),[4,this.storage.save(m,void 0,tj)];case 3:E.sent(),w=e.get(i),this.modelSyncedStatus.set(i,!0),t.next({type:f.SYNC_ENGINE_MODEL_SYNCED,data:{model:i,isFullSync:b,isDeltaSync:!b,counts:w}}),a.delete(p),0===a.size&&(d=(0,B.Iz)()-l,r(),t.next({type:f.SYNC_ENGINE_SYNC_QUERIES_READY}),n.unsubscribe()),E.label=4;case 4:return[2]}})})},error:function(e){t.error(e)}}),t.next({type:f.SYNC_ENGINE_SYNC_QUERIES_STARTED,data:{models:Array.from(a).map(function(e){return e.name})}})})];case 2:return g.sent(),p=u+c-(h+d),tR.debug("Next fullSync in "+p/1e3+" seconds. ("+new Date(Date.now()+p)+")"),[4,new Promise(function(e){r=setTimeout(e,p)})];case 3:return g.sent(),[2]}})},i=this,s.label=1;case 1:if(t.closed)return[3,3];return[5,e()];case 2:return s.sent(),[3,1];case 3:return[2]}})}),function(){n&&n.unsubscribe(),r&&clearTimeout(r)}}):C.Z.of()},e.prototype.disconnectionHandler=function(){var e=this;return function(t){(eI.u.CONNECTION_CLOSED===t||eI.u.TIMEOUT_DISCONNECT===t)&&e.datastoreConnectivity.socketDisconnected()}},e.prototype.unsubscribeConnectivity=function(){this.datastoreConnectivity.unsubscribe()},e.prototype.setupModels=function(e){return tA(this,void 0,void 0,function(){var t,n,r,i,o,s,a,u,c,l,f,d=this;return tk(this,function(h){switch(h.label){case 0:t=e.fullSyncInterval,n=this.modelClasses.ModelMetadata,r=[],Object.values(this.schema.namespaces).forEach(function(e){Object.values(e.models).filter(function(e){return e.syncable}
1).forEach(function(t){if(r.push([e.name,t]),e.name===B.xR){var n=d.userModelClasses[t.name];d.modelSyncedStatus.set(n,!1)}})}),o=r.map(function(e){var r=tT(e,2),o=r[0],s=r[1];return tA(d,void 0,void 0,function(){var e,r,a,u,c,l;return tk(this,function(f){switch(f.label){case 0:return[4,this.getModelMetadata(o,s.name)];case 1:if(e=f.sent(),a=(r=j.OY.getPredicates(this.syncPredicates.get(s),!1))?JSON.stringify(r):null,void 0!==e)return[3,3];return[4,this.storage.save(this.modelInstanceCreator(n,{model:s.name,namespace:o,lastSync:null,fullSyncInterval:t,lastFullSync:null,lastSyncPredicate:a}),void 0,tj)];case 2:return c=tT.apply(void 0,[f.sent(),1]),i=tT(c[0],1)[0],[3,5];case 3:return u=(e.lastSyncPredicate?e.lastSyncPredicate:null)!==a,[4,this.storage.save(this.modelClasses.ModelMetadata.copyOf(e,function(e){e.fullSyncInterval=t,u&&(e.lastSync=null,e.lastFullSync=null,e.lastSyncPredicate=a)}))];case 4:l=tT.apply(void 0,[f.sent(),1]),i=tT(l[0],1)[0],f.label=5;case 5:return[2,i]}})})}),s={},h.label=1;case 1:return h.trys.push([1,6,7,8]),[4,Promise.all(o)];case 2:u=(a=tN.apply(void 0,[h.sent()])).next(),h.label=3;case 3:if(u.done)return[3,5];s[(c=u.value).model]=c,h.label=4;case 4:return u=a.next(),[3,3];case 5:return[3,8];case 6:return l={error:h.sent()},[3,8];case 7:try{u&&!u.done&&(f=a.return)&&f.call(a)}finally{if(l)throw l.error}return[7];case 8:return[2,s]}})})},e.prototype.getModelsMetadata=function(){return tA(this,void 0,void 0,function(){var e;return tk(this,function(t){switch(t.label){case 0:return e=this.modelClasses.ModelMetadata,[4,this.storage.query(e)];case 1:return[2,t.sent()]}})})},e.prototype.getModelMetadata=function(e,t){return tA(this,void 0,void 0,function(){var n,r;return tk(this,function(i){switch(i.label){case 0:return n=this.modelClasses.ModelMetadata,r=j.OY.createFromExisting(this.schema.namespaces[B.J3].models[n.name],function(n){return n.namespace("eq",e).model("eq",t)}),[4,this.storage.query(n,r,{page:0,limit:1})];case 1:return[2,tT.apply(void 0,[i.sent(),1])[0]]}})})},e.prototype.getModelDefinition=function(e){var t=this.namespaceResolver(e);return this.schema.namespaces[t].models[e.name]},e.getNamespace=function(){return{name:B.J3,relationships:{},enums:{OperationType:{name:"OperationType",values:["CREATE","UPDATE","DELETE"]}},nonModels:{},models:{MutationEvent:{name:"MutationEvent",pluralName:"MutationEvents",syncable:!1,fields:{id:{name:"id",type:"ID",isRequired:!0,isArray:!1},model:{name:"model",type:"String",isRequired:!0,isArray:!1},data:{name:"data",type:"String",isRequired:!0,isArray:!1},modelId:{name:"modelId",type:"String",isRequired:!0,isArray:!1},operation:{name:"operation",type:{enum:"Operationtype"},isArray:!1,isRequired:!0},condition:{name:"condition",type:"String",isArray:!1,isRequired:!0}}},ModelMetadata:{name:"ModelMetadata",pluralName:"ModelsMetadata",syncable:!1,fields:{id:{name:"id",type:"ID",isRequired:!0,isArray:!1},namespace:{name:"namespace",type:"String",isRequired:!0,isArray:!1},model:{name:"model",type:"String",isRequired:!0,isArray:!1},lastSync:{name:"lastSync",type:"Int",isRequired:!1,isArray:!1},lastFullSync:{name:"lastFullSync",type:"Int",isRequired:!1,isArray:!1},fullSyncInterval:{name:"fullSyncInterval",type:"Int",isRequired:!0,isArray:!1},lastSyncPredicate:{name:"lastSyncPredicate",type:"String",isRequired:!1,isArray:!1}}}}}},e}(),tD=function(){return(tD=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},tL=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},tF=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;
1function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},tB=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},tG=function(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},tq=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(tG(arguments[t]));return e};(0,P.Fl)(!0),(0,P.vI)();var tz=new m.k("DataStore");(0,B.c6)(Date.now());var tW=_.JS.browserOrNode().isNode,tK="schemaVersion",tH=new WeakMap,tY=new WeakMap,tV=function(e){var t=tH.get(e);return d.namespaces[t].models[e.name]},tQ=function(e){return(0,B.hK)(e)&&tH.has(e)},tJ=function(e){return tH.get(e)},tZ=function(){if(void 0===d){var e="Schema is not initialized. DataStore will not function as expected. This could happen if you have multiple versions of DataStore installed. Please see https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js/#check-for-duplicate-versions";throw tz.error(e),Error(e)}},tX=new WeakSet;function t$(e,t){return tX.add(t),new e(t)}function t0(e){return"string"==typeof e}function t1(e){var t=e.localModel,n=e.modelConstructor,r=e.remoteModel._version;return t$(n,tD(tD({},t),{_version:r}))}function t2(e){tz.warn(e)}function t3(e,t){switch(e){case B.cG:n=g[t];break;case B.xR:n=p[t];break;case B.J3:n=h[t];break;case B.P_:n=y[t];break;default:(0,B.y0)(e)}if(tQ(n))return n;var n,r="Model name is not valid for namespace. modelName: "+t+", namespace: "+e;throw tz.error(r),Error(r)}var t4=new(function(){function e(){var e=this;this.Auth=E.g,this.API=b.ZP,this.Cache=I.ZP,this.amplifyConfig={},this.syncPredicates=new WeakMap,this.amplifyContext={Auth:this.Auth,API:this.API,Cache:this.Cache},this.start=function(){return tL(e,void 0,void 0,function(){var e,t,n,r=this;return tF(this,function(i){switch(i.label){case 0:if(void 0!==this.initialized)return[3,1];return tz.debug("Starting DataStore"),this.initialized=new Promise(function(e,t){r.initResolve=e,r.initReject=t}),[3,3];case 1:return[4,this.initialized];case 2:return i.sent(),[2];case 3:return this.storage=new eE(d,tJ,t3,t$,this.storageAdapter,this.sessionId),[4,this.storage.init()];case 4:return i.sent(),tZ(),[4,function(e,t){return tL(this,void 0,void 0,function(){var n,r,i=this;return tF(this,function(o){switch(o.label){case 0:return n=g.Setting,r=d.namespaces[B.cG].models.Setting,[4,e.runExclusive(function(e){return tL(i,void 0,void 0,function(){var i;return tF(this,function(o){switch(o.label){case 0:return[4,e.query(n,j.OY.createFromExisting(r,function(e){return e.key("eq",tK)}),{page:0,limit:1})];case 1:if(!(void 0!==(i=tG.apply(void 0,[o.sent(),1])[0])&&void 0!==i.value))return[3,4];if(!(JSON.parse(i.value)!==t))return[3,3];return[4,e.clear(!1)];case 2:o.sent(),o.label=3;case 3:return[3,6];case 4:return[4,e.save(t$(n,{key:tK,value:JSON.stringify(t)}))];case 5:o.sent(),o.label=6;case 6:return[2]}})})})];case 1:return o.sent(),[2]}})})}(this.storage,d.version)];case 5:if(i.sent(),!(e=this.amplifyConfig.aws_appsync_graphqlEndpoint))return[3,7];return tz.debug("GraphQL endpoint available",e),t=this,[4,this.processSyncExpressions()];case 6:return t.syncPredicates=i.sent(),this.sync=new tU(d,tJ,h,p,this.storage,t$,this.conflictHandler,this.errorHandler,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,this.amplifyContext),n=6e4*this.fullSyncInterval,v=this.sync.start({fullSyncInterval:n}).subscribe({next:function(e){var t=e.type,n=e.data;t===(tW?f.SYNC_ENGINE_SYNC_QUERIES_READY:f.SYNC_ENGINE_STORAGE_SUBSCRIBED)&&r.initResolve(),w.Xb.dispatch("datastore",{event:t,data:n})},error:function(e){tz.warn("Sync error",e),r.initReject()}}),[3,8];case 7:tz.warn("Data won't be synchronized. No GraphQL endpoint configured. Did you forget `Amplify.configure(awsconfig)`?",{config:this.amplifyConfig}),this.initResolve(),i.label=8;case 8:return[4,this.initialized];case 9:return i.sent(),[2]}})})},this.query=function(t,n,r){return tL(e,void 0,void 0,function(){var e,i,o,s,a;return tF(this,function(u){switch(u.label){case 0:return[4,this.start()];case 1:if(u.sent(),!tQ(t))throw e="Constructor is not for a valid model",tz.error(e,{modelConstructor:t}),Error(e);return"string"==typeof n&&void 0!==r&&tz.warn("Pagination is ignored when querying by id"),i=tV(t),o=t0(n)?j.OY.createForId(i,n):(0,j.i)(n)?void 0:j.OY.createFromExisting(i,n),s=this.processPagination(i,r),tz.debug("params ready",{modelConstructor:t,predicate:j.OY.getPredicates(o,!1),pagination:tD(tD({},s),{sort:U.getPredicates(s&&s.sort,!1)})}),[4,this.storage.query(t,o,s)];case 2:return a=u.sent(),[2,t0(n)?a[0]:a]}})})},this.save=function(t,n){return tL(e,void 0,void 0,function(){var e,r,i,o,s,a=this;return tF(this,function(u){switch(u.label){case 0:return[4,this.start()];case 1:if(u.sent(),e=tY.get(t),!tQ(r=t?t.constructor:void 0))throw i="Object is not an instance of a valid model",tz.error(i,{model:t}),Error(i);return o=tV(r),s=j.OY.createFromExisting(o,n),[4,this.storage.runExclusive(function(n){return tL(a,void 0,void 0,function(){return tF(this,function(i){switch(i.label){case 0:return[4,n.save(t,s,void 0,e)];case 1:return i.sent(),[2,n.query(r,j.OY.createForId(o,t.id))]}})})})];case 2:return[2,tG.apply(void 0,[u.sent(),1])[0]]}})})},this.setConflictHandler=function(t){var n=t.DataStore;return n&&n.conflictHandler?n.conflictHandler:e.conflictHandler===t1&&t.conflictHandler?t.conflictHandler:e.conflictHandler||t1},this.setErrorHandler=function(t){var n=t.DataStore;return n&&n.errorHandler?n.errorHandler:e.errorHandler===t2&&t.errorHandler?t.errorHandler:e.errorHandler||t2},this.delete=function(t,n){return tL(e,void 0,void 0,function(){var e,r,i,o,s,a,u;return tF(this,function(c){switch(c.label){case 0:return[4,this.start()];case 1:if(c.sent(),!t)throw r="Model or Model Constructor required",tz.error(r,{modelOrConstructor:t}),Error(r);if(!tQ(t))return[3,3];if(i=t,!n)throw r="Id to delete or criteria required. Do you want to delete all? Pass Predicates.ALL",tz.error(r,{idOrCriteria:n}),Error(r);if("string"==typeof n)e=j.OY.createForId(tV(i),n);else if(!(e=j.OY.createFromExisting(tV(i),n))||!j.OY.isValidPredicate(e))throw r="Criteria required. Do you want to delete all? Pass Predicates.ALL",tz.error(r,{condition:e}),Error(r);return[4,this.storage.delete(i,e)];case 2:return[2,tG.apply(void 0,[c.sent(),1])[0]];case 3:if(!tQ(i=Object.getPrototypeOf((o=t)||{}).constructor))throw r="Object is not an instance of a valid model",tz.error(r,{model:o}),Error(r);if(s=tV(i),a=j.OY.createForId(s,o.id),n){if("function"!=typeof n)throw r="Invalid criteria",tz.error(r,{idOrCriteria:n}),Error(r);e=n(a)}else e=a;return[4,this.storage.delete(o,e)];case 4:return u=tG.apply(void 0,[c.sent(),1]),[2,tG(u[0],1)[0]]}})})},this.observe=function(t,n){var r,i=t&&tQ(t)?t:void 0;if(t&&void 0===i){var o=t&&Object.getPrototypeOf(t).constructor;if(tQ(o))return n&&tz.warn("idOrCriteria is ignored when using a model instance",{model:t,idOrCriteria:n}),e.observe(o,t.id);var s="The model is not an instance of a PersistentModelConstructor";throw tz.error(s,{model:t}),Error(s)}if(void 0!==n&&void 0===i){var s="Cannot provide criteria without a modelConstructor";throw tz.error(s,n),Error(s)}if(i&&!tQ(i)){var s="Constructor is not for a valid model";throw tz.error(s,{modelConstructor:i}),Error(s)}return r="string"==typeof n?j.OY.createForId(tV(i),n):i&&j.OY.createFromExisting(tV(i),n),new C.Z(function(t){var n;return tL(e,void 0,void 0,function(){var e=this;return tF(this,function(o){switch(o.label){case 0:return[4,this.start()];case 1:return o.sent(),n=this.storage.observe(i,r).filter(function(e){return tJ(e.model)===B.xR}).subscribe({next:function(n){return tL(e,void 0,void 0,function(){var e,r;return tF(this,function(i){switch(i.label){case 0:if(e=n,!("DELETE"!==n.opType))return[3,2];
1return[4,this.query(n.model,n.element.id)];case 1:r=i.sent(),e=tD(tD({},e),{element:r}),i.label=2;case 2:return t.next(e),[2]}})})},error:function(e){return t.error(e)},complete:function(){return t.complete()}}),[2]}})}),function(){n&&n.unsubscribe()}})},this.observeQuery=function(t,n,r){return new C.Z(function(i){var o,s,a=new Map,u=new Map,c=[],l=function(){S(_())},d=new B.Dm({callback:l,errorHandler:i.error,maxInterval:2e3}),h=(r||{}).sort,p=h?{sort:h}:void 0,g=tV(t);s=t0(n)?j.OY.createForId(g,n):(0,j.i)(n)?void 0:j.OY.createFromExisting(g,n);var y=j.OY.getPredicates(s,!1)||{},v=y.predicates,b=y.type,m=!!v;tL(e,void 0,void 0,function(){var e,r=this;return tF(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,this.query(t,n,p)];case 1:return s.sent().forEach(function(e){return a.set(e.id,e)}),o=this.observe(t).subscribe(function(e){var t,n,i=e.element,o=e.model,s=e.opType;if(m&&!(0,B.u8)(i,b,v)){if(!("UPDATE"===s&&(a.has(i.id)||u.has(i.id))))return;c.push(i.id)}"DELETE"===s?c.push(i.id):u.set(i.id,i);var l=null!==(n=null===(t=r.sync)||void 0===t?void 0:t.getModelSyncedStatus(o))&&void 0!==n&&n;(u.size-c.length>=r.syncPageSize||l)&&d.resolve(),d.start()}),l(),[3,3];case 2:return e=s.sent(),i.error(e),[3,3];case 3:return[2]}})});var _=function(){var n,i,o=null!==(i=null===(n=e.sync)||void 0===n?void 0:n.getModelSyncedStatus(t))&&void 0!==i&&i,s=tq(Array.from(a.values()),Array.from(u.values()));return(null==r?void 0:r.sort)&&E(s),a.clear(),s.forEach(function(e){return a.set(e.id,e)}),c.forEach(function(e){return a.delete(e)}),{items:Array.from(a.values()),isSynced:o}},S=function(e){i.next(e),u.clear(),c=[]},E=function(n){var i=tV(t),o=e.processPagination(i,r),s=U.getPredicates(o.sort);if(s.length){var a=(0,B.z8)(s);n.sort(a)}},I=function(e){var n,r=e.payload,i=r.event,o=r.data;i===f.SYNC_ENGINE_MODEL_SYNCED&&(null===(n=null==o?void 0:o.model)||void 0===n?void 0:n.name)===t.name&&(l(),w.Xb.remove("api",I))};return w.Xb.listen("datastore",I),function(){o&&o.unsubscribe()}})},this.configure=function(t){void 0===t&&(t={}),e.amplifyContext.Auth=e.Auth,e.amplifyContext.API=e.API,e.amplifyContext.Cache=e.Cache;var n,r=t.DataStore,i=t.authModeStrategyType,o=(t.conflictHandler,t.errorHandler,t.maxRecordsToSync),s=t.syncPageSize,a=t.fullSyncInterval,u=t.syncExpressions,c=t.authProviders,l=t.storageAdapter,f=tB(t,["DataStore","authModeStrategyType","conflictHandler","errorHandler","maxRecordsToSync","syncPageSize","fullSyncInterval","syncExpressions","authProviders","storageAdapter"]);switch(e.amplifyConfig=tD(tD({},f),e.amplifyConfig),e.conflictHandler=e.setConflictHandler(t),e.errorHandler=e.setErrorHandler(t),r&&r.authModeStrategyType||i||k.sE.DEFAULT){case k.sE.MULTI_AUTH:e.authModeStrategy=(n=e.amplifyContext,function(e){var t,r,i,o,s=e.schema,a=e.modelName;return t=void 0,r=void 0,i=void 0,o=function(){var e,t,r,i,o;return T(this,function(u){switch(u.label){case 0:n.Auth=n.Auth||O.ZP,u.label=1;case 1:return u.trys.push([1,3,,4]),[4,n.Auth.currentAuthenticatedUser()];case 2:return e=u.sent(),[3,4];case 3:return u.sent(),[3,4];case 4:if((t=s.namespaces.user.models[a].attributes)&&(null===(o=null==(r=t.find(function(e){return"auth"===e.type}))?void 0:r.properties)||void 0===o?void 0:o.rules)){var c,l,f,d,h,p,g;return c=r.properties.rules,l=[k.Yq.CUSTOM,k.Yq.OWNER,k.Yq.GROUPS,k.Yq.PRIVATE,k.Yq.PUBLIC],f=[k.j6.FUNCTION,k.j6.USER_POOLS,k.j6.OIDC,k.j6.IAM,k.j6.API_KEY],i=x(c).sort(function(e,t){return e.allow===t.allow?f.indexOf(M(e))-f.indexOf(M(t)):l.indexOf(e.allow)-l.indexOf(t.allow)}),[2,(h=(d={currentUser:e,rules:i}).rules,p=d.currentUser,g=new Set,h.forEach(function(e){switch(e.allow){case k.Yq.CUSTOM:e.provider&&e.provider!==k.j6.FUNCTION||g.add(A.si.AWS_LAMBDA);break;case k.Yq.GROUPS:case k.Yq.OWNER:p&&(e.provider===k.j6.USER_POOLS?g.add(A.si.AMAZON_COGNITO_USER_POOLS):e.provider===k.j6.OIDC&&g.add(A.si.OPENID_CONNECT));break;case k.Yq.PRIVATE:p&&(e.provider&&e.provider!==k.j6.USER_POOLS?e.provider===k.j6.IAM&&g.add(A.si.AWS_IAM):g.add(A.si.AMAZON_COGNITO_USER_POOLS));break;case k.Yq.PUBLIC:e.provider===k.j6.IAM?g.add(A.si.AWS_IAM):e.provider&&e.provider!==k.j6.API_KEY||g.add(A.si.API_KEY)}}),Array.from(g))]}return[2,[]]}})}
1,new(i||(i=Promise))(function(e,n){function s(e){try{u(o.next(e))}catch(e){n(e)}}function a(e){try{u(o.throw(e))}catch(e){n(e)}}function u(t){var n;t.done?e(t.value):((n=t.value)instanceof i?n:new i(function(e){e(n)})).then(s,a)}u((o=o.apply(t,r||[])).next())})});break;case k.sE.DEFAULT:default:e.authModeStrategy=R}e.amplifyConfig.authProviders=r&&r.authProviders||c,e.syncExpressions=r&&r.syncExpressions||u||e.syncExpressions,e.maxRecordsToSync=r&&r.maxRecordsToSync||o||e.maxRecordsToSync||1e4,e.amplifyConfig.maxRecordsToSync=e.maxRecordsToSync,e.syncPageSize=r&&r.syncPageSize||s||e.syncPageSize||1e3,e.amplifyConfig.syncPageSize=e.syncPageSize,e.fullSyncInterval=r&&r.fullSyncInterval||a||e.fullSyncInterval||1440,e.storageAdapter=r&&r.storageAdapter||l||e.storageAdapter||void 0,e.sessionId=e.retrieveSessionId()},this.clear=function(){return tL(this,void 0,void 0,function(){return tF(this,function(e){switch(e.label){case 0:if(tZ(),void 0!==this.storage)return[3,2];return this.storage=new eE(d,tJ,t3,t$,this.storageAdapter,this.sessionId),[4,this.storage.init()];case 1:e.sent(),e.label=2;case 2:return v&&!v.closed&&v.unsubscribe(),[4,this.storage.clear()];case 3:return e.sent(),this.sync&&this.sync.unsubscribeConnectivity(),this.initialized=void 0,this.storage=void 0,this.sync=void 0,this.syncPredicates=new WeakMap,[2]}})})},this.stop=function(){return tL(this,void 0,void 0,function(){return tF(this,function(e){switch(e.label){case 0:if(!(void 0!==this.initialized))return[3,2];return[4,this.start()];case 1:e.sent(),e.label=2;case 2:return v&&!v.closed&&v.unsubscribe(),this.sync&&this.sync.unsubscribeConnectivity(),this.initialized=void 0,this.sync=void 0,[2]}})})}}return e.prototype.getModuleName=function(){return"DataStore"},e.prototype.processPagination=function(e,t){var n,r=t||{},i=r.limit,o=r.page,s=r.sort;if(void 0!==i||void 0!==o||void 0!==s){if(void 0!==o&&void 0===i)throw Error("Limit is required when requesting a page");if(void 0!==o){if("number"!=typeof o)throw Error("Page should be a number");if(o<0)throw Error("Page can't be negative")}if(void 0!==i){if("number"!=typeof i)throw Error("Limit should be a number");if(i<0)throw Error("Limit can't be negative")}return s&&(n=U.createFromExisting(e,t.sort)),{limit:i,page:o,sort:n}}},e.prototype.processSyncExpressions=function(){return tL(this,void 0,void 0,function(){var e,t=this;return tF(this,function(n){switch(n.label){case 0:if(!this.syncExpressions||!this.syncExpressions.length)return[2,new WeakMap];return[4,Promise.all(this.syncExpressions.map(function(e){return tL(t,void 0,void 0,function(){var t,n,r,i,o,s;return tF(this,function(a){switch(a.label){case 0:return[4,e];case 1:return n=(t=a.sent()).modelConstructor,r=t.conditionProducer,i=tV(n),[4,this.unwrapPromise(r)];case 2:if(o=a.sent(),(0,j.i)(o))return[2,[i,null]];return s=this.createFromCondition(i,o),[2,[i,s]]}})})}))];case 1:return e=n.sent(),[2,this.weakMapFromEntries(e)]}})})},e.prototype.createFromCondition=function(e,t){try{return j.OY.createFromExisting(e,t)}catch(e){throw tz.error("Error creating Sync Predicate"),e}},e.prototype.unwrapPromise=function(e){return tL(this,void 0,void 0,function(){var t;return tF(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,e()];case 1:return[2,n.sent()];case 2:if((t=n.sent())instanceof TypeError)return[2,e];throw t;case 3:return[2]}})})},e.prototype.weakMapFromEntries=function(e){return e.reduce(function(e,t){var n=tG(t,2),r=n[0],i=n[1];if(e.has(r)){var o=r.name;return tz.warn("You can only utilize one Sync Expression per model.\n          Subsequent sync expressions for the "+o+" model will be ignored."),e}return i&&e.set(r,i),e},new WeakMap)},e.prototype.retrieveSessionId=function(){try{var e=sessionStorage.getItem("datastoreSessionId");if(e){var t=this.amplifyConfig.aws_appsync_graphqlEndpoint.split("/")[2],n=tG(t.split("."),1)[0];return e+"-"+n}}catch(e){return}},e}());S.dQ.register(t4)},47279:function(e,t,n){"use strict";n.d(t,{OY:function(){return a},gA:function(){return s},i:function(){return o}});var r=n(64944),i=new WeakSet;function o(e){return i.has(e)}Symbol("A predicate that matches all records");var s=function(){function e(){}return Object.defineProperty(e,"ALL",{get:function(){var e=function(e){return e};return i.add(e),e},enumerable:!0,configurable:!0}),e}(),a=function(){function e(){}return e.createPredicateBuilder=function(t){var n,i=t.name,o=new Set(Object.keys(t.fields)),s=new Proxy({},n={get:function(t,s,a){switch(s){case"and":case"or":case"not":return function(t){var r={type:s,predicates:[]},i=new Proxy({},n);return e.predicateGroupsMap.set(i,r),t(i),e.predicateGroupsMap.get(a).predicates.push(r),a};default:(0,r.y0)(s,!1)}if(!o.has(s))throw Error("Invalid field for model. field: "+s+", model: "+i);return function(t,n){return e.predicateGroupsMap.get(a).predicates.push({f
1ield:s,operator:t,operand:n}),a}}});return e.predicateGroupsMap.set(s,{type:"and",predicates:[]}),s},e.isValidPredicate=function(t){return e.predicateGroupsMap.has(t)},e.getPredicates=function(t,n){if(void 0===n&&(n=!0),n&&!e.isValidPredicate(t))throw Error("The predicate is not valid");return e.predicateGroupsMap.get(t)},e.createFromExisting=function(t,n){if(n&&t)return n(e.createPredicateBuilder(t))},e.createForId=function(t,n){return e.createPredicateBuilder(t).id("eq",n)},e.predicateGroupsMap=new WeakMap,e}()},42734:function(e,t,n){"use strict";n.d(t,{$v:function(){return T},BV:function(){return A},Fr:function(){return O},G9:function(){return M},HP:function(){return v},I7:function(){return k},K5:function(){return j},S6:function(){return R},Sr:function(){return m},V9:function(){return E},Yq:function(){return p},Z1:function(){return w},aQ:function(){return C},fI:function(){return b},g5:function(){return N},j6:function(){return g},sE:function(){return _},tv:function(){return S},w5:function(){return x}});var r,i,o,s,a,u,c,l,f,d,h,p,g,y,v,b,m,_,w,S,E,I=n(64944),P=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};function C(e){return e&&void 0!==e.pluralName}function O(e){return e&&e.targetName}function A(e){return e&&void 0!==y[e]}function k(e){return!!e&&!!e.model}function T(e){return!!e&&!!e.nonModel}function N(e){return!!e&&!!e.enum}function x(e){return e&&void 0!==e.field}function M(e){return e&&void 0!==e.type}function R(e,t){var n,r,i,o;return n=this,r=void 0,i=void 0,o=function(){return P(this,function(n){return[2,{modelConstructor:e,conditionProducer:t}]})},new(i||(i=Promise))(function(e,t){function s(e){try{u(o.next(e))}catch(e){t(e)}}function a(e){try{u(o.throw(e))}catch(e){t(e)}}function u(t){var n;t.done?e(t.value):((n=t.value)instanceof i?n:new i(function(e){e(n)})).then(s,a)}u((o=o.apply(n,r||[])).next())})}(r=p||(p={})).CUSTOM="custom",r.OWNER="owner",r.GROUPS="groups",r.PRIVATE="private",r.PUBLIC="public",(i=g||(g={})).FUNCTION="function",i.USER_POOLS="userPools",i.OIDC="oidc",i.IAM="iam",i.API_KEY="apiKey",(o=y||(y={}))[o.ID=0]="ID",o[o.String=1]="String",o[o.Int=2]="Int",o[o.Float=3]="Float",o[o.Boolean=4]="Boolean",o[o.AWSDate=5]="AWSDate",o[o.AWSTime=6]="AWSTime",o[o.AWSDateTime=7]="AWSDateTime",o[o.AWSTimestamp=8]="AWSTimestamp",o[o.AWSEmail=9]="AWSEmail",o[o.AWSJSON=10]="AWSJSON",o[o.AWSURL=11]="AWSURL",o[o.AWSPhone=12]="AWSPhone",o[o.AWSIPAddress=13]="AWSIPAddress",(s=y||(y={})).getJSType=function(e){switch(e){case"Boolean":return"boolean";case"ID":case"String":case"AWSDate":case"AWSTime":case"AWSDateTime":case"AWSEmail":case"AWSURL":case"AWSPhone":case"AWSIPAddress":return"string";case"Int":case"Float":case"AWSTimestamp":return"number";case"AWSJSON":return"object";default:(0,I.y0)(e)}},s.getValidationFunction=function(e){switch(e){case"AWSDate":return I.pP;case"AWSTime":return I.Ro;case"AWSDateTime":return I.wp;case"AWSTimestamp":return I.D7;case"AWSEmail":return I.M9;case"AWSJSON":return I.nd;case"AWSURL":return I.Zu;case"AWSPhone":return I.iA;case"AWSIPAddress":return I.mY;default:return}},(a=v||(v={})).INSERT="INSERT",a.UPDATE="UPDATE",a.DELETE="DELETE",(u=b||(b={}))[u.FIRST=0]="FIRST",u[u.LAST=1]="LAST",(c=m||(m={})).ASCENDING="ASCENDING",c.DESCENDING="DESCENDING",(l=_||(_={})).DEFAULT="DEFAULT",l.MULTI_AUTH="MULTI_AUTH",(f=w||(w={}
1)).CREATE="CREATE",f.READ="READ",f.UPDATE="UPDATE",f.DELETE="DELETE",(d=S||(S={})).sync="sync",d.mutate="mutate",d.subscribe="subscribe";var j=Symbol("DISCARD");(h=E||(E={})).LIMIT="LIMIT",h.TIMER="TIMER"},64944:function(e,t,n){"use strict";n.d(t,{D0:function(){return T},D7:function(){return L},Dm:function(){return K},Iz:function(){return M},J3:function(){return b},M9:function(){return F},N6:function(){return _},NA:function(){return k},P_:function(){return m},Ro:function(){return U},Vg:function(){return function e(t,n,r){void 0===r&&(r=!1);var i,o,s,a,u=t,c=n;if(u instanceof Object&&!(c instanceof Object)||!(u instanceof Object)&&c instanceof Object)return!1;if(!(u instanceof Object))return!!r&&(i=u,o=c,null==i&&null==o)||u===c;if(Array.isArray(u)&&!Array.isArray(c)||Array.isArray(c)&&!Array.isArray(u))return!1;u instanceof Set&&c instanceof Set&&(u=p(u),c=p(c)),u instanceof Map&&c instanceof Map&&(u=Object.fromEntries(u),c=Object.fromEntries(c));var l=Object.keys(u),f=Object.keys(c);if(l.length!==f.length&&(!r||Array.isArray(u)))return!1;var d=l.length>=f.length?l:f;try{for(var h=g(d),y=h.next();!y.done;y=h.next()){var v=y.value,b=u[v],m=c[v];if(!e(b,m,r))return!1}}catch(e){s={error:e}}finally{try{y&&!y.done&&(a=h.return)&&a.call(h)}finally{if(s)throw s.error}}return!0}},Zu:function(){return G},c6:function(){return x},cG:function(){return y},hK:function(){return P},iA:function(){return q},jl:function(){return O},mY:function(){return z},nd:function(){return B},pP:function(){return j},rw:function(){return A},u8:function(){return E},wp:function(){return D},xR:function(){return v},y0:function(){return w},z8:function(){return R}});var r,i,o,s=n(94706),a=n(54355),u=n(63143),c=n(42734),l=n(23615),f=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},d=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},h=function(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},p=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(h(arguments[t]));return e},g=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};(r=i||(i={})).DATASTORE="datastore",r.USER="user",r.SYNC="sync",r.STORAGE="storage";var y=i.DATASTORE,v=i.USER,b=i.SYNC,m=i.STORAGE,_="/DataStore",w=function(e,t){if(void 0===t&&(t=!0),t)throw Error("Invalid "+e)},S=function(e){return void 0===e||null==e},E=function(e,t,n){var r,i=!1;if(0===n.length)return!0;switch(t){case"not":r="every",i=!0;break;case"and":r="every";break;case"or":r="some";break;default:w(t)}var o=n[r](function(t){if((0,c.w5)(t)){var n=t.field,r=t.operator,i=t.operand;return I(e[n],r,i)}if((0,c.G9)(t))return E(e,t.type,t.predicates);throw Error("Not a predicate or group")});return i?!o:o},I=function(e,t,n){switch(t){case"ne":return e!==n;case"eq":return e===n;case"le":return e<=n;case"lt":return e<n;case"ge":return e>=n;case"gt":return e>n;
1case"between":var r=h(n,2),i=r[0],o=r[1];return e>=i&&e<=o;case"beginsWith":return!S(e)&&e.startsWith(n);case"contains":return!S(e)&&e.indexOf(n)>-1;case"notContains":return S(e)||-1===e.indexOf(n);default:return w(t,!1),!1}},P=function(e){return e&&"function"==typeof e.copyOf};new WeakSet;var C=new WeakMap,O=function(e,t,n,r,i){var o=n.relationships,s=i(n.name,e),a=o[e],u=[],c=s.copyOf(t,function(e){a.relationTypes.forEach(function(o){var s=i(n.name,o.modelName);switch(o.relationType){case"HAS_ONE":if(t[o.fieldName]){var a=void 0;try{a=r(s,t[o.fieldName])}catch(e){console.log(e)}u.push({modelName:o.modelName,item:t[o.fieldName],instance:a}),o.targetName?(e[o.targetName]=e[o.fieldName].id,delete e[o.fieldName]):e[o.fieldName]=e[o.fieldName].id}break;case"BELONGS_TO":if(t[o.fieldName]){var a=void 0;try{a=r(s,t[o.fieldName])}catch(e){}e[o.fieldName]._deleted||u.push({modelName:o.modelName,item:t[o.fieldName],instance:a})}e[o.fieldName]&&(e[o.targetName]=e[o.fieldName].id,delete e[o.fieldName]);break;case"HAS_MANY":break;default:w(o.relationType)}})});u.unshift({modelName:e,item:c,instance:c}),C.has(n)||C.set(n,Array.from(n.modelTopologicalOrdering.keys()));var l=C.get(n);return u.sort(function(e,t){return l.indexOf(e.modelName)-l.indexOf(t.modelName)}),u},A=function(e,t){var n="";return e.some(function(e){e.modelName===t&&(n=e.targetName)}),n},k=function(e,t){return e.find(function(e){return e===t})},T=function(){return new Promise(function(e){var t,n=(0,u.v4)(),r=function(){o=!1,e(!0)},i=function(){return f(void 0,void 0,void 0,function(){return d(this,function(r){switch(r.label){case 0:if(!(t&&t.result&&"function"==typeof t.result.close))return[3,2];return[4,t.result.close()];case 1:r.sent(),r.label=2;case 2:return[4,indexedDB.deleteDatabase(n)];case 3:return r.sent(),o=!0,[2,e(!1)]}})})};return!0===o?i():!1===o||null===indexedDB?r():void((t=indexedDB.open(n)).onerror=r,t.onsuccess=i)})},N=function(){return s.lW.from(new l.Ic().random(1).toString(),"hex").readUInt8(0)/255};function x(e){var t=(0,a.tn)(N);return function(){return t(e)}}function M(){return"undefined"!=typeof performance&&performance&&"function"==typeof performance.now?0|performance.now():Date.now()}function R(e){return function(t,n){var r,i;try{for(var o=g(e),s=o.next();!s.done;s=o.next()){var a=s.value,u=a.field,l=a.sortDirection===c.Sr.ASCENDING?1:-1;if(t[u]<n[u])return -1*l;if(t[u]>n[u])return 1*l}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return 0}}var j=function(e){return!!/^\d{4}-\d{2}-\d{2}(Z|[+-]\d{2}:\d{2}($|:\d{2}))?$/.exec(e)},U=function(e){return!!/^\d{2}:\d{2}(:\d{2}(.\d+)?)?(Z|[+-]\d{2}:\d{2}($|:\d{2}))?$/.exec(e)},D=function(e){return!!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(.\d+)?)?(Z|[+-]\d{2}:\d{2}($|:\d{2}))?$/.exec(e)},L=function(e){return!!/^\d+$/.exec(String(e))},F=function(e){return!!/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.exec(e)},B=function(e){try{return JSON.parse(e),!0}catch(e){return!1}},G=function(e){try{return new URL(e),!0}catch(e){return!1}},q=function(e){return!!/^\+?\d[\d\s-]+$/.exec(e)},z=function(e){return!!/((^((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))$)|(^((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?$))$/.exec(e)},W=function(){var e=this;this.promise=new Promise(function(t,n){e.resolve=t,e.reject=n})},K=function(){function e(e){this.limitPromise=new W,this.raceInFlight=!1,this.callback=function(){},this.defaultErrorHandler=function(e){throw void 0===e&&(e="DeferredCallbackResolver error"),Error(e)},this.callback=e.callback,this.errorHandler=e.errorHandler||this.defaultErrorHandler,this.maxInterval=e.maxInterval||2e3}return e.prototype.startTimer=function(){var e=this;this.timerPromise=new Promise(function(t,n){e.timer=setTimeout(function(){t(c.V9.TIMER)},e.maxInterval)})},e.prototype.racePromises=function(){return f(this,void 0,void 0,function(){var e,t;return d(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,3,4]),this.raceInFlight=!0,this.startTimer(),[4,Promise.race([this.timerPromise,this.limitPromise.promise])];case 1:return e=n.sent(),this.callback(),[3,4];case 2:return t=n.sent(),this.errorHandler(t),[3,4];case 3:return this.clear(),this.raceInFlight=!1,this.limitPromise=new W,[2,e];case 4:return[2]}})})},e.prototype.start=function(){this.raceInFlight||this.racePromises()},e.prototype.clear=function(){clearTimeout(this.timer)},e.prototype.resolve=function(){this.limitPromise.resolve(c.V9.LIMIT)},e}()},32098:function(e,t,n){"use strict";n.d(t,{l:function(){return M}});var r=n(25049),i=n(52674),o=n(30587),s=n(67713),a=n.n(s),u=n(15047),c=n(22485),l=n(82577),f=n(98874),d=n(62044),h=n(40257),p=n(46396),g=n(33772),y=n(68623),v=n(87850),b=function(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 m(e,t){if(!Number.isFinite(e)||!Number.isFinite(t))throw Error("Invalid coordinates: ["+e+","+t+"]");if(t<-90||90<t)throw Error("Latitude must be between -90 and 90 degrees inclusive.");if(e<-180||180<e)throw Error("Longitude must be between -180 and 180 degrees inclusive.")}function _(e){if(!/^[-._\p{L}\p{N}]+$/iu.test(e))throw Error("Invalid geofenceId: '"+e+"' - IDs can only contain alphanumeric characters, hyphens, underscores and periods.")}function w(e,t){var n=t?t+": ":"";if(e.length<4)throw Error(n+"LinearRing must contain 4 or more coordinates.");var r=[];if(e.forEach(function(e){try{m(e[0],e[1])}catch(t){r.push({coordinates:e,error:t.message})}}),r.length>0)throw Error(n+"One or more of the coordinates in the Polygon LinearRing are not valid: "+JSON.stringify(r));var i=b(e[0],2),o=i[0],s=i[1],a=b(e[e.length-1],2),u=a[0],c=a[1];if(o!==u||s!==c)throw Error(n+"LinearRing's first and last coordinates are not the same");if((0,v.Z)(e))throw Error(n+"LinearRing coordinates must be wound counterclockwise")}
1var S=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},E=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},I=function(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},P=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(I(arguments[t]));return e},C=new r.k("AmazonLocationServiceProvider"),O=function(){function e(e){this._config=e||{},C.debug("Geo Options",this._config)}return e.prototype.getCategory=function(){return e.CATEGORY},e.prototype.getProviderName=function(){return e.PROVIDER_NAME},e.prototype.configure=function(e){return C.debug("configure Amazon Location Service Provider",e),e&&(this._config=Object.assign({},this._config,e)),this._config},e.prototype.getAvailableMaps=function(){this._verifyMapResources();var e=[],t=this._config.maps.items,n=this._config.region;for(var r in t){var i=t[r].style;e.push({mapName:r,style:i,region:n})}return e},e.prototype.getDefaultMap=function(){this._verifyMapResources();var e=this._config.maps.default,t=this._config.maps.items[e].style;return{mapName:e,style:t,region:this._config.region}},e.prototype.searchByText=function(e,t){return S(this,void 0,void 0,function(){var n,r,i,o,s,c;return E(this,function(d){switch(d.label){case 0:return[4,this._ensureCredentials()];case 1:if(!d.sent())throw Error("No credentials");if(this._verifySearchIndex(null==t?void 0:t.searchIndexName),n={Text:e,IndexName:this._config.search_indices.default},t){if(n.FilterCountries=t.countries,n.MaxResults=t.maxResults,t.searchIndexName&&(n.IndexName=t.searchIndexName),t.biasPosition&&t.searchAreaConstraints)throw Error("BiasPosition and SearchAreaConstraints are mutually exclusive, please remove one or the other from the options object");t.biasPosition&&(n.BiasPosition=t.biasPosition),t.searchAreaConstraints&&(n.FilterBBox=t.searchAreaConstraints)}r=new l.l({credentials:this._config.credentials,region:this._config.region,customUserAgent:(0,u.Zm)()}),i=new f.r(n),d.label=2;case 2:return d.trys.push([2,4,,5]),[4,r.send(i)];case 3:return o=d.sent(),[3,5];case 4:throw s=d.sent(),C.debug(s),s;case 5:return c=o.Results.map(function(e){return e.Place}),[2,a()(c,{deep:!0})]}})})},e.prototype.searchByCoordinates=function(e,t){return S(this,void 0,void 0,function(){var n,r,i,o,s,c;return E(this,function(f){switch(f.label){case 0:return[4,this._ensureCredentials()];case 1:if(!f.sent())throw Error("No credentials");this._verifySearchIndex(null==t?void 0:t.searchIndexName),n={Position:e,IndexName:this._config.search_indices.default},t&&(t.searchIndexName&&(n.IndexName=t.searchIndexName),n.MaxResults=t.maxResults),r=new l.l({credentials:this._config.credentials,region:this._config.region,customUserAgent:(0,u.Zm)()}),i=new d.n(n),f.label=2;case 2:return f.trys.push([2,4,,5]),[4,r.send(i)];case 3:return o=f.sent(),[3,5];case 4:throw s=f.sent(),C.debug(s),s;case 5:return c=o.Results.map(function(e){return e.Place}),[2,a()(c[0],{deep:!0})]}})})},e.prototype.saveGeofences=function(e,t){return S(this,void 0,void 0,function(){var n,r,i,o=this;return E(this,function(s){switch(s.label){case 0:if(e.length<1)throw Error("Geofence input array is empty");return[4,this._ensureCredentials()];case 1:if(!s.sent())throw Error("No credentials");try{this._verifyGeofenceCollections(null==t?void 0:t.collectionName)}catch(e){throw C.debug(e),e}for(function(e){var t={};e.forEach(function(e){if(!e.geofenceId)throw Error("Geofence '"+e+"' is missing geofenceId");var n=e.geofenceId;if(_(n),t[n])throw Error("Duplicate geofenceId: "+n);if(t[n]=!0,!e.geometry)throw Error("Geofence '"+n+"' is missing geometry");var r=e.geometry;if(!r.polygon)throw Error("Geofence '"+n+"' is missing geometry.polygon");var i=r.polygon;try{!function(e,t){var n=t?t+": ":"";if(!Array.isArray(e))throw Error(n+"Polygon is of incorrect structure. It should be an array of LinearRings");if(e.length<1)throw Error(n+"Polygon must have a single LinearRing array.");if(e.length>1)throw Error(n+"Polygon must have a single LinearRing array. Note: We do not currently support polygons with holes, multipolygons, polygons that are wound clockwise, or that cross the antimeridian.");
1if(e.reduce(function(e,t){return e+t.length},0)>1e3)throw Error(n+"Polygon has more than the maximum 1000 vertices.");e.forEach(function(e){w(e,t)})}(i,n)}catch(e){if(e.message.includes("Polygon has more than the maximum 1000 vertices."))throw Error("Geofence '"+n+"' has more than the maximum of 1000 vertices")}w(b(i,1)[0],n)})}(e),n=e.map(function(e){return{GeofenceId:e.geofenceId,Geometry:{Polygon:e.geometry.polygon}}}),r={successes:[],errors:[]},i=[];n.length>0;)i.push(n.splice(0,10));return[4,Promise.all(i.map(function(e){return S(o,void 0,void 0,function(){var n,i;return E(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this._AmazonLocationServiceBatchPutGeofenceCall(e,(null==t?void 0:t.collectionName)||this._config.geofenceCollections.default)];case 1:return n=o.sent(),[3,3];case 2:return i=o.sent(),e.forEach(function(e){r.errors.push({geofenceId:e.GeofenceId,error:{code:"APIConnectionError",message:i.message}})}),[2];case 3:return n.Successes.forEach(function(e){var t=e.GeofenceId,n=e.CreateTime,i=e.UpdateTime;r.successes.push({geofenceId:t,createTime:n,updateTime:i})}),n.Errors.forEach(function(e){var t=e.Error,n=t.Code,i=t.Message,o=e.GeofenceId;r.errors.push({error:{code:n,message:i},geofenceId:o})}),[2]}})})}))];case 2:return s.sent(),[2,r]}})})},e.prototype.getGeofence=function(e,t){return S(this,void 0,void 0,function(){var n,r,i,o,s,a,c,f,d;return E(this,function(p){switch(p.label){case 0:return[4,this._ensureCredentials()];case 1:if(!p.sent())throw Error("No credentials");try{this._verifyGeofenceCollections(null==t?void 0:t.collectionName)}catch(e){throw C.debug(e),e}_(e),n=new l.l({credentials:this._config.credentials,region:this._config.region,customUserAgent:(0,u.Zm)()}),r={GeofenceId:e,CollectionName:(null==t?void 0:t.collectionName)||this._config.geofenceCollections.default},i=new h.R(r),p.label=2;case 2:return p.trys.push([2,4,,5]),[4,n.send(i)];case 3:return o=p.sent(),[3,5];case 4:throw s=p.sent(),C.debug(s),s;case 5:return a=o.GeofenceId,c=o.CreateTime,f=o.UpdateTime,d=o.Status,[2,{createTime:c,geofenceId:a,geometry:{polygon:o.Geometry.Polygon},status:d,updateTime:f}]}})})},e.prototype.listGeofences=function(e){return S(this,void 0,void 0,function(){var t,n,r,i,o,s;return E(this,function(a){switch(a.label){case 0:return[4,this._ensureCredentials()];case 1:if(!a.sent())throw Error("No credentials");try{this._verifyGeofenceCollections(null==e?void 0:e.collectionName)}catch(e){throw C.debug(e),e}t=new l.l({credentials:this._config.credentials,region:this._config.region,customUserAgent:(0,u.Zm)()}),n={NextToken:null==e?void 0:e.nextToken,CollectionName:(null==e?void 0:e.collectionName)||this._config.geofenceCollections.default},r=new p.t(n),a.label=2;case 2:return a.trys.push([2,4,,5]),[4,t.send(r)];case 3:return i=a.sent(),[3,5];case 4:throw o=a.sent(),C.debug(o),o;case 5:return s=i.NextToken,[2,{entries:i.Entries.map(function(e){return{geofenceId:e.GeofenceId,createTime:e.CreateTime,updateTime:e.UpdateTime,status:e.Status,geometry:{polygon:e.Geometry.Polygon}}}),nextToken:s}]}})})},e.prototype.deleteGeofences=function(e,t){return S(this,void 0,void 0,function(){var n,r,i,o,s=this;return E(this,function(a){switch(a.label){case 0:if(e.length<1)throw Error("GeofenceId input array is empty");return[4,this._ensureCredentials()];case 1:if(!a.sent())throw Error("No credentials");if(this._verifyGeofenceCollections(null==t?void 0:t.collectionName),(n=e.filter(function(e){try{_(e)}catch(e){return!0}})).length>0)throw Error("Invalid geofence ids: "+n.join(", "));for(r={successes:[],errors:[]},i=[],o=0;o<e.length;)i.push(e.slice(o,o+=10));return[4,Promise.all(i.map(function(e){return S(s,void 0,void 0,function(){var n,i,o,s;return E(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this._AmazonLocationServiceBatchDeleteGeofenceCall(e,(null==t?void 0:t.collectionName)||this._config.geofenceCollections.default)];case 1:return n=a.sent(),[3,3];case 2:return i=a.sent(),e.forEach(function(e){var t={geofenceId:e,error:{code:i.message,message:i.message}};r.errors.push(t)}),[2];case 3:return o=n.Errors.map(function(e){return e.geofenceId}),(s=r.successes).push.apply(s,P(e.filter(function(e){return!o.includes(e)}))),[2]}})})}))];case 2:return a.sent(),[2,r]}})})},e.prototype._ensureCredentials=function(){return S(this,void 0,void 0,function(){var e,t,n;return E(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,c.cN.get()];case 1:if(!(e=r.sent()))return[2,!1];return t=c.cN.shear(e),C.debug("Set credentials for storage. Credentials are:",t),this._config.credentials=t,[2,!0];case 2:return n=r.sent(),C.debug("Ensure credentials error. Credentials are:",n),[2,!1];case 3:return[2]}})})},e.prototype._verifyMapResources=function(){if(!this._config.maps){var e="No map resources found in amplify config, run 'amplify add geo' to create one and run `amplify push` after";throw C.debug(e),Error(e)}if(!this._config.maps.default){var e="No default map resource found in amplify config, run 'amplify add geo' to create one and run `amplify push` after";throw C.debug(e),Error(e)}},e.prototype._verifySearchIndex=function(e){if((!this._config.search_indices||!this._config.search_indices.default)&&!e){var t="No Search Index found in amplify config, please run `amplify add geo` to create one and run `amplify push` after.";throw C.debug(t),Error(t)}},e.prototype._verifyGeofenceCollections=function(e){if((!this._config.geofenceCollections||!this._config.geofenceCollections.default)&&!e){var t="No Geofence Collections foun
1d, please run `amplify add geo` to create one and run `amplify push` after.";throw C.debug(t),Error(t)}},e.prototype._AmazonLocationServiceBatchPutGeofenceCall=function(e,t){return S(this,void 0,void 0,function(){var n,r,i,o;return E(this,function(s){switch(s.label){case 0:n={Entries:e,CollectionName:t||this._config.geofenceCollections.default},r=new l.l({credentials:this._config.credentials,region:this._config.region,customUserAgent:(0,u.Zm)()}),i=new g.t(n),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,r.send(i)];case 2:return o=s.sent(),[3,4];case 3:throw s.sent();case 4:return[2,o]}})})},e.prototype._AmazonLocationServiceBatchDeleteGeofenceCall=function(e,t){return S(this,void 0,void 0,function(){var n,r,i,o;return E(this,function(s){switch(s.label){case 0:n={GeofenceIds:e,CollectionName:t||this._config.geofenceCollections.default},r=new l.l({credentials:this._config.credentials,region:this._config.region,customUserAgent:(0,u.Zm)()}),i=new y.I(n),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,r.send(i)];case 2:return o=s.sent(),[3,4];case 3:throw s.sent();case 4:return[2,o]}})})},e.CATEGORY="Geo",e.PROVIDER_NAME="AmazonLocationService",e}(),A=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},k=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},T=function(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},N=new r.k("Geo"),x="AmazonLocationService",M=new(function(){function e(){this._config={},this._pluggables=[],N.debug("Geo Options",this._config)}return e.prototype.getModuleName=function(){return e.MODULE},e.prototype.addPluggable=function(e){if(e&&"Geo"===e.getCategory())return this._pluggables.push(e),e.configure(this._config[e.getProviderName()])},e.prototype.getPluggable=function(e){var t=this._pluggables.find(function(t){return t.getProviderName()===e});if(void 0!==t)return t;throw N.debug("No plugin found with providerName",e),Error("No plugin found in Geo for the provider")},e.prototype.removePluggable=function(e){this._pluggables=this._pluggables.filter(function(t){return t.getProviderName()!==e})},e.prototype.configure=function(e){var t=this;if(N.debug("configure Geo"),!e)return this._config;var n=(0,i.gi)(e);return this._config=Object.assign({},this._config,n.Geo,e),this._pluggables.forEach(function(e){e.configure(t._config[e.getProviderName()])}),0===this._pluggables.length&&this.addPluggable(new O),this._config},e.prototype.getAvailableMaps=function(e){return void 0===e&&(e=x),this.getPluggable(e).getAvailableMaps()},e.prototype.getDefaultMap=function(e){return void 0===e&&(e=x),this.getPluggable(e).getDefaultMap()},e.prototype.searchByText=function(e,t){return A(this,void 0,void 0,function(){var n,r,i,o;return k(this,function(s){switch(s.label){case 0:r=void 0===(n=(t||{}).providerName)?x:n,i=this.getPluggable(r),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,i.searchByText(e,t)];case 2:return[2,s.sent()];case 3:throw o=s.sent(),N.debug(o),o;case 4:return[2]}})})},e.prototype.searchByCoordinates=function(e,t){return A(this,void 0,void 0,function(){var n,r,i,o,s,a,u;return k(this,function(c){switch(c.label){case 0:r=void 0===(n=(t||{}).providerName)?x:n,i=this.getPluggable(r),s=(o=T(e,2))[0],a=o[1],c.label=1;case 1:return c.trys.push([1,3,,4]),m(s,a),[4,i.searchByCoordinates(e,t)];case 2:return[2,c.sent()];case 3:throw u=c.sent(),N.debug(u),u;case 4:return[2]}})})},e.prototype.saveGeofences=function(e,t){return A(this,void 0,void 0,function(){var n,r,i,o,s;return k(this,function(a){switch(a.label){case 0:r=void 0===(n=(t||{}).providerName)?x:n,i=this.getPluggable(r),o=Array.isArray(e)?e:[e],a.label=1;case 1:return a.trys.push([1,3,,4]),[4,i.saveGeofences(o,t)];case 2:return[2,a.sent()];case 3:throw s=a.sent(),N.debug(s),s;case 4:return[2]}})})},e.prototype.getGeofence=function(e,t){return A(this,void 0,void 0,function(){var n,r,i,o;return k(this,function(s){switch(s.label){case 0:r=void 0===(n=(t||{}).providerName)?x:n,i=this.getPluggable(r),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,i.getGeofence(e,t)];case 2:return[2,s.sent()];case 3:throw o=s.sent(),N.debug(o),o;case 4:return[2]}})})},e.prototype.listGeofences=function(e){return A(this,void 0,void 0,function(){var t,n,r,i;return k(this,function(o){switch(o.label){case 0:n=void 0===(t=(e||{}).providerName)?x:t,r=this.getPluggable(n),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,r.listGeofences(e)];case 2:return[2,o.sent()];case 3:throw i=o.sent(),N.debug(i),i;case 4:return[2]}})})},e.prototype.deleteGeofences=function(e,t){return A(this,void 0,void 0,function(){var n,r,i,o,s;return k(this,function(a){switch(a.label){case 0:r=void 0===(n=(t||{}).providerName)?x:n,i=this.getPluggable(r),o=Array.isArray(e)?e:[e],a.label=1;case 1:return a.trys.push([1,3,,4]),[4,i.deleteGeofences(o,t)];case 2:return[2,a.sent()];case 3:throw s=a.sent(),N.debug(s),s;case 4:return[2]}})})},e.MODULE="Geo",e}());o.dQ.register(M)},5452:function(e,t,n){"use strict";n.d(t,{y:function(){return I}});var r,i=n(25049),o=n(30587),s=function(){return(s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)}
1,a=new i.k("AbstractInteractionsProvider"),u=function(){function e(e){void 0===e&&(e={}),this._config=e}return e.prototype.configure=function(e){return void 0===e&&(e={}),this._config=s(s({},this._config),e),a.debug("configure "+this.getProviderName(),this._config),this.options},e.prototype.getCategory=function(){return"Interactions"},Object.defineProperty(e.prototype,"options",{get:function(){return s({},this._config)},enumerable:!0,configurable:!0}),e}(),c=n(30761),l=n(88371),f=n(63426),d=n(22485),h=n(15047),p=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},g=function(e){var t,n,r,i;return t=void 0,n=void 0,r=void 0,i=function(){return p(this,function(t){return e instanceof Blob||e instanceof ReadableStream?[2,new Response(e).arrayBuffer().then(function(e){return new Uint8Array(e)})]:[2,Promise.reject("Invalid content type")]})},new(r||(r=Promise))(function(e,o){function s(e){try{u(i.next(e))}catch(e){o(e)}}function a(e){try{u(i.throw(e))}catch(e){o(e)}}function u(t){var n;t.done?e(t.value):((n=t.value)instanceof r?n:new r(function(e){e(n)})).then(s,a)}u((i=i.apply(t,n||[])).next())})},y=(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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),v=function(){return(v=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},b=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},m=new i.k("AWSLexProvider"),_=function(e){function t(t){void 0===t&&(t={});var n=e.call(this,t)||this;return n._botsCompleteCallback={},n}return y(t,e),t.prototype.getProviderName=function(){return"AWSLexProvider"},t.prototype.configure=function(t){void 0===t&&(t={});var n=["name","alias","region"];return Object.keys(t).forEach(function(e){var r=t[e];if(!n.every(function(e){return e in r}))throw Error("invalid bot configuration")}),e.prototype.configure.call(this,t)},t.prototype.reportBotStatus=function(e,t){var n=this;m.debug("postContent state",e.dialogState),("ReadyForFulfillment"===e.dialogState||"Fulfilled"===e.dialogState)&&("function"==typeof this._botsCompleteCallback[t]&&setTimeout(function(){return n._botsCompleteCallback[t](null,e)},0),this._config&&"function"==typeof this._config[t].onComplete&&setTimeout(function(){return n._config[t].onComplete(null,e)},0)),"Failed"===e.dialogState&&("function"==typeof this._botsCompleteCallback[t]&&setTimeout(function(){return n._botsCompleteCallback[t]("Bot conversation failed")},0),this._config&&"function"==typeof this._config[t].onComplete&&setTimeout(function(){return n._config[t].onComplete("Bot c
1onversation failed")},0))},t.prototype.sendMessage=function(e,t){var n,r,i,o;return n=this,r=void 0,i=void 0,o=function(){var n,r,i,o,s,a,u,p,y,_,w;return b(this,function(b){switch(b.label){case 0:if(!this._config[e])return[2,Promise.reject("Bot "+e+" does not exist")];b.label=1;case 1:return b.trys.push([1,3,,4]),[4,d.cN.get()];case 2:return n=b.sent(),[3,4];case 3:return b.sent(),[2,Promise.reject("No credentials")];case 4:if(this.lexRuntimeServiceClient=new c.L({region:this._config[e].region,credentials:n,customUserAgent:(0,h.Zm)()}),"string"!=typeof t)return[3,9];r={botAlias:this._config[e].alias,botName:e,inputText:t,userId:n.identityId},m.debug("postText to lex",t),b.label=5;case 5:return b.trys.push([5,7,,8]),i=new l.d(r),[4,this.lexRuntimeServiceClient.send(i)];case 6:return o=b.sent(),this.reportBotStatus(o,e),[2,o];case 7:return[2,Promise.reject(b.sent())];case 8:return[3,21];case 9:if(s=t.content,"voice"!==t.options.messageType)return[3,13];if("object"!=typeof s)return[2,Promise.reject("invalid content type")];if(!(s instanceof Uint8Array))return[3,10];return u=s,[3,12];case 10:return[4,g(s)];case 11:u=b.sent(),b.label=12;case 12:return a=u,r={botAlias:this._config[e].alias,botName:e,contentType:"audio/x-l16; sample-rate=16000; channel-count=1",userId:n.identityId,accept:"audio/mpeg",inputStream:a},[3,14];case 13:if("string"!=typeof s)return[2,Promise.reject("invalid content type")];r={botAlias:this._config[e].alias,botName:e,contentType:"text/plain; charset=utf-8",inputStream:s,userId:n.identityId,accept:"audio/mpeg"},b.label=14;case 14:m.debug("postContent to lex",t),b.label=15;case 15:return b.trys.push([15,20,,21]),p=new f.b(r),[4,this.lexRuntimeServiceClient.send(p)];case 16:if(!(o=b.sent()).audioStream)return[3,18];return[4,g(o.audioStream)];case 17:return _=b.sent(),[3,19];case 18:_=void 0,b.label=19;case 19:return y=_,w=v(v({},o),{audioStream:y}),this.reportBotStatus(w,e),[2,w];case 20:return[2,Promise.reject(b.sent())];case 21:return[2]}})},new(i||(i=Promise))(function(e,t){function s(e){try{u(o.next(e))}catch(e){t(e)}}function a(e){try{u(o.throw(e))}catch(e){t(e)}}function u(t){var n;t.done?e(t.value):((n=t.value)instanceof i?n:new i(function(e){e(n)})).then(s,a)}u((o=o.apply(n,r||[])).next())})},t.prototype.onComplete=function(e,t){if(!this._config[e])throw Error("Bot "+e+" does not exist");this._botsCompleteCallback[e]=t},t}(u),w=function(){return(w=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},S=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},E=new i.k("Interactions"),I=new(function(){function e(e){void 0===e&&(e={}),this._options=e,E.debug("Interactions Options",this._options),this._pluggables={}}return e.prototype.getModuleName=function(){return"Interactions"},e.prototype.configure=function(e){var t=this,n=e?e.Interactions||e:{};E.debug("configure Interactions",{opt:n}),this._options=w(w({bots:{}},n),n.Interactions);var r=this._options.aws_bots_config,i=this._options.bots;return!Object.keys(i).length&&r&&Array.isArray(r)&&r.forEach(function(e){t._options.bots[e.name]=e}
1),Object.keys(i).forEach(function(e){var n,r=i[e],o=r.providerName||"AWSLexProvider";t._pluggables.AWSLexProvider||"AWSLexProvider"!==o||(t._pluggables.AWSLexProvider=new _),t._pluggables[o]?t._pluggables[o].configure(((n={})[r.name]=r,n)):E.debug("bot "+r.name+" was not configured as "+o+" provider was not found")}),this._options},e.prototype.addPluggable=function(e){var t=this;if(e&&"Interactions"===e.getCategory()){if(this._pluggables[e.getProviderName()])throw Error("Pluggable "+e.getProviderName()+" already plugged");Object.keys(this._options.bots).filter(function(n){return t._options.bots[n].providerName===e.getProviderName()}).forEach(function(n){var r,i=t._options.bots[n];e.configure(((r={})[i.name]=i,r))}),this._pluggables[e.getProviderName()]=e;return}},e.prototype.send=function(e,t){var n,r,i,o;return n=this,r=void 0,i=void 0,o=function(){var n;return S(this,function(r){switch(r.label){case 0:if(!this._options.bots||!this._options.bots[e])return[2,Promise.reject("Bot "+e+" does not exist")];if(n=this._options.bots[e].providerName||"AWSLexProvider",!this._pluggables[n])return[2,Promise.reject("Bot "+n+" does not have valid pluggin did you try addPluggable first?")];return[4,this._pluggables[n].sendMessage(e,t)];case 1:return[2,r.sent()]}})},new(i||(i=Promise))(function(e,t){function s(e){try{u(o.next(e))}catch(e){t(e)}}function a(e){try{u(o.throw(e))}catch(e){t(e)}}function u(t){var n;t.done?e(t.value):((n=t.value)instanceof i?n:new i(function(e){e(n)})).then(s,a)}u((o=o.apply(n,r||[])).next())})},e.prototype.onComplete=function(e,t){if(!this._options.bots||!this._options.bots[e])throw Error("Bot "+e+" does not exist");var n=this._options.bots[e].providerName||"AWSLexProvider";if(!this._pluggables[n])throw Error("Bot "+n+" does not have valid pluggin did you try addPluggable first?");this._pluggables[n].onComplete(e,t)},e}());o.dQ.register(I)},65632:function(e,t,n){"use strict";n.d(t,{x:function(){return c}});var r=n(25049),i=n(30587),o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},s=function(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},a=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(s(arguments[t]));return e},u=new r.k("Predictions"),c=new(function(){function e(e){this._options=e,this._convertPluggables=[],this._identifyPluggables=[],this._interpretPluggables=[]}return e.prototype.getModuleName=function(){return"Predictions"},e.prototype.addPluggable=function(e){if(this.getPluggable(e.getProviderName()))throw Error("Pluggable with name "+e.getProviderName()+" has already been added.");var t=!1;this.implementsConvertPluggable(e)&&(this._convertPluggables.push(e),t=!0),this.implementsIdentifyPluggable(e)&&(this._identifyPluggables.push(e),t=!0),this.implementsInterpretPluggable(e)&&(this._interpretPluggables.push(e),t=!0),t&&this.configurePluggable(e)},e.prototype.getPluggable=function(e){var t=this.getAllProviders().find(function(t){return t.getProviderName()===e});return void 0===t?(u.debug("No plugin found with providerName=>",e),null):t},e.prototype.removePluggable=function(e){this._convertPluggables=this._convertPluggables.filter(function(t){return t.getProviderName()!==e}),this._identifyPluggables=this._identifyPluggables.filter(function(t){return t.getProviderName()!==e}),this._interpretPluggables=this._interpretPluggables.filter(function(t){return t.getProviderName()!==e})},e.prototype.configure=function(e){var t=this,n=e?e.predictions||e:{};n=o(o({},n),e),this._options=Object.assign({},this._options,n),u.debug("configure Predictions",this._options),this.getAllProviders().forEach(function(e){return t.configurePluggable(e)})},e.prototype.interpret=function(e,t){return this.getPluggableToExecute(this._interpretPluggables,t).interpret(e)},e.prototype.convert=function(e,t){return this.getPluggableToExecute(this._convertPluggables,t).convert(e)},e.prototype.identify=function(e,t){return this.getPluggableToExecute(this._identifyPluggables,t).identify(e)},e.prototype.getPluggableToExecute=function(e,t){if(t&&t.providerName)return a(e).find(function(e){return e.getProviderName()===t.providerName});if(1===e.length)return e[0];throw Error("More than one or no providers are configured, Either specify a provider name or configure exactly one provider")},e.prototype.getAllProviders=function(){return a(this._convertPluggables,this._identifyPluggables,this._interpretPluggables)},e.prototype.configurePluggable=function(e){var t=Object.assign({},this._options.predictions,this._options[e.getCategory().toLowerCase()]);e.configure(t)},e.prototype.implementsConvertPluggable=function(e){return e&&"function"==typeof e.convert},e.prototype.implementsIdentifyPluggable=function(e){return e&&"function"==typeof e.identify},e.prototype.implementsInterpretPluggable=function(e){return e&&"function"==typeof e.interpret},e}())({});i.dQ.register(c)},92843:function(e,t,n){"use strict";n.d(t,{p:function(){return eb}});var r,i,o,s,a,u,c,l,f,d=n(8941),h=n(96141),p=n(25049),g=n(81846),y=n(30587),v=n(20791),b=n(60012),m=function(){return(m=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},_=new p.k("AbstractPubSubProvider"),w=function(){function e(e){void 0===e&&(e={}),this._config=e}return e.prototype.configure=function(e){return void 0===e&&(e={}),this._config=m(m({},e),this._config),_.debug("configure "+this.getProviderName(),this._config),this.options},e.prototype.getCategory=function(){return"PubSub"},Object.defineProperty(e.prototype,"options",{get:function(){return m({},this._config)},enumerable:!0,configurable:!0}),e}(),S=n(69276),E=n(98834),I=n(53150),P=function(){return(P=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},C={KEEP_ALIVE_MISSED:{keepAliveState:"unhealthy"},KEEP_ALIVE:{keepAliveState:"healthy"},CONNECTION_ESTABLISHED:{connectionState:"connected"},CONNECTION_FAILED:{intendedConnectionState:"disconnected",connectionState:"disconnected"},CLOSING_CONNECTION:{intendedConnectionState:"disconnected"},OPENING_CONNECTION:{intendedConnectionState:"connected",connectionState:"connecting"},CLOSED:{connectionState:"disconnected"},ONLINE:{networkState:"connected"},OFFLINE:{networkState:"disconnected"}},O=function(){function e(){var e=this;this._networkMonitoringSubscription=void 0,this._linkedConnectionState={networkState:"connected",connectionState:"disconnected",intendedConnectionState:"disconnected",keepAliveState:"healthy"},this._linkedConnectionStateObservable=new d.Z(function(t){t.next(e._linkedConnectionState),e._linkedConnectionStateObserver=t})}return e.prototype.enableNetworkMonitoring=function(){var e=this;void 0===this._networkMonitoringSubscription&&(this._networkMonitoringSubscription=new I.Z().networkMonitor().subscribe(function(t){var n=t.online;e.record(n?C.ONLINE:C.OFFLINE)}))},e.prototype.disableNetworkMonitoring=function(){var e;null===(e=this._networkMonitoringSubscription)||void 0===e||e.unsubscribe(),this._networkMonitoringSubscription=void 0},Object.defineProperty(e.prototype,"connectionStateObservable",{get:function(){var e,t=this;return this._linkedConnectionStateObservable.map(function(e){return t.connectionStatesTranslator(e)}).filter(function(t){var n=t!==e;return e=t,n})},enumerable:!0,configurable:!0}),e.prototype.record=function(e){"connected"===e.intendedConnectionState?this.enableNetworkMonitoring():"disconnected"===e.intendedConnectionState&&this.disableNetworkMonitoring();var t=P(P({},this._linkedConnectionState),e);this._linkedConnectionState=P({},t),this._linkedConnectionStateObserver.next(this._linkedConnectionState)},e.prototype.connectionStatesTranslator=function(e){var t=e.connectionState,n=e.networkState,r=e.intendedConnectionState,i=e.keepAliveState;return"connected"===t&&"disconnected"===n?E.e.ConnectedPendingNetwork:"c
1onnected"===t&&"disconnected"===r?E.e.ConnectedPendingDisconnect:"disconnected"===t&&"connected"===r&&"disconnected"===n?E.e.ConnectionDisruptedPendingNetwork:"disconnected"===t&&"connected"===r?E.e.ConnectionDisrupted:"connected"===t&&"unhealthy"===i?E.e.ConnectedPendingKeepAlive:"connecting"===t?E.e.Connecting:"disconnected"===t?E.e.Disconnected:E.e.Connected},e}(),A=[400,401,403],k="ConnectionStateChange";(r=c||(c={})).GQL_CONNECTION_INIT="connection_init",r.GQL_CONNECTION_ERROR="connection_error",r.GQL_CONNECTION_ACK="connection_ack",r.GQL_START="start",r.GQL_START_ACK="start_ack",r.GQL_DATA="data",r.GQL_CONNECTION_KEEP_ALIVE="ka",r.GQL_STOP="stop",r.GQL_COMPLETE="complete",r.GQL_ERROR="error",(i=l||(l={}))[i.PENDING=0]="PENDING",i[i.CONNECTED=1]="CONNECTED",i[i.FAILED=2]="FAILED",(o=f||(f={}))[o.CLOSED=0]="CLOSED",o[o.READY=1]="READY",o[o.CONNECTING=2]="CONNECTING";var T="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",N={accept:"application/json, text/javascript","content-encoding":"amz-1.0","content-type":"application/json; charset=UTF-8"},x=(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)}),M=function(){return(M=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},R=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},j=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},U=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},D=new p.k("MqttOverWSProvider"),L=function(){function e(){this.promises=new Map}return e.prototype.get=function(e,t){return R(this,void 0,void 0,function(){var n,r;return j(this,function(i){return(n=this.promises.get(e))?[2,n]:t?(r=t(e),this.promises.set(e,r),[2,r]):[2,void 0]})})},Object.defineProperty(e.prototype,"allClients",{get:function(){return Array.from(this.promises.keys())},enumerable:!0,configurable:!0}),e.prototype.remove=function(e){this.promises.delete(e)},e}(),F=function(e,t,n){S.Xb.dispatch("pubsub",{event:e,data:t,message:n},"PubSub",T)},B="undefined"!=typeof Symbol?Symbol("topic"):"@@topic",G=function(e){function t(t){void 0===t&&(t={});var n=e.call(this,M(M({},t),{clientId:t.clientId||(0,b.v4)()}))||this;return n._clientsQueue=new L,n.connectionStateMonitor=new O,n._topicObservers=new Map,n._clientIdObservers=new Map,n.connectionStateMonitor.connectionStateObservable.subscribe(function(e){F(k,{provider:n,connectionState:e},"Connection state is "+e)}),n}return x(t,e),Object.defineProperty(t.prototype,"clientId",{get:function(){return this.options.clientId},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"endpoint",{get:function(){return this.options.aws_pubsub_endpoint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"clientsQueue",{get:function(){return this._clientsQueue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isSSLEnabled",{get:function(){return!this.options.aws_appsync_dangerously_connect_to_http_endpoint_for_testing},enumerable:!0,configurable:!0}),t.prototype.getTopicForValue=function(e){return"object"==typeof e&&e[B]},t.prototype.getProviderName=function(){return"MqttOverWSProvider"},t.prototype.onDisconnect=function(e){var t=this,n=e.clientId,r=e.errorCode,i=U(e,["clientId","errorCode"]);if(0!==r){D.warn(n,JSON.stringify(M({errorCode:r},i),null,2));var o=[];if(!n)return;var s=this._clientIdObservers.get(n);if(!s)return;
1s.forEach(function(e){e.error("Disconnected, error code: "+r),t._topicObservers.forEach(function(t,n){t.delete(e),0===t.size&&o.push(n)})}),this._clientIdObservers.delete(n),o.forEach(function(e){t._topicObservers.delete(e)})}},t.prototype.newClient=function(e){var t=e.url,n=e.clientId;return R(this,void 0,void 0,function(){var e,r=this;return j(this,function(i){switch(i.label){case 0:return D.debug("Creating new MQTT client",n),this.connectionStateMonitor.record(C.OPENING_CONNECTION),(e=new v.Client(t,n)).onMessageArrived=function(e){var t=e.destinationName,n=e.payloadString;r._onMessage(t,n)},e.onConnectionLost=function(e){var t=e.errorCode,i=U(e,["errorCode"]);r.onDisconnect(M({clientId:n,errorCode:t},i)),r.connectionStateMonitor.record(C.CLOSED)},[4,new Promise(function(t,n){e.connect({useSSL:r.isSSLEnabled,mqttVersion:3,onSuccess:function(){return t(e)},onFailure:function(){n(),r.connectionStateMonitor.record(C.CONNECTION_FAILED)}})})];case 1:return i.sent(),this.connectionStateMonitor.record(C.CONNECTION_ESTABLISHED),[2,e]}})})},t.prototype.connect=function(e,t){return void 0===t&&(t={}),R(this,void 0,void 0,function(){var n=this;return j(this,function(r){switch(r.label){case 0:return[4,this.clientsQueue.get(e,function(e){return n.newClient(M(M({},t),{clientId:e}))})];case 1:return[2,r.sent()]}})})},t.prototype.disconnect=function(e){return R(this,void 0,void 0,function(){var t;return j(this,function(n){switch(n.label){case 0:return[4,this.clientsQueue.get(e)];case 1:return(t=n.sent())&&t.isConnected()&&(t.disconnect(),this.connectionStateMonitor.record(C.CLOSED)),this.clientsQueue.remove(e),[2]}})})},t.prototype.publish=function(e,t){return R(this,void 0,void 0,function(){var n,r,i,o;return j(this,function(s){switch(s.label){case 0:return n=[].concat(e),r=JSON.stringify(t),[4,this.endpoint];case 1:return i=s.sent(),[4,this.connect(this.clientId,{url:i})];case 2:return o=s.sent(),D.debug("Publishing to topic(s)",n.join(","),r),n.forEach(function(e){return o.send(e,r)}),[2]}})})},t.prototype._onMessage=function(e,t){try{var n=[];this._topicObservers.forEach(function(t,r){(function(e,t){for(var n=e.split("/"),r=n.length,i=t.split("/"),o=0;o<r;++o){var s=n[o],a=i[o];if("#"===s)return i.length>=r;if("+"!==s&&s!==a)return!1}return r===i.length})(r,e)&&n.push(t)});var r=JSON.parse(t);"object"==typeof r&&(r[B]=e),n.forEach(function(e){e.forEach(function(e){return e.next(r)})})}catch(e){D.warn("Error handling message",e,t)}},t.prototype.subscribe=function(e,t){var n=this;void 0===t&&(t={});var r=[].concat(e);return D.debug("Subscribing to topic(s)",r.join(",")),new d.Z(function(e){r.forEach(function(t){var r=n._topicObservers.get(t);r||(r=new Set,n._topicObservers.set(t,r)),r.add(e)});var i,o=t.clientId,s=void 0===o?n.clientId:o,a=n._clientIdObservers.get(s);return a||(a=new Set),a.add(e),n._clientIdObservers.set(s,a),R(n,void 0,void 0,function(){var n,o,a,u;return j(this,function(c){switch(c.label){case 0:if(void 0!==(n=t.url))return[3,2];return[4,this.endpoint];case 1:return a=c.sent(),[3,3];case 2:a=n,c.label=3;case 3:o=a,c.label=4;case 4:return c.trys.push([4,6,,7]),[4,this.connect(s,{url:o})];case 5:return i=c.sent(),r.forEach(function(e){i.subscribe(e)}),[3,7];case 6:return u=c.sent(),e.error(u),[3,7];case 7:return[2]}})}),function(){var t,o;return D.debug("Unsubscribing from topic(s)",r.join(",")),i&&(null===(t=n._clientIdObservers.get(s))||void 0===t||t.delete(e),(null===(o=n._clientIdObservers.get(s))||void 0===o?void 0:o.size)===0&&(n.connectionStateMonitor.record(C.CLOSING_CONNECTION),n.disconnect(s),n._clientIdObservers.delete(s)),r.forEach(function(t){var r=n._topicObservers.get(t)||new Set;r.delete(e),0===r.size&&(n._topicObservers.delete(t),i.isConnected()&&i.unsubscribe(t))})),null}})},t}(w),q=(a=function(e,t){return(a=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}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}
1),z=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},W=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},K=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},H=function(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},Y=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(H(arguments[t]));return e},V=new p.k("AWSAppSyncProvider"),Q=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._topicClient=new Map,t._topicAlias=new Map,t}return q(t,e),Object.defineProperty(t.prototype,"endpoint",{get:function(){throw Error("Not supported")},enumerable:!0,configurable:!0}),t.prototype.getProviderName=function(){return"AWSAppSyncProvider"},t.prototype.publish=function(e,t,n){return z(this,void 0,void 0,function(){return W(this,function(e){throw Error("Operation not supported")})})},t.prototype._cleanUp=function(e){var t=this;Array.from(this._topicClient.entries()).filter(function(t){return H(t,2)[1].clientId===e}).map(function(e){return H(e,1)[0]}).forEach(function(e){return t._cleanUpForTopic(e)})},t.prototype._cleanUpForTopic=function(e){this._topicClient.delete(e),this._topicAlias.delete(e)},t.prototype.onDisconnect=function(e){var t=this,n=e.clientId,r=e.errorCode,i=K(e,["clientId","errorCode"]);0!==r&&(Array.from(this._topicClient.entries()).filter(function(e){return H(e,2)[1].clientId===n}).map(function(e){return H(e,1)[0]}).forEach(function(e){t._topicObservers.has(e)&&(t._topicObservers.get(e).forEach(function(e){e.closed||e.error(i)}),t._topicObservers.delete(e))}),this._cleanUp(n))},t.prototype.disconnect=function(t){return z(this,void 0,void 0,function(){return W(this,function(n){switch(n.label){case 0:return[4,this.clientsQueue.get(t,function(){return null})];case 1:return n.sent(),[4,e.prototype.disconnect.call(this,t)];case 2:return n.sent(),this._cleanUp(t),[2]}})})},t.prototype.subscribe=function(e,t){var n=this;void 0===t&&(t={});var r=new d.Z(function(r){var i=[].concat(e);return V.debug("Subscribing to topic(s)",i.join(",")),z(n,void 0,void 0,function(){var e,n,o,s=this;return W(this,function(a){switch(a.label){case 0:return i.forEach(function(e){s._topicObservers.has(e)||s._topicObservers.set(e,new Set),s._topicObservers.get(e).add(r)}),n=void 0===(e=t.mqttConnections)?[]:e,o=Object.entries(t.newSubscriptions).map(function(e){var t=H(e,2),n=t[0];return[t[1].topic,n]}),this._topicAlias=new Map(Y(Array.from(this._topicAlias.entries()),o)),[4,Promise.all(Object.entries(i.reduce(function(e,t){var r=n.find(function(e){return e.topics.indexOf(t)>-1});if(r){var i=r.client,o=r.url;e[i]||(e[i]={url:o,topics:new Set}),e[i].topics.add(t)}return e},{})).map(function(e){var t=H(e,2),n=t[0],i=t[1],o=i.url,a=i.topics;return z(s,void 0,void 0,function(){var e,t,i=this;return W(this,function(s){switch(s.label){case 0:e=null,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.connect(n,{clientId:n,url:o})];case 2:return e=s.sent(),[3,4];case 3:return t=s.sent(),r.error({message:"Failed to connect",error:t}),r.complete(),[2,void 0];case 4:return a.forEach(function(t){e.isConnected()&&(e.subscribe(t),i._topicClient.set(t,e))}),[2,e]}})})}))];case 1:return a.sent(),[2]}})}),function(){V.debug("Unsubscribing from topic(s)",i.join(",")),i.forEac
1h(function(e){var t=n._topicClient.get(e);t&&t.isConnected()&&(t.unsubscribe(e),n._topicClient.delete(e),Array.from(n._topicClient.values()).some(function(e){return e===t})||n.disconnect(t.clientId)),n._topicObservers.delete(e)})}});return d.Z.from(r).map(function(e){var t=n.getTopicForValue(e),r=n._topicAlias.get(t);return e.data=Object.entries(e.data).reduce(function(e,t){var n=H(t,2),i=n[0],o=n[1];return e[r||i]=o,e},{}),e})},t}(G),J=n(16655),Z=n(8452),X=n(94706),$=n(3908),ee=n(58399),et=n(22485),en=n(95436),er=n(69249),ei=n(46375),eo=(u=function(e,t){return(u=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}u(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),es=function(){return(es=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},ea=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},eu=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},ec=function(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},el=new p.k("AWSAppSyncRealTimeProvider"),ef=function(e,t,n){S.Xb.dispatch("api",{event:e,data:t,message:n},"PubSub",T)},ed=/^https:\/\/\w{26}\.appsync\-api\.\w{2}(?:(?:\-\w{2,})+)\-\d\.amazonaws.com\/graphql$/i,eh=function(e){function t(t){void 0===t&&(t={});var n=e.call(this,t)||this;return n.socketStatus=f.CLOSED,n.keepAliveTimeout=3e5,n.subscriptionObserverMap=new Map,n.promiseArray=[],n.connectionStateMonitor=new O,n.connectionStateMonitor.connectionStateObservable.subscribe(function(e){ef(k,{provider:n,connectionState:e},"Connection state is "+e)}),n}return eo(t,e),t.prototype.getNewWebSocket=function(e,t){return new WebSocket(e,t)},t.prototype.getProviderName=function(){return"AWSAppSyncRealTimeProvider"},t.prototype.newClient=function(){throw Error("Not used here")},t.prototype.publish=function(e,t,n){return ea(this,void 0,void 0,function(){return eu(this,function(e){throw Error("Operation not supported")})})},t.prototype.isCustomDomain=function(e){return null===e.match(ed)},t.prototype.subscribe=function(e,t){var n=this,r=null==t?void 0:t.appSyncGraphqlEndpoint;return new d.Z(function(e){if(t&&r){var i=(0,b.v4)();return n._startSubscriptionWithAWSAppSyncRealTime({options:t,observer:e,subscriptionId:i}).catch(function(t){e.error({errors:[es({},new J._(E.u.REALTIME_SUBSCRIPTION_INIT_ERROR+": "+t))]}),n.connectionStateMonitor.record(C.CLOSED),e.complete()}),function(){return ea(n,void 0,void 0,function(){var e,t;return eu(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,3,4]),[4,this._waitForSubscriptionToBeConnected(i)];case 1:if(n.sent(),!(e=(this.subscriptionObserverMap.get(i)||{}).subscriptionState))return[2];if(e===l.CONNECTED)this._sendUnsubscriptionMessage(i);else throw Error("Subscription never connected");return[3,4];case 2:return t=n.sent(),el.debug("Error while unsubscribing "+t),[3,4];case 3:return this._removeSubscriptionObserver(i),[7];case 4:return[2]}})})}}e.error({errors:[es({},new J._("Subscribe only available for AWS AppSync endpoint"))]}),e.complete()})},Object.defineProperty(t.prototype,"isSSLEnabled",{get:function(){return!this.options.aws_appsync_dangerously_connect_to_http_endpoint_for_testing},enumerable:!0,configurable:!0}),t.prototype._startSubscriptionWithAWSAppSyncRealTime=function(e){var t,n,r=e.options,i=e.observer,o=e.subscriptionId;return ea(this,void 0,void 0,function(){var e,s,a,u,f,d,h,p,y,v,b,m,_,w,S,I,P,O,A,k,T,N,x,M,R=this;return eu(this,function(j){switch(j.label){case 0:return e=r.appSyncGraphqlEndpoint,s=r.authenticationType,a=r.query,u=r.variables,f=r.apiKey,d=r.region,p=void 0===(h=r.graphql_headers)?function(){return{}}:h,v=void 0===(y=r.additionalHeaders)?{}:y,b=l.PENDING,m={query:a,variables:u},this.subscriptionObserverMap.set(o,{observer:i,query:null!=a?a:"",variables:null!=u?u:{},subscriptionState:b,startAckTimeoutId:void 0}),_=JSON.stringify(m),S=[{}],[4,this._awsRealTimeHeaderBasedAuth({apiKey:f,appSyncGraphqlEndpoint:e,authenticationType:s,payload:_,canonicalUri:"",region:d,additionalHeaders:v})];case 1:return I=[es.apply(void 0,S.concat([j.sent()]))],[4,p()];case 2:w=es.apply(void 0,[es.apply(void 0,[es.apply(void 0,I.concat([j.sent()])),v]),((M={})[g.Mt]=$.gT.userAgent,M)]),P=JSON.stringify({id:o,payload:{data:_,extensions:{authorization:es({},w)}},type:c.GQL_START}),j.label=3;case 3:return j.trys.push([3,5,,6]),this.connectionStateMonitor.record(C.OPENING_CONNECTION),[4,this._initializeWebSocketConnection({apiKey:f,appSyncGraphqlEndpoint:e,authenticationType:s,region:d,additionalHeaders:v})];case 4:return j.sent(),[3,6];case 5:return O=j.sent(),el.debug({err:O}),A=null!==(t=O.message)&&void 0!==t?t:"",this.connectionStateMonitor.record(C.CLOSED),i.error({errors:[es({},new J._(E.u.CONNECTION_FAILED+": "+A))]}),i.complete(),"function"==typeof(k=(this.subscriptionObserverMap.get(o)||{}).subscriptionFailedCallback)&&k(),[2];case 6:return N=(T=null!==(n=this.subscriptionObserverMap.get(o))&&void 0!==n?n:{}).subscriptionFailedCallback,x=T.subscriptionReadyCallback,this.subscriptionObserverMap.set(o,{observer:i,subscriptionState:b,query:null!=a?a:"",variables:null!=u?u:{},subscriptionReadyCallback:x,subscriptionFailedCallback:N,startAckTimeoutId:setTimeout(function(){R._timeoutStartSubscriptionAck.call(R,o)},15e3)}),this.awsRealTimeSocket&&this.awsRealTimeSocket.send(P),[2]}})})},t.prototype._waitForSubscriptionToBeConnected=function(e){return ea(this,void 0,void 0,function(){var t,n=this;return eu(this,function(r){return(t=this.subscriptionObserverMap.get(e))&&t.subscriptionState===l.PENDING?[2,new Promise(function(r,i){var o=t.observer,s=t.subscriptionState,a=t.variables,u=t.query;n.subscriptionObserverMap.set(e,{observer:o,subscriptionState:s,variables:a,query:u,subscriptionReadyCallback:r,subscriptionFailedCallback:i})})]:[2]})})},t.prototype._sendUnsubscriptionMessage=function(e){try{if(this.awsRealTimeSocket&&this.awsRealTimeSocket.readyState===WebSocket.OPEN&&this.socketStatus===f.READY){var t={id:e,type:c.GQL_STOP},n=JSON.stringify(t);this.awsRealTimeSocket.send(n)}}catch(e){el.debug({err:e})}},t.prototype._removeSubscriptionObserver=function(e){this.subscriptionObserverMap.delete(e),setTimeout(this._closeSocketIfRequired.bind(this),1e3)},t.prototype._closeSocketIfRequired=function(){if(!(this.subscriptionObserverMap.size>0)){if(!this.awsRealTimeSocket){this.socketStatus=f.CLOSED;return}if(this.connectionStateMonitor.record(C.CLOSING_CONNECTION),this.awsRealTimeSocket.bufferedAmount>0)setTimeout(this._closeSocketIfRequired.bind(this),1e3);else{el.debug("closing WebSocket..."),this.keepAliveTimeoutId&&clearTimeout(this.keepAliveTimeoutId),this.keepAliveAlertTimeoutId&&clearTimeout(this.keepAliveAlertTimeoutId);var e=this.awsRealTimeSocket;e.onclose=null,e.onerror=null,e.close(1e3),this.awsRealTimeSocket=void 0,this.socketStatus=f.CLOSED,this.connectionStateMonitor.record(C.CLOSED)}}},t.prototype._handleIncomingSubscriptionMessage=function(e){var t=this;el.debug("subscription message from AWS AppSync RealTime: "+e.data);var n=JSON.parse(e.data),r=n.id,i=void 0===r?"":r,o=n.payload,s=n.type,a=this.subscriptionObserverMap.get(i)||{},u=a.observer,f=void 0===u?null:u,d=a.query,h=void 0===d?"":d,p=a.variables,g=void 0===p?{}:p,y=a.startAckTimeoutId,v=a.subscriptionReadyCallback,b=a.subscriptionFailedCallback;if(el.debug({id:i,observer:f,query:h,variables:g}),s===c.GQL_DATA&&o&&o.data){f?f.next(o):el.debug("observer not found for id: "+i);return}if(s===c.GQL_START_ACK){el.debug("subscription ready for "+JSON.stringify({query:h,variables:g})),"function"==typeof v&&v(),y&&clearTimeout(y),ef(E.u.SUBSCRIPTION_ACK,{query:h,variables:g},"Connection established for subscription");var m=l.CONNECTED;f&&this.subscriptionObserverMap.set(i,{observer:f,query:h,variables:g,startAckTimeoutId:void 0,subscriptionState:m,subscriptionReadyCallback:v,subscriptionFailedCallback:b}),this.connectionStateMonitor.record(C.CONNECTION_ESTABLISHED);return}if(s===c.GQL_CONNECTION_KEEP_ALIVE){this.keepAliveTimeoutId&&clearTimeout(this.keepAliveTimeoutId),this.keepAliveAlertTimeoutId&&clearTimeout(this.keepAliveAlertTimeoutId),this.keepAliveTimeoutId=setTimeout(function(){return t._errorDisconnect(E.u.TIMEOUT_DISCONNECT)},this.keepAliveTimeout),this.keepAliveAlertTimeoutId=setTimeout(function(){t.connectionStateMonitor.record(C.KEEP_ALIVE_MISSED)},65e3),this.connectionStateMonitor.record(C.KEEP_ALIVE);return}
1if(s===c.GQL_ERROR){var m=l.FAILED;f&&(this.subscriptionObserverMap.set(i,{observer:f,query:h,variables:g,startAckTimeoutId:y,subscriptionReadyCallback:v,subscriptionFailedCallback:b,subscriptionState:m}),f.error({errors:[es({},new J._(E.u.CONNECTION_FAILED+": "+JSON.stringify(o)))]}),y&&clearTimeout(y),f.complete(),"function"==typeof b&&b())}},t.prototype._errorDisconnect=function(e){el.debug("Disconnect error: "+e),this.subscriptionObserverMap.forEach(function(t){var n=t.observer;n&&!n.closed&&n.error({errors:[es({},new J._(e))]})}),this.subscriptionObserverMap.clear(),this.awsRealTimeSocket&&(this.connectionStateMonitor.record(C.CLOSED),this.awsRealTimeSocket.close()),this.socketStatus=f.CLOSED},t.prototype._timeoutStartSubscriptionAck=function(e){var t=this.subscriptionObserverMap.get(e);if(t){var n=t.observer,r=t.query,i=t.variables;if(!n)return;this.subscriptionObserverMap.set(e,{observer:n,query:r,variables:i,subscriptionState:l.FAILED}),n&&!n.closed&&(n.error({errors:[es({},new J._("Subscription timeout "+JSON.stringify({query:r,variables:i})))]}),n.complete()),el.debug("timeoutStartSubscription",JSON.stringify({query:r,variables:i}))}},t.prototype._initializeWebSocketConnection=function(e){var t=this,n=e.appSyncGraphqlEndpoint,r=e.authenticationType,i=e.apiKey,o=e.region,s=e.additionalHeaders;if(this.socketStatus!==f.READY)return new Promise(function(e,a){return ea(t,void 0,void 0,function(){var t,u,c,l,d,h,p,g,y,v;return eu(this,function(b){switch(b.label){case 0:if(this.promiseArray.push({res:e,rej:a}),this.socketStatus!==f.CLOSED)return[3,5];b.label=1;case 1:return b.trys.push([1,4,,5]),this.socketStatus=f.CONNECTING,t="{}",l=(c=JSON).stringify,[4,this._awsRealTimeHeaderBasedAuth({authenticationType:r,payload:t,canonicalUri:"/connect",apiKey:i,appSyncGraphqlEndpoint:n,region:o,additionalHeaders:s})];case 2:return u=l.apply(c,[b.sent()]),d=X.lW.from(u).toString("base64"),h=X.lW.from(t).toString("base64"),p=null!=n?n:"",p=this.isCustomDomain(p)?p.concat("/realtime"):p.replace("appsync-api","appsync-realtime-api").replace("gogi-beta","grt-beta"),g=this.isSSLEnabled?"wss://":"ws://",y=(p=p.replace("https://",g).replace("http://",g))+"?header="+d+"&payload="+h,[4,this._initializeRetryableHandshake(y)];case 3:return b.sent(),this.promiseArray.forEach(function(e){var t=e.res;el.debug("Notifying connection successful"),t()}),this.socketStatus=f.READY,this.promiseArray=[],[3,5];case 4:return v=b.sent(),this.promiseArray.forEach(function(e){return(0,e.rej)(v)}),this.promiseArray=[],this.awsRealTimeSocket&&this.awsRealTimeSocket.readyState===WebSocket.OPEN&&this.awsRealTimeSocket.close(3001),this.awsRealTimeSocket=void 0,this.socketStatus=f.CLOSED,[3,5];case 5:return[2]}})})})},t.prototype._initializeRetryableHandshake=function(e){return ea(this,void 0,void 0,function(){return eu(this,function(t){switch(t.label){case 0:return el.debug("Initializaling retryable Handshake"),[4,(0,ee.Xm)(this._initializeHandshake.bind(this),[e],5e3)];case 1:return t.sent(),[2]}})})},t.prototype._initializeHandshake=function(e){return ea(this,void 0,void 0,function(){var t,n,r,i,o=this;return eu(this,function(s){switch(s.label){case 0:el.debug("Initializing handshake "+e),s.label=1;case 1:return s.trys.push([1,4,,5]),[4,new Promise(function(t,n){var r=o.getNewWebSocket(e,"graphql-ws");r.onerror=function(){el.debug("WebSocket connection error")},r.onclose=function(){o.connectionStateMonitor.record(C.CONNECTION_FAILED),n(Error("Connection handshake error"))},r.onopen=function(){return o.awsRealTimeSocket=r,t()}})];case 2:return s.sent(),[4,new Promise(function(e,t){if(o.awsRealTimeSocket){var n=!1;o.awsRealTimeSocket.onerror=function(e){el.debug("WebSocket error "+JSON.stringify(e))},o.awsRealTimeSocket.onclose=function(e){el.debug("WebSocket closed "+e.reason),t(Error(JSON.stringify(e)))},o.awsRealTimeSocket.onmessage=function(r){el.debug("subscription message from AWS AppSyncRealTime: "+r.data+" ");var i=JSON.parse(r.data),s=i.type,a=i.payload,u=(void 0===a?{}:a).connectionTimeoutMs;if(s===c.GQL_CONNECTION_ACK){n=!0,o.awsRealTimeSocket&&(o.keepAliveTimeout=void 0===u?3e5:u,o.awsRealTimeSocket.onmessage=o._handleIncomingSubscriptionMessage.bind(o),o.awsRealTimeSocket.onerror=function(e){el.debug(e),o._errorDisconnect(E.u.CONNECTION_CLOSED)},o.awsRealTimeSocket.onclose=function(e){el.debug("WebSocket closed "+e.reason),o._errorDisconnect(E.u.CONNECTION_CLOSED)}
1),e("Cool, connected to AWS AppSyncRealTime");return}if(s===c.GQL_CONNECTION_ERROR){var l=i.payload,f=(void 0===l?{}:l).errors,d=ec(void 0===f?[]:f,1)[0],h=void 0===d?{}:d,p=h.errorType,g=h.errorCode;t({errorType:void 0===p?"":p,errorCode:void 0===g?0:g})}};var r={type:c.GQL_CONNECTION_INIT};o.awsRealTimeSocket.send(JSON.stringify(r));var i=function(e){e||(o.connectionStateMonitor.record(C.CONNECTION_FAILED),t(Error("Connection timeout: ack from AWSAppSyncRealTime was not received after 15000 ms")))};setTimeout(function(){return i(n)},15e3)}})];case 3:return s.sent(),[3,5];case 4:if(r=(n=t=s.sent()).errorType,i=n.errorCode,A.includes(i))throw new ee.V2(r);if(r)throw Error(r);throw t;case 5:return[2]}})})},t.prototype._awsRealTimeHeaderBasedAuth=function(e){var t=e.authenticationType,n=e.payload,r=e.canonicalUri,i=e.appSyncGraphqlEndpoint,o=e.apiKey,s=e.region,a=e.additionalHeaders;return ea(this,void 0,void 0,function(){var e,u,c;return eu(this,function(l){switch(l.label){case 0:if(e={API_KEY:this._awsRealTimeApiKeyHeader.bind(this),AWS_IAM:this._awsRealTimeIAMHeader.bind(this),OPENID_CONNECT:this._awsRealTimeOPENIDHeader.bind(this),AMAZON_COGNITO_USER_POOLS:this._awsRealTimeCUPHeader.bind(this),AWS_LAMBDA:this._customAuthHeader},!(!t||!e[t]))return[3,1];return el.debug("Authentication type "+t+" not supported"),[2,""];case 1:return u=e[t],c=Z.parse(null!=i?i:"").host,el.debug("Authenticating with "+t),[4,u({payload:n,canonicalUri:r,appSyncGraphqlEndpoint:i,apiKey:o,region:s,host:c,additionalHeaders:a})];case 2:return[2,l.sent()]}})})},t.prototype._awsRealTimeCUPHeader=function(e){var t=e.host;return ea(this,void 0,void 0,function(){return eu(this,function(e){switch(e.label){case 0:return[4,ei.ZP.currentSession()];case 1:return[2,{Authorization:e.sent().getAccessToken().getJwtToken(),host:t}]}})})},t.prototype._awsRealTimeOPENIDHeader=function(e){var t=e.host;return ea(this,void 0,void 0,function(){var e,n,r;return eu(this,function(i){switch(i.label){case 0:return[4,er.ZP.getItem("federatedInfo")];case 1:if(!(n=i.sent()))return[3,2];return e=n.token,[3,4];case 2:return[4,ei.ZP.currentAuthenticatedUser()];case 3:(r=i.sent())&&(e=r.token),i.label=4;case 4:if(!e)throw Error("No federated jwt");return[2,{Authorization:e,host:t}]}})})},t.prototype._awsRealTimeApiKeyHeader=function(e){var t=e.apiKey,n=e.host;return ea(this,void 0,void 0,function(){return eu(this,function(e){return[2,{host:n,"x-amz-date":new Date().toISOString().replace(/[:\-]|\.\d{3}/g,""),"x-api-key":t}]})})},t.prototype._awsRealTimeIAMHeader=function(e){var t=e.payload,n=e.canonicalUri,r=e.appSyncGraphqlEndpoint,i=e.region;return ea(this,void 0,void 0,function(){var e,o,s;return eu(this,function(a){switch(a.label){case 0:return e={region:i,service:"appsync"},[4,this._ensureCredentials()];case 1:if(!a.sent())throw Error("No credentials");return[4,et.cN.get().then(function(e){return{secret_key:e.secretAccessKey,access_key:e.accessKeyId,session_token:e.sessionToken}})];case 2:return o=a.sent(),s={url:""+r+n,data:t,method:"POST",headers:es({},N)},[2,en.E.sign(s,o,e).headers]}})})},t.prototype._customAuthHeader=function(e){var t=e.host,n=e.additionalHeaders;if(!n||!n.Authorization)throw Error("No auth token specified");return{Authorization:n.Authorization,host:t}},t.prototype._ensureCredentials=function(){return et.cN.get().then(function(e){if(!e)return!1;var t=et.cN.shear(e);return el.debug("set credentials for AWSAppSyncRealTimeProvider",t),!0}).catch(function(e){return el.warn("ensure credentials error",e),!1})},t}(w),ep=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},eg=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;
1function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},ey=(0,h.lC)().isNode,ev=new p.k("PubSub"),eb=new(function(){function e(e){this._options=null!=e?e:{},ev.debug("PubSub Options",this._options),this._pluggables=[],this.subscribe=this.subscribe.bind(this)}return Object.defineProperty(e.prototype,"awsAppSyncProvider",{get:function(){return this._awsAppSyncProvider||(this._awsAppSyncProvider=new Q(this._options)),this._awsAppSyncProvider},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"awsAppSyncRealTimeProvider",{get:function(){return this._awsAppSyncRealTimeProvider||(this._awsAppSyncRealTimeProvider=new eh(this._options)),this._awsAppSyncRealTimeProvider},enumerable:!0,configurable:!0}),e.prototype.getModuleName=function(){return"PubSub"},e.prototype.configure=function(e){var t=this,n=e?e.PubSub||e:{};return ev.debug("configure PubSub",{opt:n}),this._options=Object.assign({},this._options,n),this._pluggables.map(function(e){return e.configure(t._options)}),this._options},e.prototype.addPluggable=function(e){return ep(this,void 0,void 0,function(){return eg(this,function(t){return e&&"PubSub"===e.getCategory()?(this._pluggables.push(e),[2,e.configure(this._options)]):[2]})})},e.prototype.removePluggable=function(e){this._pluggables=this._pluggables.filter(function(t){return t.getProviderName()!==e})},e.prototype.getProviderByName=function(e){return e===g.yL?this.awsAppSyncProvider:e===g.om?this.awsAppSyncRealTimeProvider:this._pluggables.find(function(t){return t.getProviderName()===e})},e.prototype.getProviders=function(e){void 0===e&&(e={});var t=e.provider;if(!t)return this._pluggables;var n=this.getProviderByName(t);if(!n)throw Error("Could not find provider named "+t);return[n]},e.prototype.publish=function(e,t,n){return ep(this,void 0,void 0,function(){return eg(this,function(r){return[2,Promise.all(this.getProviders(n).map(function(r){return r.publish(e,t,n)}))]})})},e.prototype.subscribe=function(e,t){if(ey&&this._options&&this._options.ssr)throw Error("Subscriptions are not supported for Server-Side Rendering (SSR)");ev.debug("subscribe options",t);var n=this.getProviders(t);return new d.Z(function(r){var i=n.map(function(n){return{provider:n,observable:n.subscribe(e,t)}}).map(function(e){var t=e.provider;return e.observable.subscribe({start:console.error,next:function(e){return r.next({provider:t,value:e})},error:function(e){return r.error({provider:t,error:e})}})});return function(){return i.forEach(function(e){return e.unsubscribe()})}})},e}());y.dQ.register(eb)},98834:function(e,t,n){"use strict";var r,i,o,s;n.d(t,{e:function(){return i},u:function(){return r}}),(o=r||(r={})).CONNECTION_CLOSED="Connection closed",o.CONNECTION_FAILED="Connection failed",o.REALTIME_SUBSCRIPTION_INIT_ERROR="AppSync Realtime subscription init error",o.SUBSCRIPTION_ACK="Subscription ack",o.TIMEOUT_DISCONNECT="Timeout disconnect",(s=i||(i={})).Connected="Connected",s.ConnectedPendingNetwork="ConnectedPendingNetwork",s.ConnectionDisrupted="ConnectionDisrupted",s.ConnectionDisruptedPendingNetwork="ConnectionDisruptedPendingNetwork",s.Connecting="Connecting",s.ConnectedPendingDisconnect="ConnectedPendingDisconnect",s.Disconnected="Disconnected",s.ConnectedPendingKeepAlive="ConnectedPendingKeepAlive"},53514:function(e,t,n){"use strict";n.d(t,{Ke:function(){return eF},HN:function(){return eR}});var r,i,o,s,a,u,c,l,f,d=n(25049),h=n(52674),p=n(27406),g=n(69276),y=n(22485),v=n(52588),b=n(13447),m=n(99127),_=n(87816),w=n(48045),S=n(88847),E=n(11728),I=n(37113),P=n(20258),C=n(24588),O=n.n(C),A=n(15047);(r=a||(a={}
1)).NO_CREDENTIALS="No credentials",r.NO_SRC_KEY='source param should be an object with the property "key" with value of type string',r.NO_DEST_KEY='destination param should be an object with the property "key" with value of type string',r.INVALID_BLOB="Object must be an instance of Blob",(i=u||(u={})).CLEANUP_FAILED="Multipart copy clean up failed",i.NO_OBJECT_FOUND="Object does not exist",i.INVALID_QUEUESIZE="Queue size must be a positive number",i.NO_COPYSOURCE="You must specify a copy source",i.MAX_NUM_PARTS_EXCEEDED="Only a maximum of 10000 parts are allowed",(c||(c={})).UPLOAD_PAUSED_MESSAGE="paused";var k=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},T=function(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},N=new d.k("axios-http-handler"),x="sendUploadProgress",M="sendDownloadProgress",R=function(e,t){var n,r;try{for(var i=k(Object.entries(e)),o=i.next();!o.done;o=i.next()){var s=T(o.value,2),a=s[0],u=s[1];a!==t&&a.toUpperCase()===t.toUpperCase()&&(e[t]=u,delete e[a])}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},j=[function(e,t){return"undefined"!=typeof Blob&&e instanceof Blob?(R(t,"Content-Type"),R(t,"Accept"),e):O().defaults.transformRequest[0].call(null,e,t)}],U=function(){function e(e,t,n){void 0===e&&(e={}),this.httpOptions=e,this.emitter=t,this.cancelTokenSource=n}return e.prototype.destroy=function(){},e.prototype.handle=function(e,t){var n,r=this.httpOptions.requestTimeout,i=t.emitter||this.emitter,o=e.path;if(e.query){var s=(0,P.I)(e.query);s&&(o+="?"+s)}var a=e.port,u=e.protocol+"//"+e.hostname+(a?":"+a:"")+o,l={};return l.url=u,l.method=e.method,l.headers=e.headers,delete l.headers.host,e.body?l.data=e.body:l.headers[Object.keys(l.headers).find(function(e){return"content-type"===e.toLowerCase()})]&&(l.data=null),i&&(l.onUploadProgress=function(e){i.emit(x,e),N.debug(e)},l.onDownloadProgress=function(e){i.emit(M,e),N.debug(e)}),this.cancelTokenSource&&(l.cancelToken=this.cancelTokenSource.token),t.cancelTokenSource&&(l.cancelToken=t.cancelTokenSource.token),l.responseType="blob",A.t4.isReactNative&&(l.transformRequest=j),Promise.race([O().request(l).then(function(e){return{response:new I.Zn({headers:e.headers,statusCode:e.status,body:e.data})}}).catch(function(e){var t,n;if(e.message!==c.UPLOAD_PAUSED_MESSAGE&&N.error(e.message),O().isCancel(e)||!(void 0!==e&&Object.prototype.hasOwnProperty.call(e,"response")&&void 0!==e.response&&Object.prototype.hasOwnProperty.call(e.response,"status")&&"number"==typeof e.response.status))throw e;return{response:new I.Zn({statusCode:e.response.status,body:null===(t=e.response)||void 0===t?void 0:t.data,headers:null===(n=e.response)||void 0===n?void 0:n.headers})}}),(void 0===(n=r)&&(n=0),new Promise(function(e,t){n&&setTimeout(function(){var e=Error("Request did not complete within "+n+" ms");e.name="TimeoutError",t(e)},n)}))])},e}(),D="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",L="contentLengthMiddleware",F="__uploadInProgress",B=function(e){if("string"==typeof e)return e.length;if(z(e))return e.byteLength;if(q(e))return e.size;throw Error("Cannot determine byte length of "+e)},G=function(e,t,n,r,i){if(e){var o={attrs:n};r&&(o.metrics=r),g.Xb.dispatch("storage",{event:t,data:o,message:i},"Storage",D)}},q=function(e){return void 0!==e&&e instanceof Blob},z=function(e){return void 0!==e&&e instanceof ArrayBuffer},W=n(63209),K=function(){return(K=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)}
1,H=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},Y=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},V=new d.k("S3ClientUtils"),Q={accessKeyId:"",secretAccessKey:""},J=function(e){var t=e.credentials,n=e.level,r=e.customPrefix,i=e.identityId,o=r||{},s=i||t.identityId,a=(void 0!==o.private?o.private:"private/")+s+"/",u=(void 0!==o.protected?o.protected:"protected/")+s+"/",c=void 0!==o.public?o.public:"public/";switch(n){case"private":return a;case"protected":return u;default:return c}},Z=function(e,t){return function(n,r){return function(r){return H(void 0,void 0,void 0,function(){var i,o,s,a;return Y(this,function(u){switch(u.label){case 0:return[4,y.cN.get()];case 1:return i=u.sent(),o=y.cN.shear(i),s=J(K(K({},e),{credentials:o})),a=Object.assign({},r.input),Object.prototype.hasOwnProperty.call(r.input,"Key")?(a.Key=s+t,r.input=a):Object.prototype.hasOwnProperty.call(r.input,"Prefix")&&(a.Prefix=s+t,r.input=a),[2,n(r)]}})})}}},X=function(e){return function(t,n){return function(n){return H(void 0,void 0,void 0,function(){var r,i;return Y(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,t(n)];case 1:return[2,o.sent()];case 2:var s;throw(s=r=o.sent()).ServerTime&&"string"==typeof s.Code&&"RequestTimeTooSkewed"===s.Code&&(i=new Date(r.ServerTime),e.systemClockOffset=i.getTime()-Date.now()),r;case 3:return[2]}})})}}},$={step:"finalizeRequest",name:"autoAdjustClockskewMiddleware"},ee={step:"initialize",name:"addPrefixMiddleware"},et=function(){return H(void 0,void 0,void 0,function(){var e,t,n;return Y(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,y.cN.get()];case 1:if(!(e=r.sent()))return[2,Q];return t=y.cN.shear(e),V.debug("credentials provider get credentials",t),[2,t];case 2:return n=r.sent(),V.warn("credentials provider error",n),[2,Q];case 3:return[2]}})})},en=function(e,t){var n=e.region,r=e.cancelTokenSource,i=e.dangerouslyConnectToHttpEndpointForTesting,o=e.useAccelerateEndpoint,s={};i&&(s={endpoint:"http://localhost:20005",tls:!1,bucketEndpoint:!1,forcePathStyle:!0});var a=new W.g(K(K({region:n,credentials:et,customUserAgent:(0,A.Zm)()},s),{requestHandler:new U({},t,r),useAccelerateEndpoint:o}));return a.middlewareStack.remove(L),a},er=n(26727),ei=n(60154),eo=n(47431),es=n(94678),ea=n(24399),eu=n(32874),ec=n(52250),el=function(){return(el=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},ef=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},ed=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;
1function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},eh=new d.k("AWSS3ProviderManagedUpload"),ep=function(){function e(e,t,n){this.minPartSize=5242880,this.queueSize=4,this.body=null,this.params=null,this.opts=null,this.completedParts=[],this.uploadId=null,this.bytesUploaded=0,this.totalBytesToUpload=0,this.emitter=null,this.params=e,this.opts=t,this.emitter=n,this.s3client=this._createNewS3Client(t,n)}return e.prototype.upload=function(){return ef(this,void 0,void 0,function(){var e,t,n,r,i,o,s,a=this;return ed(this,function(u){switch(u.label){case 0:return u.trys.push([0,10,,12]),e=this,[4,this.validateAndSanitizeBody(this.params.Body)];case 1:if(e.body=u.sent(),this.totalBytesToUpload=this.byteLength(this.body),!(this.totalBytesToUpload<=this.minPartSize))return[3,2];return this.params.Body=this.body,t=new er.w(this.params),[2,this.s3client.send(t)];case 2:return n=this,[4,this.createMultiPartUpload()];case 3:n.uploadId=u.sent(),r=Math.ceil(this.totalBytesToUpload/this.minPartSize),i=this.createParts(),o=0,u.label=4;case 4:if(!(o<r))return[3,7];return[4,this.uploadParts(this.uploadId,i.slice(o,o+this.queueSize))];case 5:u.sent(),u.label=6;case 6:return o+=this.queueSize,[3,4];case 7:return i.map(function(e){a.removeEventListener(e)}),[4,this.finishMultiPartUpload(this.uploadId)];case 8:return[2,u.sent()];case 9:return[3,12];case 10:return s=u.sent(),[4,this.cleanup(this.uploadId)];case 11:throw u.sent(),eh.error("Error. Cancelling the multipart upload."),s;case 12:return[2]}})})},e.prototype.createParts=function(){try{for(var e=[],t=0;t<this.totalBytesToUpload;){var n=Math.min(t+this.minPartSize,this.totalBytesToUpload);e.push({bodyPart:this.body.slice(t,n),partNumber:e.length+1,emitter:new ec.EventEmitter,_lastUploadedBytes:0}),t+=this.minPartSize}return e}catch(e){throw eh.error(e),e}},e.prototype.createMultiPartUpload=function(){return ef(this,void 0,void 0,function(){var e,t,n;return ed(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),e=new ei.p(this.params),[4,this.s3client.send(e)];case 1:return t=r.sent(),eh.debug(t.UploadId),[2,t.UploadId];case 2:throw n=r.sent(),eh.error(n),n;case 3:return[2]}})})},e.prototype.uploadParts=function(e,t){return ef(this,void 0,void 0,function(){var n,r,i,o=this;return ed(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,Promise.all(t.map(function(t){return ef(o,void 0,void 0,function(){var n,r,i,o,s,a,u;return ed(this,function(c){switch(c.label){case 0:return this.setupEventListener(t),n={emitter:t.emitter},i=(r=this.params).Key,o=r.Bucket,s=r.SSECustomerAlgorithm,a=r.SSECustomerKey,u=r.SSECustomerKeyMD5,[4,this.s3client.send(new eo.c(el(el(el({PartNumber:t.partNumber,Body:t.bodyPart,UploadId:e,Key:i,Bucket:o},s&&{SSECustomerAlgorithm:s}),a&&{SSECustomerKey:a}),u&&{SSECustomerKeyMD5:u})),n)];case 1:return[2,c.sent()]}})})}))];case 1:for(r=0,n=s.sent();r<n.length;r++)this.completedParts.push({PartNumber:t[r].partNumber,ETag:n[r].ETag});return[3,3];case 2:throw i=s.sent(),eh.error("Error happened while uploading a part. Cancelling the multipart upload"),i;case 3:return[2]}})})},e.prototype.finishMultiPartUpload=function(e){return ef(this,void 0,void 0,function(){var t,n,r;return ed(this,function(i){switch(i.label){case 0:t={Bucket:this.params.Bucket,Key:this.params.Key,UploadId:e,MultipartUpload:{Parts:this.completedParts}},n=new es.G(t),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.s3client.send(n)];case 2:return[2,i.sent().Key];case 3:throw r=i.sent(),eh.error("Error happened while finishing the upload."),r;case 4:return[2]}})})},e.prototype.cleanup=function(e){return ef(this,void 0,void 0,function(){var t,n;return ed(this,function(r){switch(r.label){case 0:return this.body=null,this.completedParts=[],this.bytesUploaded=0,this.totalBytesToUpload=0,t={Bucket:this.params.Bucket,Key:this.params.Key,UploadId:e},[4,this.s3client.send(new ea.f(t))];case 1:return r.sent(),[4,this.s3client.send(new eu.r(t))];case 2:if((n=r.sent())&&n.Parts&&n.Parts.length>0)throw Error("Multipart upload clean up failed.");return[2]}})})},e.prototype.removeEventListener=function(e){e.emitter.removeAllListeners(x),e.emitter.removeAllListeners(M)},e.prototype.setupEventListener=function(e){var t=this;e.emitter.on(x,function(n){t.progressChanged(e.partNumber,n.loaded-e._lastUploadedBytes),e._lastUploadedBytes=n.loaded})},e.prototype.progressChanged=function(e,t){this.bytesUploaded+=t,this.emitter.emit(x,{loaded:this.bytesUploaded,total:this.totalBytesToUpload,part:e,ke
1y:this.params.Key})},e.prototype.byteLength=function(e){if(null==e)return 0;if("number"==typeof e.byteLength)return e.byteLength;if("number"==typeof e.length)return e.length;if("number"==typeof e.size)return e.size;if("string"==typeof e.path);else throw Error("Cannot determine length of "+e)},e.prototype.validateAndSanitizeBody=function(e){return ef(this,void 0,void 0,function(){return ed(this,function(t){return this.isGenericObject(e)?[2,JSON.stringify(e)]:[2,e]})})},e.prototype.isGenericObject=function(e){if(null!==e&&"object"==typeof e)try{return!(this.byteLength(e)>=0)}catch(e){return!0}return!1},e.prototype._createNewS3Client=function(e,t){var n=en(e,t);return n.middlewareStack.add(Z(this.opts,this.params.Key),ee),n.middlewareStack.add(X(n.config),$),n},e}(),eg=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},ey=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},ev=function(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},eb=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(ev(arguments[t]));return e},em=new d.k("AWSS3UploadTask");function e_(e,t){return e.PartNumber-t.PartNumber}(o=l||(l={}))[o.INIT=0]="INIT",o[o.IN_PROGRESS=1]="IN_PROGRESS",o[o.PAUSED=2]="PAUSED",o[o.CANCELLED=3]="CANCELLED",o[o.COMPLETED=4]="COMPLETED",(s=f||(f={})).CANCEL="cancel",s.UPLOAD_COMPLETE="uploadComplete",s.UPLOAD_PROGRESS="uploadPartProgress",s.ERROR="error";var ew=function(){function e(e){var t=e.s3Client,n=e.file,r=e.emitter,i=e.storage,o=e.params,s=e.level,a=e.prefixPromise;this.partSize=5242880,this.queueSize=4,this.inProgress=[],this.completedParts=[],this.queued=[],this.bytesUploaded=0,this.totalBytes=0,this.state=l.INIT,this.prefixPromise=a,this.s3client=t,this.s3client.middlewareStack.remove(L),this.storage=i,this.storageSync=Promise.resolve(),"function"==typeof this.storage.sync&&(this.storageSync=this.storage.sync()),this.params=o,this.file=n,this.totalBytes=this.file.size,this.bytesUploaded=0,this.emitter=r,this.queued=[],this.fileId=this._getFileId(s),this._validateParams(),this.emitter.on(f.ERROR,function(){})}return Object.defineProperty(e.prototype,"percent",{get:function(){return this.bytesUploaded/this.totalBytes*100},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isInProgress",{get:function(){return this.state===l.IN_PROGRESS},enumerable:!0,configurable:!0}),e.prototype._listSingleFile=function(e){var t=e.key,n=e.bucket;return eg(this,void 0,void 0,function(){var e,r,i;return ey(this,function(o){switch(o.label){case 0:return[4,this.s3client.send(new _.K({Bucket:n,Prefix:t}))];case 1:return r=void 0===(e=o.sent().Contents)?[]:e,[4,this.prefixPromise];case 2:return i=o.sent(),[2,r.find(function(e){return e.Key===""+i+t})]}})})},e.prototype._getFileId=function(e){var t;return void 0!==(t=this.file)&&t instanceof File?[this.file.name,this.file.lastModified,this.file.size,this.file.type,this.params.Bucket,e,this.params.Key].join("-"):[this.file.size,this.file.type,this.params.Bucket,e,this.params.Key].join("-")},e.prototype._findCachedUploadParts=function(){return eg(this,void 0,void 0,function(){var e,t;return ey(this,function(n){switch(n.label){case 0:return[4,this._listCachedUploadTasks()];case 1:if(0===Object.keys(e=n.sent()).length||!Object.prototype.hasOwnProperty.call(e,this.fileId))return[2,{parts:[],uploadId:null}];return(t=e[this.fileId]).lastTouched=Date.now(),this.storage.setItem(F,JSON.stringify(e)),[4,this.s3client.send(new eu.r({Bucket:this.params.Bucket,Key:this.params.Key,UploadId:t.uploadId}
1))];case 2:return[2,{parts:n.sent().Parts||[],uploadId:t.uploadId}]}})})},e.prototype._emitEvent=function(e,t){this.emitter.emit(e,t)},e.prototype._validateParams=function(){if(this.file.size/this.partSize>1e4)throw Error("Too many parts. Number of parts is "+this.file.size/this.partSize+", maximum is 10000.")},e.prototype._listCachedUploadTasks=function(){return eg(this,void 0,void 0,function(){return ey(this,function(e){switch(e.label){case 0:return[4,this.storageSync];case 1:return e.sent(),[2,JSON.parse(this.storage.getItem(F)||"{}")]}})})},e.prototype._cache=function(e){return eg(this,void 0,void 0,function(){var t;return ey(this,function(n){switch(n.label){case 0:return[4,this._listCachedUploadTasks()];case 1:return(t=n.sent())[this.fileId]=e,this.storage.setItem(F,JSON.stringify(t)),[2]}})})},e.prototype._isCached=function(){return eg(this,void 0,void 0,function(){var e,t;return ey(this,function(n){switch(n.label){case 0:return t=(e=Object.prototype.hasOwnProperty).call,[4,this._listCachedUploadTasks()];case 1:return[2,t.apply(e,[n.sent(),this.fileId])]}})})},e.prototype._removeFromCache=function(){return eg(this,void 0,void 0,function(){var e;return ey(this,function(t){switch(t.label){case 0:return[4,this._listCachedUploadTasks()];case 1:return e=t.sent(),delete e[this.fileId],this.storage.setItem(F,JSON.stringify(e)),[2]}})})},e.prototype._onPartUploadCompletion=function(e){var t=e.eTag,n=e.partNumber,r=e.chunk;return eg(this,void 0,void 0,function(){return ey(this,function(e){return this.completedParts.push({ETag:t,PartNumber:n}),this.bytesUploaded+=B(r),this._emitEvent(f.UPLOAD_PROGRESS,{loaded:this.bytesUploaded,total:this.totalBytes}),this.inProgress=this.inProgress.filter(function(e){return e.uploadPartInput.PartNumber!==n}),this.queued.length&&this.state!==l.PAUSED&&this._startNextPart(),this._isDone()&&this._completeUpload(),[2]})})},e.prototype._completeUpload=function(){return eg(this,void 0,void 0,function(){var e;return ey(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.s3client.send(new es.G({Bucket:this.params.Bucket,Key:this.params.Key,UploadId:this.uploadId,MultipartUpload:{Parts:this.completedParts.sort(e_)}}))];case 1:return t.sent(),this._verifyFileSize(),this._emitEvent(f.UPLOAD_COMPLETE,{key:this.params.Bucket+"/"+this.params.Key}),this._removeFromCache(),this.state=l.COMPLETED,[3,3];case 2:return e=t.sent(),em.error("error completing upload",e),this._emitEvent(f.ERROR,e),[3,3];case 3:return[2]}})})},e.prototype._makeUploadPartRequest=function(e,t){return eg(this,void 0,void 0,function(){var n,r;return ey(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.s3client.send(new eo.c(e),{cancelTokenSource:t})];case 1:return n=i.sent(),[4,this._onPartUploadCompletion({eTag:n.ETag,partNumber:e.PartNumber,chunk:e.Body})];case 2:return i.sent(),[3,4];case 3:return r=i.sent(),this.state===l.PAUSED?em.log("upload paused"):this.state===l.CANCELLED?em.log("upload aborted"):em.error("error starting next part of upload: ",r),O().isCancel(r)||r.message===c.UPLOAD_PAUSED_MESSAGE||(this._emitEvent(f.ERROR,r),this.pause()),[3,4];case 4:return[2]}})})},e.prototype._startNextPart=function(){if(this.queued.length>0&&this.state!==l.PAUSED){var e=O().CancelToken.source(),t=this.queued.shift();this.inProgress.push({uploadPartInput:t,s3Request:this._makeUploadPartRequest(t,e),cancel:e.cancel})}},e.prototype._verifyFileSize=function(){return eg(this,void 0,void 0,function(){var e,t;return ey(this,function(n){switch(n.label){case 0:return[4,this._listSingleFile({key:this.params.Key,bucket:this.params.Bucket})];case 1:if(!(t=!!((e=n.sent())&&e.Size===this.file.size)))throw Error("File size does not match between local file and file on s3");return[2,t]}})})},e.prototype._isDone=function(){return!this.queued.length&&!this.inProgress.length&&this.bytesUploaded===this.totalBytes},e.prototype._createParts=function(){for(var e=this.file.size,t=[],n=0;n<e;){var r=Math.min(n+this.partSize,e);t.push({Body:this.file.slice(n,r),Key:this.params.Key,Bucket:this.params.Bucket,PartNumber:t.length+1,UploadId:this.uploadId}),n+=this.partSize}return t},e.prototype._initCachedUploadParts=function(e){this.bytesUploaded+=e.reduce(function(e,t){return e+t.Size},0);var t=new Set(e.map(function(e){return e.PartNumber}));this.queued=this.queued.filter(function(e){return!t.has(e.PartNumber)}),this.completedParts=e.map(function(e){return{PartNumber:e.PartNumber,ETag:e.ETag}}),this._emitEvent(f.UPLOAD_PROGRESS,{loaded:this.bytesUploaded,total:this.totalBytes})},e.prototype._initMultipartUpload=function(){return eg(this,void 0,void 0,function(){var e;return ey(this,function(t){switch(t.label){case 0:return[4,this.s3client.send(new ei.p(this.params))];case 1:return e=t.sent(),this._cache({uploadId:e.UploadId,lastTouched:Date.now(),bucket:this.params.Bucket,key:this.params.Key,fileName:this.file instanceof File?this.file.name:""}),[2,e.UploadId]}})})},e.prototype._initializeUploadTask=function(){return eg(this,void 0,void 0,function(){var e,t,n,r;return ey(this,function(i){switch(i.label){case 0:this.state=l.IN_PROGRESS,i.label=1;case 1:return i.trys.push([1,7,,8]),[4,this._isCached()];case 2:if(!i.sent())return[3,4];return[4,this._findCachedUploadParts()];case 3:return t=(e=i.sent()).parts,n=e.uploadId,this.uploadId=n,this.queued=this._createParts(),this._initCachedUploadParts(t),this._startUpload(),[3,6];case 4:if(this.uploadId)return[3,6];return[4,this._initMultipartUpload()];case 5:n=i.sent(),this.uploadId=n,this.queued=this._createParts(),this._startUpload(),i.label=6;case 6:return[3,8];case 7:return r=i.sent(),O().isCancel(r)||em.error("Error initializing the upload task",r),[3,8];case 8:return[2]}})})},e.prototype.resume=function(){this.state===l.CANCELLED?em.warn("This task has already been cancelled"):this.state===l.COMPLETED?em.warn("This task has already been completed"):this.state===l.IN_PROGRESS?em.warn("Upload task already in progress"):this.uploadId?this._startUpload():this._initializeUploadTask()},e.prototype._startUpload=function(){this.state=l.IN_PROGRESS;for(var e=0;e<this.queueSize;e++)this._startNextPart()},e.prototype._cancel=function(){return eg(this,void 0,void 0,function(){var e;return ey(this,function(t){switch(t.label){case 0:if(this.state!==l.CANCELLED)return[3,1];return em.warn("This task has already been cancelled"),[2,!1];case 1:if(this.state!==l.COMPLETED)return[3,2];return em.warn("This task has already been completed"),[2,!1];case 2:this.pause(),this.queued=[],this.completedParts=[],this.bytesUploaded=0,this.state=l.CANCELLED,t.label=3;case 3:return t.trys.push([3,6,,7]),[4,this.s3client.send(new ea.f({Bucket:this.params.Bucket,Key:this.params.Key,UploadId:this.uploadId}
1))];case 4:return t.sent(),[4,this._removeFromCache()];case 5:return t.sent(),[2,!0];case 6:return e=t.sent(),em.error("Error cancelling upload task",e),[2,!1];case 7:return[2]}})})},e.prototype.pause=function(){this.state===l.CANCELLED?em.warn("This task has already been cancelled"):this.state===l.COMPLETED?em.warn("This task has already been completed"):this.state===l.PAUSED&&em.warn("This task is already paused"),this.state=l.PAUSED;var e,t=this.inProgress.splice(0,this.inProgress.length);t.forEach(function(e){e.cancel(c.UPLOAD_PAUSED_MESSAGE)}),(e=this.queued).unshift.apply(e,eb(t.map(function(e){return e.uploadPartInput})))},e}(),eS=function(){return(eS=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},eE=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},eI=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},eP=function(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},eC=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(eP(arguments[t]));return e},eO=new d.k("AWSS3Provider"),eA="public",ek=function(){function e(e){var t=this;this._config=e||{},this._storage=new p.c4().getStorage(),g.Xb.listen("auth",function(e){var n=e.payload;("signOut"===n.event||"signIn"===n.event)&&t._storage.removeItem(F)}),eO.debug("Storage Options",this._config)}return e.prototype.getCategory=function(){return e.CATEGORY},e.prototype.getProviderName=function(){return e.PROVIDER_NAME},e.prototype.configure=function(e){if(eO.debug("configure Storage",e),!e)return this._config;var t=h._b.parseMobilehubConfig(e);return this._config=Object.assign({},this._config,t.Storage),this._config.bucket||eO.debug("Do not have bucket yet"),this._config},e.prototype.startResumableUpload=function(e,t){var n=e.s3Client,r=e.emitter,i=e.key,o=e.file,s=e.params,u=t.progressCallback,c=t.completeCallback,l=t.errorCallback,d=t.track;if(!(o instanceof Blob))throw Error(a.INVALID_BLOB);r.on(f.UPLOAD_PROGRESS,function(e){u&&("function"==typeof u?u(e):eO.warn("progressCallback should be a function, not a "+typeof u))}),r.on(f.UPLOAD_COMPLETE,function(e){c&&("function"==typeof c?c(e):eO.warn("completeCallback should be a function, not a "+typeof c))}),r.on(f.ERROR,function(e){l&&("function"==typeof l?l(e):eO.warn("errorCallback should be a function, not a "+typeof l))});var h=y.cN.get().then(function(e){var n=y.cN.shear(e);return J(eS(eS({},t),{credentials:n}))}),p=new ew({s3Client:n,file:o,emitter:r,level:t.level,storage:this._storage,params:s,prefixPromise:h});return G(void 0!==d&&d,"upload",{method:"put",result:"success"},null,"Upload Task created successfully for "+i),p.resume(),p},e.prototype.copy=function(e,t,n){return eE(this,void 0,void 0,function(){var r,i,o,s,u,c,l,f,d,h,p,g,y,b,m,_,w,S,E,I,P,C,O,A,k;return eI(this,function(T){switch(T.label){case 0:return[4,this._ensureCredentials()];case 1:if(!T.sent()||!this._isWithCredentials(this._config))throw Error(a.NO_CREDENTIALS);if(i=(r=Object.assign({},this._config,n)).acl,o=r.bucket,s=r.cacheControl,u=r.expires,c=r.track,l=r.serverSideEncryption,f=r.SSECustomerAlgorithm,d=r.SSECustomerKey,h=r.SSECustomerKeyMD5,p=r.SSEKMSKeyId,y=void 0===(g=e.level)?eA:g,b=e.identityId,m=e.key,w=void 0===(_=t.level)?eA:_,S=t.key,!m||"string"!=typeof m)throw Error(a.NO_SRC_KEY);if(!S||"string"!=typeof S)throw Error(a.NO_DEST_KEY);"protected"!==y&&b&&eO.warn('You may copy files from another user if the source level is "protected", currently it\'s '+y),E=this._prefix(eS(eS(eS({},r),{level:y}),b&&{identityId:b})),I=this._prefix(eS(eS({},r),{level:w})),P=o+"/"+E+m,C=""+I+S,eO.debug("copying "+P+" to "+C),O={Bucket:o,CopySource:P,Key:C,MetadataDirective:"COPY"},s&&(O.CacheControl=s),u&&(O.Expires=u),l&&(O.ServerSideEncryption=l),f&&(O.SSECustomerAlgorithm=f),d&&(O.SSECustomerKey=d),h&&(O.SSECustomerKeyMD5=h),p&&(O.SSEKMSKeyId=p),i&&(O.ACL=i),A=this._createNewS3Client(r),T.label=2;case 2:return T.trys.push([2,4,,5]),[4,A.send(new v.v(O))];
1case 3:return T.sent(),G(c,"copy",{method:"copy",result:"success"},null,"Copy success from "+m+" to "+S),[2,{key:S}];case 4:throw k=T.sent(),G(c,"copy",{method:"copy",result:"failed"},null,"Copy failed from "+m+" to "+S),k;case 5:return[2]}})})},e.prototype.get=function(e,t){return eE(this,void 0,void 0,function(){var n,r,i,o,s,u,c,l,f,d,h,p,g,y,v,m,_,I,P,C,O,A,k,T,N,x;return eI(this,function(R){switch(R.label){case 0:return[4,this._ensureCredentials()];case 1:if(!R.sent()||!this._isWithCredentials(this._config))throw Error(a.NO_CREDENTIALS);if(r=(n=Object.assign({},this._config,t)).bucket,i=n.download,o=n.cacheControl,s=n.contentDisposition,u=n.contentEncoding,c=n.contentLanguage,l=n.contentType,f=n.expires,d=n.track,h=n.SSECustomerAlgorithm,p=n.SSECustomerKey,g=n.SSECustomerKeyMD5,y=n.progressCallback,v=this._prefix(n)+e,m=new ec.EventEmitter,_=this._createNewS3Client(n,m),eO.debug("get "+e+" from "+v),I={Bucket:r,Key:v},o&&(I.ResponseCacheControl=o),s&&(I.ResponseContentDisposition=s),u&&(I.ResponseContentEncoding=u),c&&(I.ResponseContentLanguage=c),l&&(I.ResponseContentType=l),h&&(I.SSECustomerAlgorithm=h),p&&(I.SSECustomerKey=p),g&&(I.SSECustomerKeyMD5=g),!0!==i)return[3,5];P=new b.i(I),R.label=2;case 2:return R.trys.push([2,4,,5]),y&&("function"==typeof y?m.on(M,function(e){y(e)}):eO.warn("progressCallback should be a function, not a "+typeof y)),[4,_.send(P)];case 3:return C=R.sent(),m.removeAllListeners(M),G(d,"download",{method:"get",result:"success"},{fileSize:Number(C.Body.size||C.Body.length)},"Download success for "+e),[2,C];case 4:throw O=R.sent(),G(d,"download",{method:"get",result:"failed"},null,"Download failed with "+O.message),O;case 5:return R.trys.push([5,8,,9]),A=new E.X(eS({},_.config)),[4,(0,S.h)(_,new b.i(I))];case 6:return k=R.sent(),N=w.C,[4,A.presign(k,{expiresIn:f||900})];case 7:return T=N.apply(void 0,[R.sent()]),G(d,"getSignedUrl",{method:"get",result:"success"},null,"Signed URL: "+T),[2,T];case 8:throw x=R.sent(),eO.warn("get signed url error",x),G(d,"getSignedUrl",{method:"get",result:"failed"},null,"Could not get a signed URL for "+e),x;case 9:return[2]}})})},e.prototype.put=function(e,t,n){var r=Object.assign({},this._config,n),i=r.bucket,o=r.track,s=r.progressCallback,a=r.level,u=r.resumable,c=r.contentType,l=r.contentDisposition,f=r.contentEncoding,d=r.cacheControl,h=r.expires,p=r.metadata,g=r.tagging,y=r.acl,v=r.serverSideEncryption,b=r.SSECustomerAlgorithm,m=r.SSECustomerKey,_=r.SSECustomerKeyMD5,w=r.SSEKMSKeyId,S={Bucket:i,Key:e,Body:t,ContentType:c||"binary/octet-stream"};d&&(S.CacheControl=d),l&&(S.ContentDisposition=l),f&&(S.ContentEncoding=f),h&&(S.Expires=h),p&&(S.Metadata=p),g&&(S.Tagging=g),v&&(S.ServerSideEncryption=v),b&&(S.SSECustomerAlgorithm=b),m&&(S.SSECustomerKey=m),_&&(S.SSECustomerKeyMD5=_),w&&(S.SSEKMSKeyId=w);var E=new ec.EventEmitter,I=new ep(S,r,E);if(y&&(S.ACL=y),!0===u){var P=this._createNewS3Client(r);return P.middlewareStack.add(Z(r,e),ee),this.startResumableUpload({bucket:i,key:e,s3Client:P,file:t,emitter:E,accessLevel:a,params:S},n)}try{return s&&("function"==typeof s?E.on(x,function(e){s(e)}):eO.warn("progressCallback should be a function, not a "+typeof s)),I.upload().then(function(t){return eO.debug("upload result",t),G(o,"upload",{method:"put",result:"success"},null,"Upload success for "+e),{key:e}})}catch(t){throw eO.warn("error uploading",t),G(o,"upload",{method:"put",result:"failed"},null,"Error uploading "+e),t}},e.prototype.remove=function(e,t){return eE(this,void 0,void 0,function(){var n,r,i,o,s,u,c,l,f;return eI(this,function(d){switch(d.label){case 0:return[4,this._ensureCredentials()];case 1:if(!d.sent()||!this._isWithCredentials(this._config))throw Error(a.NO_CREDENTIALS);r=(n=Object.assign({},this._config,t)).bucket,i=n.track,o=this._prefix(n)+e,s=this._createNewS3Client(n),eO.debug("remove "+e+" from "+o),u={Bucket:r,Key:o},c=new m.C(u),d.label=2;case 2:return d.trys.push([2,4,,5]),[4,s.send(c)];case 3:return l=d.sent(),G(i,"delete",{method:"remove",result:"success"},null,"Deleted "+e+" successfully"),[2,l];case 4:throw f=d.sent(),G(i,"delete",{method:"remove",result:"failed"},null,"Deletion of "+e+" failed with "+f),f;case 5:return[2]}})})},e.prototype._list=function(e,t,n){return eE(this,void 0,void 0,function(){var r,i,o,s;return eI(this,function(a){switch(a.label){case 0:return r={contents:[],nextToken:""},i=this._createNewS3Client(t),o=new _.K(eS({},e)),[4,i.send(o)];case 1:return(s=a.sent())&&s.Contents&&(r.contents=s.Contents.map(function(e){return{key:e.Key.substr(n.length),eTag:e.ETag,lastModified:e.LastModified,size:e.Size}}),r.nextToken=s.NextContinuationToken),[2,r]}})})},e.prototype.list=function(e,t){return eE(this,void 0,void 0,function(){var n,r,i,o,s,u,c,l,f,d,h;return eI(this,function(p){switch(p.label){case 0:return[4,this._ensureCredentials()];case 1:if(!p.sent()||!this._isWithCredentials(this._config))throw Error(a.NO_CREDENTIALS);r=(n=Object.assign({},this._config,t)).bucket,i=n.track,o=n.maxKeys,u=(s=this._prefix(n))+e,eO.debug("list "+e+" from "+u),p.label=2;case 2:if(p.trys.push([2,10,,11]),c=[],l=void 0,f=void 0,d={Bucket:r,Prefix:u,MaxKeys:1e3},"ALL"!==o)return[3,7];p.label=3;case 3:return d.ContinuationToken=l,d.MaxKeys=1e3,[4,this._list(d,n,s)];
1case 4:f=p.sent(),c.push.apply(c,eC(f.contents)),f.nextToken&&(l=f.nextToken),p.label=5;case 5:if(f.nextToken)return[3,3];p.label=6;case 6:return[3,9];case 7:return o<1e3||"string"==typeof o?d.MaxKeys=o:d.MaxKeys=1e3,[4,this._list(d,n,s)];case 8:f=p.sent(),c.push.apply(c,eC(f.contents)),o>1e3&&eO.warn("maxkeys can be from 0 - 1000 or 'ALL'. To list all files you can set maxKeys to 'ALL'."),p.label=9;case 9:return G(i,"list",{method:"list",result:"success"},null,c.length+" items returned from list operation"),eO.debug("list",c),[2,c];case 10:throw h=p.sent(),eO.warn("list error",h),G(i,"list",{method:"list",result:"failed"},null,"Listing items failed: "+h.message),h;case 11:return[2]}})})},e.prototype._ensureCredentials=function(){return eE(this,void 0,void 0,function(){var e,t,n;return eI(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,y.cN.get()];case 1:if(!(e=r.sent()))return[2,!1];return t=y.cN.shear(e),eO.debug("set credentials for storage",t),this._config.credentials=t,[2,!0];case 2:return n=r.sent(),eO.warn("ensure credentials error",n),[2,!1];case 3:return[2]}})})},e.prototype._isWithCredentials=function(e){return"object"==typeof e&&e.hasOwnProperty("credentials")},e.prototype._prefix=function(e){var t=e.credentials,n=e.level,r=e.customPrefix||{},i=e.identityId||t.identityId,o=(void 0!==r.private?r.private:"private/")+i+"/",s=(void 0!==r.protected?r.protected:"protected/")+i+"/",a=void 0!==r.public?r.public:"public/";switch(n){case"private":return o;case"protected":return s;default:return a}},e.prototype._createNewS3Client=function(e,t){var n=en(e,t);return n.middlewareStack.add(X(n.config),$),n},e.CATEGORY="Storage",e.PROVIDER_NAME="AWSS3",e}(),eT=function(){return(eT=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},eN=function(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},ex=new d.k("StorageClass"),eM="AWSS3",eR=function(){function e(){this._config={},this._pluggables=[],this._cancelTokenSourceMap=new WeakMap,ex.debug("Storage Options",this._config),this.get=this.get.bind(this),this.put=this.put.bind(this),this.remove=this.remove.bind(this),this.list=this.list.bind(this)}return e.prototype.getModuleName=function(){return"Storage"},e.prototype.addPluggable=function(e){if(e&&"Storage"===e.getCategory())return this._pluggables.push(e),e.configure(this._config[e.getProviderName()])},e.prototype.getPluggable=function(e){var t=this._pluggables.find(function(t){return t.getProviderName()===e});return void 0===t?(ex.debug("No plugin found with providerName",e),null):t},e.prototype.removePluggable=function(e){this._pluggables=this._pluggables.filter(function(t){return t.getProviderName()!==e})},e.prototype.configure=function(e){var t=this;if(ex.debug("configure Storage"),!e)return this._config;var n=h._b.parseMobilehubConfig(e),r=Object.keys(n.Storage),i=["bucket","region","level","track","customPrefix","serverSideEncryption","SSECustomerAlgorithm","SSECustomerKey","SSECustomerKeyMD5","SSEKMSKeyId"],o=function(e){return i.some(function(t){return t===e})};return r&&r.find(function(e){return o(e)})&&!n.Storage[eM]&&(n.Storage[eM]={}),Object.entries(n.Storage).map(function(e){var t=eN(e,2),r=t[0],i=t[1];r&&o(r)&&void 0!==i&&(n.Storage[eM][r]=i,delete n.Storage[r])}),Object.keys(n.Storage).forEach(function(e){"string"!=typeof n.Storage[e]&&(t._config[e]=eT(eT({},t._config[e]),n.Storage[e]))}),this._pluggables.forEach(function(e){e.configure(t._config[e.getProviderName()])}),0===this._pluggables.length&&this.addPluggable(new ek),this._config},e.prototype.getCancellableTokenSource=function(){return O().CancelToken.source()},e.prototype.updateRequestToBeCancellable=function(e,t){this._cancelTokenSourceMap.set(e,t)},e.prototype.isUploadTask=function(e){return void 0!==e&&"function"==typeof e.pause&&"function"==typeof e.resume},e.prototype.cancel=function(e,t){if(e instanceof ew)return e._cancel();var n=this._cancelTokenSourceMap.get(e);n?n.cancel(t):ex.debug("The request does not map to any cancel token")},e.prototype.copy=function(e,t,n){var r=(null==n?void 0:n.provider)||eM,i=this._pluggables.find(function(e){return e.getProviderName()===r});if(void 0===i)return ex.debug("No plugin found with providerName",r),Promise.reject("No plugin found in Storage for the provider");var o=this.getCancellableTokenSource();if("function"!=typeof i.copy)return Promise.reject(".copy is not implemented on provider "+i.getProviderName());var s=i.copy(e,t,eT(eT({},n),{cancelTokenSource:o}));return this.updateRequestToBeCancellable(s,o),s},e.prototype.get=function(e,t){var n=(null==t?void 0:t.provider)||eM,r=this._pluggables.find(function(e){return e.getProviderName()===n});if(void 0===r)return ex.debug("No plugin found with providerName",n),Promise.reject("No plugin found in Storage for the provider");var i=this.getCancellableTokenSource(),o=r.get(e,eT(eT({},t),{cancelTokenSource:i}));return this.updateRequestToBeCancellable(o,i),o},e.prototype.isCancelError=function(e){return O().isCancel(e)},e.prototype.put=function(e,t,n){var r=(null==n?void 0:n.provider)||eM,i=this._pluggables.find(function(e){return e.getProviderName()===r});if(void 0===i)return ex.debug("No plugin found with providerName",r),Promise.reject("No plugin found in Storage for the provider");var o=this.getCancellableTokenSource(),s=i.put(e,t,eT(eT({},n),{cancelTokenSource:o}));return this.isUploadTask(s)||this.updateRequestToBeCancellable(s,o),s},e.prototype.remove=function(e,t){var n=(null==t?void 0:t.provider)||eM,r=this._pluggables.find(function(e){return e.getProviderName()===n});return void 0===r?(ex.debug("No plugin found with providerName",n),Promise.reject("No plugin found in Storage for the provider")):r.remove(e,t)},e.prototype.list=function(e,t){var n=(null==t?void 0:t.provider)||eM,r=this._pluggables.find(function(e){return e.getProviderName()===n});return void 0===r?(ex.debug("No plugin found with providerName",n),Promise.reject("No plugin found in Storage for the provider")):r.list(e,t)},e}(),ej=n(30587),eU=function(){return(eU=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},eD=new d.k("Storage"),eL=null,eF=function(){if(eL)return eL;eD.debug("Create Storage Instance, debug"),(eL=new eR).vault=new eR;var e=eL.configure;return eL.configure=function(t){eD.debug("storage configure called");var n=eU({},e.call(eL,t));
1Object.keys(n).forEach(function(e){"string"!=typeof n[e]&&(n[e]=eU(eU({},n[e]),{level:"private"}))}),eD.debug("storage vault configure called"),eL.vault.configure(n)},eL}();ej.dQ.register(eF)},15566:function(e){var t;t=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||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=0)}([function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(1)),r(n(2)),r(n(3)),r(n(4)),r(n(5)),r(n(6)),r(n(7)),r(n(8)),r(n(9)),r(n(10)),r(n(11)),r(n(12)),r(n(13))},function(e,t,n){e.exports={a:"Anchor__a___1_Iz8"}},function(e,t,n){e.exports={button:"Button__button___vS7Mv",signInButton:"Button__signInButton___3bUH-",googleSignInButton:"Button__googleSignInButton___1YiCu",signInButtonIcon:"Button__signInButtonIcon___ihN75",auth0SignInButton:"Button__auth0SignInButton___znnCj",facebookSignInButton:"Button__facebookSignInButton___34Txh",amazonSignInButton:"Button__amazonSignInButton___2EMtl",oAuthSignInButton:"Button__oAuthSignInButton___3UGOl",signInButtonContent:"Button__signInButtonContent___xqTXJ"}},function(e,t,n){e.exports={formContainer:"Form__formContainer___1GA3x",formSection:"Form__formSection___1PPvW",formField:"Form__formField___38Ikl",formRow:"Form__formRow___2mwRs"}},function(e,t,n){e.exports={hint:"Hint__hint___2XngB"}},function(e,t,n){e.exports={input:"Input__input___3e_bf",inputLabel:"Input__inputLabel___3VF0S",label:"Input__label___23sO8",radio:"Input__radio___2hllK"}},function(e,t,n){e.exports={navBar:"Nav__navBar___xtCFA",navRight:"Nav__navRight___1QG2J",nav:"Nav__nav___2Dx2Y",navItem:"Nav__navItem___1LtFQ"}},function(e,t,n){e.exports={photoPickerButton:"PhotoPicker__photoPickerButton___2XdVn",photoPlaceholder:"PhotoPicker__photoPlaceholder___2JXO4",photoPlaceholderIcon:"PhotoPicker__photoPlaceholderIcon___3Et71"}},function(e,t,n){e.exports={container:"Section__container___3YYTG",actionRow:"Section__actionRow___2LWSU",sectionHeader:"Section__sectionHeader___2djyg",sectionHeaderHint:"Section__sectionHeaderHint___3Wxdc",sectionBody:"Section__sectionBody___ihqqd",sectionHeaderContent:"Section__sectionHeaderContent___1UCqa",sectionFooter:"Section__sectionFooter___1T54C",sectionFooterPrimaryContent:"Section__sectionFooterPrimaryContent___2r9ZX",sectionFooterSecondaryContent:"Section__sectionFooterSecondaryContent___Nj41Q"}},function(e,t,n){e.exports={selectInput:"SelectInput__selectInput___3efO4"}},function(e,t,n){e.exports={strike:"Strike__strike___1XV1b",strikeContent:"Strike__strikeContent___10gLb"}},function(e,t,n){e.exports={toast:"Toast__toast___XXr3v",toastClose:"Toast__toastClose___18lU4"}},function(e,t,n){e.exports={totpQrcode:"Totp__totpQrcode___1crLx"}},function(e,t,n){e.exports={sumerianSceneContainer:"XR__sumerianSceneContainer___3nVMt",sumerianScene:"XR__sumerianScene___2Tt7-",loadingOverlay:"XR__loadingOverlay___IbqcI",loadingContainer:"XR__loadingContainer___2Itxb",loadingLogo:"XR__loadingLogo___Ub7xQ",loadingSceneName:"XR__loadingSceneName___3__ne",loadingBar:"XR__loadingBar___2vcke",loadingBarFill:"XR__loadingBarFill___3M-D9",sceneErrorText:"XR__sceneErrorText___2y0tp",sceneBar:"XR__sceneBar___2ShrP",sceneName:"XR__sceneName___1ApHr",sceneActions:"XR__sceneActions___7plGs",actionButton:"XR__actionButton___2poIM",tooltip:"XR__tooltip___UYyhn",actionIcon:"XR__actionIcon___2qnd2",autoShowTooltip:"XR__autoShowTooltip___V1QH7"}}])},e.exports=t()},28906:function(e,t,n){"use strict";n.d(t,{XR:function(){return x}});var r,i,o=n(25049),s=n(30587),a=n(3908),u=n(22485),c=n(95436),l=function(){return(l=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},f=new o.k("AbstractXRProvider"),d=function(){function e(e){void 0===e&&(e={}),this._config=e}return e.prototype.configure=function(e){return void 0===e&&(e={}),this._config=l(l({},e),this._config),f.debug("configure "+this.getProviderName(),this._config),this.options},e.prototype.getCategory=function(){return"XR"},Object.defineProperty(e.prototype,"options",{get:function(){return l({},this._config)},enumerable:!0,configurable:!0}),e}(),h=(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}
1)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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h(t,e),t}(Error),g=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h(t,e),t}(p),y=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h(t,e),t}(p),v=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h(t,e),t}(p),b=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h(t,e),t}(p),m=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h(t,e),t}(p),_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h(t,e),t}(p),w=(i=function(e,t){return(i=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}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),S=function(){return(S=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},E=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},I=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},P=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},C=new o.k("SumerianProvider"),O=function(e){function t(t){return void 0===t&&(t={}),e.call(this,t)||this}return w(t,e),t.prototype.getProviderName=function(){return"SumerianProvider"},t.prototype.loadScript=function(e){return E(this,void 0,void 0,function(){return I(this,function(t){return[2,new Promise(function(t,n){var r=document.createElement("script");r.src=e,r.addEventListener("load",function(e){t()}),r.addEventListener("error",function(t){n(Error("Failed to load script: "+e))}),document.head.appendChild(r)})]})})},t.prototype.loadScene=function(e,t,n){return E(this,void 0,void 0,function(){var r,i,o,s,l,f,d,h,p,g,y,v,_,w,E,O,A,k,T,N,x,M,R,j,U,D,L;return I(this,function(I){switch(I.label){case 0:if(!e)throw r="No scene name passed into loadScene",C.error(r),new m(r);if(!t)throw r="No dom element id passed into loadScene",C.error(r),new b(r);
1if(!(i=document.getElementById(t)))throw r="DOM element id, "+t+" not found",C.error(r),new b(r);if(!(o=this.getScene(e)).sceneConfig)throw r="No scene config configured for scene: "+e,C.error(r),new m(r);if(s=o.sceneConfig.url,l=o.sceneConfig.sceneId,o.sceneConfig.hasOwnProperty("region"))f=o.sceneConfig.region;else if(this.options.hasOwnProperty("region"))f=this.options.region;else throw r="No region configured for scene: "+e,C.error(r),new m(r);d={region:f,customUserAgent:a.gT.userAgent+"-SumerianScene"},h={headers:{"X-Amz-User-Agent":a.gT.userAgent}},p=s,I.label=1;case 1:return I.trys.push([1,3,,4]),[4,u.cN.get()];case 2:return g=I.sent(),d.credentials=g,y={secret_key:g.secretAccessKey,access_key:g.accessKeyId,session_token:g.sessionToken},v={region:f,service:"sumerian"},_=c.E.sign({method:"GET",url:s},y,v),h.headers=S(S({},h.headers),_.headers),p=_.url,[3,4];case 3:return I.sent(),C.debug("No credentials available, the request will be unsigned"),[3,4];case 4:return[4,fetch(p,h)];case 5:return[4,(w=I.sent()).json()];case 6:if(E=I.sent(),403===w.status){if(E.message)throw C.error("Failure to authenticate user: "+E.message),new m("Failure to authenticate user: "+E.message);throw C.error("Failure to authenticate user"),new m("Failure to authenticate user")}return[4,fetch((O=E.bundleData[l]).url,{headers:O.headers})];case 7:return[4,I.sent().json()];case 8:A=I.sent(),I.label=9;case 9:return I.trys.push([9,11,,12]),[4,this.loadScript(A[l].bootstrapperUrl)];case 10:return I.sent(),[3,12];case 11:throw k=I.sent(),C.error(k),new m(k);case 12:return T=n.progressCallback?n.progressCallback:void 0,N=o.publishParamOverrides?o.publishParamOverrides:void 0,x={element:i,sceneId:l,sceneBundle:A,apiResponse:E,progressCallback:T,publishParamOverrides:N,awsSDKConfigOverride:d},[4,window.SumerianBootstrapper.loadScene(x)];case 13:M=I.sent(),o.sceneController=M,o.isLoaded=!0;try{for(j=(R=P(M.sceneLoadWarnings)).next();!j.done;j=R.next())U=j.value,C.warn("loadScene warning: "+U)}catch(e){D={error:e}}finally{try{j&&!j.done&&(L=R.return)&&L.call(R)}finally{if(D)throw D.error}}return[2]}})})},t.prototype.isSceneLoaded=function(e){return this.getScene(e).isLoaded||!1},t.prototype.getScene=function(e){if(!this.options.scenes){var t="No scenes were defined in the configuration";throw C.error(t),new g(t)}if(!e){var t="No scene name was passed";throw C.error(t),new y(t)}if(!this.options.scenes[e]){var t="Scene '"+e+"' is not configured";throw C.error(t),new y(t)}return this.options.scenes[e]},t.prototype.getSceneController=function(e){if(!this.options.scenes){var t="No scenes were defined in the configuration";throw C.error(t),new g(t)}var n=this.options.scenes[e];if(!n){var t="Scene '"+e+"' is not configured";throw C.error(t),new y(t)}var r=n.sceneController;if(!r){var t="Scene controller for '"+e+"' has not been loaded";throw C.error(t),new v(t)}return r},t.prototype.isVRCapable=function(e){return this.getSceneController(e).vrCapable},t.prototype.isVRPresentationActive=function(e){return this.getSceneController(e).vrPresentationActive},t.prototype.start=function(e){this.getSceneController(e).start()},t.prototype.enterVR=function(e){this.getSceneController(e).enterVR()},t.prototype.exitVR=function(e){this.getSceneController(e).exitVR()},t.prototype.isMuted=function(e){return this.getSceneController(e).muted},t.prototype.setMuted=function(e,t){this.getSceneController(e).muted=t},t.prototype.onSceneEvent=function(e,t,n){this.getSceneController(e).on(t,n)},t.prototype.enableAudio=function(e){this.getSceneController(e).enableAudio()},t}(d),A=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},k=function(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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;
1function a(o){return function(a){return function(o){if(n)throw 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]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},T=function(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},N=new o.k("XR"),x=new(function(){function e(e){this._options=e,N.debug("XR Options",this._options),this._defaultProvider="SumerianProvider",this._pluggables={},this.addPluggable(new O)}return e.prototype.configure=function(e){var t=this,n=e?e.XR||e:{};return N.debug("configure XR",{opt:n}),this._options=Object.assign({},this._options,n),Object.entries(this._pluggables).map(function(e){var r=T(e,2),i=r[0],o=r[1];i!==t._defaultProvider||n[t._defaultProvider]?o.configure(t._options[i]):o.configure(t._options)}),this._options},e.prototype.addPluggable=function(e){return A(this,void 0,void 0,function(){return k(this,function(t){return e&&"XR"===e.getCategory()?(this._pluggables[e.getProviderName()]=e,[2,e.configure(this._options)]):[2]})})},e.prototype.loadScene=function(e,t,n,r){return void 0===n&&(n={}),void 0===r&&(r=this._defaultProvider),A(this,void 0,void 0,function(){return k(this,function(i){switch(i.label){case 0:if(!this._pluggables[r])throw new _("Provider '"+r+"' not configured");return[4,this._pluggables[r].loadScene(e,t,n)];case 1:return[2,i.sent()]}})})},e.prototype.isSceneLoaded=function(e,t){if(void 0===t&&(t=this._defaultProvider),!this._pluggables[t])throw new _("Provider '"+t+"' not configured");return this._pluggables[t].isSceneLoaded(e)},e.prototype.getSceneController=function(e,t){if(void 0===t&&(t=this._defaultProvider),!this._pluggables[t])throw new _("Provider '"+t+"' not configured");return this._pluggables[t].getSceneController(e)},e.prototype.isVRCapable=function(e,t){if(void 0===t&&(t=this._defaultProvider),!this._pluggables[t])throw new _("Provider '"+t+"' not configured");return this._pluggables[t].isVRCapable(e)},e.prototype.isVRPresentationActive=function(e,t){if(void 0===t&&(t=this._defaultProvider),!this._pluggables[t])throw new _("Provider '"+t+"' not configured");return this._pluggables[t].isVRPresentationActive(e)},e.prototype.start=function(e,t){if(void 0===t&&(t=this._defaultProvider),!this._pluggables[t])throw new _("Provider '"+t+"' not configured");return this._pluggables[t].start(e)},e.prototype.enterVR=function(e,t){if(void 0===t&&(t=this._defaultProvider),!this._pluggables[t])throw new _("Provider '"+t+"' not configured");return this._pluggables[t].enterVR(e)},e.prototype.exitVR=function(e,t){if(void 0===t&&(t=this._defaultProvider),!this._pluggables[t])throw new _("Provider '"+t+"' not configured");return this._pluggables[t].exitVR(e)},e.prototype.isMuted=function(e,t){if(void 0===t&&(t=this._defaultProvider),!this._pluggables[t])throw new _("Provider '"+t+"' not configured");return this._pluggables[t].isMuted(e)},e.prototype.setMuted=function(e,t,n){if(void 0===n&&(n=this._defaultProvider),!this._pluggables[n])throw new _("Provider '"+n+"' not configured");return this._pluggables[n].setMuted(e,t)},e.prototype.onSceneEvent=function(e,t,n,r){if(void 0===r&&(r=this._defaultProvider),!this._pluggables[r])throw new _("Provider '"+r+"' not configured");return this._pluggables[r].onSceneEvent(e,t,n)},e.prototype.enableAudio=function(e,t){if(void 0===t&&(t=this._defaultProvider),!this._pluggables[t])throw new _("Provider '"+t+"' not configured");return this._pluggables[t].enableAudio(e)},e}())(null);s.dQ.register(x)},95200:function(e,t,n){"use strict";n.r(t),n.d(t,{API:function(){return h.b},APIClass:function(){return h.Y},AWSCloudWatchProvider:function(){return N.P}
1,AWSKinesisFirehoseProvider:function(){return l.s},AWSKinesisProvider:function(){return c.s},AWSPinpointProvider:function(){return u.Y},AmazonPersonalizeProvider:function(){return f.C},Amplify:function(){return r.dQ},Analytics:function(){return a.c},Auth:function(){return o.g},AuthModeStrategyType:function(){return g.sE},Cache:function(){return s._m},ClientDevice:function(){return A._},DataStore:function(){return y.KT},Geo:function(){return M.l},Hub:function(){return C.Xb},I18n:function(){return T.o},Interactions:function(){return m.y},JS:function(){return O.JS},Logger:function(){return P.k},Predicates:function(){return v.gA},Predictions:function(){return I.x},PubSub:function(){return b.p},ServiceWorker:function(){return i.f},Signer:function(){return k.E},SortDirection:function(){return g.Sr},Storage:function(){return d.Ke},StorageClass:function(){return d.HN},XR:function(){return E.XR},graphqlOperation:function(){return p.wT},syncExpression:function(){return g.S6},withSSRContext:function(){return x.x}});var r=n(30587),i=n(90352),o=n(37260),s=n(69249),a=n(66964),u=n(98922),c=n(21368),l=n(41346),f=n(80398),d=n(53514),h=n(11260),p=n(58032),g=n(42734),y=n(38282),v=n(47279),b=n(92843),m=n(5452),_=n(15566),w={};for(var S in _)0>["default","Analytics","AWSPinpointProvider","AWSKinesisProvider","AWSKinesisFirehoseProvider","AmazonPersonalizeProvider","Auth","Storage","StorageClass","API","APIClass","graphqlOperation","AuthModeStrategyType","DataStore","Predicates","SortDirection","syncExpression","PubSub","Cache","Interactions","XR","Predictions","Logger","Hub","JS","ClientDevice","Signer","I18n","ServiceWorker","AWSCloudWatchProvider","withSSRContext","Geo","Amplify"].indexOf(S)&&(w[S]=(function(e){return _[e]}).bind(0,S));n.d(t,w);var E=n(28906),I=n(65632),P=n(25049),C=n(69276),O=n(96141),A=n(63115),k=n(95436),T=n(63338),N=n(3001),x=n(24321),M=n(32098);r.dQ.Auth=o.g,r.dQ.Cache=s._m,r.dQ.ServiceWorker=i.f,t.default=r.dQ},24321:function(e,t,n){"use strict";n.d(t,{x:function(){return d}});var r=n(3426),i=n(37260),o=n(22485),s=n(30587),a=n(2468),u=n(38282),c=function(){return(c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},l=[i.g,o.cN],f=[r.ZP,i.g,u.KT];function d(e){void 0===e&&(e={});var t=e.modules,n=void 0===t?f:t,r=e.req,i=s.dQ.configure(),o=new s.bY,u=new a.N({req:r});return l.forEach(function(e){n.includes(e)||o.register(new e.constructor)}),n.forEach(function(e){o.register(new e.constructor)}),o.configure(c(c({},i),{storage:u})),o}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.