@aws-amplify/datastore 3.12.6-next.13 → 3.12.6-next.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/aws-amplify-datastore.js +44634 -59578
  2. package/dist/aws-amplify-datastore.js.map +1 -1
  3. package/dist/aws-amplify-datastore.min.js +126 -24
  4. package/dist/aws-amplify-datastore.min.js.map +1 -1
  5. package/lib/authModeStrategies/multiAuthStrategy.js +5 -63
  6. package/lib/authModeStrategies/multiAuthStrategy.js.map +1 -1
  7. package/lib/datastore/datastore.js +56 -147
  8. package/lib/datastore/datastore.js.map +1 -1
  9. package/lib/index.js +2 -4
  10. package/lib/index.js.map +1 -1
  11. package/lib/storage/adapter/AsyncStorageAdapter.js +40 -96
  12. package/lib/storage/adapter/AsyncStorageAdapter.js.map +1 -1
  13. package/lib/storage/adapter/AsyncStorageDatabase.js +32 -94
  14. package/lib/storage/adapter/AsyncStorageDatabase.js.map +1 -1
  15. package/lib/storage/adapter/InMemoryStore.js +16 -67
  16. package/lib/storage/adapter/InMemoryStore.js.map +1 -1
  17. package/lib/storage/adapter/InMemoryStore.native.js +2 -4
  18. package/lib/storage/adapter/InMemoryStore.native.js.map +1 -1
  19. package/lib/storage/adapter/IndexedDBAdapter.js +57 -137
  20. package/lib/storage/adapter/IndexedDBAdapter.js.map +1 -1
  21. package/lib/storage/adapter/getDefaultAdapter/index.js +3 -5
  22. package/lib/storage/adapter/getDefaultAdapter/index.js.map +1 -1
  23. package/lib/storage/adapter/getDefaultAdapter/index.native.js +2 -4
  24. package/lib/storage/adapter/getDefaultAdapter/index.native.js.map +1 -1
  25. package/lib/storage/storage.js +38 -125
  26. package/lib/storage/storage.js.map +1 -1
  27. package/lib/sync/datastoreConnectivity.js +4 -17
  28. package/lib/sync/datastoreConnectivity.js.map +1 -1
  29. package/lib/sync/datastoreReachability/index.native.js +2 -4
  30. package/lib/sync/datastoreReachability/index.native.js.map +1 -1
  31. package/lib/sync/index.js +36 -105
  32. package/lib/sync/index.js.map +1 -1
  33. package/lib/sync/merger.js +8 -74
  34. package/lib/sync/merger.js.map +1 -1
  35. package/lib/sync/outbox.js +24 -97
  36. package/lib/sync/outbox.js.map +1 -1
  37. package/lib/sync/processors/errorMaps.js +4 -34
  38. package/lib/sync/processors/errorMaps.js.map +1 -1
  39. package/lib/sync/processors/mutation.js +30 -117
  40. package/lib/sync/processors/mutation.js.map +1 -1
  41. package/lib/sync/processors/subscription.js +19 -95
  42. package/lib/sync/processors/subscription.js.map +1 -1
  43. package/lib/sync/processors/sync.js +23 -99
  44. package/lib/sync/processors/sync.js.map +1 -1
  45. package/lib/sync/utils.js +8 -54
  46. package/lib/sync/utils.js.map +1 -1
  47. package/lib/types.js +3 -38
  48. package/lib/types.js.map +1 -1
  49. package/lib/util.js +15 -81
  50. package/lib/util.js.map +1 -1
  51. package/lib-esm/authModeStrategies/multiAuthStrategy.js +1 -56
  52. package/lib-esm/authModeStrategies/multiAuthStrategy.js.map +1 -1
  53. package/lib-esm/datastore/datastore.js +1 -89
  54. package/lib-esm/datastore/datastore.js.map +1 -1
  55. package/lib-esm/storage/adapter/AsyncStorageAdapter.js +1 -54
  56. package/lib-esm/storage/adapter/AsyncStorageAdapter.js.map +1 -1
  57. package/lib-esm/storage/adapter/AsyncStorageDatabase.js +1 -63
  58. package/lib-esm/storage/adapter/AsyncStorageDatabase.js.map +1 -1
  59. package/lib-esm/storage/adapter/InMemoryStore.js +1 -52
  60. package/lib-esm/storage/adapter/InMemoryStore.js.map +1 -1
  61. package/lib-esm/storage/adapter/IndexedDBAdapter.js +1 -74
  62. package/lib-esm/storage/adapter/IndexedDBAdapter.js.map +1 -1
  63. package/lib-esm/storage/storage.js +1 -85
  64. package/lib-esm/storage/storage.js.map +1 -1
  65. package/lib-esm/sync/datastoreConnectivity.js +1 -11
  66. package/lib-esm/sync/datastoreConnectivity.js.map +1 -1
  67. package/lib-esm/sync/index.js +1 -67
  68. package/lib-esm/sync/index.js.map +1 -1
  69. package/lib-esm/sync/merger.js +1 -67
  70. package/lib-esm/sync/merger.js.map +1 -1
  71. package/lib-esm/sync/outbox.js +1 -74
  72. package/lib-esm/sync/outbox.js.map +1 -1
  73. package/lib-esm/sync/processors/errorMaps.js +1 -31
  74. package/lib-esm/sync/processors/errorMaps.js.map +1 -1
  75. package/lib-esm/sync/processors/mutation.js +1 -85
  76. package/lib-esm/sync/processors/mutation.js.map +1 -1
  77. package/lib-esm/sync/processors/subscription.js +1 -67
  78. package/lib-esm/sync/processors/subscription.js.map +1 -1
  79. package/lib-esm/sync/processors/sync.js +1 -74
  80. package/lib-esm/sync/processors/sync.js.map +1 -1
  81. package/lib-esm/sync/utils.js +1 -47
  82. package/lib-esm/sync/utils.js.map +1 -1
  83. package/lib-esm/types.js +1 -36
  84. package/lib-esm/types.js.map +1 -1
  85. package/lib-esm/util.js +1 -67
  86. package/lib-esm/util.js.map +1 -1
  87. package/package.json +8 -7
@@ -1,44 +1,29 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("aws_amplify_pubsub")):"function"==typeof define&&define.amd?define("aws_amplify_datastore",["aws_amplify_pubsub"],t):"object"==typeof exports?exports.aws_amplify_datastore=t(require("aws_amplify_pubsub")):e.aws_amplify_datastore=t(e.aws_amplify_pubsub)}(window,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=144)}([function(e,t,n){"use strict";n.r(t),n.d(t,"__extends",(function(){return i})),n.d(t,"__assign",(function(){return o})),n.d(t,"__rest",(function(){return s})),n.d(t,"__decorate",(function(){return a})),n.d(t,"__param",(function(){return u})),n.d(t,"__metadata",(function(){return c})),n.d(t,"__awaiter",(function(){return l})),n.d(t,"__generator",(function(){return f})),n.d(t,"__createBinding",(function(){return d})),n.d(t,"__exportStar",(function(){return h})),n.d(t,"__values",(function(){return p})),n.d(t,"__read",(function(){return v})),n.d(t,"__spread",(function(){return y})),n.d(t,"__spreadArrays",(function(){return g})),n.d(t,"__await",(function(){return m})),n.d(t,"__asyncGenerator",(function(){return b})),n.d(t,"__asyncDelegator",(function(){return w})),n.d(t,"__asyncValues",(function(){return S})),n.d(t,"__makeTemplateObject",(function(){return _})),n.d(t,"__importStar",(function(){return E})),n.d(t,"__importDefault",(function(){return A})),n.d(t,"__classPrivateFieldGet",(function(){return O})),n.d(t,"__classPrivateFieldSet",(function(){return I}));
2
- /*! *****************************************************************************
3
- Copyright (c) Microsoft Corporation.
4
-
5
- Permission to use, copy, modify, and/or distribute this software for any
6
- purpose with or without fee is hereby granted.
7
-
8
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
- PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */
16
- var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function i(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function s(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function a(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function u(e,t){return function(n,r){t(n,r,e)}}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function f(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next: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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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 d(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}function h(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||(t[n]=e[n])}function p(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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(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 y(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(v(arguments[t]));return e}function g(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}function m(e){return this instanceof m?(this.v=e,this):new m(e)}function b(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{(n=i[e](t)).value instanceof m?Promise.resolve(n.value.v).then(u,c):l(o[0][2],n)}catch(e){l(o[0][3],e)}var n}function u(e){a("next",e)}function c(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function w(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:m(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function S(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=p(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}function _(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function E(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function A(e){return e&&e.__esModule?e:{default:e}}function O(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function I(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}},function(e,t,n){"use strict";n.d(t,"w",(function(){return v})),n.d(t,"l",(function(){return y})),n.d(t,"x",(function(){return g})),n.d(t,"o",(function(){return m})),n.d(t,"q",(function(){return b})),n.d(t,"r",(function(){return w})),n.d(t,"p",(function(){return S})),n.d(t,"e",(function(){return r})),n.d(t,"f",(function(){return i})),n.d(t,"c",(function(){return o})),n.d(t,"n",(function(){return _})),n.d(t,"s",(function(){return E})),n.d(t,"t",(function(){return A})),n.d(t,"m",(function(){return O})),n.d(t,"h",(function(){return s})),n.d(t,"v",(function(){return I})),n.d(t,"u",(function(){return T})),n.d(t,"j",(function(){return a})),n.d(t,"k",(function(){return u})),n.d(t,"a",(function(){return c})),n.d(t,"g",(function(){return l})),n.d(t,"y",(function(){return C})),n.d(t,"i",(function(){return f})),n.d(t,"b",(function(){return P})),n.d(t,"d",(function(){return x}));var r,i,o,s,a,u,c,l,f,d=n(2),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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},p=function(e,t){var n,r,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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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 v(e){return e&&void 0!==e.pluralName}function y(e){return e&&e.associatedWith}function g(e){return e&&e.targetName}function m(e){return"auth"===e.type&&e.properties&&e.properties.rules&&e.properties.rules.length>0}function b(e){return"key"===e.type&&e.properties&&e.properties.fields&&e.properties.fields.length>0}function w(e){return b(e)&&void 0===e.properties.name}function S(e){return b(e)&&void 0!==e.properties.name&&e.properties.fields.length>2}function _(e){return e&&void 0!==o[e]}function E(e){return!(!e||!e.model)}function A(e){return!(!e||!e.nonModel)}function O(e){return!(!e||!e.enum)}function I(e){return e&&void 0!==e.field}function T(e){return e&&void 0!==e.type}function C(e,t){return h(this,void 0,void 0,(function(){return p(this,(function(n){return[2,{modelConstructor:e,conditionProducer:t}]}))}))}!function(e){e.CUSTOM="custom",e.OWNER="owner",e.GROUPS="groups",e.PRIVATE="private",e.PUBLIC="public"}(r||(r={})),function(e){e.FUNCTION="function",e.USER_POOLS="userPools",e.OIDC="oidc",e.IAM="iam",e.API_KEY="apiKey"}(i||(i={})),function(e){e[e.ID=0]="ID",e[e.String=1]="String",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Boolean=4]="Boolean",e[e.AWSDate=5]="AWSDate",e[e.AWSTime=6]="AWSTime",e[e.AWSDateTime=7]="AWSDateTime",e[e.AWSTimestamp=8]="AWSTimestamp",e[e.AWSEmail=9]="AWSEmail",e[e.AWSJSON=10]="AWSJSON",e[e.AWSURL=11]="AWSURL",e[e.AWSPhone=12]="AWSPhone",e[e.AWSIPAddress=13]="AWSIPAddress"}(o||(o={})),function(e){e.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:Object(d.h)(e)}},e.getValidationFunction=function(e){switch(e){case"AWSDate":return d.l;case"AWSTime":return d.r;case"AWSDateTime":return d.m;case"AWSTimestamp":return d.s;case"AWSEmail":return d.n;case"AWSJSON":return d.p;case"AWSURL":return d.t;case"AWSPhone":return d.q;case"AWSIPAddress":return d.o;default:return}}}(o||(o={})),function(e){e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"}(s||(s={})),function(e){e[e.FIRST=0]="FIRST",e[e.LAST=1]="LAST"}(a||(a={})),function(e){e.ASCENDING="ASCENDING",e.DESCENDING="DESCENDING"}(u||(u={})),function(e){e.DEFAULT="DEFAULT",e.MULTI_AUTH="MULTI_AUTH"}(c||(c={})),function(e){e.CREATE="CREATE",e.READ="READ",e.UPDATE="UPDATE",e.DELETE="DELETE"}(l||(l={})),function(e){e.sync="sync",e.mutate="mutate",e.subscribe="subscribe"}(f||(f={}));var x,P=Symbol("DISCARD");!function(e){e.LIMIT="LIMIT",e.TIMER="TIMER"}(x||(x={}))},function(e,t,n){"use strict";n.d(t,"e",(function(){return T})),n.d(t,"d",(function(){return C})),n.d(t,"c",(function(){return x})),n.d(t,"a",(function(){return I})),n.d(t,"f",(function(){return P})),n.d(t,"h",(function(){return k})),n.d(t,"w",(function(){return N})),n.d(t,"D",(function(){return M})),n.d(t,"u",(function(){return R})),n.d(t,"A",(function(){return U})),n.d(t,"v",(function(){return L})),n.d(t,"g",(function(){return B})),n.d(t,"C",(function(){return z})),n.d(t,"i",(function(){return K})),n.d(t,"j",(function(){return H})),n.d(t,"x",(function(){return V})),n.d(t,"z",(function(){return W})),n.d(t,"k",(function(){return Y})),n.d(t,"B",(function(){return J})),n.d(t,"E",(function(){return $})),n.d(t,"l",(function(){return Z})),n.d(t,"r",(function(){return Q})),n.d(t,"m",(function(){return X})),n.d(t,"s",(function(){return ee})),n.d(t,"n",(function(){return te})),n.d(t,"p",(function(){return ne})),n.d(t,"t",(function(){return re})),n.d(t,"q",(function(){return ie})),n.d(t,"o",(function(){return oe})),n.d(t,"b",(function(){return ae})),n.d(t,"y",(function(){return ue}));var r=n(6);function i(e){var t=new Error(e);return t.source="ulid",t}var o="0123456789ABCDEFGHJKMNPQRSTVWXYZ",s=o.length,a=Math.pow(2,48)-1;function u(e,t,n){return t>e.length-1?e:e.substr(0,t)+n+e.substr(t+1)}function c(e){var t=Math.floor(e()*s);return t===s&&(t=s-1),o.charAt(t)}function l(e,t){if(isNaN(e))throw new Error(e+" must be a number");if(e>a)throw i("cannot encode time greater than "+a);if(e<0)throw i("time must be positive");if(!1===Number.isInteger(e))throw i("time must be an integer");for(var n=void 0,r="";t>0;t--)r=o.charAt(n=e%s)+r,e=(e-n)/s;return r}function f(e,t){for(var n="";e>0;e--)n=c(t)+n;return n}function d(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments[1];t||(t="undefined"!=typeof window?window:null);var r=t&&(t.crypto||t.msCrypto);if(r)return function(){var e=new Uint8Array(1);return r.getRandomValues(e),e[0]/255};try{var o=n(86);return function(){return o.randomBytes(1).readUInt8()/255}}catch(e){}if(e){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch(e){}return function(){return Math.random()}}throw i("secure crypto unusable, insecure Math.random not allowed")}function h(e){e||(e=d());var t=0,n=void 0;return function(r){if(isNaN(r)&&(r=Date.now()),r<=t){var a=n=function(e){for(var t=void 0,n=e.length,r=void 0,a=void 0,c=s-1;!t&&n-- >=0;){if(r=e[n],-1===(a=o.indexOf(r)))throw i("incorrectly encoded string");a!==c?t=u(e,n,o[a+1]):e=u(e,n,o[0])}if("string"==typeof t)return t;throw i("cannot increment this string")}(n);return l(t,10)+a}t=r;var c=n=f(16,e);return l(r,10)+c}}p||(p=d());var p,v=n(31),y=n(15),g=n(1),m=n(8);function b(e){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var w,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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},_=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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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=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(E(arguments[t]));return e},O=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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};!function(e){e.DATASTORE="datastore",e.USER="user",e.SYNC="sync",e.STORAGE="storage"}(w||(w={}));var I=w.DATASTORE,T=w.USER,C=w.SYNC,x=w.STORAGE,P="/DataStore",k=function(e,t){if(void 0===t&&(t=!0),t)throw new Error("Invalid "+e)},N=function(e){return void 0===e||null==e},M=function e(t,n,r){var i,o=!1;if(0===r.length)return!0;switch(n){case"not":i="every",o=!0;break;case"and":i="every";break;case"or":i="some";break;default:k(n)}var s=r[i]((function(n){if(Object(g.v)(n)){var r=n.field,i=n.operator,o=n.operand,s=t[r];return j(s,i,o)}if(Object(g.u)(n)){var a=n.type,u=n.predicates;return e(t,a,u)}throw new Error("Not a predicate or group")}));return o?!s:s},j=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;case"between":var r=E(n,2),i=r[0],o=r[1];return e>=i&&e<=o;case"beginsWith":return!N(e)&&e.startsWith(n);case"contains":return!N(e)&&e.indexOf(n)>-1;case"notContains":return N(e)||-1===e.indexOf(n);default:return k(t,!1),!1}},R=function(e){return e&&"function"==typeof e.copyOf},D=new WeakSet;function U(e){D.add(e)}var F,L=function(e){return D.has(e)},B=function(e){var t={},n={};return Object.keys(e.models).forEach((function(r){var i,o,s,a;t[r]={indexes:[],relationTypes:[]},n[r]={};var u,c,l,f=e.models[r];if(Object.keys(f.fields).forEach((function(e){var n=f.fields[e];if("object"===b(n.type)&&"model"in n.type){var i=n.association.connectionType;t[r].relationTypes.push({fieldName:n.name,modelName:n.type.model,relationType:i,targetName:n.association.targetName,associatedWith:n.association.associatedWith}),"BELONGS_TO"===i&&t[r].indexes.push(n.association.targetName)}})),f.attributes){n[r].compositeKeys=(u=f.attributes,l=(c=function(e){return e.reduce((function(e,t){var n=new Set(t);if(0===e.length)return e.push(n),e;var r=e.findIndex((function(e){return A(e).some((function(e){return n.has(e)}))}));if(r>-1){var i=new Set(A(e[r],n));e[r]=i}else e.push(n);return e}),[])})(u.filter(g.p).map((function(e){return E(e.properties.fields).slice(1)}))),c(l));try{for(var d=O(f.attributes),h=d.next();!h.done;h=d.next()){var p=h.value;if(Object(g.q)(p)){Object(g.r)(p)&&(n[r].primaryKey=p.properties.fields);var v=p.properties.fields;try{for(var y=(s=void 0,O(v)),m=y.next();!m.done;m=y.next()){var w=m.value;t[r].indexes.includes(w)||t[r].indexes.push(w)}}catch(e){s={error:e}}finally{try{m&&!m.done&&(a=y.return)&&a.call(y)}finally{if(s)throw s.error}}}}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}}})),[t,n]},q=new WeakMap,z=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]){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:k(o.relationType)}}))}));u.unshift({modelName:e,item:c,instance:c}),q.has(n)||q.set(n,Array.from(n.modelTopologicalOrdering.keys()));var l=q.get(n);return u.sort((function(e,t){return l.indexOf(e.modelName)-l.indexOf(t.modelName)})),u},K=function(e,t){var n="";return e.some((function(e){e.modelName===t&&(n=e.targetName)})),n},H=function(e,t){return e.find((function(e){return e===t}))},V=function(){return new Promise((function(e){var t,n=Object(v.v4)(),r=function(){F=!1,e(!0)},i=function(){return S(void 0,void 0,void 0,(function(){return _(this,(function(r){switch(r.label){case 0:return t&&t.result&&"function"==typeof t.result.close?[4,t.result.close()]:[3,2];case 1:r.sent(),r.label=2;case 2:return[4,indexedDB.deleteDatabase(n)];case 3:return r.sent(),F=!0,[2,e(!1)]}}))}))};return!0===F?i():!1===F||null===indexedDB?r():((t=indexedDB.open(n)).onerror=r,void(t.onsuccess=i))}))},G=function(){return(e=1,r.Buffer.from((new m.j).random(e).toString(),"hex")).readUInt8(0)/255;var e};function W(e){var t=h(G);return function(){return t(e)}}function Y(){return"undefined"!=typeof performance&&performance&&"function"==typeof performance.now?0|performance.now():Date.now()}function J(e){return function(t,n){var r,i;try{for(var o=O(e),s=o.next();!s.done;s=o.next()){var a=s.value,u=a.field,c=a.sortDirection===g.k.ASCENDING?1:-1;if(t[u]<n[u])return-1*c;if(t[u]>n[u])return 1*c}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return 0}}function $(e,t,n){var r,i;void 0===n&&(n=!1);var o,s,a=e,u=t;if(a instanceof Object&&!(u instanceof Object)||!(a instanceof Object)&&u instanceof Object)return!1;if(!(a instanceof Object))return!(!n||(o=a,s=u,null!=o||null!=s))||a===u;if(Array.isArray(a)&&!Array.isArray(u)||Array.isArray(u)&&!Array.isArray(a))return!1;a instanceof Set&&u instanceof Set&&(a=A(a),u=A(u)),a instanceof Map&&u instanceof Map&&(a=Object.fromEntries(a),u=Object.fromEntries(u));var c=Object.keys(a),l=Object.keys(u);if(c.length!==l.length&&(!n||Array.isArray(a)))return!1;var f=c.length>=l.length?c:l;try{for(var d=O(f),h=d.next();!h.done;h=d.next()){var p=h.value;if(!$(a[p],u[p],n))return!1}}catch(e){r={error:e}}finally{try{h&&!h.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}return!0}var Z=function(e){return!!/^\d{4}-\d{2}-\d{2}(Z|[+-]\d{2}:\d{2}($|:\d{2}))?$/.exec(e)},Q=function(e){return!!/^\d{2}:\d{2}(:\d{2}(.\d+)?)?(Z|[+-]\d{2}:\d{2}($|:\d{2}))?$/.exec(e)},X=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)},ee=function(e){return!!/^\d+$/.exec(String(e))},te=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)},ne=function(e){try{return JSON.parse(e),!0}catch(e){return!1}},re=function(e){try{return!!new URL(e)}catch(e){return!1}},ie=function(e){return!!/^\+?\d[\d\s-]+$/.exec(e)},oe=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)},se=function(){var e=this;this.promise=new Promise((function(t,n){e.resolve=t,e.reject=n}))},ae=function(){function e(e){this.limitPromise=new se,this.raceInFlight=!1,this.callback=function(){},this.defaultErrorHandler=function(e){throw void 0===e&&(e="DeferredCallbackResolver error"),new 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(g.d.TIMER)}),e.maxInterval)}))},e.prototype.racePromises=function(){return S(this,void 0,void 0,(function(){var e,t;return _(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 se,[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(g.d.LIMIT)},e}();function ue(e,t,n){var r,i=t.concat(n);return Object(y.d)(e,(function(e){Object(y.a)(e,i)}),(function(e){r=e})),r}},function(e,t,n){"use strict";var r,i,o;function s(e){return e&&!!["provider"].find((function(t){return e.hasOwnProperty(t)}))}function a(e){return e&&!!["customProvider"].find((function(t){return e.hasOwnProperty(t)}))}function u(e){return e&&!!["customState"].find((function(t){return e.hasOwnProperty(t)}))}function c(e){return void 0!==e.redirectSignIn}function l(e){return!!e.username}n.d(t,"b",(function(){return r})),n.d(t,"f",(function(){return s})),n.d(t,"g",(function(){return a})),n.d(t,"d",(function(){return u})),n.d(t,"e",(function(){return c})),n.d(t,"a",(function(){return i})),n.d(t,"h",(function(){return l})),n.d(t,"c",(function(){return o})),function(e){e.Cognito="COGNITO",e.Google="Google",e.Facebook="Facebook",e.Amazon="LoginWithAmazon",e.Apple="SignInWithApple"}(r||(r={})),function(e){e.NoConfig="noConfig",e.MissingAuthConfig="missingAuthConfig",e.EmptyUsername="emptyUsername",e.InvalidUsername="invalidUsername",e.EmptyPassword="emptyPassword",e.EmptyCode="emptyCode",e.SignUpError="signUpError",e.NoMFA="noMFA",e.InvalidMFA="invalidMFA",e.EmptyChallengeResponse="emptyChallengeResponse",e.NoUserSession="noUserSession",e.Default="default",e.DeviceConfig="deviceConfig",e.NetworkError="networkError",e.AutoSignInError="autoSignInError"}(i||(i={})),function(e){e.API_KEY="API_KEY",e.AWS_IAM="AWS_IAM",e.OPENID_CONNECT="OPENID_CONNECT",e.AMAZON_COGNITO_USER_POOLS="AMAZON_COGNITO_USER_POOLS",e.AWS_LAMBDA="AWS_LAMBDA"}(o||(o={}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return l})),n.d(t,"e",(function(){return b})),n.d(t,"c",(function(){return w})),n.d(t,"b",(function(){return S})),n.d(t,"d",(function(){return _})),n.d(t,"k",(function(){return E})),n.d(t,"l",(function(){return A})),n.d(t,"j",(function(){return O})),n.d(t,"h",(function(){return I})),n.d(t,"g",(function(){return T})),n.d(t,"f",(function(){return C})),n.d(t,"i",(function(){return x}));var r=n(3),i=n(20),o=n(21),s=n(1),a=n(2);function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var c,l,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,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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},h=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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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 o.a("DataStore");!function(e){e.LIST="query",e.CREATE="mutation",e.UPDATE="mutation",e.DELETE="mutation",e.GET="query"}(c||(c={})),function(e){e.CREATE="Create",e.UPDATE="Update",e.DELETE="Delete",e.GET="Get"}(l||(l={}));var v={_version:void 0,_lastChangedAt:void 0,_deleted:void 0},y=Object.keys(v);function g(e,t){var n=m(t),r=function(e,t){var n=[];return Object.values(t.fields).forEach((function(t){var r=t.name,i=t.type;if(Object(s.t)(i)){var o=e.nonModels[i.nonModel],a=Object.values(m(o)).map((function(e){return e.name})),u=[];Object.values(o.fields).forEach((function(t){var n=t.type,r=t.name;if(Object(s.t)(n)){var i=e.nonModels[n.nonModel];u.push(r+" { "+g(e,i)+" }")}})),n.push(r+" { "+a.join(" ")+" "+u.join(" ")+" }")}})),n}(e,t),i=function(e,t){var n=function(e){var t=[];Object(s.w)(e)&&e.attributes&&e.attributes.forEach((function(e){if(e.properties&&e.properties.rules){var n=e.properties.rules.find((function(e){return"owner"===e.allow}));n&&n.ownerField&&t.push(n.ownerField)}}));return t}(e);if(!t.owner&&n.includes("owner"))return["owner"];return[]}(t,n),o=Object.values(n).map((function(e){return e.name})).concat(i).concat(r);return Object(s.w)(t)&&(o=o.concat(y).concat(function(e){var t=[];return Object.values(e.fields).filter((function(e){var t=e.association;return t&&Object.keys(t).length})).forEach((function(e){var n=e.name,r=e.association,i=r.connectionType;switch(i){case"HAS_ONE":case"HAS_MANY":break;case"BELONGS_TO":Object(s.x)(r)&&t.push(n+" { id _deleted }");break;default:Object(a.h)(i)}})),t}(t))),o.join("\n")}function m(e){var t=e.fields;return Object.values(t).filter((function(e){return!(!Object(s.n)(e.type)&&!Object(s.m)(e.type))})).reduce((function(e,t){return e[t.name]=t,e}),{})}function b(e){var t=([].concat(e.attributes).find((function(e){return e&&"auth"===e.type}))||{}).properties,n=(void 0===t?{}:t).rules,r=[];return(void 0===n?[]:n).forEach((function(t){var n=t.identityClaim,i=void 0===n?"cognito:username":n,o=t.ownerField,s=void 0===o?"owner":o,a=t.operations,u=void 0===a?["create","update","delete","read"]:a,c=t.provider,l=void 0===c?"userPools":c,f=t.groupClaim,d=void 0===f?"cognito:groups":f,h=t.allow,p=void 0===h?"iam":h,v=t.groups,y=void 0===v?[]:v,g="owner"===p;if(u.includes("read")||g){var m={identityClaim:i,ownerField:s,provider:l,groupClaim:d,authStrategy:p,groups:y,areSubscriptionsPublic:!1};if(g){var b=([].concat(e.attributes).find((function(e){return e&&"model"===e.type}))||{}).properties,w=(void 0===b?{}:b).subscriptions,S=(void 0===w?{}:w).level,_=void 0===S?"on":S;m.areSubscriptionsPublic=!u.includes("read")||"public"===_}g?r.push(m):r.unshift(m)}})),r}function w(e,t,n,r,i){var o=g(e,t),s=t.name,a=(t.pluralName,"on"+n+s),u="",c="";return r&&(u="($"+i+": String!)",c="("+i+": $"+i+")"),[n,a,"subscription operation"+u+"{\n\t\t\t"+a+c+"{\n\t\t\t\t"+o+"\n\t\t\t}\n\t\t}"]}function S(e,t,n){var r,i,o=g(e,t),s=t.name,u=t.pluralName,f=" ",d=" ";switch(n){case"LIST":r="sync"+u,f="($limit: Int, $nextToken: String, $lastSync: AWSTimestamp, $filter: Model"+s+"FilterInput)",d="(limit: $limit, nextToken: $nextToken, lastSync: $lastSync, filter: $filter)",o="items {\n\t\t\t\t\t\t\t"+o+"\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnextToken\n\t\t\t\t\t\tstartedAt";break;case"CREATE":r="create"+s,f="($input: Create"+s+"Input!)",d="(input: $input)",i=l.CREATE;break;case"UPDATE":r="update"+s,f="($input: Update"+s+"Input!, $condition: Model"+s+"ConditionInput)",d="(input: $input, condition: $condition)",i=l.UPDATE;break;case"DELETE":r="delete"+s,f="($input: Delete"+s+"Input!, $condition: Model"+s+"ConditionInput)",d="(input: $input, condition: $condition)",i=l.DELETE;break;case"GET":r="get"+s,f="($id: ID!)",d="(id: $id)",i=l.GET;break;default:Object(a.h)(n)}return[[i,r,c[n]+" operation"+f+"{\n\t\t"+r+d+"{\n\t\t\t"+o+"\n\t\t}\n\t}"]]}function _(e,t,n,r,i,o,c,d,h){var p;switch(n){case s.h.INSERT:p=l.CREATE;break;case s.h.UPDATE:p=l.UPDATE;break;case s.h.DELETE:p=l.DELETE;break;default:Object(a.h)(n)}return d(c,f(f({},h?{id:h}:{}),{data:JSON.stringify(i,(function(e,n){return e&&null!==n&&"object"===u(n)&&t.fields[e]&&"AWSJSON"===t.fields[e].type?JSON.stringify(n):n})),modelId:i.id,model:r.name,operation:p,condition:JSON.stringify(o)}))}function E(e){var t={};return e&&Array.isArray(e.predicates)?(e.predicates.forEach((function(e){var n;if(Object(s.v)(e)){var r=e.field,i=e.operator,o=e.operand;if("id"===r)return;t[r]=((n={})[i]=o,n)}else t[e.type]=E(e)})),t):t}function A(e){var t={};if(!e||!Array.isArray(e.predicates))return t;var n=e.type,r=e.predicates,i="and"===n||"or"===n;t[n]=i?[]:{};var o=function(e){return i?t[n].push(e):t[n]=e};return r.forEach((function(e){var t,n;if(Object(s.v)(e)){var r=e.field,i=e.operator,a=e.operand,u=((t={})[r]=((n={})[i]=a,n),t);o(u)}else o(A(e))})),t}function O(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 I(e){var t=e.authModeStrategy,n=e.defaultAuthMode,r=e.modelName,i=e.schema;return d(this,void 0,void 0,(function(){var e,o,a,u=this;return h(this,(function(c){switch(c.label){case 0:e=Object.values(s.g),o={CREATE:[],READ:[],UPDATE:[],DELETE:[]},c.label=1;case 1:return c.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e){return d(u,void 0,void 0,(function(){var s;return h(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 c.sent(),[3,4];case 3:return a=c.sent(),p.debug("Error getting auth modes for model: "+r,a),[3,4];case 4:return[2,o]}}))}))}function T(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 C(e){var t=Object.values(i.a);return e&&e.message&&t.find((function(t){return e.message.includes(t)}))||null}function x(e,t){return void 0===t&&(t={}),d(this,void 0,void 0,(function(){var n,i,o;return h(this,(function(s){switch(s.label){case 0:if(e!==r.c.AWS_LAMBDA)return[3,6];if(n=t.authProviders,!(i=(void 0===n?{functionAuthProvider:null}:n).functionAuthProvider)||"function"!=typeof i)return[3,5];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,i()];case 2:return[2,s.sent().token];case 3:throw o=s.sent(),new Error("Error retrieving token from `functionAuthProvider`: "+o);case 4:return[3,6];case 5:throw new Error("You must provide a `functionAuthProvider` function to `DataStore.configure` when using "+r.c.AWS_LAMBDA);case 6:return[2]}}))}))}},function(e,t,n){"use strict";n.d(t,"c",(function(){return o})),n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return a}));var r=n(2),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){var u=s;switch(u){case"and":case"or":case"not":return function(t){var r={type:u,predicates:[]},i=new Proxy({},n);return e.predicateGroupsMap.set(i,r),t(i),e.predicateGroupsMap.get(a).predicates.push(r),a};default:Object(r.h)(u,!1)}var c=s;if(!o.has(c))throw new Error("Invalid field for model. field: "+c+", model: "+i);return function(t,n){return e.predicateGroupsMap.get(a).predicates.push({field:c,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 new 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}()},function(e,t,n){"use strict";(function(e){
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("aws_amplify_pubsub")):"function"==typeof define&&define.amd?define("aws_amplify_datastore",["aws_amplify_pubsub"],t):"object"==typeof exports?exports.aws_amplify_datastore=t(require("aws_amplify_pubsub")):e.aws_amplify_datastore=t(e.aws_amplify_pubsub)}(window,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=146)}([function(e,t,n){"use strict";n.d(t,"d",(function(){return i})),n.d(t,"a",(function(){return o})),n.d(t,"g",(function(){return s})),n.d(t,"c",(function(){return a})),n.d(t,"e",(function(){return u})),n.d(t,"i",(function(){return c})),n.d(t,"f",(function(){return l})),n.d(t,"h",(function(){return f})),n.d(t,"b",(function(){return d}));var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function s(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function a(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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function u(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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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])}}}Object.create;function c(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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function l(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 f(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(l(arguments[t]));return e}function d(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=c(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}Object.create},function(e,t,n){"use strict";n.d(t,"w",(function(){return p})),n.d(t,"l",(function(){return v})),n.d(t,"x",(function(){return y})),n.d(t,"o",(function(){return g})),n.d(t,"q",(function(){return m})),n.d(t,"r",(function(){return b})),n.d(t,"p",(function(){return w})),n.d(t,"e",(function(){return r})),n.d(t,"f",(function(){return i})),n.d(t,"c",(function(){return o})),n.d(t,"n",(function(){return S})),n.d(t,"s",(function(){return O})),n.d(t,"t",(function(){return _})),n.d(t,"m",(function(){return E})),n.d(t,"h",(function(){return s})),n.d(t,"v",(function(){return A})),n.d(t,"u",(function(){return I})),n.d(t,"j",(function(){return a})),n.d(t,"k",(function(){return u})),n.d(t,"a",(function(){return c})),n.d(t,"g",(function(){return l})),n.d(t,"y",(function(){return T})),n.d(t,"i",(function(){return f})),n.d(t,"b",(function(){return C})),n.d(t,"d",(function(){return j}));var r,i,o,s,a,u,c,l,f,d=n(0),h=n(2);function p(e){return e&&void 0!==e.pluralName}function v(e){return e&&e.associatedWith}function y(e){return e&&e.targetName}function g(e){return"auth"===e.type&&e.properties&&e.properties.rules&&e.properties.rules.length>0}function m(e){return"key"===e.type&&e.properties&&e.properties.fields&&e.properties.fields.length>0}function b(e){return m(e)&&void 0===e.properties.name}function w(e){return m(e)&&void 0!==e.properties.name&&e.properties.fields.length>2}function S(e){return e&&void 0!==o[e]}function O(e){return!(!e||!e.model)}function _(e){return!(!e||!e.nonModel)}function E(e){return!(!e||!e.enum)}function A(e){return e&&void 0!==e.field}function I(e){return e&&void 0!==e.type}function T(e,t){return Object(d.c)(this,void 0,void 0,(function(){return Object(d.e)(this,(function(n){return[2,{modelConstructor:e,conditionProducer:t}]}))}))}!function(e){e.CUSTOM="custom",e.OWNER="owner",e.GROUPS="groups",e.PRIVATE="private",e.PUBLIC="public"}(r||(r={})),function(e){e.FUNCTION="function",e.USER_POOLS="userPools",e.OIDC="oidc",e.IAM="iam",e.API_KEY="apiKey"}(i||(i={})),function(e){e[e.ID=0]="ID",e[e.String=1]="String",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Boolean=4]="Boolean",e[e.AWSDate=5]="AWSDate",e[e.AWSTime=6]="AWSTime",e[e.AWSDateTime=7]="AWSDateTime",e[e.AWSTimestamp=8]="AWSTimestamp",e[e.AWSEmail=9]="AWSEmail",e[e.AWSJSON=10]="AWSJSON",e[e.AWSURL=11]="AWSURL",e[e.AWSPhone=12]="AWSPhone",e[e.AWSIPAddress=13]="AWSIPAddress"}(o||(o={})),function(e){e.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:Object(h.h)(e)}},e.getValidationFunction=function(e){switch(e){case"AWSDate":return h.l;case"AWSTime":return h.r;case"AWSDateTime":return h.m;case"AWSTimestamp":return h.s;case"AWSEmail":return h.n;case"AWSJSON":return h.p;case"AWSURL":return h.t;case"AWSPhone":return h.q;case"AWSIPAddress":return h.o;default:return}}}(o||(o={})),function(e){e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"}(s||(s={})),function(e){e[e.FIRST=0]="FIRST",e[e.LAST=1]="LAST"}(a||(a={})),function(e){e.ASCENDING="ASCENDING",e.DESCENDING="DESCENDING"}(u||(u={})),function(e){e.DEFAULT="DEFAULT",e.MULTI_AUTH="MULTI_AUTH"}(c||(c={})),function(e){e.CREATE="CREATE",e.READ="READ",e.UPDATE="UPDATE",e.DELETE="DELETE"}(l||(l={})),function(e){e.sync="sync",e.mutate="mutate",e.subscribe="subscribe"}(f||(f={}));var j,C=Symbol("DISCARD");!function(e){e.LIMIT="LIMIT",e.TIMER="TIMER"}(j||(j={}))},function(e,t,n){"use strict";n.d(t,"e",(function(){return _})),n.d(t,"d",(function(){return E})),n.d(t,"c",(function(){return A})),n.d(t,"a",(function(){return O})),n.d(t,"f",(function(){return I})),n.d(t,"h",(function(){return T})),n.d(t,"w",(function(){return j})),n.d(t,"D",(function(){return C})),n.d(t,"u",(function(){return x})),n.d(t,"A",(function(){return N})),n.d(t,"v",(function(){return D})),n.d(t,"g",(function(){return R})),n.d(t,"C",(function(){return F})),n.d(t,"i",(function(){return L})),n.d(t,"j",(function(){return B})),n.d(t,"x",(function(){return q})),n.d(t,"z",(function(){return K})),n.d(t,"k",(function(){return V})),n.d(t,"B",(function(){return G})),n.d(t,"E",(function(){return H})),n.d(t,"l",(function(){return W})),n.d(t,"r",(function(){return Y})),n.d(t,"m",(function(){return J})),n.d(t,"s",(function(){return $})),n.d(t,"n",(function(){return Z})),n.d(t,"p",(function(){return Q})),n.d(t,"t",(function(){return X})),n.d(t,"q",(function(){return ee})),n.d(t,"o",(function(){return te})),n.d(t,"b",(function(){return re})),n.d(t,"y",(function(){return ie}));var r=n(0),i=n(6);function o(e){var t=new Error(e);return t.source="ulid",t}var s="0123456789ABCDEFGHJKMNPQRSTVWXYZ",a=s.length,u=Math.pow(2,48)-1;function c(e,t,n){return t>e.length-1?e:e.substr(0,t)+n+e.substr(t+1)}function l(e){var t=Math.floor(e()*a);return t===a&&(t=a-1),s.charAt(t)}function f(e,t){if(isNaN(e))throw new Error(e+" must be a number");if(e>u)throw o("cannot encode time greater than "+u);if(e<0)throw o("time must be positive");if(!1===Number.isInteger(e))throw o("time must be an integer");for(var n=void 0,r="";t>0;t--)r=s.charAt(n=e%a)+r,e=(e-n)/a;return r}function d(e,t){for(var n="";e>0;e--)n=l(t)+n;return n}function h(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments[1];t||(t="undefined"!=typeof window?window:null);var r=t&&(t.crypto||t.msCrypto);if(r)return function(){var e=new Uint8Array(1);return r.getRandomValues(e),e[0]/255};try{var i=n(87);return function(){return i.randomBytes(1).readUInt8()/255}}catch(e){}if(e){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch(e){}return function(){return Math.random()}}throw o("secure crypto unusable, insecure Math.random not allowed")}function p(e){e||(e=h());var t=0,n=void 0;return function(r){if(isNaN(r)&&(r=Date.now()),r<=t){var i=n=function(e){for(var t=void 0,n=e.length,r=void 0,i=void 0,u=a-1;!t&&n-- >=0;){if(r=e[n],-1===(i=s.indexOf(r)))throw o("incorrectly encoded string");i!==u?t=c(e,n,s[i+1]):e=c(e,n,s[0])}if("string"==typeof t)return t;throw o("cannot increment this string")}(n);return f(t,10)+i}t=r;var u=n=d(16,e);return f(r,10)+u}}v||(v=h());var v,y,g=n(34),m=n(16),b=n(1),w=n(8);function S(e){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e){e.DATASTORE="datastore",e.USER="user",e.SYNC="sync",e.STORAGE="storage"}(y||(y={}));var O=y.DATASTORE,_=y.USER,E=y.SYNC,A=y.STORAGE,I="/DataStore",T=function(e,t){if(void 0===t&&(t=!0),t)throw new Error("Invalid "+e)},j=function(e){return void 0===e||null==e},C=function e(t,n,r){var i,o=!1;if(0===r.length)return!0;switch(n){case"not":i="every",o=!0;break;case"and":i="every";break;case"or":i="some";break;default:T(n)}var s=r[i]((function(n){if(Object(b.v)(n)){var r=n.field,i=n.operator,o=n.operand,s=t[r];return P(s,i,o)}if(Object(b.u)(n)){var a=n.type,u=n.predicates;return e(t,a,u)}throw new Error("Not a predicate or group")}));return o?!s:s},P=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;case"between":var i=Object(r.f)(n,2),o=i[0],s=i[1];return e>=o&&e<=s;case"beginsWith":return!j(e)&&e.startsWith(n);case"contains":return!j(e)&&e.indexOf(n)>-1;case"notContains":return j(e)||-1===e.indexOf(n);default:return T(t,!1),!1}},x=function(e){return e&&"function"==typeof e.copyOf},k=new WeakSet;function N(e){k.add(e)}var M,D=function(e){return k.has(e)},R=function(e){var t={},n={};return Object.keys(e.models).forEach((function(i){var o,s,a,u;t[i]={indexes:[],relationTypes:[]},n[i]={};var c,l,f,d=e.models[i];if(Object.keys(d.fields).forEach((function(e){var n=d.fields[e];if("object"===S(n.type)&&"model"in n.type){var r=n.association.connectionType;t[i].relationTypes.push({fieldName:n.name,modelName:n.type.model,relationType:r,targetName:n.association.targetName,associatedWith:n.association.associatedWith}),"BELONGS_TO"===r&&t[i].indexes.push(n.association.targetName)}})),d.attributes){n[i].compositeKeys=(c=d.attributes,f=(l=function(e){return e.reduce((function(e,t){var n=new Set(t);if(0===e.length)return e.push(n),e;var i=e.findIndex((function(e){return Object(r.h)(e).some((function(e){return n.has(e)}))}));if(i>-1){var o=new Set(Object(r.h)(e[i],n));e[i]=o}else e.push(n);return e}),[])})(c.filter(b.p).map((function(e){return Object(r.f)(e.properties.fields).slice(1)}))),l(f));try{for(var h=Object(r.i)(d.attributes),p=h.next();!p.done;p=h.next()){var v=p.value;if(Object(b.q)(v)){Object(b.r)(v)&&(n[i].primaryKey=v.properties.fields);var y=v.properties.fields;try{for(var g=(a=void 0,Object(r.i)(y)),m=g.next();!m.done;m=g.next()){var w=m.value;t[i].indexes.includes(w)||t[i].indexes.push(w)}}catch(e){a={error:e}}finally{try{m&&!m.done&&(u=g.return)&&u.call(g)}finally{if(a)throw a.error}}}}}catch(e){o={error:e}}finally{try{p&&!p.done&&(s=h.return)&&s.call(h)}finally{if(o)throw o.error}}}})),[t,n]},U=new WeakMap,F=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]){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:T(o.relationType)}}))}));u.unshift({modelName:e,item:c,instance:c}),U.has(n)||U.set(n,Array.from(n.modelTopologicalOrdering.keys()));var l=U.get(n);return u.sort((function(e,t){return l.indexOf(e.modelName)-l.indexOf(t.modelName)})),u},L=function(e,t){var n="";return e.some((function(e){e.modelName===t&&(n=e.targetName)})),n},B=function(e,t){return e.find((function(e){return e===t}))},q=function(){return new Promise((function(e){var t,n=Object(g.v4)(),i=function(){M=!1,e(!0)},o=function(){return Object(r.c)(void 0,void 0,void 0,(function(){return Object(r.e)(this,(function(r){switch(r.label){case 0:return t&&t.result&&"function"==typeof t.result.close?[4,t.result.close()]:[3,2];case 1:r.sent(),r.label=2;case 2:return[4,indexedDB.deleteDatabase(n)];case 3:return r.sent(),M=!0,[2,e(!1)]}}))}))};return!0===M?o():!1===M||null===indexedDB?i():((t=indexedDB.open(n)).onerror=i,void(t.onsuccess=o))}))},z=function(){return(e=1,i.Buffer.from((new w.j).random(e).toString(),"hex")).readUInt8(0)/255;var e};function K(e){var t=p(z);return function(){return t(e)}}function V(){return"undefined"!=typeof performance&&performance&&"function"==typeof performance.now?0|performance.now():Date.now()}function G(e){return function(t,n){var i,o;try{for(var s=Object(r.i)(e),a=s.next();!a.done;a=s.next()){var u=a.value,c=u.field,l=u.sortDirection===b.k.ASCENDING?1:-1;if(t[c]<n[c])return-1*l;if(t[c]>n[c])return 1*l}}catch(e){i={error:e}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}return 0}}function H(e,t,n){var i,o;void 0===n&&(n=!1);var s,a,u=e,c=t;if(u instanceof Object&&!(c instanceof Object)||!(u instanceof Object)&&c instanceof Object)return!1;if(!(u instanceof Object))return!(!n||(s=u,a=c,null!=s||null!=a))||u===c;if(Array.isArray(u)&&!Array.isArray(c)||Array.isArray(c)&&!Array.isArray(u))return!1;u instanceof Set&&c instanceof Set&&(u=Object(r.h)(u),c=Object(r.h)(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&&(!n||Array.isArray(u)))return!1;var d=l.length>=f.length?l:f;try{for(var h=Object(r.i)(d),p=h.next();!p.done;p=h.next()){var v=p.value;if(!H(u[v],c[v],n))return!1}}catch(e){i={error:e}}finally{try{p&&!p.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}return!0}var W=function(e){return!!/^\d{4}-\d{2}-\d{2}(Z|[+-]\d{2}:\d{2}($|:\d{2}))?$/.exec(e)},Y=function(e){return!!/^\d{2}:\d{2}(:\d{2}(.\d+)?)?(Z|[+-]\d{2}:\d{2}($|:\d{2}))?$/.exec(e)},J=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)},$=function(e){return!!/^\d+$/.exec(String(e))},Z=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)},Q=function(e){try{return JSON.parse(e),!0}catch(e){return!1}},X=function(e){try{return!!new URL(e)}catch(e){return!1}},ee=function(e){return!!/^\+?\d[\d\s-]+$/.exec(e)},te=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)},ne=function(){var e=this;this.promise=new Promise((function(t,n){e.resolve=t,e.reject=n}))},re=function(){function e(e){this.limitPromise=new ne,this.raceInFlight=!1,this.callback=function(){},this.defaultErrorHandler=function(e){throw void 0===e&&(e="DeferredCallbackResolver error"),new 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(b.d.TIMER)}),e.maxInterval)}))},e.prototype.racePromises=function(){return Object(r.c)(this,void 0,void 0,(function(){var e,t;return Object(r.e)(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 ne,[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(b.d.LIMIT)},e}();function ie(e,t,n){var r,i=t.concat(n);return Object(m.d)(e,(function(e){Object(m.a)(e,i)}),(function(e){r=e})),r}},function(e,t,n){"use strict";var r,i,o;function s(e){return e&&!!["provider"].find((function(t){return e.hasOwnProperty(t)}))}function a(e){return e&&!!["customProvider"].find((function(t){return e.hasOwnProperty(t)}))}function u(e){return e&&!!["customState"].find((function(t){return e.hasOwnProperty(t)}))}function c(e){return void 0!==e.redirectSignIn}function l(e){return!!e.username}n.d(t,"b",(function(){return r})),n.d(t,"f",(function(){return s})),n.d(t,"g",(function(){return a})),n.d(t,"d",(function(){return u})),n.d(t,"e",(function(){return c})),n.d(t,"a",(function(){return i})),n.d(t,"h",(function(){return l})),n.d(t,"c",(function(){return o})),function(e){e.Cognito="COGNITO",e.Google="Google",e.Facebook="Facebook",e.Amazon="LoginWithAmazon",e.Apple="SignInWithApple"}(r||(r={})),function(e){e.NoConfig="noConfig",e.MissingAuthConfig="missingAuthConfig",e.EmptyUsername="emptyUsername",e.InvalidUsername="invalidUsername",e.EmptyPassword="emptyPassword",e.EmptyCode="emptyCode",e.SignUpError="signUpError",e.NoMFA="noMFA",e.InvalidMFA="invalidMFA",e.EmptyChallengeResponse="emptyChallengeResponse",e.NoUserSession="noUserSession",e.Default="default",e.DeviceConfig="deviceConfig",e.NetworkError="networkError",e.AutoSignInError="autoSignInError"}(i||(i={})),function(e){e.API_KEY="API_KEY",e.AWS_IAM="AWS_IAM",e.OPENID_CONNECT="OPENID_CONNECT",e.AMAZON_COGNITO_USER_POOLS="AMAZON_COGNITO_USER_POOLS",e.AWS_LAMBDA="AWS_LAMBDA"}(o||(o={}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return f})),n.d(t,"e",(function(){return g})),n.d(t,"c",(function(){return m})),n.d(t,"b",(function(){return b})),n.d(t,"d",(function(){return w})),n.d(t,"k",(function(){return S})),n.d(t,"l",(function(){return O})),n.d(t,"j",(function(){return _})),n.d(t,"h",(function(){return E})),n.d(t,"g",(function(){return A})),n.d(t,"f",(function(){return I})),n.d(t,"i",(function(){return T}));var r=n(0),i=n(3),o=n(21),s=n(22),a=n(1),u=n(2);function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var l,f,d=new s.a("DataStore");!function(e){e.LIST="query",e.CREATE="mutation",e.UPDATE="mutation",e.DELETE="mutation",e.GET="query"}(l||(l={})),function(e){e.CREATE="Create",e.UPDATE="Update",e.DELETE="Delete",e.GET="Get"}(f||(f={}));var h={_version:void 0,_lastChangedAt:void 0,_deleted:void 0},p=Object.keys(h);function v(e,t){var n=y(t),r=function(e,t){var n=[];return Object.values(t.fields).forEach((function(t){var r=t.name,i=t.type;if(Object(a.t)(i)){var o=e.nonModels[i.nonModel],s=Object.values(y(o)).map((function(e){return e.name})),u=[];Object.values(o.fields).forEach((function(t){var n=t.type,r=t.name;if(Object(a.t)(n)){var i=e.nonModels[n.nonModel];u.push(r+" { "+v(e,i)+" }")}})),n.push(r+" { "+s.join(" ")+" "+u.join(" ")+" }")}})),n}(e,t),i=function(e,t){var n=function(e){var t=[];Object(a.w)(e)&&e.attributes&&e.attributes.forEach((function(e){if(e.properties&&e.properties.rules){var n=e.properties.rules.find((function(e){return"owner"===e.allow}));n&&n.ownerField&&t.push(n.ownerField)}}));return t}(e);if(!t.owner&&n.includes("owner"))return["owner"];return[]}(t,n),o=Object.values(n).map((function(e){return e.name})).concat(i).concat(r);return Object(a.w)(t)&&(o=o.concat(p).concat(function(e){var t=[];return Object.values(e.fields).filter((function(e){var t=e.association;return t&&Object.keys(t).length})).forEach((function(e){var n=e.name,r=e.association,i=r.connectionType;switch(i){case"HAS_ONE":case"HAS_MANY":break;case"BELONGS_TO":Object(a.x)(r)&&t.push(n+" { id _deleted }");break;default:Object(u.h)(i)}})),t}(t))),o.join("\n")}function y(e){var t=e.fields;return Object.values(t).filter((function(e){return!(!Object(a.n)(e.type)&&!Object(a.m)(e.type))})).reduce((function(e,t){return e[t.name]=t,e}),{})}function g(e){var t=([].concat(e.attributes).find((function(e){return e&&"auth"===e.type}))||{}).properties,n=(void 0===t?{}:t).rules,r=[];return(void 0===n?[]:n).forEach((function(t){var n=t.identityClaim,i=void 0===n?"cognito:username":n,o=t.ownerField,s=void 0===o?"owner":o,a=t.operations,u=void 0===a?["create","update","delete","read"]:a,c=t.provider,l=void 0===c?"userPools":c,f=t.groupClaim,d=void 0===f?"cognito:groups":f,h=t.allow,p=void 0===h?"iam":h,v=t.groups,y=void 0===v?[]:v,g="owner"===p;if(u.includes("read")||g){var m={identityClaim:i,ownerField:s,provider:l,groupClaim:d,authStrategy:p,groups:y,areSubscriptionsPublic:!1};if(g){var b=([].concat(e.attributes).find((function(e){return e&&"model"===e.type}))||{}).properties,w=(void 0===b?{}:b).subscriptions,S=(void 0===w?{}:w).level,O=void 0===S?"on":S;m.areSubscriptionsPublic=!u.includes("read")||"public"===O}g?r.push(m):r.unshift(m)}})),r}function m(e,t,n,r,i){var o=v(e,t),s=t.name,a=(t.pluralName,"on"+n+s),u="",c="";return r&&(u="($"+i+": String!)",c="("+i+": $"+i+")"),[n,a,"subscription operation"+u+"{\n\t\t\t"+a+c+"{\n\t\t\t\t"+o+"\n\t\t\t}\n\t\t}"]}function b(e,t,n){var r,i,o=v(e,t),s=t.name,a=t.pluralName,c=" ",d=" ";switch(n){case"LIST":r="sync"+a,c="($limit: Int, $nextToken: String, $lastSync: AWSTimestamp, $filter: Model"+s+"FilterInput)",d="(limit: $limit, nextToken: $nextToken, lastSync: $lastSync, filter: $filter)",o="items {\n\t\t\t\t\t\t\t"+o+"\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnextToken\n\t\t\t\t\t\tstartedAt";break;case"CREATE":r="create"+s,c="($input: Create"+s+"Input!)",d="(input: $input)",i=f.CREATE;break;case"UPDATE":r="update"+s,c="($input: Update"+s+"Input!, $condition: Model"+s+"ConditionInput)",d="(input: $input, condition: $condition)",i=f.UPDATE;break;case"DELETE":r="delete"+s,c="($input: Delete"+s+"Input!, $condition: Model"+s+"ConditionInput)",d="(input: $input, condition: $condition)",i=f.DELETE;break;case"GET":r="get"+s,c="($id: ID!)",d="(id: $id)",i=f.GET;break;default:Object(u.h)(n)}return[[i,r,l[n]+" operation"+c+"{\n\t\t"+r+d+"{\n\t\t\t"+o+"\n\t\t}\n\t}"]]}function w(e,t,n,i,o,s,l,d,h){var p;switch(n){case a.h.INSERT:p=f.CREATE;break;case a.h.UPDATE:p=f.UPDATE;break;case a.h.DELETE:p=f.DELETE;break;default:Object(u.h)(n)}return d(l,Object(r.a)(Object(r.a)({},h?{id:h}:{}),{data:JSON.stringify(o,(function(e,n){return e&&null!==n&&"object"===c(n)&&t.fields[e]&&"AWSJSON"===t.fields[e].type?JSON.stringify(n):n})),modelId:o.id,model:i.name,operation:p,condition:JSON.stringify(s)}))}function S(e){var t={};return e&&Array.isArray(e.predicates)?(e.predicates.forEach((function(e){var n;if(Object(a.v)(e)){var r=e.field,i=e.operator,o=e.operand;if("id"===r)return;t[r]=((n={})[i]=o,n)}else t[e.type]=S(e)})),t):t}function O(e){var t={};if(!e||!Array.isArray(e.predicates))return t;var n=e.type,r=e.predicates,i="and"===n||"or"===n;t[n]=i?[]:{};var o=function(e){return i?t[n].push(e):t[n]=e};return r.forEach((function(e){var t,n;if(Object(a.v)(e)){var r=e.field,i=e.operator,s=e.operand,u=((t={})[r]=((n={})[i]=s,n),t);o(u)}else o(O(e))})),t}function _(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 E(e){var t=e.authModeStrategy,n=e.defaultAuthMode,i=e.modelName,o=e.schema;return Object(r.c)(this,void 0,void 0,(function(){var e,s,u,c=this;return Object(r.e)(this,(function(l){switch(l.label){case 0:e=Object.values(a.g),s={CREATE:[],READ:[],UPDATE:[],DELETE:[]},l.label=1;case 1:return l.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e){return Object(r.c)(c,void 0,void 0,(function(){var a;return Object(r.e)(this,(function(r){switch(r.label){case 0:return[4,t({schema:o,modelName:i,operation:e})];case 1:return"string"==typeof(a=r.sent())?s[e]=[a]:Array.isArray(a)&&a.length?s[e]=a:s[e]=[n],[2]}}))}))})))];case 2:return l.sent(),[3,4];case 3:return u=l.sent(),d.debug("Error getting auth modes for model: "+i,u),[3,4];case 4:return[2,s]}}))}))}function A(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 I(e){var t=Object.values(o.a);return e&&e.message&&t.find((function(t){return e.message.includes(t)}))||null}function T(e,t){return void 0===t&&(t={}),Object(r.c)(this,void 0,void 0,(function(){var n,o,s;return Object(r.e)(this,(function(r){switch(r.label){case 0:if(e!==i.c.AWS_LAMBDA)return[3,6];if(n=t.authProviders,!(o=(void 0===n?{functionAuthProvider:null}:n).functionAuthProvider)||"function"!=typeof o)return[3,5];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,o()];case 2:return[2,r.sent().token];case 3:throw s=r.sent(),new Error("Error retrieving token from `functionAuthProvider`: "+s);case 4:return[3,6];case 5:throw new Error("You must provide a `functionAuthProvider` function to `DataStore.configure` when using "+i.c.AWS_LAMBDA);case 6:return[2]}}))}))}},function(e,t,n){"use strict";n.d(t,"c",(function(){return o})),n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return a}));var r=n(2),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){var u=s;switch(u){case"and":case"or":case"not":return function(t){var r={type:u,predicates:[]},i=new Proxy({},n);return e.predicateGroupsMap.set(i,r),t(i),e.predicateGroupsMap.get(a).predicates.push(r),a};default:Object(r.h)(u,!1)}var c=s;if(!o.has(c))throw new Error("Invalid field for model. field: "+c+", model: "+i);return function(t,n){return e.predicateGroupsMap.get(a).predicates.push({field:c,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 new 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}()},function(e,t,n){"use strict";(function(e){
17
2
  /*!
18
3
  * The buffer module from node.js, for the browser.
19
4
  *
20
5
  * @author Feross Aboukhadijeh <http://feross.org>
21
6
  * @license MIT
22
7
  */
23
- var r=n(83),i=n(84),o=n(85);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,n){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return f(this,e)}return c(this,e,t,n)}function c(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=d(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!u.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|p(t,n),i=(e=a(e,r)).write(t,n);i!==r&&(e=e.slice(0,i));return e}(e,t,n):function(e,t){if(u.isBuffer(t)){var n=0|h(t.length);return 0===(e=a(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?a(e,0):d(e,t);if("Buffer"===t.type&&o(t.data))return d(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function f(e,t){if(l(t),e=a(e,t<0?0:0|h(t)),!u.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function d(e,t){var n=t.length<0?0:0|h(t.length);e=a(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function h(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function p(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return B(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(e).length;default:if(r)return B(e).length;t=(""+t).toLowerCase(),r=!0}}function v(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,n);case"utf8":case"utf-8":return I(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return C(this,t,n);case"base64":return O(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:m(e,t,n,r,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):m(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,n,r,i){var o,s=1,a=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=n;o<a;o++)if(c(e,o)===c(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(n+u>a&&(n=a-u),o=n;o>=0;o--){for(var f=!0,d=0;d<u;d++)if(c(e,o+d)!==c(t,d)){f=!1;break}if(f)return o}return-1}function b(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[n+s]=a}return s}function w(e,t,n,r){return z(B(t,e.length-n),e,n,r)}function S(e,t,n,r){return z(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function _(e,t,n,r){return S(e,t,n,r)}function E(e,t,n,r){return z(q(t),e,n,r)}function A(e,t,n,r){return z(function(e,t){for(var n,r,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function O(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function I(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,s,a,u,c=e[i],l=null,f=c>239?4:c>223?3:c>191?2:1;if(i+f<=n)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=4096));return n}(r)}t.Buffer=u,t.SlowBuffer=function(e){+e!=e&&(e=0);return u.alloc(+e)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=s(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,n){return c(null,e,t,n)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,n){return function(e,t,n,r){return l(t),t<=0?a(e,t):void 0!==n?"string"==typeof r?a(e,t).fill(n,r):a(e,t).fill(n):a(e,t)}(null,e,t,n)},u.allocUnsafe=function(e){return f(null,e)},u.allocUnsafeSlow=function(e){return f(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!o(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=u.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var s=e[n];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,i),i+=s.length}return r},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)y(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?I(this,0,e):v.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},u.prototype.compare=function(e,t,n,r,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),c=this.slice(r,i),l=e.slice(t,n),f=0;f<a;++f)if(c[f]!==l[f]){o=c[f],s=l[f];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},u.prototype.indexOf=function(e,t,n){return g(this,e,t,n,!0)},u.prototype.lastIndexOf=function(e,t,n){return g(this,e,t,n,!1)},u.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return S(this,e,t,n);case"latin1":case"binary":return _(this,e,t,n);case"base64":return E(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function C(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function x(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=L(e[o]);return i}function P(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function k(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function M(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function j(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function R(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,o){return o||R(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,o){return o||R(e,0,n,8),i.write(e,t,n,r,52,8),n+8}u.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=u.prototype;else{var i=t-e;n=new u(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},u.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||k(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},u.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||k(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},u.prototype.readUInt8=function(e,t){return t||k(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||k(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||k(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||k(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||k(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||k(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},u.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||k(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return t||k(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||k(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(e,t){t||k(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(e,t){return t||k(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||k(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||k(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||k(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||k(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||k(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||N(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},u.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||N(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},u.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):j(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<n&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},u.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):j(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},u.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var s=u.isBuffer(e)?e:B(new u(e,r).toString()),a=s.length;for(o=0;o<n-t;++o)this[o+t]=s[o%a]}return this};var F=/[^+\/0-9A-Za-z-_]/g;function L(e){return e<16?"0"+e.toString(16):e.toString(16)}function B(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],s=0;s<r;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function q(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(F,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(27))},,function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return k})),n.d(t,"c",(function(){return M})),n.d(t,"d",(function(){return j})),n.d(t,"e",(function(){return G})),n.d(t,"f",(function(){return q})),n.d(t,"g",(function(){return oe})),n.d(t,"h",(function(){return U})),n.d(t,"i",(function(){return ae})),n.d(t,"j",(function(){return h}));
8
+ var r=n(84),i=n(85),o=n(86);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,n){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return f(this,e)}return c(this,e,t,n)}function c(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=d(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!u.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|p(t,n),i=(e=a(e,r)).write(t,n);i!==r&&(e=e.slice(0,i));return e}(e,t,n):function(e,t){if(u.isBuffer(t)){var n=0|h(t.length);return 0===(e=a(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?a(e,0):d(e,t);if("Buffer"===t.type&&o(t.data))return d(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function f(e,t){if(l(t),e=a(e,t<0?0:0|h(t)),!u.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function d(e,t){var n=t.length<0?0:0|h(t.length);e=a(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function h(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function p(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return B(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(e).length;default:if(r)return B(e).length;t=(""+t).toLowerCase(),r=!0}}function v(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,n);case"utf8":case"utf-8":return I(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return j(this,t,n);case"base64":return A(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:m(e,t,n,r,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):m(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,n,r,i){var o,s=1,a=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=n;o<a;o++)if(c(e,o)===c(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(n+u>a&&(n=a-u),o=n;o>=0;o--){for(var f=!0,d=0;d<u;d++)if(c(e,o+d)!==c(t,d)){f=!1;break}if(f)return o}return-1}function b(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[n+s]=a}return s}function w(e,t,n,r){return z(B(t,e.length-n),e,n,r)}function S(e,t,n,r){return z(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function O(e,t,n,r){return S(e,t,n,r)}function _(e,t,n,r){return z(q(t),e,n,r)}function E(e,t,n,r){return z(function(e,t){for(var n,r,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function A(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function I(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,s,a,u,c=e[i],l=null,f=c>239?4:c>223?3:c>191?2:1;if(i+f<=n)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=4096));return n}(r)}t.Buffer=u,t.SlowBuffer=function(e){+e!=e&&(e=0);return u.alloc(+e)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=s(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,n){return c(null,e,t,n)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,n){return function(e,t,n,r){return l(t),t<=0?a(e,t):void 0!==n?"string"==typeof r?a(e,t).fill(n,r):a(e,t).fill(n):a(e,t)}(null,e,t,n)},u.allocUnsafe=function(e){return f(null,e)},u.allocUnsafeSlow=function(e){return f(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!o(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=u.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var s=e[n];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,i),i+=s.length}return r},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)y(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?I(this,0,e):v.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},u.prototype.compare=function(e,t,n,r,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),c=this.slice(r,i),l=e.slice(t,n),f=0;f<a;++f)if(c[f]!==l[f]){o=c[f],s=l[f];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},u.prototype.indexOf=function(e,t,n){return g(this,e,t,n,!0)},u.prototype.lastIndexOf=function(e,t,n){return g(this,e,t,n,!1)},u.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return S(this,e,t,n);case"latin1":case"binary":return O(this,e,t,n);case"base64":return _(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function j(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function C(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=L(e[o]);return i}function P(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function x(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function k(e,t,n,r,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function N(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function M(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function D(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function R(e,t,n,r,o){return o||D(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,o){return o||D(e,0,n,8),i.write(e,t,n,r,52,8),n+8}u.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=u.prototype;else{var i=t-e;n=new u(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},u.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||x(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},u.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||x(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},u.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||x(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||x(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||x(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},u.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||x(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return t||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||x(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(e,t){t||x(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(e,t){return t||x(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||x(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||x(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||k(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},u.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||k(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},u.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):M(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);k(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<n&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},u.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);k(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):M(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,n){return R(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return R(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},u.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var s=u.isBuffer(e)?e:B(new u(e,r).toString()),a=s.length;for(o=0;o<n-t;++o)this[o+t]=s[o%a]}return this};var F=/[^+\/0-9A-Za-z-_]/g;function L(e){return e<16?"0"+e.toString(16):e.toString(16)}function B(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],s=0;s<r;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function q(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(F,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(31))},,function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return x})),n.d(t,"c",(function(){return N})),n.d(t,"d",(function(){return M})),n.d(t,"e",(function(){return H})),n.d(t,"f",(function(){return q})),n.d(t,"g",(function(){return oe})),n.d(t,"h",(function(){return U})),n.d(t,"i",(function(){return ae})),n.d(t,"j",(function(){return h}));
24
9
  /*!
25
10
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
26
11
  * SPDX-License-Identifier: Apache-2.0
27
12
  */
28
- var r=function(){function e(e){var t=e||{},n=t.ValidationData,r=t.Username,i=t.Password,o=t.AuthParameters,s=t.ClientMetadata;this.validationData=n||{},this.authParameters=o||{},this.clientMetadata=s||{},this.username=r,this.password=i}var t=e.prototype;return t.getUsername=function(){return this.username},t.getPassword=function(){return this.password},t.getValidationData=function(){return this.validationData},t.getAuthParameters=function(){return this.authParameters},t.getClientMetadata=function(){return this.clientMetadata},e}(),i=n(6),o=n(12),s=n.n(o),a=(n(44),n(37)),u=n.n(a),c=n(24),l=n.n(c),f=n(67);var d,h=function(){function e(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length}var t=e.prototype;return t.random=function(t){for(var n=[],r=0;r<t;r+=4)n.push(Object(f.a)());return new e(n,t)},t.toString=function(){return function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")}(this)},e}(),p=v;function v(e,t){null!=e&&this.fromString(e,t)}function y(){return new v(null)}var g="undefined"!=typeof navigator;g&&"Microsoft Internet Explorer"==navigator.appName?(v.prototype.am=function(e,t,n,r,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var u=32767&this[e],c=this[e++]>>15,l=a*u+c*s;i=((u=s*u+((32767&l)<<15)+n[r]+(1073741823&i))>>>30)+(l>>>15)+a*c+(i>>>30),n[r++]=1073741823&u}return i},d=30):g&&"Netscape"!=navigator.appName?(v.prototype.am=function(e,t,n,r,i,o){for(;--o>=0;){var s=t*this[e++]+n[r]+i;i=Math.floor(s/67108864),n[r++]=67108863&s}return i},d=26):(v.prototype.am=function(e,t,n,r,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var u=16383&this[e],c=this[e++]>>14,l=a*u+c*s;i=((u=s*u+((16383&l)<<14)+n[r]+i)>>28)+(l>>14)+a*c,n[r++]=268435455&u}return i},d=28),v.prototype.DB=d,v.prototype.DM=(1<<d)-1,v.prototype.DV=1<<d;v.prototype.FV=Math.pow(2,52),v.prototype.F1=52-d,v.prototype.F2=2*d-52;var m,b,w=new Array;for(m="0".charCodeAt(0),b=0;b<=9;++b)w[m++]=b;for(m="a".charCodeAt(0),b=10;b<36;++b)w[m++]=b;for(m="A".charCodeAt(0),b=10;b<36;++b)w[m++]=b;function S(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function _(e,t){var n=w[e.charCodeAt(t)];return null==n?-1:n}function E(e){var t=y();return t.fromInt(e),t}function A(e){var t,n=1;return 0!=(t=e>>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}function O(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}
13
+ var r=function(){function e(e){var t=e||{},n=t.ValidationData,r=t.Username,i=t.Password,o=t.AuthParameters,s=t.ClientMetadata;this.validationData=n||{},this.authParameters=o||{},this.clientMetadata=s||{},this.username=r,this.password=i}var t=e.prototype;return t.getUsername=function(){return this.username},t.getPassword=function(){return this.password},t.getValidationData=function(){return this.validationData},t.getAuthParameters=function(){return this.authParameters},t.getClientMetadata=function(){return this.clientMetadata},e}(),i=n(6),o=n(12),s=n.n(o),a=(n(46),n(28)),u=n.n(a),c=n(25),l=n.n(c),f=n(71);var d,h=function(){function e(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length}var t=e.prototype;return t.random=function(t){for(var n=[],r=0;r<t;r+=4)n.push(Object(f.a)());return new e(n,t)},t.toString=function(){return function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")}(this)},e}(),p=v;function v(e,t){null!=e&&this.fromString(e,t)}function y(){return new v(null)}var g="undefined"!=typeof navigator;g&&"Microsoft Internet Explorer"==navigator.appName?(v.prototype.am=function(e,t,n,r,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var u=32767&this[e],c=this[e++]>>15,l=a*u+c*s;i=((u=s*u+((32767&l)<<15)+n[r]+(1073741823&i))>>>30)+(l>>>15)+a*c+(i>>>30),n[r++]=1073741823&u}return i},d=30):g&&"Netscape"!=navigator.appName?(v.prototype.am=function(e,t,n,r,i,o){for(;--o>=0;){var s=t*this[e++]+n[r]+i;i=Math.floor(s/67108864),n[r++]=67108863&s}return i},d=26):(v.prototype.am=function(e,t,n,r,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var u=16383&this[e],c=this[e++]>>14,l=a*u+c*s;i=((u=s*u+((16383&l)<<14)+n[r]+i)>>28)+(l>>14)+a*c,n[r++]=268435455&u}return i},d=28),v.prototype.DB=d,v.prototype.DM=(1<<d)-1,v.prototype.DV=1<<d;v.prototype.FV=Math.pow(2,52),v.prototype.F1=52-d,v.prototype.F2=2*d-52;var m,b,w=new Array;for(m="0".charCodeAt(0),b=0;b<=9;++b)w[m++]=b;for(m="a".charCodeAt(0),b=10;b<36;++b)w[m++]=b;for(m="A".charCodeAt(0),b=10;b<36;++b)w[m++]=b;function S(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function O(e,t){var n=w[e.charCodeAt(t)];return null==n?-1:n}function _(e){var t=y();return t.fromInt(e),t}function E(e){var t,n=1;return 0!=(t=e>>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}function A(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}
29
14
  /*!
30
15
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
31
16
  * SPDX-License-Identifier: Apache-2.0
32
17
  */
33
- function I(e){return i.Buffer.from((new h).random(e).toString(),"hex")}O.prototype.convert=function(e){var t=y();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(v.ZERO)>0&&this.m.subTo(t,t),t},O.prototype.revert=function(e){var t=y();return e.copyTo(t),this.reduce(t),t},O.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=32767&e[t],r=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[n=t+this.m.t]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},O.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},O.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},v.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},v.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},v.prototype.fromString=function(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)throw new Error("Only radix 2, 4, 8, 16, 32 are supported");n=2}this.t=0,this.s=0;for(var r=e.length,i=!1,o=0;--r>=0;){var s=_(e,r);s<0?"-"==e.charAt(r)&&(i=!0):(i=!1,0==o?this[this.t++]=s:o+n>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,(o+=n)>=this.DB&&(o-=this.DB))}this.clamp(),i&&v.ZERO.subTo(this,this)},v.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},v.prototype.dlShiftTo=function(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s},v.prototype.drShiftTo=function(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s},v.prototype.lShiftTo=function(e,t){var n,r=e%this.DB,i=this.DB-r,o=(1<<i)-1,s=Math.floor(e/this.DB),a=this.s<<r&this.DM;for(n=this.t-1;n>=0;--n)t[n+s+1]=this[n]>>i|a,a=(this[n]&o)<<r;for(n=s-1;n>=0;--n)t[n]=0;t[s]=a,t.t=this.t+s+1,t.s=this.s,t.clamp()},v.prototype.rShiftTo=function(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,o=(1<<r)-1;t[0]=this[n]>>r;for(var s=n+1;s<this.t;++s)t[s-n-1]|=(this[s]&o)<<i,t[s-n]=this[s]>>r;r>0&&(t[this.t-n-1]|=(this.s&o)<<i),t.t=this.t-n,t.clamp()}},v.prototype.subTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]-e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r-=e[n],t[n++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()},v.prototype.multiplyTo=function(e,t){var n=this.abs(),r=e.abs(),i=n.t;for(t.t=i+r.t;--i>=0;)t[i]=0;for(i=0;i<r.t;++i)t[i+n.t]=n.am(0,r[i],t,i,0,n.t);t.s=0,t.clamp(),this.s!=e.s&&v.ZERO.subTo(t,t)},v.prototype.squareTo=function(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var r=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,r,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()},v.prototype.divRemTo=function(e,t,n){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t<r.t)return null!=t&&t.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=y());var o=y(),s=this.s,a=e.s,u=this.DB-A(r[r.t-1]);u>0?(r.lShiftTo(u,o),i.lShiftTo(u,n)):(r.copyTo(o),i.copyTo(n));var c=o.t,l=o[c-1];if(0!=l){var f=l*(1<<this.F1)+(c>1?o[c-2]>>this.F2:0),d=this.FV/f,h=(1<<this.F1)/f,p=1<<this.F2,g=n.t,m=g-c,b=null==t?y():t;for(o.dlShiftTo(m,b),n.compareTo(b)>=0&&(n[n.t++]=1,n.subTo(b,n)),v.ONE.dlShiftTo(c,b),b.subTo(o,o);o.t<c;)o[o.t++]=0;for(;--m>=0;){var w=n[--g]==l?this.DM:Math.floor(n[g]*d+(n[g-1]+p)*h);if((n[g]+=o.am(0,w,n,m,0,c))<w)for(o.dlShiftTo(m,b),n.subTo(b,n);n[g]<--w;)n.subTo(b,n)}null!=t&&(n.drShiftTo(c,t),s!=a&&v.ZERO.subTo(t,t)),n.t=c,n.clamp(),u>0&&n.rShiftTo(u,n),s<0&&v.ZERO.subTo(n,n)}}},v.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},v.prototype.addTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]+e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r+=e[n],t[n++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[n++]=r:r<-1&&(t[n++]=this.DV+r),t.t=n,t.clamp()},v.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)throw new Error("Only radix 2, 4, 8, 16, 32 are supported");t=2}var n,r=(1<<t)-1,i=!1,o="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(n=this[s]>>a)>0&&(i=!0,o=S(n));s>=0;)a<t?(n=(this[s]&(1<<a)-1)<<t-a,n|=this[--s]>>(a+=this.DB-t)):(n=this[s]>>(a-=t)&r,a<=0&&(a+=this.DB,--s)),n>0&&(i=!0),i&&(o+=S(n));return i?o:"0"},v.prototype.negate=function(){var e=y();return v.ZERO.subTo(this,e),e},v.prototype.abs=function(){return this.s<0?this.negate():this},v.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(0!=(t=n-e.t))return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0},v.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+A(this[this.t-1]^this.s&this.DM)},v.prototype.mod=function(e){var t=y();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(v.ZERO)>0&&e.subTo(t,t),t},v.prototype.equals=function(e){return 0==this.compareTo(e)},v.prototype.add=function(e){var t=y();return this.addTo(e,t),t},v.prototype.subtract=function(e){var t=y();return this.subTo(e,t),t},v.prototype.multiply=function(e){var t=y();return this.multiplyTo(e,t),t},v.prototype.divide=function(e){var t=y();return this.divRemTo(e,t,null),t},v.prototype.modPow=function(e,t,n){var r,i=e.bitLength(),o=E(1),s=new O(t);if(i<=0)return o;r=i<18?1:i<48?3:i<144?4:i<768?5:6;var a=new Array,u=3,c=r-1,l=(1<<r)-1;if(a[1]=s.convert(this),r>1){var f=y();for(s.sqrTo(a[1],f);u<=l;)a[u]=y(),s.mulTo(f,a[u-2],a[u]),u+=2}var d,h,p=e.t-1,v=!0,g=y();for(i=A(e[p])-1;p>=0;){for(i>=c?d=e[p]>>i-c&l:(d=(e[p]&(1<<i+1)-1)<<c-i,p>0&&(d|=e[p-1]>>this.DB+i-c)),u=r;0==(1&d);)d>>=1,--u;if((i-=u)<0&&(i+=this.DB,--p),v)a[d].copyTo(o),v=!1;else{for(;u>1;)s.sqrTo(o,g),s.sqrTo(g,o),u-=2;u>0?s.sqrTo(o,g):(h=o,o=g,g=h),s.mulTo(g,a[d],o)}for(;p>=0&&0==(e[p]&1<<i);)s.sqrTo(o,g),h=o,o=g,g=h,--i<0&&(i=this.DB-1,--p)}var m=s.revert(o);return n(null,m),m},v.ZERO=E(0),v.ONE=E(1);var T=/^[89a-f]/i,C=function(){function e(e){this.N=new p("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF",16),this.g=new p("2",16),this.k=new p(this.hexHash(""+this.padHex(this.N)+this.padHex(this.g)),16),this.smallAValue=this.generateRandomSmallA(),this.getLargeAValue((function(){})),this.infoBits=i.Buffer.from("Caldera Derived Key","utf8"),this.poolName=e}var t=e.prototype;return t.getSmallAValue=function(){return this.smallAValue},t.getLargeAValue=function(e){var t=this;this.largeAValue?e(null,this.largeAValue):this.calculateA(this.smallAValue,(function(n,r){n&&e(n,null),t.largeAValue=r,e(null,t.largeAValue)}))},t.generateRandomSmallA=function(){var e=I(128).toString("hex");return new p(e,16)},t.generateRandomString=function(){return I(40).toString("base64")},t.getRandomPassword=function(){return this.randomPassword},t.getSaltDevices=function(){return this.SaltToHashDevices},t.getVerifierDevices=function(){return this.verifierDevices},t.generateHashDevice=function(e,t,n){var r=this;this.randomPassword=this.generateRandomString();var i=""+e+t+":"+this.randomPassword,o=this.hash(i),s=I(16).toString("hex");this.SaltToHashDevices=this.padHex(new p(s,16)),this.g.modPow(new p(this.hexHash(this.SaltToHashDevices+o),16),this.N,(function(e,t){e&&n(e,null),r.verifierDevices=r.padHex(t),n(null,null)}))},t.calculateA=function(e,t){var n=this;this.g.modPow(e,this.N,(function(e,r){e&&t(e,null),r.mod(n.N).equals(p.ZERO)&&t(new Error("Illegal paramater. A mod N cannot be 0."),null),t(null,r)}))},t.calculateU=function(e,t){return this.UHexHash=this.hexHash(this.padHex(e)+this.padHex(t)),new p(this.UHexHash,16)},t.hash=function(e){var t=e instanceof i.Buffer?s.a.lib.WordArray.create(e):e,n=u()(t).toString();return new Array(64-n.length).join("0")+n},t.hexHash=function(e){return this.hash(i.Buffer.from(e,"hex"))},t.computehkdf=function(e,t){var n=s.a.lib.WordArray.create(i.Buffer.concat([this.infoBits,i.Buffer.from(String.fromCharCode(1),"utf8")])),r=e instanceof i.Buffer?s.a.lib.WordArray.create(e):e,o=t instanceof i.Buffer?s.a.lib.WordArray.create(t):t,a=l()(r,o),u=l()(n,a);return i.Buffer.from(u.toString(),"hex").slice(0,16)},t.getPasswordAuthenticationKey=function(e,t,n,r,o){var s=this;if(n.mod(this.N).equals(p.ZERO))throw new Error("B cannot be zero.");if(this.UValue=this.calculateU(this.largeAValue,n),this.UValue.equals(p.ZERO))throw new Error("U cannot be zero.");var a=""+this.poolName+e+":"+t,u=this.hash(a),c=new p(this.hexHash(this.padHex(r)+u),16);this.calculateS(c,n,(function(e,t){e&&o(e,null);var n=s.computehkdf(i.Buffer.from(s.padHex(t),"hex"),i.Buffer.from(s.padHex(s.UValue),"hex"));o(null,n)}))},t.calculateS=function(e,t,n){var r=this;this.g.modPow(e,this.N,(function(i,o){i&&n(i,null),t.subtract(r.k.multiply(o)).modPow(r.smallAValue.add(r.UValue.multiply(e)),r.N,(function(e,t){e&&n(e,null),n(null,t.mod(r.N))}))}))},t.getNewPasswordRequiredChallengeUserAttributePrefix=function(){return"userAttributes."},t.padHex=function(e){if(!(e instanceof p))throw new Error("Not a BigInteger");var t=e.compareTo(p.ZERO)<0,n=e.abs().toString(16);if(n=n.length%2!=0?"0"+n:n,n=T.test(n)?"00"+n:n,t){var r=n.split("").map((function(e){var t=15&~parseInt(e,16);return"0123456789ABCDEF".charAt(t)})).join("");(n=new p(r,16).add(p.ONE).toString(16)).toUpperCase().startsWith("FF8")&&(n=n.substring(2))}return n},e}(),x=function(){function e(e){this.jwtToken=e||"",this.payload=this.decodePayload()}var t=e.prototype;return t.getJwtToken=function(){return this.jwtToken},t.getExpiration=function(){return this.payload.exp},t.getIssuedAt=function(){return this.payload.iat},t.decodePayload=function(){var e=this.jwtToken.split(".")[1];try{return JSON.parse(i.Buffer.from(e,"base64").toString("utf8"))}catch(e){return{}}},e}();function P(e,t){return(P=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}
18
+ function I(e){return i.Buffer.from((new h).random(e).toString(),"hex")}A.prototype.convert=function(e){var t=y();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(v.ZERO)>0&&this.m.subTo(t,t),t},A.prototype.revert=function(e){var t=y();return e.copyTo(t),this.reduce(t),t},A.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=32767&e[t],r=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[n=t+this.m.t]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},A.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},A.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},v.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},v.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},v.prototype.fromString=function(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)throw new Error("Only radix 2, 4, 8, 16, 32 are supported");n=2}this.t=0,this.s=0;for(var r=e.length,i=!1,o=0;--r>=0;){var s=O(e,r);s<0?"-"==e.charAt(r)&&(i=!0):(i=!1,0==o?this[this.t++]=s:o+n>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,(o+=n)>=this.DB&&(o-=this.DB))}this.clamp(),i&&v.ZERO.subTo(this,this)},v.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},v.prototype.dlShiftTo=function(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s},v.prototype.drShiftTo=function(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s},v.prototype.lShiftTo=function(e,t){var n,r=e%this.DB,i=this.DB-r,o=(1<<i)-1,s=Math.floor(e/this.DB),a=this.s<<r&this.DM;for(n=this.t-1;n>=0;--n)t[n+s+1]=this[n]>>i|a,a=(this[n]&o)<<r;for(n=s-1;n>=0;--n)t[n]=0;t[s]=a,t.t=this.t+s+1,t.s=this.s,t.clamp()},v.prototype.rShiftTo=function(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,o=(1<<r)-1;t[0]=this[n]>>r;for(var s=n+1;s<this.t;++s)t[s-n-1]|=(this[s]&o)<<i,t[s-n]=this[s]>>r;r>0&&(t[this.t-n-1]|=(this.s&o)<<i),t.t=this.t-n,t.clamp()}},v.prototype.subTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]-e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r-=e[n],t[n++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()},v.prototype.multiplyTo=function(e,t){var n=this.abs(),r=e.abs(),i=n.t;for(t.t=i+r.t;--i>=0;)t[i]=0;for(i=0;i<r.t;++i)t[i+n.t]=n.am(0,r[i],t,i,0,n.t);t.s=0,t.clamp(),this.s!=e.s&&v.ZERO.subTo(t,t)},v.prototype.squareTo=function(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var r=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,r,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()},v.prototype.divRemTo=function(e,t,n){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t<r.t)return null!=t&&t.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=y());var o=y(),s=this.s,a=e.s,u=this.DB-E(r[r.t-1]);u>0?(r.lShiftTo(u,o),i.lShiftTo(u,n)):(r.copyTo(o),i.copyTo(n));var c=o.t,l=o[c-1];if(0!=l){var f=l*(1<<this.F1)+(c>1?o[c-2]>>this.F2:0),d=this.FV/f,h=(1<<this.F1)/f,p=1<<this.F2,g=n.t,m=g-c,b=null==t?y():t;for(o.dlShiftTo(m,b),n.compareTo(b)>=0&&(n[n.t++]=1,n.subTo(b,n)),v.ONE.dlShiftTo(c,b),b.subTo(o,o);o.t<c;)o[o.t++]=0;for(;--m>=0;){var w=n[--g]==l?this.DM:Math.floor(n[g]*d+(n[g-1]+p)*h);if((n[g]+=o.am(0,w,n,m,0,c))<w)for(o.dlShiftTo(m,b),n.subTo(b,n);n[g]<--w;)n.subTo(b,n)}null!=t&&(n.drShiftTo(c,t),s!=a&&v.ZERO.subTo(t,t)),n.t=c,n.clamp(),u>0&&n.rShiftTo(u,n),s<0&&v.ZERO.subTo(n,n)}}},v.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},v.prototype.addTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]+e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r+=e[n],t[n++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[n++]=r:r<-1&&(t[n++]=this.DV+r),t.t=n,t.clamp()},v.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)throw new Error("Only radix 2, 4, 8, 16, 32 are supported");t=2}var n,r=(1<<t)-1,i=!1,o="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(n=this[s]>>a)>0&&(i=!0,o=S(n));s>=0;)a<t?(n=(this[s]&(1<<a)-1)<<t-a,n|=this[--s]>>(a+=this.DB-t)):(n=this[s]>>(a-=t)&r,a<=0&&(a+=this.DB,--s)),n>0&&(i=!0),i&&(o+=S(n));return i?o:"0"},v.prototype.negate=function(){var e=y();return v.ZERO.subTo(this,e),e},v.prototype.abs=function(){return this.s<0?this.negate():this},v.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(0!=(t=n-e.t))return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0},v.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+E(this[this.t-1]^this.s&this.DM)},v.prototype.mod=function(e){var t=y();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(v.ZERO)>0&&e.subTo(t,t),t},v.prototype.equals=function(e){return 0==this.compareTo(e)},v.prototype.add=function(e){var t=y();return this.addTo(e,t),t},v.prototype.subtract=function(e){var t=y();return this.subTo(e,t),t},v.prototype.multiply=function(e){var t=y();return this.multiplyTo(e,t),t},v.prototype.divide=function(e){var t=y();return this.divRemTo(e,t,null),t},v.prototype.modPow=function(e,t,n){var r,i=e.bitLength(),o=_(1),s=new A(t);if(i<=0)return o;r=i<18?1:i<48?3:i<144?4:i<768?5:6;var a=new Array,u=3,c=r-1,l=(1<<r)-1;if(a[1]=s.convert(this),r>1){var f=y();for(s.sqrTo(a[1],f);u<=l;)a[u]=y(),s.mulTo(f,a[u-2],a[u]),u+=2}var d,h,p=e.t-1,v=!0,g=y();for(i=E(e[p])-1;p>=0;){for(i>=c?d=e[p]>>i-c&l:(d=(e[p]&(1<<i+1)-1)<<c-i,p>0&&(d|=e[p-1]>>this.DB+i-c)),u=r;0==(1&d);)d>>=1,--u;if((i-=u)<0&&(i+=this.DB,--p),v)a[d].copyTo(o),v=!1;else{for(;u>1;)s.sqrTo(o,g),s.sqrTo(g,o),u-=2;u>0?s.sqrTo(o,g):(h=o,o=g,g=h),s.mulTo(g,a[d],o)}for(;p>=0&&0==(e[p]&1<<i);)s.sqrTo(o,g),h=o,o=g,g=h,--i<0&&(i=this.DB-1,--p)}var m=s.revert(o);return n(null,m),m},v.ZERO=_(0),v.ONE=_(1);var T=/^[89a-f]/i,j=function(){function e(e){this.N=new p("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF",16),this.g=new p("2",16),this.k=new p(this.hexHash(""+this.padHex(this.N)+this.padHex(this.g)),16),this.smallAValue=this.generateRandomSmallA(),this.getLargeAValue((function(){})),this.infoBits=i.Buffer.from("Caldera Derived Key","utf8"),this.poolName=e}var t=e.prototype;return t.getSmallAValue=function(){return this.smallAValue},t.getLargeAValue=function(e){var t=this;this.largeAValue?e(null,this.largeAValue):this.calculateA(this.smallAValue,(function(n,r){n&&e(n,null),t.largeAValue=r,e(null,t.largeAValue)}))},t.generateRandomSmallA=function(){var e=I(128).toString("hex");return new p(e,16)},t.generateRandomString=function(){return I(40).toString("base64")},t.getRandomPassword=function(){return this.randomPassword},t.getSaltDevices=function(){return this.SaltToHashDevices},t.getVerifierDevices=function(){return this.verifierDevices},t.generateHashDevice=function(e,t,n){var r=this;this.randomPassword=this.generateRandomString();var i=""+e+t+":"+this.randomPassword,o=this.hash(i),s=I(16).toString("hex");this.SaltToHashDevices=this.padHex(new p(s,16)),this.g.modPow(new p(this.hexHash(this.SaltToHashDevices+o),16),this.N,(function(e,t){e&&n(e,null),r.verifierDevices=r.padHex(t),n(null,null)}))},t.calculateA=function(e,t){var n=this;this.g.modPow(e,this.N,(function(e,r){e&&t(e,null),r.mod(n.N).equals(p.ZERO)&&t(new Error("Illegal paramater. A mod N cannot be 0."),null),t(null,r)}))},t.calculateU=function(e,t){return this.UHexHash=this.hexHash(this.padHex(e)+this.padHex(t)),new p(this.UHexHash,16)},t.hash=function(e){var t=e instanceof i.Buffer?s.a.lib.WordArray.create(e):e,n=u()(t).toString();return new Array(64-n.length).join("0")+n},t.hexHash=function(e){return this.hash(i.Buffer.from(e,"hex"))},t.computehkdf=function(e,t){var n=s.a.lib.WordArray.create(i.Buffer.concat([this.infoBits,i.Buffer.from(String.fromCharCode(1),"utf8")])),r=e instanceof i.Buffer?s.a.lib.WordArray.create(e):e,o=t instanceof i.Buffer?s.a.lib.WordArray.create(t):t,a=l()(r,o),u=l()(n,a);return i.Buffer.from(u.toString(),"hex").slice(0,16)},t.getPasswordAuthenticationKey=function(e,t,n,r,o){var s=this;if(n.mod(this.N).equals(p.ZERO))throw new Error("B cannot be zero.");if(this.UValue=this.calculateU(this.largeAValue,n),this.UValue.equals(p.ZERO))throw new Error("U cannot be zero.");var a=""+this.poolName+e+":"+t,u=this.hash(a),c=new p(this.hexHash(this.padHex(r)+u),16);this.calculateS(c,n,(function(e,t){e&&o(e,null);var n=s.computehkdf(i.Buffer.from(s.padHex(t),"hex"),i.Buffer.from(s.padHex(s.UValue),"hex"));o(null,n)}))},t.calculateS=function(e,t,n){var r=this;this.g.modPow(e,this.N,(function(i,o){i&&n(i,null),t.subtract(r.k.multiply(o)).modPow(r.smallAValue.add(r.UValue.multiply(e)),r.N,(function(e,t){e&&n(e,null),n(null,t.mod(r.N))}))}))},t.getNewPasswordRequiredChallengeUserAttributePrefix=function(){return"userAttributes."},t.padHex=function(e){if(!(e instanceof p))throw new Error("Not a BigInteger");var t=e.compareTo(p.ZERO)<0,n=e.abs().toString(16);if(n=n.length%2!=0?"0"+n:n,n=T.test(n)?"00"+n:n,t){var r=n.split("").map((function(e){var t=15&~parseInt(e,16);return"0123456789ABCDEF".charAt(t)})).join("");(n=new p(r,16).add(p.ONE).toString(16)).toUpperCase().startsWith("FF8")&&(n=n.substring(2))}return n},e}(),C=function(){function e(e){this.jwtToken=e||"",this.payload=this.decodePayload()}var t=e.prototype;return t.getJwtToken=function(){return this.jwtToken},t.getExpiration=function(){return this.payload.exp},t.getIssuedAt=function(){return this.payload.iat},t.decodePayload=function(){var e=this.jwtToken.split(".")[1];try{return JSON.parse(i.Buffer.from(e,"base64").toString("utf8"))}catch(e){return{}}},e}();function P(e,t){return(P=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}
34
19
  /*!
35
20
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
36
21
  * SPDX-License-Identifier: Apache-2.0
37
- */var k=function(e){var t,n;function r(t){var n=(void 0===t?{}:t).AccessToken;return e.call(this,n||"")||this}return n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,P(t,n),r}(x);function N(e,t){return(N=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}
22
+ */var x=function(e){var t,n;function r(t){var n=(void 0===t?{}:t).AccessToken;return e.call(this,n||"")||this}return n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,P(t,n),r}(C);function k(e,t){return(k=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}
38
23
  /*!
39
24
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
40
25
  * SPDX-License-Identifier: Apache-2.0
41
- */var M=function(e){var t,n;function r(t){var n=(void 0===t?{}:t).IdToken;return e.call(this,n||"")||this}return n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,N(t,n),r}(x),j=function(){function e(e){var t=(void 0===e?{}:e).RefreshToken;this.token=t||""}return e.prototype.getToken=function(){return this.token},e}(),R=n(39),D=n.n(R),U=function(){function e(e){var t=void 0===e?{}:e,n=t.IdToken,r=t.RefreshToken,i=t.AccessToken,o=t.ClockDrift;if(null==i||null==n)throw new Error("Id token and Access Token must be present.");this.idToken=n,this.refreshToken=r,this.accessToken=i,this.clockDrift=void 0===o?this.calculateClockDrift():o}var t=e.prototype;return t.getIdToken=function(){return this.idToken},t.getRefreshToken=function(){return this.refreshToken},t.getAccessToken=function(){return this.accessToken},t.getClockDrift=function(){return this.clockDrift},t.calculateClockDrift=function(){return Math.floor(new Date/1e3)-Math.min(this.accessToken.getIssuedAt(),this.idToken.getIssuedAt())},t.isValid=function(){var e=Math.floor(new Date/1e3)-this.clockDrift;return e<this.accessToken.getExpiration()&&e<this.idToken.getExpiration()},e}(),F=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],L=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],B=function(){function e(){}return e.prototype.getNowString=function(){var e=new Date,t=L[e.getUTCDay()],n=F[e.getUTCMonth()],r=e.getUTCDate(),i=e.getUTCHours();i<10&&(i="0"+i);var o=e.getUTCMinutes();o<10&&(o="0"+o);var s=e.getUTCSeconds();return s<10&&(s="0"+s),t+" "+n+" "+r+" "+i+":"+o+":"+s+" UTC "+e.getUTCFullYear()},e}(),q=function(){function e(e){var t=void 0===e?{}:e,n=t.Name,r=t.Value;this.Name=n||"",this.Value=r||""}var t=e.prototype;return t.getValue=function(){return this.Value},t.setValue=function(e){return this.Value=e,this},t.getName=function(){return this.Name},t.setName=function(e){return this.Name=e,this},t.toString=function(){return JSON.stringify(this)},t.toJSON=function(){return{Name:this.Name,Value:this.Value}},e}(),z={},K=function(){function e(){}return e.setItem=function(e,t){return z[e]=t,z[e]},e.getItem=function(e){return Object.prototype.hasOwnProperty.call(z,e)?z[e]:void 0},e.removeItem=function(e){return delete z[e]},e.clear=function(){return z={}},e}(),H=function(){function e(){try{this.storageWindow=window.localStorage,this.storageWindow.setItem("aws.cognito.test-ls",1),this.storageWindow.removeItem("aws.cognito.test-ls")}catch(e){this.storageWindow=K}}return e.prototype.getStorage=function(){return this.storageWindow},e}(),V="undefined"!=typeof navigator?navigator.userAgent:"nodejs",G=function(){function e(e){if(null==e||null==e.Username||null==e.Pool)throw new Error("Username and Pool information are required.");this.username=e.Username||"",this.pool=e.Pool,this.Session=null,this.client=e.Pool.client,this.signInUserSession=null,this.authenticationFlowType="USER_SRP_AUTH",this.storage=e.Storage||(new H).getStorage(),this.keyPrefix="CognitoIdentityServiceProvider."+this.pool.getClientId(),this.userDataKey=this.keyPrefix+"."+this.username+".userData"}var t=e.prototype;return t.setSignInUserSession=function(e){this.clearCachedUserData(),this.signInUserSession=e,this.cacheTokens()},t.getSignInUserSession=function(){return this.signInUserSession},t.getUsername=function(){return this.username},t.getAuthenticationFlowType=function(){return this.authenticationFlowType},t.setAuthenticationFlowType=function(e){this.authenticationFlowType=e},t.initiateAuth=function(e,t){var n=this,r=e.getAuthParameters();r.USERNAME=this.username;var i=0!==Object.keys(e.getValidationData()).length?e.getValidationData():e.getClientMetadata(),o={AuthFlow:"CUSTOM_AUTH",ClientId:this.pool.getClientId(),AuthParameters:r,ClientMetadata:i};this.getUserContextData()&&(o.UserContextData=this.getUserContextData()),this.client.request("InitiateAuth",o,(function(e,r){if(e)return t.onFailure(e);var i=r.ChallengeName,o=r.ChallengeParameters;return"CUSTOM_CHALLENGE"===i?(n.Session=r.Session,t.customChallenge(o)):(n.signInUserSession=n.getCognitoUserSession(r.AuthenticationResult),n.cacheTokens(),t.onSuccess(n.signInUserSession))}))},t.authenticateUser=function(e,t){return"USER_PASSWORD_AUTH"===this.authenticationFlowType?this.authenticateUserPlainUsernamePassword(e,t):"USER_SRP_AUTH"===this.authenticationFlowType||"CUSTOM_AUTH"===this.authenticationFlowType?this.authenticateUserDefaultAuth(e,t):t.onFailure(new Error("Authentication flow type is invalid."))},t.authenticateUserDefaultAuth=function(e,t){var n,r,o=this,a=new C(this.pool.getUserPoolId().split("_")[1]),u=new B,c={};null!=this.deviceKey&&(c.DEVICE_KEY=this.deviceKey),c.USERNAME=this.username,a.getLargeAValue((function(f,d){f&&t.onFailure(f),c.SRP_A=d.toString(16),"CUSTOM_AUTH"===o.authenticationFlowType&&(c.CHALLENGE_NAME="SRP_A");var h=0!==Object.keys(e.getValidationData()).length?e.getValidationData():e.getClientMetadata(),v={AuthFlow:o.authenticationFlowType,ClientId:o.pool.getClientId(),AuthParameters:c,ClientMetadata:h};o.getUserContextData(o.username)&&(v.UserContextData=o.getUserContextData(o.username)),o.client.request("InitiateAuth",v,(function(c,f){if(c)return t.onFailure(c);var d=f.ChallengeParameters;o.username=d.USER_ID_FOR_SRP,o.userDataKey=o.keyPrefix+"."+o.username+".userData",n=new p(d.SRP_B,16),r=new p(d.SALT,16),o.getCachedDeviceKeyAndPassword(),a.getPasswordAuthenticationKey(o.username,e.getPassword(),n,r,(function(e,n){e&&t.onFailure(e);var r=u.getNowString(),c=s.a.lib.WordArray.create(i.Buffer.concat([i.Buffer.from(o.pool.getUserPoolId().split("_")[1],"utf8"),i.Buffer.from(o.username,"utf8"),i.Buffer.from(d.SECRET_BLOCK,"base64"),i.Buffer.from(r,"utf8")])),p=s.a.lib.WordArray.create(n),v=D.a.stringify(l()(c,p)),y={};y.USERNAME=o.username,y.PASSWORD_CLAIM_SECRET_BLOCK=d.SECRET_BLOCK,y.TIMESTAMP=r,y.PASSWORD_CLAIM_SIGNATURE=v,null!=o.deviceKey&&(y.DEVICE_KEY=o.deviceKey);var g={ChallengeName:"PASSWORD_VERIFIER",ClientId:o.pool.getClientId(),ChallengeResponses:y,Session:f.Session,ClientMetadata:h};o.getUserContextData()&&(g.UserContextData=o.getUserContextData()),function e(t,n){return o.client.request("RespondToAuthChallenge",t,(function(r,i){return r&&"ResourceNotFoundException"===r.code&&-1!==r.message.toLowerCase().indexOf("device")?(y.DEVICE_KEY=null,o.deviceKey=null,o.randomPassword=null,o.deviceGroupKey=null,o.clearCachedDeviceKeyAndPassword(),e(t,n)):n(r,i)}))}(g,(function(e,n){return e?t.onFailure(e):o.authenticateUserInternal(n,a,t)}))}))}))}))},t.authenticateUserPlainUsernamePassword=function(e,t){var n=this,r={};if(r.USERNAME=this.username,r.PASSWORD=e.getPassword(),r.PASSWORD){var i=new C(this.pool.getUserPoolId().split("_")[1]);this.getCachedDeviceKeyAndPassword(),null!=this.deviceKey&&(r.DEVICE_KEY=this.deviceKey);var o=0!==Object.keys(e.getValidationData()).length?e.getValidationData():e.getClientMetadata(),s={AuthFlow:"USER_PASSWORD_AUTH",ClientId:this.pool.getClientId(),AuthParameters:r,ClientMetadata:o};this.getUserContextData(this.username)&&(s.UserContextData=this.getUserContextData(this.username)),this.client.request("InitiateAuth",s,(function(e,r){return e?t.onFailure(e):n.authenticateUserInternal(r,i,t)}))}else t.onFailure(new Error("PASSWORD parameter is required"))},t.authenticateUserInternal=function(e,t,n){var r=this,o=e.ChallengeName,s=e.ChallengeParameters;if("SMS_MFA"===o)return this.Session=e.Session,n.mfaRequired(o,s);if("SELECT_MFA_TYPE"===o)return this.Session=e.Session,n.selectMFAType(o,s);if("MFA_SETUP"===o)return this.Session=e.Session,n.mfaSetup(o,s);if("SOFTWARE_TOKEN_MFA"===o)return this.Session=e.Session,n.totpRequired(o,s);if("CUSTOM_CHALLENGE"===o)return this.Session=e.Session,n.customChallenge(s);if("NEW_PASSWORD_REQUIRED"===o){this.Session=e.Session;var a=null,u=null,c=[],l=t.getNewPasswordRequiredChallengeUserAttributePrefix();if(s&&(a=JSON.parse(e.ChallengeParameters.userAttributes),u=JSON.parse(e.ChallengeParameters.requiredAttributes)),u)for(var f=0;f<u.length;f++)c[f]=u[f].substr(l.length);return n.newPasswordRequired(a,c)}if("DEVICE_SRP_AUTH"===o)return this.Session=e.Session,void this.getDeviceResponse(n);this.signInUserSession=this.getCognitoUserSession(e.AuthenticationResult),this.challengeName=o,this.cacheTokens();var d=e.AuthenticationResult.NewDeviceMetadata;if(null==d)return n.onSuccess(this.signInUserSession);t.generateHashDevice(e.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,e.AuthenticationResult.NewDeviceMetadata.DeviceKey,(function(o){if(o)return n.onFailure(o);var s={Salt:i.Buffer.from(t.getSaltDevices(),"hex").toString("base64"),PasswordVerifier:i.Buffer.from(t.getVerifierDevices(),"hex").toString("base64")};r.verifierDevices=s.PasswordVerifier,r.deviceGroupKey=d.DeviceGroupKey,r.randomPassword=t.getRandomPassword(),r.client.request("ConfirmDevice",{DeviceKey:d.DeviceKey,AccessToken:r.signInUserSession.getAccessToken().getJwtToken(),DeviceSecretVerifierConfig:s,DeviceName:V},(function(t,i){return t?n.onFailure(t):(r.deviceKey=e.AuthenticationResult.NewDeviceMetadata.DeviceKey,r.cacheDeviceKeyAndPassword(),!0===i.UserConfirmationNecessary?n.onSuccess(r.signInUserSession,i.UserConfirmationNecessary):n.onSuccess(r.signInUserSession))}))}))},t.completeNewPasswordChallenge=function(e,t,n,r){var i=this;if(!e)return n.onFailure(new Error("New password is required."));var o=new C(this.pool.getUserPoolId().split("_")[1]),s=o.getNewPasswordRequiredChallengeUserAttributePrefix(),a={};t&&Object.keys(t).forEach((function(e){a[s+e]=t[e]})),a.NEW_PASSWORD=e,a.USERNAME=this.username;var u={ChallengeName:"NEW_PASSWORD_REQUIRED",ClientId:this.pool.getClientId(),ChallengeResponses:a,Session:this.Session,ClientMetadata:r};this.getUserContextData()&&(u.UserContextData=this.getUserContextData()),this.client.request("RespondToAuthChallenge",u,(function(e,t){return e?n.onFailure(e):i.authenticateUserInternal(t,o,n)}))},t.getDeviceResponse=function(e,t){var n=this,r=new C(this.deviceGroupKey),o=new B,a={};a.USERNAME=this.username,a.DEVICE_KEY=this.deviceKey,r.getLargeAValue((function(u,c){u&&e.onFailure(u),a.SRP_A=c.toString(16);var f={ChallengeName:"DEVICE_SRP_AUTH",ClientId:n.pool.getClientId(),ChallengeResponses:a,ClientMetadata:t,Session:n.Session};n.getUserContextData()&&(f.UserContextData=n.getUserContextData()),n.client.request("RespondToAuthChallenge",f,(function(t,a){if(t)return e.onFailure(t);var u=a.ChallengeParameters,c=new p(u.SRP_B,16),f=new p(u.SALT,16);r.getPasswordAuthenticationKey(n.deviceKey,n.randomPassword,c,f,(function(t,r){if(t)return e.onFailure(t);var c=o.getNowString(),f=s.a.lib.WordArray.create(i.Buffer.concat([i.Buffer.from(n.deviceGroupKey,"utf8"),i.Buffer.from(n.deviceKey,"utf8"),i.Buffer.from(u.SECRET_BLOCK,"base64"),i.Buffer.from(c,"utf8")])),d=s.a.lib.WordArray.create(r),h=D.a.stringify(l()(f,d)),p={};p.USERNAME=n.username,p.PASSWORD_CLAIM_SECRET_BLOCK=u.SECRET_BLOCK,p.TIMESTAMP=c,p.PASSWORD_CLAIM_SIGNATURE=h,p.DEVICE_KEY=n.deviceKey;var v={ChallengeName:"DEVICE_PASSWORD_VERIFIER",ClientId:n.pool.getClientId(),ChallengeResponses:p,Session:a.Session};n.getUserContextData()&&(v.UserContextData=n.getUserContextData()),n.client.request("RespondToAuthChallenge",v,(function(t,r){return t?e.onFailure(t):(n.signInUserSession=n.getCognitoUserSession(r.AuthenticationResult),n.cacheTokens(),e.onSuccess(n.signInUserSession))}))}))}))}))},t.confirmRegistration=function(e,t,n,r){var i={ClientId:this.pool.getClientId(),ConfirmationCode:e,Username:this.username,ForceAliasCreation:t,ClientMetadata:r};this.getUserContextData()&&(i.UserContextData=this.getUserContextData()),this.client.request("ConfirmSignUp",i,(function(e){return e?n(e,null):n(null,"SUCCESS")}))},t.sendCustomChallengeAnswer=function(e,t,n){var r=this,i={};i.USERNAME=this.username,i.ANSWER=e;var o=new C(this.pool.getUserPoolId().split("_")[1]);this.getCachedDeviceKeyAndPassword(),null!=this.deviceKey&&(i.DEVICE_KEY=this.deviceKey);var s={ChallengeName:"CUSTOM_CHALLENGE",ChallengeResponses:i,ClientId:this.pool.getClientId(),Session:this.Session,ClientMetadata:n};this.getUserContextData()&&(s.UserContextData=this.getUserContextData()),this.client.request("RespondToAuthChallenge",s,(function(e,n){return e?t.onFailure(e):r.authenticateUserInternal(n,o,t)}))},t.sendMFACode=function(e,t,n,r){var o=this,s={};s.USERNAME=this.username,s.SMS_MFA_CODE=e;var a=n||"SMS_MFA";"SOFTWARE_TOKEN_MFA"===a&&(s.SOFTWARE_TOKEN_MFA_CODE=e),null!=this.deviceKey&&(s.DEVICE_KEY=this.deviceKey);var u={ChallengeName:a,ChallengeResponses:s,ClientId:this.pool.getClientId(),Session:this.Session,ClientMetadata:r};this.getUserContextData()&&(u.UserContextData=this.getUserContextData()),this.client.request("RespondToAuthChallenge",u,(function(e,n){if(e)return t.onFailure(e);if("DEVICE_SRP_AUTH"!==n.ChallengeName){if(o.signInUserSession=o.getCognitoUserSession(n.AuthenticationResult),o.cacheTokens(),null==n.AuthenticationResult.NewDeviceMetadata)return t.onSuccess(o.signInUserSession);var r=new C(o.pool.getUserPoolId().split("_")[1]);r.generateHashDevice(n.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,n.AuthenticationResult.NewDeviceMetadata.DeviceKey,(function(e){if(e)return t.onFailure(e);var s={Salt:i.Buffer.from(r.getSaltDevices(),"hex").toString("base64"),PasswordVerifier:i.Buffer.from(r.getVerifierDevices(),"hex").toString("base64")};o.verifierDevices=s.PasswordVerifier,o.deviceGroupKey=n.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,o.randomPassword=r.getRandomPassword(),o.client.request("ConfirmDevice",{DeviceKey:n.AuthenticationResult.NewDeviceMetadata.DeviceKey,AccessToken:o.signInUserSession.getAccessToken().getJwtToken(),DeviceSecretVerifierConfig:s,DeviceName:V},(function(e,r){return e?t.onFailure(e):(o.deviceKey=n.AuthenticationResult.NewDeviceMetadata.DeviceKey,o.cacheDeviceKeyAndPassword(),!0===r.UserConfirmationNecessary?t.onSuccess(o.signInUserSession,r.UserConfirmationNecessary):t.onSuccess(o.signInUserSession))}))}))}else o.getDeviceResponse(t)}))},t.changePassword=function(e,t,n,r){if(null==this.signInUserSession||!this.signInUserSession.isValid())return n(new Error("User is not authenticated"),null);this.client.request("ChangePassword",{PreviousPassword:e,ProposedPassword:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),ClientMetadata:r},(function(e){return e?n(e,null):n(null,"SUCCESS")}))},t.enableMFA=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);var t=[];t.push({DeliveryMedium:"SMS",AttributeName:"phone_number"}),this.client.request("SetUserSettings",{MFAOptions:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(t){return t?e(t,null):e(null,"SUCCESS")}))},t.setUserMfaPreference=function(e,t,n){if(null==this.signInUserSession||!this.signInUserSession.isValid())return n(new Error("User is not authenticated"),null);this.client.request("SetUserMFAPreference",{SMSMfaSettings:e,SoftwareTokenMfaSettings:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(e){return e?n(e,null):n(null,"SUCCESS")}))},t.disableMFA=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);this.client.request("SetUserSettings",{MFAOptions:[],AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(t){return t?e(t,null):e(null,"SUCCESS")}))},t.deleteUser=function(e,t){var n=this;if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);this.client.request("DeleteUser",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),ClientMetadata:t},(function(t){return t?e(t,null):(n.clearCachedUser(),e(null,"SUCCESS"))}))},t.updateAttributes=function(e,t,n){var r=this;if(null==this.signInUserSession||!this.signInUserSession.isValid())return t(new Error("User is not authenticated"),null);this.client.request("UpdateUserAttributes",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),UserAttributes:e,ClientMetadata:n},(function(e){return e?t(e,null):r.getUserData((function(){return t(null,"SUCCESS")}),{bypassCache:!0})}))},t.getUserAttributes=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);this.client.request("GetUser",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(t,n){if(t)return e(t,null);for(var r=[],i=0;i<n.UserAttributes.length;i++){var o={Name:n.UserAttributes[i].Name,Value:n.UserAttributes[i].Value},s=new q(o);r.push(s)}return e(null,r)}))},t.getMFAOptions=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);this.client.request("GetUser",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(t,n){return t?e(t,null):e(null,n.MFAOptions)}))},t.createGetUserRequest=function(){return this.client.promisifyRequest("GetUser",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()})},t.refreshSessionIfPossible=function(e){var t=this;return void 0===e&&(e={}),new Promise((function(n){var r=t.signInUserSession.getRefreshToken();r&&r.getToken()?t.refreshSession(r,n,e.clientMetadata):n()}))},t.getUserData=function(e,t){var n=this;if(null==this.signInUserSession||!this.signInUserSession.isValid())return this.clearCachedUserData(),e(new Error("User is not authenticated"),null);var r=this.getUserDataFromCache();if(r)if(this.isFetchUserDataAndTokenRequired(t))this.fetchUserData().then((function(e){return n.refreshSessionIfPossible(t).then((function(){return e}))})).then((function(t){return e(null,t)})).catch(e);else try{return void e(null,JSON.parse(r))}catch(t){return this.clearCachedUserData(),void e(t,null)}else this.fetchUserData().then((function(t){e(null,t)})).catch(e)},t.getUserDataFromCache=function(){return this.storage.getItem(this.userDataKey)},t.isFetchUserDataAndTokenRequired=function(e){var t=(e||{}).bypassCache;return void 0!==t&&t},t.fetchUserData=function(){var e=this;return this.createGetUserRequest().then((function(t){return e.cacheUserData(t),t}))},t.deleteAttributes=function(e,t){var n=this;if(null==this.signInUserSession||!this.signInUserSession.isValid())return t(new Error("User is not authenticated"),null);this.client.request("DeleteUserAttributes",{UserAttributeNames:e,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(e){return e?t(e,null):n.getUserData((function(){return t(null,"SUCCESS")}),{bypassCache:!0})}))},t.resendConfirmationCode=function(e,t){var n={ClientId:this.pool.getClientId(),Username:this.username,ClientMetadata:t};this.client.request("ResendConfirmationCode",n,(function(t,n){return t?e(t,null):e(null,n)}))},t.getSession=function(e,t){if(void 0===t&&(t={}),null==this.username)return e(new Error("Username is null. Cannot retrieve a new session"),null);if(null!=this.signInUserSession&&this.signInUserSession.isValid())return e(null,this.signInUserSession);var n="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,r=n+".idToken",i=n+".accessToken",o=n+".refreshToken",s=n+".clockDrift";if(this.storage.getItem(r)){var a=new M({IdToken:this.storage.getItem(r)}),u=new k({AccessToken:this.storage.getItem(i)}),c=new j({RefreshToken:this.storage.getItem(o)}),l=parseInt(this.storage.getItem(s),0)||0,f=new U({IdToken:a,AccessToken:u,RefreshToken:c,ClockDrift:l});if(f.isValid())return this.signInUserSession=f,e(null,this.signInUserSession);if(!c.getToken())return e(new Error("Cannot retrieve a new session. Please authenticate."),null);this.refreshSession(c,e,t.clientMetadata)}else e(new Error("Local storage is missing an ID Token, Please authenticate"),null)},t.refreshSession=function(e,t,n){var r=this,i=this.pool.wrapRefreshSessionCallback?this.pool.wrapRefreshSessionCallback(t):t,o={};o.REFRESH_TOKEN=e.getToken();var s="CognitoIdentityServiceProvider."+this.pool.getClientId(),a=s+".LastAuthUser";if(this.storage.getItem(a)){this.username=this.storage.getItem(a);var u=s+"."+this.username+".deviceKey";this.deviceKey=this.storage.getItem(u),o.DEVICE_KEY=this.deviceKey}var c={ClientId:this.pool.getClientId(),AuthFlow:"REFRESH_TOKEN_AUTH",AuthParameters:o,ClientMetadata:n};this.getUserContextData()&&(c.UserContextData=this.getUserContextData()),this.client.request("InitiateAuth",c,(function(t,n){if(t)return"NotAuthorizedException"===t.code&&r.clearCachedUser(),i(t,null);if(n){var o=n.AuthenticationResult;return Object.prototype.hasOwnProperty.call(o,"RefreshToken")||(o.RefreshToken=e.getToken()),r.signInUserSession=r.getCognitoUserSession(o),r.cacheTokens(),i(null,r.signInUserSession)}}))},t.cacheTokens=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId(),t=e+"."+this.username+".idToken",n=e+"."+this.username+".accessToken",r=e+"."+this.username+".refreshToken",i=e+"."+this.username+".clockDrift",o=e+".LastAuthUser";this.storage.setItem(t,this.signInUserSession.getIdToken().getJwtToken()),this.storage.setItem(n,this.signInUserSession.getAccessToken().getJwtToken()),this.storage.setItem(r,this.signInUserSession.getRefreshToken().getToken()),this.storage.setItem(i,""+this.signInUserSession.getClockDrift()),this.storage.setItem(o,this.username)},t.cacheUserData=function(e){this.storage.setItem(this.userDataKey,JSON.stringify(e))},t.clearCachedUserData=function(){this.storage.removeItem(this.userDataKey)},t.clearCachedUser=function(){this.clearCachedTokens(),this.clearCachedUserData()},t.cacheDeviceKeyAndPassword=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,t=e+".deviceKey",n=e+".randomPasswordKey",r=e+".deviceGroupKey";this.storage.setItem(t,this.deviceKey),this.storage.setItem(n,this.randomPassword),this.storage.setItem(r,this.deviceGroupKey)},t.getCachedDeviceKeyAndPassword=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,t=e+".deviceKey",n=e+".randomPasswordKey",r=e+".deviceGroupKey";this.storage.getItem(t)&&(this.deviceKey=this.storage.getItem(t),this.randomPassword=this.storage.getItem(n),this.deviceGroupKey=this.storage.getItem(r))},t.clearCachedDeviceKeyAndPassword=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,t=e+".deviceKey",n=e+".randomPasswordKey",r=e+".deviceGroupKey";this.storage.removeItem(t),this.storage.removeItem(n),this.storage.removeItem(r)},t.clearCachedTokens=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId(),t=e+"."+this.username+".idToken",n=e+"."+this.username+".accessToken",r=e+"."+this.username+".refreshToken",i=e+".LastAuthUser",o=e+"."+this.username+".clockDrift";this.storage.removeItem(t),this.storage.removeItem(n),this.storage.removeItem(r),this.storage.removeItem(i),this.storage.removeItem(o)},t.getCognitoUserSession=function(e){var t=new M(e),n=new k(e),r=new j(e);return new U({IdToken:t,AccessToken:n,RefreshToken:r})},t.forgotPassword=function(e,t){var n={ClientId:this.pool.getClientId(),Username:this.username,ClientMetadata:t};this.getUserContextData()&&(n.UserContextData=this.getUserContextData()),this.client.request("ForgotPassword",n,(function(t,n){return t?e.onFailure(t):"function"==typeof e.inputVerificationCode?e.inputVerificationCode(n):e.onSuccess(n)}))},t.confirmPassword=function(e,t,n,r){var i={ClientId:this.pool.getClientId(),Username:this.username,ConfirmationCode:e,Password:t,ClientMetadata:r};this.getUserContextData()&&(i.UserContextData=this.getUserContextData()),this.client.request("ConfirmForgotPassword",i,(function(e){return e?n.onFailure(e):n.onSuccess("SUCCESS")}))},t.getAttributeVerificationCode=function(e,t,n){if(null==this.signInUserSession||!this.signInUserSession.isValid())return t.onFailure(new Error("User is not authenticated"));this.client.request("GetUserAttributeVerificationCode",{AttributeName:e,AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),ClientMetadata:n},(function(e,n){return e?t.onFailure(e):"function"==typeof t.inputVerificationCode?t.inputVerificationCode(n):t.onSuccess("SUCCESS")}))},t.verifyAttribute=function(e,t,n){if(null==this.signInUserSession||!this.signInUserSession.isValid())return n.onFailure(new Error("User is not authenticated"));this.client.request("VerifyUserAttribute",{AttributeName:e,Code:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(e){return e?n.onFailure(e):n.onSuccess("SUCCESS")}))},t.getDevice=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e.onFailure(new Error("User is not authenticated"));this.client.request("GetDevice",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:this.deviceKey},(function(t,n){return t?e.onFailure(t):e.onSuccess(n)}))},t.forgetSpecificDevice=function(e,t){if(null==this.signInUserSession||!this.signInUserSession.isValid())return t.onFailure(new Error("User is not authenticated"));this.client.request("ForgetDevice",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:e},(function(e){return e?t.onFailure(e):t.onSuccess("SUCCESS")}))},t.forgetDevice=function(e){var t=this;this.forgetSpecificDevice(this.deviceKey,{onFailure:e.onFailure,onSuccess:function(n){return t.deviceKey=null,t.deviceGroupKey=null,t.randomPassword=null,t.clearCachedDeviceKeyAndPassword(),e.onSuccess(n)}})},t.setDeviceStatusRemembered=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e.onFailure(new Error("User is not authenticated"));this.client.request("UpdateDeviceStatus",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:this.deviceKey,DeviceRememberedStatus:"remembered"},(function(t){return t?e.onFailure(t):e.onSuccess("SUCCESS")}))},t.setDeviceStatusNotRemembered=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e.onFailure(new Error("User is not authenticated"));this.client.request("UpdateDeviceStatus",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:this.deviceKey,DeviceRememberedStatus:"not_remembered"},(function(t){return t?e.onFailure(t):e.onSuccess("SUCCESS")}))},t.listDevices=function(e,t,n){if(null==this.signInUserSession||!this.signInUserSession.isValid())return n.onFailure(new Error("User is not authenticated"));var r={AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),Limit:e};t&&(r.PaginationToken=t),this.client.request("ListDevices",r,(function(e,t){return e?n.onFailure(e):n.onSuccess(t)}))},t.globalSignOut=function(e){var t=this;if(null==this.signInUserSession||!this.signInUserSession.isValid())return e.onFailure(new Error("User is not authenticated"));this.client.request("GlobalSignOut",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(n){return n?e.onFailure(n):(t.clearCachedUser(),e.onSuccess("SUCCESS"))}))},t.signOut=function(e){var t=this;e&&"function"==typeof e?this.getSession((function(n,r){if(n)return e(n);t.revokeTokens((function(n){t.cleanClientData(),e(n)}))})):this.cleanClientData()},t.revokeTokens=function(e){if(void 0===e&&(e=function(){}),"function"!=typeof e)throw new Error("Invalid revokeTokenCallback. It should be a function.");if(!this.signInUserSession)return e(new Error("User is not authenticated"));if(!this.signInUserSession.getAccessToken())return e(new Error("No Access token available"));var t=this.signInUserSession.getRefreshToken().getToken(),n=this.signInUserSession.getAccessToken();if(this.isSessionRevocable(n)&&t)return this.revokeToken({token:t,callback:e});e()},t.isSessionRevocable=function(e){if(e&&"function"==typeof e.decodePayload)try{return!!e.decodePayload().origin_jti}catch(e){}return!1},t.cleanClientData=function(){this.signInUserSession=null,this.clearCachedUser()},t.revokeToken=function(e){var t=e.token,n=e.callback;this.client.requestWithRetry("RevokeToken",{Token:t,ClientId:this.pool.getClientId()},(function(e){if(e)return n(e);n()}))},t.sendMFASelectionAnswer=function(e,t){var n=this,r={};r.USERNAME=this.username,r.ANSWER=e;var i={ChallengeName:"SELECT_MFA_TYPE",ChallengeResponses:r,ClientId:this.pool.getClientId(),Session:this.Session};this.getUserContextData()&&(i.UserContextData=this.getUserContextData()),this.client.request("RespondToAuthChallenge",i,(function(r,i){return r?t.onFailure(r):(n.Session=i.Session,"SMS_MFA"===e?t.mfaRequired(i.ChallengeName,i.ChallengeParameters):"SOFTWARE_TOKEN_MFA"===e?t.totpRequired(i.ChallengeName,i.ChallengeParameters):void 0)}))},t.getUserContextData=function(){return this.pool.getUserContextData(this.username)},t.associateSoftwareToken=function(e){var t=this;null!=this.signInUserSession&&this.signInUserSession.isValid()?this.client.request("AssociateSoftwareToken",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(t,n){return t?e.onFailure(t):e.associateSecretCode(n.SecretCode)})):this.client.request("AssociateSoftwareToken",{Session:this.Session},(function(n,r){return n?e.onFailure(n):(t.Session=r.Session,e.associateSecretCode(r.SecretCode))}))},t.verifySoftwareToken=function(e,t,n){var r=this;null!=this.signInUserSession&&this.signInUserSession.isValid()?this.client.request("VerifySoftwareToken",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),UserCode:e,FriendlyDeviceName:t},(function(e,t){return e?n.onFailure(e):n.onSuccess(t)})):this.client.request("VerifySoftwareToken",{Session:this.Session,UserCode:e,FriendlyDeviceName:t},(function(e,t){if(e)return n.onFailure(e);r.Session=t.Session;var i={};i.USERNAME=r.username;var o={ChallengeName:"MFA_SETUP",ClientId:r.pool.getClientId(),ChallengeResponses:i,Session:r.Session};r.getUserContextData()&&(o.UserContextData=r.getUserContextData()),r.client.request("RespondToAuthChallenge",o,(function(e,t){return e?n.onFailure(e):(r.signInUserSession=r.getCognitoUserSession(t.AuthenticationResult),r.cacheTokens(),n.onSuccess(r.signInUserSession))}))}))},e}(),W=(n(90),{userAgent:"aws-amplify/5.0.4 js",product:"",navigator:null,isReactNative:!1});
26
+ */var N=function(e){var t,n;function r(t){var n=(void 0===t?{}:t).IdToken;return e.call(this,n||"")||this}return n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,k(t,n),r}(C),M=function(){function e(e){var t=(void 0===e?{}:e).RefreshToken;this.token=t||""}return e.prototype.getToken=function(){return this.token},e}(),D=n(29),R=n.n(D),U=function(){function e(e){var t=void 0===e?{}:e,n=t.IdToken,r=t.RefreshToken,i=t.AccessToken,o=t.ClockDrift;if(null==i||null==n)throw new Error("Id token and Access Token must be present.");this.idToken=n,this.refreshToken=r,this.accessToken=i,this.clockDrift=void 0===o?this.calculateClockDrift():o}var t=e.prototype;return t.getIdToken=function(){return this.idToken},t.getRefreshToken=function(){return this.refreshToken},t.getAccessToken=function(){return this.accessToken},t.getClockDrift=function(){return this.clockDrift},t.calculateClockDrift=function(){return Math.floor(new Date/1e3)-Math.min(this.accessToken.getIssuedAt(),this.idToken.getIssuedAt())},t.isValid=function(){var e=Math.floor(new Date/1e3)-this.clockDrift;return e<this.accessToken.getExpiration()&&e<this.idToken.getExpiration()},e}(),F=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],L=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],B=function(){function e(){}return e.prototype.getNowString=function(){var e=new Date,t=L[e.getUTCDay()],n=F[e.getUTCMonth()],r=e.getUTCDate(),i=e.getUTCHours();i<10&&(i="0"+i);var o=e.getUTCMinutes();o<10&&(o="0"+o);var s=e.getUTCSeconds();return s<10&&(s="0"+s),t+" "+n+" "+r+" "+i+":"+o+":"+s+" UTC "+e.getUTCFullYear()},e}(),q=function(){function e(e){var t=void 0===e?{}:e,n=t.Name,r=t.Value;this.Name=n||"",this.Value=r||""}var t=e.prototype;return t.getValue=function(){return this.Value},t.setValue=function(e){return this.Value=e,this},t.getName=function(){return this.Name},t.setName=function(e){return this.Name=e,this},t.toString=function(){return JSON.stringify(this)},t.toJSON=function(){return{Name:this.Name,Value:this.Value}},e}(),z={},K=function(){function e(){}return e.setItem=function(e,t){return z[e]=t,z[e]},e.getItem=function(e){return Object.prototype.hasOwnProperty.call(z,e)?z[e]:void 0},e.removeItem=function(e){return delete z[e]},e.clear=function(){return z={}},e}(),V=function(){function e(){try{this.storageWindow=window.localStorage,this.storageWindow.setItem("aws.cognito.test-ls",1),this.storageWindow.removeItem("aws.cognito.test-ls")}catch(e){this.storageWindow=K}}return e.prototype.getStorage=function(){return this.storageWindow},e}(),G="undefined"!=typeof navigator?navigator.userAgent:"nodejs",H=function(){function e(e){if(null==e||null==e.Username||null==e.Pool)throw new Error("Username and Pool information are required.");this.username=e.Username||"",this.pool=e.Pool,this.Session=null,this.client=e.Pool.client,this.signInUserSession=null,this.authenticationFlowType="USER_SRP_AUTH",this.storage=e.Storage||(new V).getStorage(),this.keyPrefix="CognitoIdentityServiceProvider."+this.pool.getClientId(),this.userDataKey=this.keyPrefix+"."+this.username+".userData"}var t=e.prototype;return t.setSignInUserSession=function(e){this.clearCachedUserData(),this.signInUserSession=e,this.cacheTokens()},t.getSignInUserSession=function(){return this.signInUserSession},t.getUsername=function(){return this.username},t.getAuthenticationFlowType=function(){return this.authenticationFlowType},t.setAuthenticationFlowType=function(e){this.authenticationFlowType=e},t.initiateAuth=function(e,t){var n=this,r=e.getAuthParameters();r.USERNAME=this.username;var i=0!==Object.keys(e.getValidationData()).length?e.getValidationData():e.getClientMetadata(),o={AuthFlow:"CUSTOM_AUTH",ClientId:this.pool.getClientId(),AuthParameters:r,ClientMetadata:i};this.getUserContextData()&&(o.UserContextData=this.getUserContextData()),this.client.request("InitiateAuth",o,(function(e,r){if(e)return t.onFailure(e);var i=r.ChallengeName,o=r.ChallengeParameters;return"CUSTOM_CHALLENGE"===i?(n.Session=r.Session,t.customChallenge(o)):(n.signInUserSession=n.getCognitoUserSession(r.AuthenticationResult),n.cacheTokens(),t.onSuccess(n.signInUserSession))}))},t.authenticateUser=function(e,t){return"USER_PASSWORD_AUTH"===this.authenticationFlowType?this.authenticateUserPlainUsernamePassword(e,t):"USER_SRP_AUTH"===this.authenticationFlowType||"CUSTOM_AUTH"===this.authenticationFlowType?this.authenticateUserDefaultAuth(e,t):t.onFailure(new Error("Authentication flow type is invalid."))},t.authenticateUserDefaultAuth=function(e,t){var n,r,o=this,a=new j(this.pool.getUserPoolId().split("_")[1]),u=new B,c={};null!=this.deviceKey&&(c.DEVICE_KEY=this.deviceKey),c.USERNAME=this.username,a.getLargeAValue((function(f,d){f&&t.onFailure(f),c.SRP_A=d.toString(16),"CUSTOM_AUTH"===o.authenticationFlowType&&(c.CHALLENGE_NAME="SRP_A");var h=0!==Object.keys(e.getValidationData()).length?e.getValidationData():e.getClientMetadata(),v={AuthFlow:o.authenticationFlowType,ClientId:o.pool.getClientId(),AuthParameters:c,ClientMetadata:h};o.getUserContextData(o.username)&&(v.UserContextData=o.getUserContextData(o.username)),o.client.request("InitiateAuth",v,(function(c,f){if(c)return t.onFailure(c);var d=f.ChallengeParameters;o.username=d.USER_ID_FOR_SRP,o.userDataKey=o.keyPrefix+"."+o.username+".userData",n=new p(d.SRP_B,16),r=new p(d.SALT,16),o.getCachedDeviceKeyAndPassword(),a.getPasswordAuthenticationKey(o.username,e.getPassword(),n,r,(function(e,n){e&&t.onFailure(e);var r=u.getNowString(),c=s.a.lib.WordArray.create(i.Buffer.concat([i.Buffer.from(o.pool.getUserPoolId().split("_")[1],"utf8"),i.Buffer.from(o.username,"utf8"),i.Buffer.from(d.SECRET_BLOCK,"base64"),i.Buffer.from(r,"utf8")])),p=s.a.lib.WordArray.create(n),v=R.a.stringify(l()(c,p)),y={};y.USERNAME=o.username,y.PASSWORD_CLAIM_SECRET_BLOCK=d.SECRET_BLOCK,y.TIMESTAMP=r,y.PASSWORD_CLAIM_SIGNATURE=v,null!=o.deviceKey&&(y.DEVICE_KEY=o.deviceKey);var g={ChallengeName:"PASSWORD_VERIFIER",ClientId:o.pool.getClientId(),ChallengeResponses:y,Session:f.Session,ClientMetadata:h};o.getUserContextData()&&(g.UserContextData=o.getUserContextData()),function e(t,n){return o.client.request("RespondToAuthChallenge",t,(function(r,i){return r&&"ResourceNotFoundException"===r.code&&-1!==r.message.toLowerCase().indexOf("device")?(y.DEVICE_KEY=null,o.deviceKey=null,o.randomPassword=null,o.deviceGroupKey=null,o.clearCachedDeviceKeyAndPassword(),e(t,n)):n(r,i)}))}(g,(function(e,n){return e?t.onFailure(e):o.authenticateUserInternal(n,a,t)}))}))}))}))},t.authenticateUserPlainUsernamePassword=function(e,t){var n=this,r={};if(r.USERNAME=this.username,r.PASSWORD=e.getPassword(),r.PASSWORD){var i=new j(this.pool.getUserPoolId().split("_")[1]);this.getCachedDeviceKeyAndPassword(),null!=this.deviceKey&&(r.DEVICE_KEY=this.deviceKey);var o=0!==Object.keys(e.getValidationData()).length?e.getValidationData():e.getClientMetadata(),s={AuthFlow:"USER_PASSWORD_AUTH",ClientId:this.pool.getClientId(),AuthParameters:r,ClientMetadata:o};this.getUserContextData(this.username)&&(s.UserContextData=this.getUserContextData(this.username)),this.client.request("InitiateAuth",s,(function(e,r){return e?t.onFailure(e):n.authenticateUserInternal(r,i,t)}))}else t.onFailure(new Error("PASSWORD parameter is required"))},t.authenticateUserInternal=function(e,t,n){var r=this,o=e.ChallengeName,s=e.ChallengeParameters;if("SMS_MFA"===o)return this.Session=e.Session,n.mfaRequired(o,s);if("SELECT_MFA_TYPE"===o)return this.Session=e.Session,n.selectMFAType(o,s);if("MFA_SETUP"===o)return this.Session=e.Session,n.mfaSetup(o,s);if("SOFTWARE_TOKEN_MFA"===o)return this.Session=e.Session,n.totpRequired(o,s);if("CUSTOM_CHALLENGE"===o)return this.Session=e.Session,n.customChallenge(s);if("NEW_PASSWORD_REQUIRED"===o){this.Session=e.Session;var a=null,u=null,c=[],l=t.getNewPasswordRequiredChallengeUserAttributePrefix();if(s&&(a=JSON.parse(e.ChallengeParameters.userAttributes),u=JSON.parse(e.ChallengeParameters.requiredAttributes)),u)for(var f=0;f<u.length;f++)c[f]=u[f].substr(l.length);return n.newPasswordRequired(a,c)}if("DEVICE_SRP_AUTH"===o)return this.Session=e.Session,void this.getDeviceResponse(n);this.signInUserSession=this.getCognitoUserSession(e.AuthenticationResult),this.challengeName=o,this.cacheTokens();var d=e.AuthenticationResult.NewDeviceMetadata;if(null==d)return n.onSuccess(this.signInUserSession);t.generateHashDevice(e.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,e.AuthenticationResult.NewDeviceMetadata.DeviceKey,(function(o){if(o)return n.onFailure(o);var s={Salt:i.Buffer.from(t.getSaltDevices(),"hex").toString("base64"),PasswordVerifier:i.Buffer.from(t.getVerifierDevices(),"hex").toString("base64")};r.verifierDevices=s.PasswordVerifier,r.deviceGroupKey=d.DeviceGroupKey,r.randomPassword=t.getRandomPassword(),r.client.request("ConfirmDevice",{DeviceKey:d.DeviceKey,AccessToken:r.signInUserSession.getAccessToken().getJwtToken(),DeviceSecretVerifierConfig:s,DeviceName:G},(function(t,i){return t?n.onFailure(t):(r.deviceKey=e.AuthenticationResult.NewDeviceMetadata.DeviceKey,r.cacheDeviceKeyAndPassword(),!0===i.UserConfirmationNecessary?n.onSuccess(r.signInUserSession,i.UserConfirmationNecessary):n.onSuccess(r.signInUserSession))}))}))},t.completeNewPasswordChallenge=function(e,t,n,r){var i=this;if(!e)return n.onFailure(new Error("New password is required."));var o=new j(this.pool.getUserPoolId().split("_")[1]),s=o.getNewPasswordRequiredChallengeUserAttributePrefix(),a={};t&&Object.keys(t).forEach((function(e){a[s+e]=t[e]})),a.NEW_PASSWORD=e,a.USERNAME=this.username;var u={ChallengeName:"NEW_PASSWORD_REQUIRED",ClientId:this.pool.getClientId(),ChallengeResponses:a,Session:this.Session,ClientMetadata:r};this.getUserContextData()&&(u.UserContextData=this.getUserContextData()),this.client.request("RespondToAuthChallenge",u,(function(e,t){return e?n.onFailure(e):i.authenticateUserInternal(t,o,n)}))},t.getDeviceResponse=function(e,t){var n=this,r=new j(this.deviceGroupKey),o=new B,a={};a.USERNAME=this.username,a.DEVICE_KEY=this.deviceKey,r.getLargeAValue((function(u,c){u&&e.onFailure(u),a.SRP_A=c.toString(16);var f={ChallengeName:"DEVICE_SRP_AUTH",ClientId:n.pool.getClientId(),ChallengeResponses:a,ClientMetadata:t,Session:n.Session};n.getUserContextData()&&(f.UserContextData=n.getUserContextData()),n.client.request("RespondToAuthChallenge",f,(function(t,a){if(t)return e.onFailure(t);var u=a.ChallengeParameters,c=new p(u.SRP_B,16),f=new p(u.SALT,16);r.getPasswordAuthenticationKey(n.deviceKey,n.randomPassword,c,f,(function(t,r){if(t)return e.onFailure(t);var c=o.getNowString(),f=s.a.lib.WordArray.create(i.Buffer.concat([i.Buffer.from(n.deviceGroupKey,"utf8"),i.Buffer.from(n.deviceKey,"utf8"),i.Buffer.from(u.SECRET_BLOCK,"base64"),i.Buffer.from(c,"utf8")])),d=s.a.lib.WordArray.create(r),h=R.a.stringify(l()(f,d)),p={};p.USERNAME=n.username,p.PASSWORD_CLAIM_SECRET_BLOCK=u.SECRET_BLOCK,p.TIMESTAMP=c,p.PASSWORD_CLAIM_SIGNATURE=h,p.DEVICE_KEY=n.deviceKey;var v={ChallengeName:"DEVICE_PASSWORD_VERIFIER",ClientId:n.pool.getClientId(),ChallengeResponses:p,Session:a.Session};n.getUserContextData()&&(v.UserContextData=n.getUserContextData()),n.client.request("RespondToAuthChallenge",v,(function(t,r){return t?e.onFailure(t):(n.signInUserSession=n.getCognitoUserSession(r.AuthenticationResult),n.cacheTokens(),e.onSuccess(n.signInUserSession))}))}))}))}))},t.confirmRegistration=function(e,t,n,r){var i={ClientId:this.pool.getClientId(),ConfirmationCode:e,Username:this.username,ForceAliasCreation:t,ClientMetadata:r};this.getUserContextData()&&(i.UserContextData=this.getUserContextData()),this.client.request("ConfirmSignUp",i,(function(e){return e?n(e,null):n(null,"SUCCESS")}))},t.sendCustomChallengeAnswer=function(e,t,n){var r=this,i={};i.USERNAME=this.username,i.ANSWER=e;var o=new j(this.pool.getUserPoolId().split("_")[1]);this.getCachedDeviceKeyAndPassword(),null!=this.deviceKey&&(i.DEVICE_KEY=this.deviceKey);var s={ChallengeName:"CUSTOM_CHALLENGE",ChallengeResponses:i,ClientId:this.pool.getClientId(),Session:this.Session,ClientMetadata:n};this.getUserContextData()&&(s.UserContextData=this.getUserContextData()),this.client.request("RespondToAuthChallenge",s,(function(e,n){return e?t.onFailure(e):r.authenticateUserInternal(n,o,t)}))},t.sendMFACode=function(e,t,n,r){var o=this,s={};s.USERNAME=this.username,s.SMS_MFA_CODE=e;var a=n||"SMS_MFA";"SOFTWARE_TOKEN_MFA"===a&&(s.SOFTWARE_TOKEN_MFA_CODE=e),null!=this.deviceKey&&(s.DEVICE_KEY=this.deviceKey);var u={ChallengeName:a,ChallengeResponses:s,ClientId:this.pool.getClientId(),Session:this.Session,ClientMetadata:r};this.getUserContextData()&&(u.UserContextData=this.getUserContextData()),this.client.request("RespondToAuthChallenge",u,(function(e,n){if(e)return t.onFailure(e);if("DEVICE_SRP_AUTH"!==n.ChallengeName){if(o.signInUserSession=o.getCognitoUserSession(n.AuthenticationResult),o.cacheTokens(),null==n.AuthenticationResult.NewDeviceMetadata)return t.onSuccess(o.signInUserSession);var r=new j(o.pool.getUserPoolId().split("_")[1]);r.generateHashDevice(n.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,n.AuthenticationResult.NewDeviceMetadata.DeviceKey,(function(e){if(e)return t.onFailure(e);var s={Salt:i.Buffer.from(r.getSaltDevices(),"hex").toString("base64"),PasswordVerifier:i.Buffer.from(r.getVerifierDevices(),"hex").toString("base64")};o.verifierDevices=s.PasswordVerifier,o.deviceGroupKey=n.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,o.randomPassword=r.getRandomPassword(),o.client.request("ConfirmDevice",{DeviceKey:n.AuthenticationResult.NewDeviceMetadata.DeviceKey,AccessToken:o.signInUserSession.getAccessToken().getJwtToken(),DeviceSecretVerifierConfig:s,DeviceName:G},(function(e,r){return e?t.onFailure(e):(o.deviceKey=n.AuthenticationResult.NewDeviceMetadata.DeviceKey,o.cacheDeviceKeyAndPassword(),!0===r.UserConfirmationNecessary?t.onSuccess(o.signInUserSession,r.UserConfirmationNecessary):t.onSuccess(o.signInUserSession))}))}))}else o.getDeviceResponse(t)}))},t.changePassword=function(e,t,n,r){if(null==this.signInUserSession||!this.signInUserSession.isValid())return n(new Error("User is not authenticated"),null);this.client.request("ChangePassword",{PreviousPassword:e,ProposedPassword:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),ClientMetadata:r},(function(e){return e?n(e,null):n(null,"SUCCESS")}))},t.enableMFA=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);var t=[];t.push({DeliveryMedium:"SMS",AttributeName:"phone_number"}),this.client.request("SetUserSettings",{MFAOptions:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(t){return t?e(t,null):e(null,"SUCCESS")}))},t.setUserMfaPreference=function(e,t,n){if(null==this.signInUserSession||!this.signInUserSession.isValid())return n(new Error("User is not authenticated"),null);this.client.request("SetUserMFAPreference",{SMSMfaSettings:e,SoftwareTokenMfaSettings:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(e){return e?n(e,null):n(null,"SUCCESS")}))},t.disableMFA=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);this.client.request("SetUserSettings",{MFAOptions:[],AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(t){return t?e(t,null):e(null,"SUCCESS")}))},t.deleteUser=function(e,t){var n=this;if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);this.client.request("DeleteUser",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),ClientMetadata:t},(function(t){return t?e(t,null):(n.clearCachedUser(),e(null,"SUCCESS"))}))},t.updateAttributes=function(e,t,n){var r=this;if(null==this.signInUserSession||!this.signInUserSession.isValid())return t(new Error("User is not authenticated"),null);this.client.request("UpdateUserAttributes",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),UserAttributes:e,ClientMetadata:n},(function(e){return e?t(e,null):r.getUserData((function(){return t(null,"SUCCESS")}),{bypassCache:!0})}))},t.getUserAttributes=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);this.client.request("GetUser",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(t,n){if(t)return e(t,null);for(var r=[],i=0;i<n.UserAttributes.length;i++){var o={Name:n.UserAttributes[i].Name,Value:n.UserAttributes[i].Value},s=new q(o);r.push(s)}return e(null,r)}))},t.getMFAOptions=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);this.client.request("GetUser",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(t,n){return t?e(t,null):e(null,n.MFAOptions)}))},t.createGetUserRequest=function(){return this.client.promisifyRequest("GetUser",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()})},t.refreshSessionIfPossible=function(e){var t=this;return void 0===e&&(e={}),new Promise((function(n){var r=t.signInUserSession.getRefreshToken();r&&r.getToken()?t.refreshSession(r,n,e.clientMetadata):n()}))},t.getUserData=function(e,t){var n=this;if(null==this.signInUserSession||!this.signInUserSession.isValid())return this.clearCachedUserData(),e(new Error("User is not authenticated"),null);var r=this.getUserDataFromCache();if(r)if(this.isFetchUserDataAndTokenRequired(t))this.fetchUserData().then((function(e){return n.refreshSessionIfPossible(t).then((function(){return e}))})).then((function(t){return e(null,t)})).catch(e);else try{return void e(null,JSON.parse(r))}catch(t){return this.clearCachedUserData(),void e(t,null)}else this.fetchUserData().then((function(t){e(null,t)})).catch(e)},t.getUserDataFromCache=function(){return this.storage.getItem(this.userDataKey)},t.isFetchUserDataAndTokenRequired=function(e){var t=(e||{}).bypassCache;return void 0!==t&&t},t.fetchUserData=function(){var e=this;return this.createGetUserRequest().then((function(t){return e.cacheUserData(t),t}))},t.deleteAttributes=function(e,t){var n=this;if(null==this.signInUserSession||!this.signInUserSession.isValid())return t(new Error("User is not authenticated"),null);this.client.request("DeleteUserAttributes",{UserAttributeNames:e,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(e){return e?t(e,null):n.getUserData((function(){return t(null,"SUCCESS")}),{bypassCache:!0})}))},t.resendConfirmationCode=function(e,t){var n={ClientId:this.pool.getClientId(),Username:this.username,ClientMetadata:t};this.client.request("ResendConfirmationCode",n,(function(t,n){return t?e(t,null):e(null,n)}))},t.getSession=function(e,t){if(void 0===t&&(t={}),null==this.username)return e(new Error("Username is null. Cannot retrieve a new session"),null);if(null!=this.signInUserSession&&this.signInUserSession.isValid())return e(null,this.signInUserSession);var n="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,r=n+".idToken",i=n+".accessToken",o=n+".refreshToken",s=n+".clockDrift";if(this.storage.getItem(r)){var a=new N({IdToken:this.storage.getItem(r)}),u=new x({AccessToken:this.storage.getItem(i)}),c=new M({RefreshToken:this.storage.getItem(o)}),l=parseInt(this.storage.getItem(s),0)||0,f=new U({IdToken:a,AccessToken:u,RefreshToken:c,ClockDrift:l});if(f.isValid())return this.signInUserSession=f,e(null,this.signInUserSession);if(!c.getToken())return e(new Error("Cannot retrieve a new session. Please authenticate."),null);this.refreshSession(c,e,t.clientMetadata)}else e(new Error("Local storage is missing an ID Token, Please authenticate"),null)},t.refreshSession=function(e,t,n){var r=this,i=this.pool.wrapRefreshSessionCallback?this.pool.wrapRefreshSessionCallback(t):t,o={};o.REFRESH_TOKEN=e.getToken();var s="CognitoIdentityServiceProvider."+this.pool.getClientId(),a=s+".LastAuthUser";if(this.storage.getItem(a)){this.username=this.storage.getItem(a);var u=s+"."+this.username+".deviceKey";this.deviceKey=this.storage.getItem(u),o.DEVICE_KEY=this.deviceKey}var c={ClientId:this.pool.getClientId(),AuthFlow:"REFRESH_TOKEN_AUTH",AuthParameters:o,ClientMetadata:n};this.getUserContextData()&&(c.UserContextData=this.getUserContextData()),this.client.request("InitiateAuth",c,(function(t,n){if(t)return"NotAuthorizedException"===t.code&&r.clearCachedUser(),i(t,null);if(n){var o=n.AuthenticationResult;return Object.prototype.hasOwnProperty.call(o,"RefreshToken")||(o.RefreshToken=e.getToken()),r.signInUserSession=r.getCognitoUserSession(o),r.cacheTokens(),i(null,r.signInUserSession)}}))},t.cacheTokens=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId(),t=e+"."+this.username+".idToken",n=e+"."+this.username+".accessToken",r=e+"."+this.username+".refreshToken",i=e+"."+this.username+".clockDrift",o=e+".LastAuthUser";this.storage.setItem(t,this.signInUserSession.getIdToken().getJwtToken()),this.storage.setItem(n,this.signInUserSession.getAccessToken().getJwtToken()),this.storage.setItem(r,this.signInUserSession.getRefreshToken().getToken()),this.storage.setItem(i,""+this.signInUserSession.getClockDrift()),this.storage.setItem(o,this.username)},t.cacheUserData=function(e){this.storage.setItem(this.userDataKey,JSON.stringify(e))},t.clearCachedUserData=function(){this.storage.removeItem(this.userDataKey)},t.clearCachedUser=function(){this.clearCachedTokens(),this.clearCachedUserData()},t.cacheDeviceKeyAndPassword=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,t=e+".deviceKey",n=e+".randomPasswordKey",r=e+".deviceGroupKey";this.storage.setItem(t,this.deviceKey),this.storage.setItem(n,this.randomPassword),this.storage.setItem(r,this.deviceGroupKey)},t.getCachedDeviceKeyAndPassword=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,t=e+".deviceKey",n=e+".randomPasswordKey",r=e+".deviceGroupKey";this.storage.getItem(t)&&(this.deviceKey=this.storage.getItem(t),this.randomPassword=this.storage.getItem(n),this.deviceGroupKey=this.storage.getItem(r))},t.clearCachedDeviceKeyAndPassword=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,t=e+".deviceKey",n=e+".randomPasswordKey",r=e+".deviceGroupKey";this.storage.removeItem(t),this.storage.removeItem(n),this.storage.removeItem(r)},t.clearCachedTokens=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId(),t=e+"."+this.username+".idToken",n=e+"."+this.username+".accessToken",r=e+"."+this.username+".refreshToken",i=e+".LastAuthUser",o=e+"."+this.username+".clockDrift";this.storage.removeItem(t),this.storage.removeItem(n),this.storage.removeItem(r),this.storage.removeItem(i),this.storage.removeItem(o)},t.getCognitoUserSession=function(e){var t=new N(e),n=new x(e),r=new M(e);return new U({IdToken:t,AccessToken:n,RefreshToken:r})},t.forgotPassword=function(e,t){var n={ClientId:this.pool.getClientId(),Username:this.username,ClientMetadata:t};this.getUserContextData()&&(n.UserContextData=this.getUserContextData()),this.client.request("ForgotPassword",n,(function(t,n){return t?e.onFailure(t):"function"==typeof e.inputVerificationCode?e.inputVerificationCode(n):e.onSuccess(n)}))},t.confirmPassword=function(e,t,n,r){var i={ClientId:this.pool.getClientId(),Username:this.username,ConfirmationCode:e,Password:t,ClientMetadata:r};this.getUserContextData()&&(i.UserContextData=this.getUserContextData()),this.client.request("ConfirmForgotPassword",i,(function(e){return e?n.onFailure(e):n.onSuccess("SUCCESS")}))},t.getAttributeVerificationCode=function(e,t,n){if(null==this.signInUserSession||!this.signInUserSession.isValid())return t.onFailure(new Error("User is not authenticated"));this.client.request("GetUserAttributeVerificationCode",{AttributeName:e,AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),ClientMetadata:n},(function(e,n){return e?t.onFailure(e):"function"==typeof t.inputVerificationCode?t.inputVerificationCode(n):t.onSuccess("SUCCESS")}))},t.verifyAttribute=function(e,t,n){if(null==this.signInUserSession||!this.signInUserSession.isValid())return n.onFailure(new Error("User is not authenticated"));this.client.request("VerifyUserAttribute",{AttributeName:e,Code:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(e){return e?n.onFailure(e):n.onSuccess("SUCCESS")}))},t.getDevice=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e.onFailure(new Error("User is not authenticated"));this.client.request("GetDevice",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:this.deviceKey},(function(t,n){return t?e.onFailure(t):e.onSuccess(n)}))},t.forgetSpecificDevice=function(e,t){if(null==this.signInUserSession||!this.signInUserSession.isValid())return t.onFailure(new Error("User is not authenticated"));this.client.request("ForgetDevice",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:e},(function(e){return e?t.onFailure(e):t.onSuccess("SUCCESS")}))},t.forgetDevice=function(e){var t=this;this.forgetSpecificDevice(this.deviceKey,{onFailure:e.onFailure,onSuccess:function(n){return t.deviceKey=null,t.deviceGroupKey=null,t.randomPassword=null,t.clearCachedDeviceKeyAndPassword(),e.onSuccess(n)}})},t.setDeviceStatusRemembered=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e.onFailure(new Error("User is not authenticated"));this.client.request("UpdateDeviceStatus",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:this.deviceKey,DeviceRememberedStatus:"remembered"},(function(t){return t?e.onFailure(t):e.onSuccess("SUCCESS")}))},t.setDeviceStatusNotRemembered=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e.onFailure(new Error("User is not authenticated"));this.client.request("UpdateDeviceStatus",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:this.deviceKey,DeviceRememberedStatus:"not_remembered"},(function(t){return t?e.onFailure(t):e.onSuccess("SUCCESS")}))},t.listDevices=function(e,t,n){if(null==this.signInUserSession||!this.signInUserSession.isValid())return n.onFailure(new Error("User is not authenticated"));var r={AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),Limit:e};t&&(r.PaginationToken=t),this.client.request("ListDevices",r,(function(e,t){return e?n.onFailure(e):n.onSuccess(t)}))},t.globalSignOut=function(e){var t=this;if(null==this.signInUserSession||!this.signInUserSession.isValid())return e.onFailure(new Error("User is not authenticated"));this.client.request("GlobalSignOut",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(n){return n?e.onFailure(n):(t.clearCachedUser(),e.onSuccess("SUCCESS"))}))},t.signOut=function(e){var t=this;e&&"function"==typeof e?this.getSession((function(n,r){if(n)return e(n);t.revokeTokens((function(n){t.cleanClientData(),e(n)}))})):this.cleanClientData()},t.revokeTokens=function(e){if(void 0===e&&(e=function(){}),"function"!=typeof e)throw new Error("Invalid revokeTokenCallback. It should be a function.");if(!this.signInUserSession)return e(new Error("User is not authenticated"));if(!this.signInUserSession.getAccessToken())return e(new Error("No Access token available"));var t=this.signInUserSession.getRefreshToken().getToken(),n=this.signInUserSession.getAccessToken();if(this.isSessionRevocable(n)&&t)return this.revokeToken({token:t,callback:e});e()},t.isSessionRevocable=function(e){if(e&&"function"==typeof e.decodePayload)try{return!!e.decodePayload().origin_jti}catch(e){}return!1},t.cleanClientData=function(){this.signInUserSession=null,this.clearCachedUser()},t.revokeToken=function(e){var t=e.token,n=e.callback;this.client.requestWithRetry("RevokeToken",{Token:t,ClientId:this.pool.getClientId()},(function(e){if(e)return n(e);n()}))},t.sendMFASelectionAnswer=function(e,t){var n=this,r={};r.USERNAME=this.username,r.ANSWER=e;var i={ChallengeName:"SELECT_MFA_TYPE",ChallengeResponses:r,ClientId:this.pool.getClientId(),Session:this.Session};this.getUserContextData()&&(i.UserContextData=this.getUserContextData()),this.client.request("RespondToAuthChallenge",i,(function(r,i){return r?t.onFailure(r):(n.Session=i.Session,"SMS_MFA"===e?t.mfaRequired(i.ChallengeName,i.ChallengeParameters):"SOFTWARE_TOKEN_MFA"===e?t.totpRequired(i.ChallengeName,i.ChallengeParameters):void 0)}))},t.getUserContextData=function(){return this.pool.getUserContextData(this.username)},t.associateSoftwareToken=function(e){var t=this;null!=this.signInUserSession&&this.signInUserSession.isValid()?this.client.request("AssociateSoftwareToken",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(t,n){return t?e.onFailure(t):e.associateSecretCode(n.SecretCode)})):this.client.request("AssociateSoftwareToken",{Session:this.Session},(function(n,r){return n?e.onFailure(n):(t.Session=r.Session,e.associateSecretCode(r.SecretCode))}))},t.verifySoftwareToken=function(e,t,n){var r=this;null!=this.signInUserSession&&this.signInUserSession.isValid()?this.client.request("VerifySoftwareToken",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),UserCode:e,FriendlyDeviceName:t},(function(e,t){return e?n.onFailure(e):n.onSuccess(t)})):this.client.request("VerifySoftwareToken",{Session:this.Session,UserCode:e,FriendlyDeviceName:t},(function(e,t){if(e)return n.onFailure(e);r.Session=t.Session;var i={};i.USERNAME=r.username;var o={ChallengeName:"MFA_SETUP",ClientId:r.pool.getClientId(),ChallengeResponses:i,Session:r.Session};r.getUserContextData()&&(o.UserContextData=r.getUserContextData()),r.client.request("RespondToAuthChallenge",o,(function(e,t){return e?n.onFailure(e):(r.signInUserSession=r.getCognitoUserSession(t.AuthenticationResult),r.cacheTokens(),n.onSuccess(r.signInUserSession))}))}))},e}(),W=(n(91),{userAgent:"aws-amplify/5.0.4 js",product:"",navigator:null,isReactNative:!1});
42
27
  /*!
43
28
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
44
29
  * SPDX-License-Identifier: Apache-2.0
@@ -47,7 +32,7 @@ function I(e){return i.Buffer.from((new h).random(e).toString(),"hex")}O.prototy
47
32
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
48
33
  * SPDX-License-Identifier: Apache-2.0
49
34
  */
50
- var oe=function(){function e(e,t){var n=e||{},r=n.UserPoolId,i=n.ClientId,o=n.endpoint,s=n.fetchOptions,a=n.AdvancedSecurityDataCollectionFlag;if(!r||!i)throw new Error("Both UserPoolId and ClientId are required.");if(r.length>55||!/^[\w-]+_[0-9a-zA-Z]+$/.test(r))throw new Error("Invalid UserPoolId format.");var u=r.split("_")[0];this.userPoolId=r,this.clientId=i,this.client=new re(u,o,s),this.advancedSecurityDataCollectionFlag=!1!==a,this.storage=e.Storage||(new H).getStorage(),t&&(this.wrapRefreshSessionCallback=t)}var t=e.prototype;return t.getUserPoolId=function(){return this.userPoolId},t.getClientId=function(){return this.clientId},t.signUp=function(e,t,n,r,i,o){var s=this,a={ClientId:this.clientId,Username:e,Password:t,UserAttributes:n,ValidationData:r,ClientMetadata:o};this.getUserContextData(e)&&(a.UserContextData=this.getUserContextData(e)),this.client.request("SignUp",a,(function(t,n){if(t)return i(t,null);var r={Username:e,Pool:s,Storage:s.storage},o={user:new G(r),userConfirmed:n.UserConfirmed,userSub:n.UserSub,codeDeliveryDetails:n.CodeDeliveryDetails};return i(null,o)}))},t.getCurrentUser=function(){var e="CognitoIdentityServiceProvider."+this.clientId+".LastAuthUser",t=this.storage.getItem(e);if(t){var n={Username:t,Pool:this,Storage:this.storage};return new G(n)}return null},t.getUserContextData=function(e){if("undefined"!=typeof AmazonCognitoAdvancedSecurityData){var t=AmazonCognitoAdvancedSecurityData;if(this.advancedSecurityDataCollectionFlag){var n=t.getData(e,this.userPoolId,this.clientId);if(n)return{EncodedData:n}}return{}}},e}(),se=n(26),ae=function(){function e(e){if(!e.domain)throw new Error("The domain of cookieStorage can not be undefined.");if(this.domain=e.domain,e.path?this.path=e.path:this.path="/",Object.prototype.hasOwnProperty.call(e,"expires")?this.expires=e.expires:this.expires=365,Object.prototype.hasOwnProperty.call(e,"secure")?this.secure=e.secure:this.secure=!0,Object.prototype.hasOwnProperty.call(e,"sameSite")){if(!["strict","lax","none"].includes(e.sameSite))throw new Error('The sameSite value of cookieStorage must be "lax", "strict" or "none".');if("none"===e.sameSite&&!this.secure)throw new Error("sameSite = None requires the Secure attribute in latest browser versions.");this.sameSite=e.sameSite}else this.sameSite=null}var t=e.prototype;return t.setItem=function(e,t){var n={path:this.path,expires:this.expires,domain:this.domain,secure:this.secure};return this.sameSite&&(n.sameSite=this.sameSite),se.set(e,t,n),se.get(e)},t.getItem=function(e){return se.get(e)},t.removeItem=function(e){var t={path:this.path,expires:this.expires,domain:this.domain,secure:this.secure};return this.sameSite&&(t.sameSite=this.sameSite),se.remove(e,t)},t.clear=function(){for(var e=se.get(),t=Object.keys(e).length,n=0;n<t;++n)this.removeItem(Object.keys(e)[n]);return{}},e}()},function(e,t,n){"use strict";var r=n(93),i=n(94);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){i.isString(e)&&(e=b(e));return e instanceof o?e.format():o.prototype.format.call(e)},t.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),f=["%","/","?",";","#"].concat(l),d=["/","?","#"],h=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},m=n(95);function b(e,t,n){if(e&&i.isObject(e)&&e instanceof o)return e;var r=new o;return r.parse(e,t,n),r}o.prototype.parse=function(e,t,n){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o<e.indexOf("#")?"?":"#",c=e.split(a);c[0]=c[0].replace(/\\/g,"/");var b=e=c.join(a);if(b=b.trim(),!n&&1===e.split("#").length){var w=u.exec(b);if(w)return this.path=b,this.href=b,this.pathname=w[1],w[2]?(this.search=w[2],this.query=t?m.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var S=s.exec(b);if(S){var _=(S=S[0]).toLowerCase();this.protocol=_,b=b.substr(S.length)}if(n||S||b.match(/^\/\/[^@\/]+@[^@\/]+/)){var E="//"===b.substr(0,2);!E||S&&y[S]||(b=b.substr(2),this.slashes=!0)}if(!y[S]&&(E||S&&!g[S])){for(var A,O,I=-1,T=0;T<d.length;T++){-1!==(C=b.indexOf(d[T]))&&(-1===I||C<I)&&(I=C)}-1!==(O=-1===I?b.lastIndexOf("@"):b.lastIndexOf("@",I))&&(A=b.slice(0,O),b=b.slice(O+1),this.auth=decodeURIComponent(A)),I=-1;for(T=0;T<f.length;T++){var C;-1!==(C=b.indexOf(f[T]))&&(-1===I||C<I)&&(I=C)}-1===I&&(I=b.length),this.host=b.slice(0,I),b=b.slice(I),this.parseHost(),this.hostname=this.hostname||"";var x="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!x)for(var P=this.hostname.split(/\./),k=(T=0,P.length);T<k;T++){var N=P[T];if(N&&!N.match(h)){for(var M="",j=0,R=N.length;j<R;j++)N.charCodeAt(j)>127?M+="x":M+=N[j];if(!M.match(h)){var D=P.slice(0,T),U=P.slice(T+1),F=N.match(p);F&&(D.push(F[1]),U.unshift(F[2])),U.length&&(b="/"+U.join(".")+b),this.hostname=D.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),x||(this.hostname=r.toASCII(this.hostname));var L=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+L,this.href+=this.host,x&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!v[_])for(T=0,k=l.length;T<k;T++){var q=l[T];if(-1!==b.indexOf(q)){var z=encodeURIComponent(q);z===q&&(z=escape(q)),b=b.split(q).join(z)}}var K=b.indexOf("#");-1!==K&&(this.hash=b.substr(K),b=b.slice(0,K));var H=b.indexOf("?");if(-1!==H?(this.search=b.substr(H),this.query=b.substr(H+1),t&&(this.query=m.parse(this.query)),b=b.slice(0,H)):t&&(this.search="",this.query={}),b&&(this.pathname=b),g[_]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){L=this.pathname||"";var V=this.search||"";this.path=L+V}return this.href=this.format(),this},o.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",n=this.pathname||"",r=this.hash||"",o=!1,s="";this.host?o=e+this.host:this.hostname&&(o=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(s=m.stringify(this.query));var a=this.search||s&&"?"+s||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||g[t])&&!1!==o?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):o||(o=""),r&&"#"!==r.charAt(0)&&(r="#"+r),a&&"?"!==a.charAt(0)&&(a="?"+a),t+o+(n=n.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(a=a.replace("#","%23"))+r},o.prototype.resolve=function(e){return this.resolveObject(b(e,!1,!0)).format()},o.prototype.resolveObject=function(e){if(i.isString(e)){var t=new o;t.parse(e,!1,!0),e=t}for(var n=new o,r=Object.keys(this),s=0;s<r.length;s++){var a=r[s];n[a]=this[a]}if(n.hash=e.hash,""===e.href)return n.href=n.format(),n;if(e.slashes&&!e.protocol){for(var u=Object.keys(e),c=0;c<u.length;c++){var l=u[c];"protocol"!==l&&(n[l]=e[l])}return g[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(e.protocol&&e.protocol!==n.protocol){if(!g[e.protocol]){for(var f=Object.keys(e),d=0;d<f.length;d++){var h=f[d];n[h]=e[h]}return n.href=n.format(),n}if(n.protocol=e.protocol,e.host||y[e.protocol])n.pathname=e.pathname;else{for(var p=(e.pathname||"").split("/");p.length&&!(e.host=p.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==p[0]&&p.unshift(""),p.length<2&&p.unshift(""),n.pathname=p.join("/")}if(n.search=e.search,n.query=e.query,n.host=e.host||"",n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,n.pathname||n.search){var v=n.pathname||"",m=n.search||"";n.path=v+m}return n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var b=n.pathname&&"/"===n.pathname.charAt(0),w=e.host||e.pathname&&"/"===e.pathname.charAt(0),S=w||b||n.host&&e.pathname,_=S,E=n.pathname&&n.pathname.split("/")||[],A=(p=e.pathname&&e.pathname.split("/")||[],n.protocol&&!g[n.protocol]);if(A&&(n.hostname="",n.port=null,n.host&&(""===E[0]?E[0]=n.host:E.unshift(n.host)),n.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===p[0]?p[0]=e.host:p.unshift(e.host)),e.host=null),S=S&&(""===p[0]||""===E[0])),w)n.host=e.host||""===e.host?e.host:n.host,n.hostname=e.hostname||""===e.hostname?e.hostname:n.hostname,n.search=e.search,n.query=e.query,E=p;else if(p.length)E||(E=[]),E.pop(),E=E.concat(p),n.search=e.search,n.query=e.query;else if(!i.isNullOrUndefined(e.search)){if(A)n.hostname=n.host=E.shift(),(x=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=x.shift(),n.host=n.hostname=x.shift());return n.search=e.search,n.query=e.query,i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!E.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var O=E.slice(-1)[0],I=(n.host||e.host||E.length>1)&&("."===O||".."===O)||""===O,T=0,C=E.length;C>=0;C--)"."===(O=E[C])?E.splice(C,1):".."===O?(E.splice(C,1),T++):T&&(E.splice(C,1),T--);if(!S&&!_)for(;T--;T)E.unshift("..");!S||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),I&&"/"!==E.join("/").substr(-1)&&E.push("");var x,P=""===E[0]||E[0]&&"/"===E[0].charAt(0);A&&(n.hostname=n.host=P?"":E.length?E.shift():"",(x=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=x.shift(),n.host=n.hostname=x.shift()));return(S=S||n.host&&E.length)&&!P&&E.unshift(""),E.length?n.pathname=E.join("/"):(n.pathname=null,n.path=null),i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){"use strict";var r=n(75),i=n.n(r).a;t.a=i},function(e,t,n){"use strict";var r;n.d(t,"a",(function(){return r})),function(e){e.DEFAULT_MSG="Authentication Error",e.EMPTY_EMAIL="Email cannot be empty",e.EMPTY_PHONE="Phone number cannot be empty",e.EMPTY_USERNAME="Username cannot be empty",e.INVALID_USERNAME="The username should either be a string or one of the sign in types",e.EMPTY_PASSWORD="Password cannot be empty",e.EMPTY_CODE="Confirmation code cannot be empty",e.SIGN_UP_ERROR="Error creating account",e.NO_MFA="No valid MFA method provided",e.INVALID_MFA="Invalid MFA type",e.EMPTY_CHALLENGE="Challenge response cannot be empty",e.NO_USER_SESSION="Failed to get the session because the user is empty",e.NETWORK_ERROR="Network Error",e.DEVICE_CONFIG="Device tracking has not been configured in this User Pool",e.AUTOSIGNIN_ERROR="Please use your credentials to sign in"}(r||(r={}))},function(e,t,n){(function(t){var r;e.exports=(r=r||function(e,r){var i;if("undefined"!=typeof window&&window.crypto&&(i=window.crypto),"undefined"!=typeof self&&self.crypto&&(i=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(i=globalThis.crypto),!i&&"undefined"!=typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&void 0!==t&&t.crypto&&(i=t.crypto),!i)try{i=n(87)}catch(e){}var o=function(){if(i){if("function"==typeof i.getRandomValues)try{return i.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof i.randomBytes)try{return i.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),a={},u=a.lib={},c=u.Base={extend:function(e){var t=s(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},l=u.WordArray=c.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||d).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,i=e.sigBytes;if(this.clamp(),r%4)for(var o=0;o<i;o++){var s=n[o>>>2]>>>24-o%4*8&255;t[r+o>>>2]|=s<<24-(r+o)%4*8}else for(var a=0;a<i;a+=4)t[r+a>>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(o());return new l.init(t,e)}}),f=a.enc={},d=f.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new l.init(n,t/2)}},h=f.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new l.init(n,t)}},p=f.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},v=u.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,i=r.words,o=r.sigBytes,s=this.blockSize,a=o/(4*s),u=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,c=e.min(4*u,o);if(u){for(var f=0;f<u;f+=s)this._doProcessBlock(i,f);n=i.splice(0,u),r.sigBytes-=c}return new l.init(n,c)},clone:function(){var e=c.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),y=(u.Hasher=v.extend({cfg:c.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){v.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new y.HMAC.init(e,n).finalize(t)}}}),a.algo={});return a}(Math),r)}).call(this,n(27))},function(e,t,n){"use strict";var r=n(56),i=Object.prototype.toString;function o(e){return Array.isArray(e)}function s(e){return void 0===e}function a(e){return"[object ArrayBuffer]"===i.call(e)}function u(e){return null!==e&&"object"==typeof e}function c(e){if("[object Object]"!==i.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function l(e){return"[object Function]"===i.call(e)}function f(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),o(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}e.exports={isArray:o,isArrayBuffer:a,isBuffer:function(e){return null!==e&&!s(e)&&null!==e.constructor&&!s(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"[object FormData]"===i.call(e)},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&a(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:u,isPlainObject:c,isUndefined:s,isDate:function(e){return"[object Date]"===i.call(e)},isFile:function(e){return"[object File]"===i.call(e)},isBlob:function(e){return"[object Blob]"===i.call(e)},isFunction:l,isStream:function(e){return u(e)&&l(e.pipe)},isURLSearchParams:function(e){return"[object URLSearchParams]"===i.call(e)},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:f,merge:function e(){var t={};function n(n,r){c(t[r])&&c(n)?t[r]=e(t[r],n):c(n)?t[r]=e({},n):o(n)?t[r]=n.slice():t[r]=n}for(var r=0,i=arguments.length;r<i;r++)f(arguments[r],n);return t},extend:function(e,t,n){return f(t,(function(t,i){e[i]=n&&"function"==typeof t?r(t,n):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function i(e){return!!e&&!!e[W]}function o(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Y}(e)||Array.isArray(e)||!!e[G]||!!e.constructor[G]||d(e)||h(e))}function s(e,t,n){void 0===n&&(n=!1),0===a(e)?(n?Object.keys:J)(e).forEach((function(r){n&&"symbol"==typeof r||t(r,e[r],e)})):e.forEach((function(n,r){return t(r,n,e)}))}function a(e){var t=e[W];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:d(e)?2:h(e)?3:0}function u(e,t){return 2===a(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function c(e,t){return 2===a(e)?e.get(t):e[t]}function l(e,t,n){var r=a(e);2===r?e.set(t,n):3===r?(e.delete(t),e.add(n)):e[t]=n}function f(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function d(e){return z&&e instanceof Map}function h(e){return K&&e instanceof Set}function p(e){return e.o||e.t}function v(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=$(e);delete t[W];for(var n=J(t),r=0;r<n.length;r++){var i=n[r],o=t[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(t[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function y(e,t){return void 0===t&&(t=!1),m(e)||i(e)||!o(e)||(a(e)>1&&(e.set=e.add=e.clear=e.delete=g),Object.freeze(e),t&&s(e,(function(e,t){return y(t,!0)}),!0)),e}function g(){r(2)}function m(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function b(e){var t=Z[e];return t||r(18,e),t}function w(e,t){Z[e]||(Z[e]=t)}function S(){return B}function _(e,t){t&&(b("Patches"),e.u=[],e.s=[],e.v=t)}function E(e){A(e),e.p.forEach(I),e.p=null}function A(e){e===B&&(B=e.l)}function O(e){return B={p:[],l:B,h:e,m:!0,_:0}}function I(e){var t=e[W];0===t.i||1===t.i?t.j():t.O=!0}function T(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||b("ES5").S(t,e,i),i?(n[W].P&&(E(t),r(4)),o(e)&&(e=C(t,e),t.l||P(t,e)),t.u&&b("Patches").M(n[W],e,t.u,t.s)):e=C(t,n,[]),E(t),t.u&&t.v(t.u,t.s),e!==V?e:void 0}function C(e,t,n){if(m(t))return t;var r=t[W];if(!r)return s(t,(function(i,o){return x(e,r,t,i,o,n)}),!0),t;if(r.A!==e)return t;if(!r.P)return P(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=4===r.i||5===r.i?r.o=v(r.k):r.o;s(3===r.i?new Set(i):i,(function(t,o){return x(e,r,i,t,o,n)})),P(e,i,!1),n&&e.u&&b("Patches").R(r,n,e.u,e.s)}return r.o}function x(e,t,n,r,s,a){if(i(s)){var c=C(e,s,a&&t&&3!==t.i&&!u(t.D,r)?a.concat(r):void 0);if(l(n,r,c),!i(c))return;e.m=!1}if(o(s)&&!m(s)){if(!e.h.F&&e._<1)return;C(e,s),t&&t.A.l||P(e,s)}}function P(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&y(t,n)}function k(e,t){var n=e[W];return(n?p(n):e)[t]}function N(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function M(e){e.P||(e.P=!0,e.l&&M(e.l))}function j(e){e.o||(e.o=v(e.t))}function R(e,t,n){var r=d(t)?b("MapSet").N(t,n):h(t)?b("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:S(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=r,o=Q;n&&(i=[r],o=X);var s=Proxy.revocable(i,o),a=s.revoke,u=s.proxy;return r.k=u,r.j=a,u}(t,n):b("ES5").J(t,n);return(n?n.A:S()).p.push(r),r}function D(e){return i(e)||r(22,e),function e(t){if(!o(t))return t;var n,r=t[W],i=a(t);if(r){if(!r.P&&(r.i<4||!b("ES5").K(r)))return r.t;r.I=!0,n=U(t,i),r.I=!1}else n=U(t,i);return s(n,(function(t,i){r&&c(r.t,t)===i||l(n,t,e(i))})),3===i?new Set(n):n}(e)}function U(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return v(e)}function F(){function e(t){if(!o(t))return t;if(Array.isArray(t))return t.map(e);if(d(t))return new Map(Array.from(t.entries()).map((function(t){return[t[0],e(t[1])]})));if(h(t))return new Set(Array.from(t).map(e));var n=Object.create(Object.getPrototypeOf(t));for(var r in t)n[r]=e(t[r]);return u(t,G)&&(n[G]=t[G]),n}function t(t){return i(t)?e(t):t}var n="add";w("Patches",{$:function(t,i){return i.forEach((function(i){for(var o=i.path,s=i.op,u=t,l=0;l<o.length-1;l++){var f=a(u),d=""+o[l];0!==f&&1!==f||"__proto__"!==d&&"constructor"!==d||r(24),"function"==typeof u&&"prototype"===d&&r(24),"object"!=typeof(u=c(u,d))&&r(15,o.join("/"))}var h=a(u),p=e(i.value),v=o[o.length-1];switch(s){case"replace":switch(h){case 2:return u.set(v,p);case 3:r(16);default:return u[v]=p}case n:switch(h){case 1:return u.splice(v,0,p);case 2:return u.set(v,p);case 3:return u.add(p);default:return u[v]=p}case"remove":switch(h){case 1:return u.splice(v,1);case 2:return u.delete(v);case 3:return u.delete(i.value);default:return delete u[v]}default:r(17,s)}})),t},R:function(e,r,i,o){switch(e.i){case 0:case 4:case 2:return function(e,r,i,o){var a=e.t,l=e.o;s(e.D,(function(e,s){var f=c(a,e),d=c(l,e),h=s?u(a,e)?"replace":n:"remove";if(f!==d||"replace"!==h){var p=r.concat(e);i.push("remove"===h?{op:h,path:p}:{op:h,path:p,value:d}),o.push(h===n?{op:"remove",path:p}:"remove"===h?{op:n,path:p,value:t(f)}:{op:"replace",path:p,value:t(f)})}}))}(e,r,i,o);case 5:case 1:return function(e,r,i,o){var s=e.t,a=e.D,u=e.o;if(u.length<s.length){var c=[u,s];s=c[0],u=c[1];var l=[o,i];i=l[0],o=l[1]}for(var f=0;f<s.length;f++)if(a[f]&&u[f]!==s[f]){var d=r.concat([f]);i.push({op:"replace",path:d,value:t(u[f])}),o.push({op:"replace",path:d,value:t(s[f])})}for(var h=s.length;h<u.length;h++){var p=r.concat([h]);i.push({op:n,path:p,value:t(u[h])})}s.length<u.length&&o.push({op:"replace",path:r.concat(["length"]),value:s.length})}(e,r,i,o);case 3:return function(e,t,r,i){var o=e.t,s=e.o,a=0;o.forEach((function(e){if(!s.has(e)){var o=t.concat([a]);r.push({op:"remove",path:o,value:e}),i.unshift({op:n,path:o,value:e})}a++})),a=0,s.forEach((function(e){if(!o.has(e)){var s=t.concat([a]);r.push({op:n,path:s,value:e}),i.unshift({op:"remove",path:s,value:e})}a++}))}(e,r,i,o)}},M:function(e,t,n,r){n.push({op:"replace",path:[],value:t===V?void 0:t}),r.push({op:"replace",path:[],value:e.t})}})}n.d(t,"a",(function(){return re})),n.d(t,"b",(function(){return F})),n.d(t,"c",(function(){return G})),n.d(t,"d",(function(){return te})),n.d(t,"e",(function(){return ne}));var L,B,q="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),z="undefined"!=typeof Map,K="undefined"!=typeof Set,H="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,V=q?Symbol.for("immer-nothing"):((L={})["immer-nothing"]=!0,L),G=q?Symbol.for("immer-draftable"):"__$immer_draftable",W=q?Symbol.for("immer-state"):"__$immer_state",Y=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),J="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,$=Object.getOwnPropertyDescriptors||function(e){var t={};return J(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Z={},Q={get:function(e,t){if(t===W)return e;var n=p(e);if(!u(n,t))return function(e,t,n){var r,i=N(t,n);return i?"value"in i?i.value:null===(r=i.get)||void 0===r?void 0:r.call(e.k):void 0}(e,n,t);var r=n[t];return e.I||!o(r)?r:r===k(e.t,t)?(j(e),e.o[t]=R(e.A.h,r,e)):r},has:function(e,t){return t in p(e)},ownKeys:function(e){return Reflect.ownKeys(p(e))},set:function(e,t,n){var r=N(p(e),t);if(null==r?void 0:r.set)return r.set.call(e.k,n),!0;if(!e.P){var i=k(p(e),t),o=null==i?void 0:i[W];if(o&&o.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(f(n,i)&&(void 0!==n||u(e.t,t)))return!0;j(e),M(e)}return e.o[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.o)||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==k(e.t,t)||t in e.t?(e.D[t]=!1,j(e),M(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=p(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty:function(){r(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){r(12)}},X={};s(Q,(function(e,t){X[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),X.deleteProperty=function(e,t){return Q.deleteProperty.call(this,e[0],t)},X.set=function(e,t,n){return Q.set.call(this,e[0],t,n,e[0])};var ee=new(function(){function e(e){var t=this;this.g=H,this.F=!0,this.produce=function(e,n,i){if("function"==typeof e&&"function"!=typeof n){var s=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=s);for(var r=arguments.length,i=Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return a.produce(e,(function(e){var r;return(r=n).call.apply(r,[t,e].concat(i))}))}}var u;if("function"!=typeof n&&r(6),void 0!==i&&"function"!=typeof i&&r(7),o(e)){var c=O(t),l=R(t,e,void 0),f=!0;try{u=n(l),f=!1}finally{f?E(c):A(c)}return"undefined"!=typeof Promise&&u instanceof Promise?u.then((function(e){return _(c,i),T(e,c)}),(function(e){throw E(c),e})):(_(c,i),T(u,c))}if(!e||"object"!=typeof e){if((u=n(e))===V)return;return void 0===u&&(u=e),t.F&&y(u,!0),u}r(21,e)},this.produceWithPatches=function(e,n){return"function"==typeof e?function(n){for(var r=arguments.length,i=Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(i))}))}:[t.produce(e,n,(function(e,t){r=e,i=t})),r,i];var r,i},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){o(e)||r(8),i(e)&&(e=D(e));var t=O(this),n=R(this,e,void 0);return n[W].C=!0,A(t),n},t.finishDraft=function(e,t){var n=(e&&e[W]).A;return _(n,t),T(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!H&&r(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}var o=b("Patches").$;return i(e)?o(e,t):this.produce(e,(function(e){return o(e,t.slice(n+1))}))},e}()),te=ee.produce,ne=(ee.produceWithPatches.bind(ee),ee.setAutoFreeze.bind(ee)),re=(ee.setUseProxies.bind(ee),ee.applyPatches.bind(ee));ee.createDraft.bind(ee),ee.finishDraft.bind(ee)},function(e,t,n){"use strict";(function(e){n.d(t,"d",(function(){return l})),n.d(t,"c",(function(){return f})),n.d(t,"b",(function(){return d})),n.d(t,"a",(function(){return y}));var r=[{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"}],i=function(e){return void 0===e&&(e={}),0===Object.keys(e).length},o=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},s=function(e,t){var n=Object.assign({},e);return t&&("string"==typeof t?delete n[t]:t.forEach((function(e){delete n[e]}))),n},a=function(e,t){void 0===t&&(t="application/octet-stream");var n=e.toLowerCase(),i=r.filter((function(e){return n.endsWith("."+e.ext)}));return i.length>0?i[0].type:t},u=function(e){var t=e.toLowerCase();return!!t.startsWith("text/")||("application/json"===t||"application/xml"===t||"application/sh"===t)},c=function(){for(var e="",t="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=32;n>0;n-=1)e+=t[Math.floor(Math.random()*t.length)];return e},l=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},f=function(){if("undefined"==typeof self)return!1;var e=self;return void 0!==e.WorkerGlobalScope&&self instanceof e.WorkerGlobalScope},d=function(){return{isBrowser:"undefined"!=typeof window&&void 0!==window.document,isNode:void 0!==e&&null!=e.versions&&null!=e.versions.node}},h=function e(t,n,r){if(void 0===n&&(n=[]),void 0===r&&(r=[]),!v(t))return t;var i={};for(var o in t){if(t.hasOwnProperty(o))i[n.includes(o)?o:o[0].toLowerCase()+o.slice(1)]=r.includes(o)?t[o]:e(t[o],n,r)}return i},p=function e(t,n,r){if(void 0===n&&(n=[]),void 0===r&&(r=[]),!v(t))return t;var i={};for(var o in t){if(t.hasOwnProperty(o))i[n.includes(o)?o:o[0].toUpperCase()+o.slice(1)]=r.includes(o)?t[o]:e(t[o],n,r)}return i},v=function(e){return!(!(e instanceof Object)||e instanceof Array||e instanceof Function||e instanceof Number||e instanceof String||e instanceof Boolean)},y=function(){function e(){}return e.isEmpty=i,e.sortByField=o,e.objectLessAttributes=s,e.filenameToContentType=a,e.isTextFile=u,e.generateRandomString=c,e.makeQuerablePromise=l,e.isWebWorker=f,e.browserOrNode=d,e.transferKeyToLowerCase=h,e.transferKeyToUpperCase=p,e.isStrictObject=v,e}()}).call(this,n(46))},function(e,t,n){"use strict";var r=n(32);n(8);t.a=r.a},function(e,t,n){"use strict";for(var r=n(32),i=n(19),o=n(21),s=n(153),a=n(33),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={clockOffset:0,getDateWithClockOffset:function(){return c.clockOffset?new Date((new Date).getTime()+c.clockOffset):new Date},getClockOffset:function(){return c.clockOffset},getHeaderStringFromDate:function(e){return void 0===e&&(e=c.getDateWithClockOffset()),e.toISOString().replace(/[:\-]|\.\d{3}/g,"")},getDateFromHeaderString:function(e){var t=u(e.match(/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2}).+/),7),n=t[1],r=t[2],i=t[3],o=t[4],s=t[5],a=t[6];return new Date(Date.UTC(Number(n),Number(r)-1,Number(i),Number(o),Number(s),Number(a)))},isClockSkewed:function(e){return Math.abs(e.getTime()-c.getDateWithClockOffset().getTime())>=3e5},isClockSkewError:function(e){if(!e.response||!e.response.headers)return!1;var t=e.response.headers;return Boolean(["BadRequestException","InvalidSignatureException"].includes(t["x-amzn-errortype"])&&(t.date||t.Date))},setClockOffset:function(e){c.clockOffset=e}},l=n(40),f={},d={},h=0;h<256;h++){var p=h.toString(16).toLowerCase();1===p.length&&(p="0"+p),f[h]=p,d[p]=h}function v(e){for(var t="",n=0;n<e.byteLength;n++)t+=f[e[n]];return t}var y=n(9);function g(e){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var 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)},b=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},w=new o.a("Signer"),S=function(e,t){var n=new l.Sha256(e);return n.update(t),n.digestSync()},_=function(e){var t=e||"",n=new l.Sha256;return n.update(t),v(n.digestSync())},E=function(e){return Object.keys(e).map((function(e){return e.toLowerCase()})).sort().join(";")},A=function(e){var t,n,r=Object(y.parse)(e.url);return[e.method||"/",encodeURIComponent(r.pathname).replace(/%2F/gi,"/"),(n=r.query,n&&0!==n.length?n.split("&").map((function(e){var t=e.split("=");if(1===t.length)return e;var n=t[1].replace(/[!'()*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}));return t[0]+"="+n})).sort((function(e,t){var n=e.split("=")[0],r=t.split("=")[0];return n===r?e<t?-1:1:n<r?-1:1})).join("&"):""),(t=e.headers,t&&0!==Object.keys(t).length?Object.keys(t).map((function(e){return{key:e.toLowerCase(),value:t[e]?t[e].trim().replace(/\s+/g," "):""}})).sort((function(e,t){return e.key<t.key?-1:1})).map((function(e){return e.key+":"+e.value})).join("\n")+"\n":""),E(e.headers),_(e.data)].join("\n")},O=function(e){var t=(Object(y.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]}},I=function(e,t,n){return[e,t,n,"aws4_request"].join("/")},T=function(e,t,n,r){return[e,n,r,_(t)].join("\n")},C=function(e,t,n){w.debug(n);var r=S("AWS4"+e,t),i=S(r,n.region),o=S(i,n.service);return S(o,"aws4_request")},x=function(e,t){return v(S(e,t))},P=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 new Error('The attribute "body" was found on the request object. Please use the attribute "data" instead.');var r=c.getDateWithClockOffset().toISOString().replace(/[:\-]|\.\d{3}/g,""),i=r.substr(0,8),o=Object(y.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 s=A(e);w.debug(s);var a=n||O(e),u=I(i,a.region,a.service),l=T("AWS4-HMAC-SHA256",s,r,u),f=C(t.secret_key,i,a),d=x(f,l),h=function(e,t,n,r,i){return[e+" Credential="+t+"/"+n,"SignedHeaders="+r,"Signature="+i].join(", ")}("AWS4-HMAC-SHA256",t.access_key,u,E(e.headers),d);return e.headers.Authorization=h,e},e.signUrl=function(e,t,n,r){var i="object"===g(e)?e.url:e,o="object"===g(e)?e.method:"GET",s="object"===g(e)?e.body:void 0,a=c.getDateWithClockOffset().toISOString().replace(/[:\-]|\.\d{3}/g,""),u=a.substr(0,8),l=Object(y.parse)(i,!0,!0),f=(l.search,b(l,["search"])),d={host:f.host},h=n||O({url:Object(y.format)(f)}),p=h.region,v=h.service,w=I(u,p,v),S=t.session_token&&"iotdevicegateway"!==v,_=m(m(m({"X-Amz-Algorithm":"AWS4-HMAC-SHA256","X-Amz-Credential":[t.access_key,w].join("/"),"X-Amz-Date":a.substr(0,16)},S?{"X-Amz-Security-Token":""+t.session_token}:{}),r?{"X-Amz-Expires":""+r}:{}),{"X-Amz-SignedHeaders":Object.keys(d).join(",")}),E=A({method:o,url:Object(y.format)(m(m({},f),{query:m(m({},f.query),_)})),headers:d,data:s}),P=T("AWS4-HMAC-SHA256",E,a,w),k=C(t.secret_key,u,{region:p,service:v}),N=x(k,P),M=m({"X-Amz-Signature":N},t.session_token&&{"X-Amz-Security-Token":t.session_token});return Object(y.format)({protocol:f.protocol,slashes:!0,hostname:f.hostname,port:f.port,pathname:f.pathname,query:m(m(m({},f.query),_),M)})},e}(),k=n(28),N=n.n(k),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)},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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},R=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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},U=new o.a("RestClient"),F=function(){function e(e){this._region="us-east-1",this._service="execute-api",this._custom_header=void 0,this._cancelTokenMap=null,this.Credentials=s.a,this._options=e,U.debug("API Options",this._options),null==this._cancelTokenMap&&(this._cancelTokenMap=new WeakMap)}return e.prototype.ajax=function(e,t,n){return j(this,void 0,void 0,(function(){var r,i,o,s,u,l,f,d,h,p,v,g,m,b,w=this;return R(this,(function(S){switch(S.label){case 0:return U.debug(t,e),o="us-east-1",s="execute-api",u=void 0,"string"==typeof e?(r=this._parseUrl(e),i=e):(i=e.endpoint,u=e.custom_header,o=e.region,s=e.service,r=this._parseUrl(e.endpoint)),l={method:t,url:i,host:r.host,path:r.path,headers:{},data:null,responseType:"json",timeout:0,cancelToken:null},f={},a.a.isReactNative&&(d=a.a.userAgent||"aws-amplify/0.1.x",f={"User-Agent":d}),h=Object.assign({},n),p=h.response,h.body&&("function"==typeof FormData&&h.body instanceof FormData?(f["Content-Type"]="multipart/form-data",l.data=h.body):(f["Content-Type"]="application/json; charset=UTF-8",l.data=JSON.stringify(h.body))),h.responseType&&(l.responseType=h.responseType),h.withCredentials&&(l.withCredentials=h.withCredentials),h.timeout&&(l.timeout=h.timeout),h.cancellableToken&&(l.cancelToken=h.cancellableToken.token),l.signerServiceInfo=h.signerServiceInfo,"function"!=typeof u?[3,2]:[4,u()];case 1:return g=S.sent(),[3,3];case 2:g=void 0,S.label=3;case 3:return v=g,l.headers=M(M(M({},f),v),h.headers),m=Object(y.parse)(i,!0,!0),m.search,b=D(m,["search"]),l.url=Object(y.format)(M(M({},b),{query:M(M({},b.query),h.queryStringParameters||{})})),void 0!==l.headers.Authorization?(l.headers=Object.keys(l.headers).reduce((function(e,t){return l.headers[t]&&(e[t]=l.headers[t]),e}),{}),[2,this._request(l,p)]):[2,this.Credentials.get().then((function(r){return w._signed(M({},l),r,p,{region:o,service:s}).catch((function(r){if(c.isClockSkewError(r)){var i=r.response.headers,o=i&&(i.date||i.Date),s=new Date(o),a=c.getDateFromHeaderString(l.headers["x-amz-date"]);if(c.isClockSkewed(s))return c.setClockOffset(s.getTime()-a.getTime()),w.ajax(e,t,n)}throw r}))}),(function(e){return U.debug("No credentials available, the request will be unsigned"),w._request(l,p)}))]}}))}))},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 N.a.isCancel(e)},e.prototype.getCancellableToken=function(){return N.a.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="";return 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):r},e.prototype._signed=function(e,t,n,r){var i=r.service,o=r.region,s=e.signerServiceInfo,a=D(e,["signerServiceInfo"]),u=o||this._region||this._options.region,c=i||this._service||this._options.service,l={secret_key:t.secretAccessKey,access_key:t.accessKeyId,session_token:t.sessionToken},f={region:u,service:c},d=Object.assign(f,s),h=P.sign(a,l,d);return h.data&&(h.body=h.data),U.debug("Signed Request: ",h),delete h.headers.host,N()(h).then((function(e){return n?e:e.data})).catch((function(e){throw U.debug(e),e}))},e.prototype._request=function(e,t){return void 0===t&&(t=!1),N()(e).then((function(e){return t?e:e.data})).catch((function(e){throw U.debug(e),e}))},e.prototype._parseUrl=function(e){var t=e.split("/");return{host:t[2],path:"/"+t.slice(3).join("/")}},e}(),L=n(38),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)},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,t 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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},H=new o.a("RestAPI"),V=function(){function e(e){this._api=null,this.Credentials=s.a,this._options=e,H.debug("API Options",this._options)}return e.prototype.getModuleName=function(){return"RestAPI"},e.prototype.configure=function(e){var t=e||{},n=t.API,r=void 0===n?{}:n,i=K(t,["API"]),o=B(B({},i),r);if(H.debug("configure Rest API",{opt:o}),o.aws_project_region){if(o.aws_cloud_logic_custom){var s=o.aws_cloud_logic_custom;o.endpoints="string"==typeof s?JSON.parse(s):s}o=Object.assign({},o,{region:o.aws_project_region,header:{}})}return Array.isArray(o.endpoints)?o.endpoints.forEach((function(e){void 0!==e.custom_header&&"function"!=typeof e.custom_header&&(H.warn("Rest API "+e.name+", custom_header should be a function"),e.custom_header=void 0)})):this._options&&Array.isArray(this._options.endpoints)?o.endpoints=this._options.endpoints:o.endpoints=[],this._options=Object.assign({},this._options,o),this.createInstance(),this._options},e.prototype.createInstance=function(){return H.debug("create Rest API instance"),this._api=new F(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){return q(this,void 0,void 0,(function(){return z(this,(function(t){return[2,this._api.endpoint(e)]}))}))},e.prototype.getEndpointInfo=function(e,t){var n=this._options.endpoints;if(!Array.isArray(n))throw new Error("API category not configured");var r=n.find((function(t){return t.name===e}));if(!r)throw new 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}(),G=new V(null);function W(e){return(W="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}L.a.register(G);"function"==typeof Symbol&&null!=Symbol.iterator&&Symbol.iterator,"function"==typeof Symbol&&null!=Symbol.asyncIterator&&Symbol.asyncIterator;var Y="function"==typeof Symbol&&null!=Symbol.toStringTag?Symbol.toStringTag:"@@toStringTag";function J(e,t){for(var n,r=/\r\n|[\n\r]/g,i=1,o=t+1;(n=r.exec(e.body))&&n.index<t;)i+=1,o=t+1-(n.index+n[0].length);return{line:i,column:o}}function $(e){return Z(e.source,J(e.source,e.start))}function Z(e,t){var n=e.locationOffset.column-1,r=X(n)+e.body,i=t.line-1,o=e.locationOffset.line-1,s=t.line+o,a=1===t.line?n:0,u=t.column+a,c="".concat(e.name,":").concat(s,":").concat(u,"\n"),l=r.split(/\r\n|[\n\r]/g),f=l[i];if(f.length>120){for(var d=Math.floor(u/80),h=u%80,p=[],v=0;v<f.length;v+=80)p.push(f.slice(v,v+80));return c+Q([["".concat(s),p[0]]].concat(p.slice(1,d+1).map((function(e){return["",e]})),[[" ",X(h-1)+"^"],["",p[d+1]]]))}return c+Q([["".concat(s-1),l[i-1]],["".concat(s),f],["",X(u-1)+"^"],["".concat(s+1),l[i+1]]])}function Q(e){var t=e.filter((function(e){e[0];return void 0!==e[1]})),n=Math.max.apply(Math,t.map((function(e){return e[0].length})));return t.map((function(e){var t,r=e[0],i=e[1];return X(n-(t=r).length)+t+(i?" | "+i:" |")})).join("\n")}function X(e){return Array(e+1).join(" ")}function ee(e){return(ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function te(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ne(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function re(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ie(e,t){return!t||"object"!==ee(t)&&"function"!=typeof t?oe(e):t}function oe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function se(e){var t="function"==typeof Map?new Map:void 0;return(se=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return ae(e,arguments,le(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),ce(r,e)})(e)}function ae(e,t,n){return(ae=ue()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&ce(i,n.prototype),i}).apply(null,arguments)}function ue(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function ce(e,t){return(ce=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function le(e){return(le=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var fe=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ce(e,t)}(a,e);var t,n,r,i,o,s=(t=a,n=ue(),function(){var e,r=le(t);if(n){var i=le(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return ie(this,e)});function a(e,t,n,r,i,o,u){var c,l,f,d;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(d=s.call(this,e)).name="GraphQLError",d.originalError=null!=o?o:void 0,d.nodes=de(Array.isArray(t)?t:t?[t]:void 0);for(var h=[],p=0,v=null!==(y=d.nodes)&&void 0!==y?y:[];p<v.length;p++){var y,g=v[p].loc;null!=g&&h.push(g)}h=de(h),d.source=null!=n?n:null===(c=h)||void 0===c?void 0:c[0].source,d.positions=null!=r?r:null===(l=h)||void 0===l?void 0:l.map((function(e){return e.start})),d.locations=r&&n?r.map((function(e){return J(n,e)})):null===(f=h)||void 0===f?void 0:f.map((function(e){return J(e.source,e.start)})),d.path=null!=i?i:void 0;var m,b=null==o?void 0:o.extensions;return null==u&&("object"==W(m=b)&&null!==m)?d.extensions=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?te(Object(n),!0).forEach((function(t){ne(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},b):d.extensions=null!=u?u:{},Object.defineProperties(oe(d),{message:{enumerable:!0},locations:{enumerable:null!=d.locations},path:{enumerable:null!=d.path},extensions:{enumerable:null!=d.extensions&&Object.keys(d.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=o&&o.stack?(Object.defineProperty(oe(d),"stack",{value:o.stack,writable:!0,configurable:!0}),ie(d)):(Error.captureStackTrace?Error.captureStackTrace(oe(d),a):Object.defineProperty(oe(d),"stack",{value:Error().stack,writable:!0,configurable:!0}),d)}return r=a,(i=[{key:"toString",value:function(){return function(e){var t=e.message;if(e.nodes)for(var n=0,r=e.nodes;n<r.length;n++){var i=r[n];i.loc&&(t+="\n\n"+$(i.loc))}else if(e.source&&e.locations)for(var o=0,s=e.locations;o<s.length;o++){var a=s[o];t+="\n\n"+Z(e.source,a)}return t}(this)}},{key:Y,get:function(){return"Object"}}])&&re(r.prototype,i),o&&re(r,o),a}(se(Error));function de(e){return void 0===e||0===e.length?void 0:e}function he(e,t,n){return new fe("Syntax Error: ".concat(n),void 0,e,[t])}var pe=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});var ve="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):void 0;function ye(e){var t=e.prototype.toJSON;"function"==typeof t||function(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}(0),e.prototype.inspect=t,ve&&(e.prototype[ve]=t)}var ge=function(){function e(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}return e.prototype.toJSON=function(){return{start:this.start,end:this.end}},e}();ye(ge);var me=function(){function e(e,t,n,r,i,o,s){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=i,this.value=s,this.prev=o,this.next=null}return e.prototype.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},e}();function be(e){return null!=e&&"string"==typeof e.kind}ye(me);var we=Object.freeze({SOF:"<SOF>",EOF:"<EOF>",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"});function Se(e){return(Se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _e(e){return Ee(e,[])}function Ee(e,t){switch(Se(e)){case"string":return JSON.stringify(e);case"function":return e.name?"[function ".concat(e.name,"]"):"[function]";case"object":return null===e?"null":function(e,t){if(-1!==t.indexOf(e))return"[Circular]";var n=[].concat(t,[e]),r=function(e){var t=e[String(ve)];if("function"==typeof t)return t;if("function"==typeof e.inspect)return e.inspect}(e);if(void 0!==r){var i=r.call(e);if(i!==e)return"string"==typeof i?i:Ee(i,n)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>2)return"[Array]";for(var n=Math.min(10,e.length),r=e.length-n,i=[],o=0;o<n;++o)i.push(Ee(e[o],t));1===r?i.push("... 1 more item"):r>1&&i.push("... ".concat(r," more items"));return"["+i.join(", ")+"]"}(e,n);return function(e,t){var n=Object.keys(e);if(0===n.length)return"{}";if(t.length>2)return"["+function(e){var t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){var n=e.constructor.name;if("string"==typeof n&&""!==n)return n}return t}(e)+"]";return"{ "+n.map((function(n){return n+": "+Ee(e[n],t)})).join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}function Ae(e,t){if(!Boolean(e))throw new Error(t)}var Oe=function(e,t){return e instanceof t};function Ie(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Te=function(){function e(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GraphQL request",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{line:1,column:1};"string"==typeof e||Ae(0,"Body must be a string. Received: ".concat(_e(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||Ae(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Ae(0,"column in locationOffset is 1-indexed and must be positive.")}var t,n,r;return t=e,(n=[{key:Y,get:function(){return"Source"}}])&&Ie(t.prototype,n),r&&Ie(t,r),e}();var Ce=Object.freeze({QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION"});function xe(e){var t=e.split(/\r\n|[\n\r]/g),n=function(e){for(var t,n=!0,r=!0,i=0,o=null,s=0;s<e.length;++s)switch(e.charCodeAt(s)){case 13:10===e.charCodeAt(s+1)&&++s;case 10:n=!1,r=!0,i=0;break;case 9:case 32:++i;break;default:r&&!n&&(null===o||i<o)&&(o=i),r=!1}return null!==(t=o)&&void 0!==t?t:0}(e);if(0!==n)for(var r=1;r<t.length;r++)t[r]=t[r].slice(n);for(var i=0;i<t.length&&Pe(t[i]);)++i;for(var o=t.length;o>i&&Pe(t[o-1]);)--o;return t.slice(i,o).join("\n")}function Pe(e){for(var t=0;t<e.length;++t)if(" "!==e[t]&&"\t"!==e[t])return!1;return!0}var ke=function(){function e(e){var t=new me(we.SOF,0,0,0,0,null);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}var t=e.prototype;return t.advance=function(){return this.lastToken=this.token,this.token=this.lookahead()},t.lookahead=function(){var e=this.token;if(e.kind!==we.EOF)do{var t;e=null!==(t=e.next)&&void 0!==t?t:e.next=Me(this,e)}while(e.kind===we.COMMENT);return e},e}();function Ne(e){return isNaN(e)?we.EOF:e<127?JSON.stringify(String.fromCharCode(e)):'"\\u'.concat(("00"+e.toString(16).toUpperCase()).slice(-4),'"')}function Me(e,t){for(var n=e.source,r=n.body,i=r.length,o=t.end;o<i;){var s=r.charCodeAt(o),a=e.line,u=1+o-e.lineStart;switch(s){case 65279:case 9:case 32:case 44:++o;continue;case 10:++o,++e.line,e.lineStart=o;continue;case 13:10===r.charCodeAt(o+1)?o+=2:++o,++e.line,e.lineStart=o;continue;case 33:return new me(we.BANG,o,o+1,a,u,t);case 35:return Re(n,o,a,u,t);case 36:return new me(we.DOLLAR,o,o+1,a,u,t);case 38:return new me(we.AMP,o,o+1,a,u,t);case 40:return new me(we.PAREN_L,o,o+1,a,u,t);case 41:return new me(we.PAREN_R,o,o+1,a,u,t);case 46:if(46===r.charCodeAt(o+1)&&46===r.charCodeAt(o+2))return new me(we.SPREAD,o,o+3,a,u,t);break;case 58:return new me(we.COLON,o,o+1,a,u,t);case 61:return new me(we.EQUALS,o,o+1,a,u,t);case 64:return new me(we.AT,o,o+1,a,u,t);case 91:return new me(we.BRACKET_L,o,o+1,a,u,t);case 93:return new me(we.BRACKET_R,o,o+1,a,u,t);case 123:return new me(we.BRACE_L,o,o+1,a,u,t);case 124:return new me(we.PIPE,o,o+1,a,u,t);case 125:return new me(we.BRACE_R,o,o+1,a,u,t);case 34:return 34===r.charCodeAt(o+1)&&34===r.charCodeAt(o+2)?Le(n,o,a,u,t,e):Fe(n,o,a,u,t);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return De(n,o,s,a,u,t);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:return qe(n,o,a,u,t)}throw he(n,o,je(s))}var c=e.line,l=1+o-e.lineStart;return new me(we.EOF,i,i,c,l,t)}function je(e){return e<32&&9!==e&&10!==e&&13!==e?"Cannot contain the invalid character ".concat(Ne(e),"."):39===e?"Unexpected single quote character ('), did you mean to use a double quote (\")?":"Cannot parse the unexpected character ".concat(Ne(e),".")}function Re(e,t,n,r,i){var o,s=e.body,a=t;do{o=s.charCodeAt(++a)}while(!isNaN(o)&&(o>31||9===o));return new me(we.COMMENT,t,a,n,r,i,s.slice(t+1,a))}function De(e,t,n,r,i,o){var s=e.body,a=n,u=t,c=!1;if(45===a&&(a=s.charCodeAt(++u)),48===a){if((a=s.charCodeAt(++u))>=48&&a<=57)throw he(e,u,"Invalid number, unexpected digit after 0: ".concat(Ne(a),"."))}else u=Ue(e,u,a),a=s.charCodeAt(u);if(46===a&&(c=!0,a=s.charCodeAt(++u),u=Ue(e,u,a),a=s.charCodeAt(u)),69!==a&&101!==a||(c=!0,43!==(a=s.charCodeAt(++u))&&45!==a||(a=s.charCodeAt(++u)),u=Ue(e,u,a),a=s.charCodeAt(u)),46===a||function(e){return 95===e||e>=65&&e<=90||e>=97&&e<=122}(a))throw he(e,u,"Invalid number, expected digit but got: ".concat(Ne(a),"."));return new me(c?we.FLOAT:we.INT,t,u,r,i,o,s.slice(t,u))}function Ue(e,t,n){var r=e.body,i=t,o=n;if(o>=48&&o<=57){do{o=r.charCodeAt(++i)}while(o>=48&&o<=57);return i}throw he(e,i,"Invalid number, expected digit but got: ".concat(Ne(o),"."))}function Fe(e,t,n,r,i){for(var o,s,a,u,c=e.body,l=t+1,f=l,d=0,h="";l<c.length&&!isNaN(d=c.charCodeAt(l))&&10!==d&&13!==d;){if(34===d)return h+=c.slice(f,l),new me(we.STRING,t,l+1,n,r,i,h);if(d<32&&9!==d)throw he(e,l,"Invalid character within String: ".concat(Ne(d),"."));if(++l,92===d){switch(h+=c.slice(f,l-1),d=c.charCodeAt(l)){case 34:h+='"';break;case 47:h+="/";break;case 92:h+="\\";break;case 98:h+="\b";break;case 102:h+="\f";break;case 110:h+="\n";break;case 114:h+="\r";break;case 116:h+="\t";break;case 117:var p=(o=c.charCodeAt(l+1),s=c.charCodeAt(l+2),a=c.charCodeAt(l+3),u=c.charCodeAt(l+4),Be(o)<<12|Be(s)<<8|Be(a)<<4|Be(u));if(p<0){var v=c.slice(l+1,l+5);throw he(e,l,"Invalid character escape sequence: \\u".concat(v,"."))}h+=String.fromCharCode(p),l+=4;break;default:throw he(e,l,"Invalid character escape sequence: \\".concat(String.fromCharCode(d),"."))}f=++l}}throw he(e,l,"Unterminated string.")}function Le(e,t,n,r,i,o){for(var s=e.body,a=t+3,u=a,c=0,l="";a<s.length&&!isNaN(c=s.charCodeAt(a));){if(34===c&&34===s.charCodeAt(a+1)&&34===s.charCodeAt(a+2))return l+=s.slice(u,a),new me(we.BLOCK_STRING,t,a+3,n,r,i,xe(l));if(c<32&&9!==c&&10!==c&&13!==c)throw he(e,a,"Invalid character within String: ".concat(Ne(c),"."));10===c?(++a,++o.line,o.lineStart=a):13===c?(10===s.charCodeAt(a+1)?a+=2:++a,++o.line,o.lineStart=a):92===c&&34===s.charCodeAt(a+1)&&34===s.charCodeAt(a+2)&&34===s.charCodeAt(a+3)?(l+=s.slice(u,a)+'"""',u=a+=4):++a}throw he(e,a,"Unterminated string.")}function Be(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function qe(e,t,n,r,i){for(var o=e.body,s=o.length,a=t+1,u=0;a!==s&&!isNaN(u=o.charCodeAt(a))&&(95===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122);)++a;return new me(we.NAME,t,a,n,r,i,o.slice(t,a))}function ze(e,t){return new Ke(e,t).parseDocument()}var Ke=function(){function e(e,t){var n=function(e){return Oe(e,Te)}(e)?e:new Te(e);this._lexer=new ke(n),this._options=t}var t=e.prototype;return t.parseName=function(){var e=this.expectToken(we.NAME);return{kind:pe.NAME,value:e.value,loc:this.loc(e)}},t.parseDocument=function(){var e=this._lexer.token;return{kind:pe.DOCUMENT,definitions:this.many(we.SOF,this.parseDefinition,we.EOF),loc:this.loc(e)}},t.parseDefinition=function(){if(this.peek(we.NAME))switch(this._lexer.token.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return this.parseTypeSystemDefinition();case"extend":return this.parseTypeSystemExtension()}else{if(this.peek(we.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},t.parseOperationDefinition=function(){var e=this._lexer.token;if(this.peek(we.BRACE_L))return{kind:pe.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(e)};var t,n=this.parseOperationType();return this.peek(we.NAME)&&(t=this.parseName()),{kind:pe.OPERATION_DEFINITION,operation:n,name:t,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseOperationType=function(){var e=this.expectToken(we.NAME);switch(e.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(e)},t.parseVariableDefinitions=function(){return this.optionalMany(we.PAREN_L,this.parseVariableDefinition,we.PAREN_R)},t.parseVariableDefinition=function(){var e=this._lexer.token;return{kind:pe.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(we.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(we.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(e)}},t.parseVariable=function(){var e=this._lexer.token;return this.expectToken(we.DOLLAR),{kind:pe.VARIABLE,name:this.parseName(),loc:this.loc(e)}},t.parseSelectionSet=function(){var e=this._lexer.token;return{kind:pe.SELECTION_SET,selections:this.many(we.BRACE_L,this.parseSelection,we.BRACE_R),loc:this.loc(e)}},t.parseSelection=function(){return this.peek(we.SPREAD)?this.parseFragment():this.parseField()},t.parseField=function(){var e,t,n=this._lexer.token,r=this.parseName();return this.expectOptionalToken(we.COLON)?(e=r,t=this.parseName()):t=r,{kind:pe.FIELD,alias:e,name:t,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(we.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},t.parseArguments=function(e){var t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(we.PAREN_L,t,we.PAREN_R)},t.parseArgument=function(){var e=this._lexer.token,t=this.parseName();return this.expectToken(we.COLON),{kind:pe.ARGUMENT,name:t,value:this.parseValueLiteral(!1),loc:this.loc(e)}},t.parseConstArgument=function(){var e=this._lexer.token;return{kind:pe.ARGUMENT,name:this.parseName(),value:(this.expectToken(we.COLON),this.parseValueLiteral(!0)),loc:this.loc(e)}},t.parseFragment=function(){var e=this._lexer.token;this.expectToken(we.SPREAD);var t=this.expectOptionalKeyword("on");return!t&&this.peek(we.NAME)?{kind:pe.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(e)}:{kind:pe.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseFragmentDefinition=function(){var e,t=this._lexer.token;return this.expectKeyword("fragment"),!0===(null===(e=this._options)||void 0===e?void 0:e.experimentalFragmentVariables)?{kind:pe.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(t)}:{kind:pe.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(t)}},t.parseFragmentName=function(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()},t.parseValueLiteral=function(e){var t=this._lexer.token;switch(t.kind){case we.BRACKET_L:return this.parseList(e);case we.BRACE_L:return this.parseObject(e);case we.INT:return this._lexer.advance(),{kind:pe.INT,value:t.value,loc:this.loc(t)};case we.FLOAT:return this._lexer.advance(),{kind:pe.FLOAT,value:t.value,loc:this.loc(t)};case we.STRING:case we.BLOCK_STRING:return this.parseStringLiteral();case we.NAME:switch(this._lexer.advance(),t.value){case"true":return{kind:pe.BOOLEAN,value:!0,loc:this.loc(t)};case"false":return{kind:pe.BOOLEAN,value:!1,loc:this.loc(t)};case"null":return{kind:pe.NULL,loc:this.loc(t)};default:return{kind:pe.ENUM,value:t.value,loc:this.loc(t)}}case we.DOLLAR:if(!e)return this.parseVariable()}throw this.unexpected()},t.parseStringLiteral=function(){var e=this._lexer.token;return this._lexer.advance(),{kind:pe.STRING,value:e.value,block:e.kind===we.BLOCK_STRING,loc:this.loc(e)}},t.parseList=function(e){var t=this,n=this._lexer.token;return{kind:pe.LIST,values:this.any(we.BRACKET_L,(function(){return t.parseValueLiteral(e)}),we.BRACKET_R),loc:this.loc(n)}},t.parseObject=function(e){var t=this,n=this._lexer.token;return{kind:pe.OBJECT,fields:this.any(we.BRACE_L,(function(){return t.parseObjectField(e)}),we.BRACE_R),loc:this.loc(n)}},t.parseObjectField=function(e){var t=this._lexer.token,n=this.parseName();return this.expectToken(we.COLON),{kind:pe.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e),loc:this.loc(t)}},t.parseDirectives=function(e){for(var t=[];this.peek(we.AT);)t.push(this.parseDirective(e));return t},t.parseDirective=function(e){var t=this._lexer.token;return this.expectToken(we.AT),{kind:pe.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e),loc:this.loc(t)}},t.parseTypeReference=function(){var e,t=this._lexer.token;return this.expectOptionalToken(we.BRACKET_L)?(e=this.parseTypeReference(),this.expectToken(we.BRACKET_R),e={kind:pe.LIST_TYPE,type:e,loc:this.loc(t)}):e=this.parseNamedType(),this.expectOptionalToken(we.BANG)?{kind:pe.NON_NULL_TYPE,type:e,loc:this.loc(t)}:e},t.parseNamedType=function(){var e=this._lexer.token;return{kind:pe.NAMED_TYPE,name:this.parseName(),loc:this.loc(e)}},t.parseTypeSystemDefinition=function(){var e=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(e.kind===we.NAME)switch(e.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(e)},t.peekDescription=function(){return this.peek(we.STRING)||this.peek(we.BLOCK_STRING)},t.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},t.parseSchemaDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");var n=this.parseDirectives(!0),r=this.many(we.BRACE_L,this.parseOperationTypeDefinition,we.BRACE_R);return{kind:pe.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:r,loc:this.loc(e)}},t.parseOperationTypeDefinition=function(){var e=this._lexer.token,t=this.parseOperationType();this.expectToken(we.COLON);var n=this.parseNamedType();return{kind:pe.OPERATION_TYPE_DEFINITION,operation:t,type:n,loc:this.loc(e)}},t.parseScalarTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");var n=this.parseName(),r=this.parseDirectives(!0);return{kind:pe.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:r,loc:this.loc(e)}},t.parseObjectTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");var n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseDirectives(!0),o=this.parseFieldsDefinition();return{kind:pe.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:o,loc:this.loc(e)}},t.parseImplementsInterfaces=function(){var e;if(!this.expectOptionalKeyword("implements"))return[];if(!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacySDLImplementsInterfaces)){var t=[];this.expectOptionalToken(we.AMP);do{t.push(this.parseNamedType())}while(this.expectOptionalToken(we.AMP)||this.peek(we.NAME));return t}return this.delimitedMany(we.AMP,this.parseNamedType)},t.parseFieldsDefinition=function(){var e;return!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacySDLEmptyFields)&&this.peek(we.BRACE_L)&&this._lexer.lookahead().kind===we.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(we.BRACE_L,this.parseFieldDefinition,we.BRACE_R)},t.parseFieldDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(we.COLON);var i=this.parseTypeReference(),o=this.parseDirectives(!0);return{kind:pe.FIELD_DEFINITION,description:t,name:n,arguments:r,type:i,directives:o,loc:this.loc(e)}},t.parseArgumentDefs=function(){return this.optionalMany(we.PAREN_L,this.parseInputValueDef,we.PAREN_R)},t.parseInputValueDef=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(we.COLON);var r,i=this.parseTypeReference();this.expectOptionalToken(we.EQUALS)&&(r=this.parseValueLiteral(!0));var o=this.parseDirectives(!0);return{kind:pe.INPUT_VALUE_DEFINITION,description:t,name:n,type:i,defaultValue:r,directives:o,loc:this.loc(e)}},t.parseInterfaceTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");var n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseDirectives(!0),o=this.parseFieldsDefinition();return{kind:pe.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:o,loc:this.loc(e)}},t.parseUnionTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");var n=this.parseName(),r=this.parseDirectives(!0),i=this.parseUnionMemberTypes();return{kind:pe.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:i,loc:this.loc(e)}},t.parseUnionMemberTypes=function(){return this.expectOptionalToken(we.EQUALS)?this.delimitedMany(we.PIPE,this.parseNamedType):[]},t.parseEnumTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");var n=this.parseName(),r=this.parseDirectives(!0),i=this.parseEnumValuesDefinition();return{kind:pe.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:i,loc:this.loc(e)}},t.parseEnumValuesDefinition=function(){return this.optionalMany(we.BRACE_L,this.parseEnumValueDefinition,we.BRACE_R)},t.parseEnumValueDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseDirectives(!0);return{kind:pe.ENUM_VALUE_DEFINITION,description:t,name:n,directives:r,loc:this.loc(e)}},t.parseInputObjectTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");var n=this.parseName(),r=this.parseDirectives(!0),i=this.parseInputFieldsDefinition();return{kind:pe.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:i,loc:this.loc(e)}},t.parseInputFieldsDefinition=function(){return this.optionalMany(we.BRACE_L,this.parseInputValueDef,we.BRACE_R)},t.parseTypeSystemExtension=function(){var e=this._lexer.lookahead();if(e.kind===we.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)},t.parseSchemaExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var t=this.parseDirectives(!0),n=this.optionalMany(we.BRACE_L,this.parseOperationTypeDefinition,we.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return{kind:pe.SCHEMA_EXTENSION,directives:t,operationTypes:n,loc:this.loc(e)}},t.parseScalarTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var t=this.parseName(),n=this.parseDirectives(!0);if(0===n.length)throw this.unexpected();return{kind:pe.SCALAR_TYPE_EXTENSION,name:t,directives:n,loc:this.loc(e)}},t.parseObjectTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseDirectives(!0),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return{kind:pe.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i,loc:this.loc(e)}},t.parseInterfaceTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseDirectives(!0),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return{kind:pe.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i,loc:this.loc(e)}},t.parseUnionTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseUnionMemberTypes();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:pe.UNION_TYPE_EXTENSION,name:t,directives:n,types:r,loc:this.loc(e)}},t.parseEnumTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseEnumValuesDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:pe.ENUM_TYPE_EXTENSION,name:t,directives:n,values:r,loc:this.loc(e)}},t.parseInputObjectTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseInputFieldsDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:pe.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:r,loc:this.loc(e)}},t.parseDirectiveDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(we.AT);var n=this.parseName(),r=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var o=this.parseDirectiveLocations();return{kind:pe.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:i,locations:o,loc:this.loc(e)}},t.parseDirectiveLocations=function(){return this.delimitedMany(we.PIPE,this.parseDirectiveLocation)},t.parseDirectiveLocation=function(){var e=this._lexer.token,t=this.parseName();if(void 0!==Ce[t.value])return t;throw this.unexpected(e)},t.loc=function(e){var t;if(!0!==(null===(t=this._options)||void 0===t?void 0:t.noLocation))return new ge(e,this._lexer.lastToken,this._lexer.source)},t.peek=function(e){return this._lexer.token.kind===e},t.expectToken=function(e){var t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t;throw he(this._lexer.source,t.start,"Expected ".concat(Ve(e),", found ").concat(He(t),"."))},t.expectOptionalToken=function(e){var t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t},t.expectKeyword=function(e){var t=this._lexer.token;if(t.kind!==we.NAME||t.value!==e)throw he(this._lexer.source,t.start,'Expected "'.concat(e,'", found ').concat(He(t),"."));this._lexer.advance()},t.expectOptionalKeyword=function(e){var t=this._lexer.token;return t.kind===we.NAME&&t.value===e&&(this._lexer.advance(),!0)},t.unexpected=function(e){var t=null!=e?e:this._lexer.token;return he(this._lexer.source,t.start,"Unexpected ".concat(He(t),"."))},t.any=function(e,t,n){this.expectToken(e);for(var r=[];!this.expectOptionalToken(n);)r.push(t.call(this));return r},t.optionalMany=function(e,t,n){if(this.expectOptionalToken(e)){var r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r}return[]},t.many=function(e,t,n){this.expectToken(e);var r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r},t.delimitedMany=function(e,t){this.expectOptionalToken(e);var n=[];do{n.push(t.call(this))}while(this.expectOptionalToken(e));return n},e}();function He(e){var t=e.value;return Ve(e.kind)+(null!=t?' "'.concat(t,'"'):"")}function Ve(e){return function(e){return e===we.BANG||e===we.DOLLAR||e===we.AMP||e===we.PAREN_L||e===we.PAREN_R||e===we.SPREAD||e===we.COLON||e===we.EQUALS||e===we.AT||e===we.BRACKET_L||e===we.BRACKET_R||e===we.BRACE_L||e===we.PIPE||e===we.BRACE_R}(e)?'"'.concat(e,'"'):e}var Ge={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},We=Object.freeze({});function Ye(e,t,n){var r=e[t];if(r){if(!n&&"function"==typeof r)return r;var i=n?r.leave:r.enter;if("function"==typeof i)return i}else{var o=n?e.leave:e.enter;if(o){if("function"==typeof o)return o;var s=o[t];if("function"==typeof s)return s}}}function Je(e){return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ge,r=void 0,i=Array.isArray(e),o=[e],s=-1,a=[],u=void 0,c=void 0,l=void 0,f=[],d=[],h=e;do{var p=++s===o.length,v=p&&0!==a.length;if(p){if(c=0===d.length?void 0:f[f.length-1],u=l,l=d.pop(),v){if(i)u=u.slice();else{for(var y={},g=0,m=Object.keys(u);g<m.length;g++){var b=m[g];y[b]=u[b]}u=y}for(var w=0,S=0;S<a.length;S++){var _=a[S][0],E=a[S][1];i&&(_-=w),i&&null===E?(u.splice(_,1),w++):u[_]=E}}s=r.index,o=r.keys,a=r.edits,i=r.inArray,r=r.prev}else{if(c=l?i?s:o[s]:void 0,null==(u=l?l[c]:h))continue;l&&f.push(c)}var A,O=void 0;if(!Array.isArray(u)){if(!be(u))throw new Error("Invalid AST Node: ".concat(_e(u),"."));var I=Ye(t,u.kind,p);if(I){if((O=I.call(t,u,c,l,f,d))===We)break;if(!1===O){if(!p){f.pop();continue}}else if(void 0!==O&&(a.push([c,O]),!p)){if(!be(O)){f.pop();continue}u=O}}}if(void 0===O&&v&&a.push([c,u]),p)f.pop();else r={inArray:i,index:s,keys:o,edits:a,prev:r},o=(i=Array.isArray(u))?u:null!==(A=n[u.kind])&&void 0!==A?A:[],s=-1,a=[],l&&d.push(l),l=u}while(void 0!==r);return 0!==a.length&&(h=a[a.length-1][1]),h}(e,{leave:$e})}var $e={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return Qe(e.definitions,"\n\n")+"\n"},OperationDefinition:function(e){var t=e.operation,n=e.name,r=et("(",Qe(e.variableDefinitions,", "),")"),i=Qe(e.directives," "),o=e.selectionSet;return n||i||r||"query"!==t?Qe([t,Qe([n,r]),i,o]," "):o},VariableDefinition:function(e){var t=e.variable,n=e.type,r=e.defaultValue,i=e.directives;return t+": "+n+et(" = ",r)+et(" ",Qe(i," "))},SelectionSet:function(e){return Xe(e.selections)},Field:function(e){var t=e.alias,n=e.name,r=e.arguments,i=e.directives,o=e.selectionSet,s=et("",t,": ")+n,a=s+et("(",Qe(r,", "),")");return a.length>80&&(a=s+et("(\n",tt(Qe(r,"\n")),"\n)")),Qe([a,Qe(i," "),o]," ")},Argument:function(e){return e.name+": "+e.value},FragmentSpread:function(e){return"..."+e.name+et(" ",Qe(e.directives," "))},InlineFragment:function(e){var t=e.typeCondition,n=e.directives,r=e.selectionSet;return Qe(["...",et("on ",t),Qe(n," "),r]," ")},FragmentDefinition:function(e){var t=e.name,n=e.typeCondition,r=e.variableDefinitions,i=e.directives,o=e.selectionSet;return"fragment ".concat(t).concat(et("(",Qe(r,", "),")")," ")+"on ".concat(n," ").concat(et("",Qe(i," ")," "))+o},IntValue:function(e){return e.value},FloatValue:function(e){return e.value},StringValue:function(e,t){var n=e.value;return e.block?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=-1===e.indexOf("\n"),i=" "===e[0]||"\t"===e[0],o='"'===e[e.length-1],s="\\"===e[e.length-1],a=!r||o||s||n,u="";return!a||r&&i||(u+="\n"+t),u+=t?e.replace(/\n/g,"\n"+t):e,a&&(u+="\n"),'"""'+u.replace(/"""/g,'\\"""')+'"""'}(n,"description"===t?"":" "):JSON.stringify(n)},BooleanValue:function(e){return e.value?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){return e.value},ListValue:function(e){return"["+Qe(e.values,", ")+"]"},ObjectValue:function(e){return"{"+Qe(e.fields,", ")+"}"},ObjectField:function(e){return e.name+": "+e.value},Directive:function(e){return"@"+e.name+et("(",Qe(e.arguments,", "),")")},NamedType:function(e){return e.name},ListType:function(e){return"["+e.type+"]"},NonNullType:function(e){return e.type+"!"},SchemaDefinition:Ze((function(e){var t=e.directives,n=e.operationTypes;return Qe(["schema",Qe(t," "),Xe(n)]," ")})),OperationTypeDefinition:function(e){return e.operation+": "+e.type},ScalarTypeDefinition:Ze((function(e){return Qe(["scalar",e.name,Qe(e.directives," ")]," ")})),ObjectTypeDefinition:Ze((function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return Qe(["type",t,et("implements ",Qe(n," & ")),Qe(r," "),Xe(i)]," ")})),FieldDefinition:Ze((function(e){var t=e.name,n=e.arguments,r=e.type,i=e.directives;return t+(rt(n)?et("(\n",tt(Qe(n,"\n")),"\n)"):et("(",Qe(n,", "),")"))+": "+r+et(" ",Qe(i," "))})),InputValueDefinition:Ze((function(e){var t=e.name,n=e.type,r=e.defaultValue,i=e.directives;return Qe([t+": "+n,et("= ",r),Qe(i," ")]," ")})),InterfaceTypeDefinition:Ze((function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return Qe(["interface",t,et("implements ",Qe(n," & ")),Qe(r," "),Xe(i)]," ")})),UnionTypeDefinition:Ze((function(e){var t=e.name,n=e.directives,r=e.types;return Qe(["union",t,Qe(n," "),r&&0!==r.length?"= "+Qe(r," | "):""]," ")})),EnumTypeDefinition:Ze((function(e){var t=e.name,n=e.directives,r=e.values;return Qe(["enum",t,Qe(n," "),Xe(r)]," ")})),EnumValueDefinition:Ze((function(e){return Qe([e.name,Qe(e.directives," ")]," ")})),InputObjectTypeDefinition:Ze((function(e){var t=e.name,n=e.directives,r=e.fields;return Qe(["input",t,Qe(n," "),Xe(r)]," ")})),DirectiveDefinition:Ze((function(e){var t=e.name,n=e.arguments,r=e.repeatable,i=e.locations;return"directive @"+t+(rt(n)?et("(\n",tt(Qe(n,"\n")),"\n)"):et("(",Qe(n,", "),")"))+(r?" repeatable":"")+" on "+Qe(i," | ")})),SchemaExtension:function(e){var t=e.directives,n=e.operationTypes;return Qe(["extend schema",Qe(t," "),Xe(n)]," ")},ScalarTypeExtension:function(e){return Qe(["extend scalar",e.name,Qe(e.directives," ")]," ")},ObjectTypeExtension:function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return Qe(["extend type",t,et("implements ",Qe(n," & ")),Qe(r," "),Xe(i)]," ")},InterfaceTypeExtension:function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return Qe(["extend interface",t,et("implements ",Qe(n," & ")),Qe(r," "),Xe(i)]," ")},UnionTypeExtension:function(e){var t=e.name,n=e.directives,r=e.types;return Qe(["extend union",t,Qe(n," "),r&&0!==r.length?"= "+Qe(r," | "):""]," ")},EnumTypeExtension:function(e){var t=e.name,n=e.directives,r=e.values;return Qe(["extend enum",t,Qe(n," "),Xe(r)]," ")},InputObjectTypeExtension:function(e){var t=e.name,n=e.directives,r=e.fields;return Qe(["extend input",t,Qe(n," "),Xe(r)]," ")}};function Ze(e){return function(t){return Qe([t.description,e(t)],"\n")}}function Qe(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return null!==(t=null==e?void 0:e.filter((function(e){return e})).join(n))&&void 0!==t?t:""}function Xe(e){return et("{\n",tt(Qe(e,"\n")),"\n}")}function et(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return null!=t&&""!==t?e+t+n:""}function tt(e){return et(" ",e.replace(/\n/g,"\n "))}function nt(e){return-1!==e.indexOf("\n")}function rt(e){return null!=e&&e.some(nt)}var it="undefined"!=typeof Symbol&&"function"==typeof Symbol.for,ot=(it&&Symbol.for("INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER"),it?Symbol.for("INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER"):"@@INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER"),st=n(14),at=n(17),ut=n(20),ct=function(){return(ct=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)},lt=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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},ft=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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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])}}},dt=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},ht=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},pt=new o.a("GraphQLAPI"),vt=function(){function e(e){this._api=null,this.Auth=at.a,this.Cache=i.a,this.Credentials=s.a,this._options=e,pt.debug("API Options",this._options)}return e.prototype.getModuleName=function(){return"GraphQLAPI"},e.prototype.configure=function(e){var t=e||{},n=t.API,r=void 0===n?{}:n,i=dt(t,["API"]),o=ct(ct({},i),r);return pt.debug("configure GraphQL API",{opt:o}),o.aws_project_region&&(o=Object.assign({},o,{region:o.aws_project_region,header:{}})),void 0!==o.graphql_headers&&"function"!=typeof o.graphql_headers&&(pt.warn("graphql_headers should be a function"),o.graphql_headers=void 0),this._options=Object.assign({},this._options,o),this.createInstance(),this._options},e.prototype.createInstance=function(){return pt.debug("create Rest instance"),this._options?(this._api=new F(this._options),this._api.Credentials=this.Credentials,!0):Promise.reject("API not configured")},e.prototype._headerBasedAuth=function(e,t){return void 0===t&&(t={}),lt(this,void 0,void 0,(function(){var n,r,o,s,a,u,c,l;return ft(this,(function(f){switch(f.label){case 0:switch(n=this._options,r=n.aws_appsync_authenticationType,o=n.aws_appsync_apiKey,s={},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]}return[3,16];case 1:if(!o)throw new Error(ut.a.NO_API_KEY);return s={Authorization:null,"X-Api-Key":o},[3,17];case 2:return[4,this._ensureCredentials()];case 3:if(!f.sent())throw new Error(ut.a.NO_CREDENTIALS);return[3,17];case 4:return f.trys.push([4,9,,10]),a=void 0,[4,i.a.getItem("federatedInfo")];case 5:return(u=f.sent())?(a=u.token,[3,8]):[3,6];case 6:return[4,at.a.currentAuthenticatedUser()];case 7:(c=f.sent())&&(a=c.token),f.label=8;case 8:if(!a)throw new Error(ut.a.NO_FEDERATED_JWT);return s={Authorization:a},[3,10];case 9:throw f.sent(),new Error(ut.a.NO_CURRENT_USER);case 10:return[3,17];case 11:return f.trys.push([11,13,,14]),[4,this.Auth.currentSession()];case 12:return l=f.sent(),s={Authorization:l.getAccessToken().getJwtToken()},[3,14];case 13:throw f.sent(),new Error(ut.a.NO_CURRENT_USER);case 14:return[3,17];case 15:if(!t.Authorization)throw new Error(ut.a.NO_AUTH_TOKEN);return s={Authorization:t.Authorization},[3,17];case 16:return s={Authorization:null},[3,17];case 17:return[2,s]}}))}))},e.prototype.getGraphqlOperationType=function(e){var t=ze(e).definitions;return ht(t,1)[0].operation},e.prototype.graphql=function(e,t){var n=e.query,r=e.variables,i=void 0===r?{}:r,o=e.authMode,s=e.authToken,a=e.userAgentSuffix,u=ze("string"==typeof n?n:Je(n)),c=ht(u.definitions.filter((function(e){return"OperationDefinition"===e.kind})),1)[0],l=(void 0===c?{}:c).operation,f=t||{};switch(s&&(f.Authorization=s),l){case"query":case"mutation":var d=this._api.getCancellableToken(),h={cancellableToken:d},p=this._graphql({query:u,variables:i,authMode:o,userAgentSuffix:a},f,h);return this._api.updateRequestToBeCancellable(p,d),p;case"subscription":return this._graphqlSubscribe({query:u,variables:i,authMode:o},f);default:throw new Error("invalid operation type: "+l)}},e.prototype._graphql=function(e,t,n){var r=e.query,i=e.variables,o=e.authMode,s=e.userAgentSuffix;return void 0===t&&(t={}),void 0===n&&(n={}),lt(this,void 0,void 0,(function(){var e,u,c,l,f,d,h,p,v,y,g,m,b,w,S,_,E,A,O,I,T;return ft(this,(function(C){switch(C.label){case 0:return this._api?[3,2]:[4,this.createInstance()];case 1:C.sent(),C.label=2;case 2:return e=this._options,u=e.aws_appsync_region,c=e.aws_appsync_graphqlEndpoint,l=e.graphql_headers,f=void 0===l?function(){return{}}:l,d=e.graphql_endpoint,h=e.graphql_endpoint_iam_region,v=[{}],(y=!d)?[4,this._headerBasedAuth(o,t)]:[3,4];case 3:y=C.sent(),C.label=4;case 4:return g=[ct.apply(void 0,v.concat([y]))],(m=d)?h?[4,this._headerBasedAuth(o,t)]:[3,6]:[3,8];case 5:return b=C.sent(),[3,7];case 6:b={Authorization:null},C.label=7;case 7:m=b,C.label=8;case 8:return w=[ct.apply(void 0,g.concat([m]))],[4,f({query:r,variables:i})];case 9:if(p=ct.apply(void 0,[ct.apply(void 0,[ct.apply(void 0,w.concat([C.sent()])),t]),!d&&(T={},T["x-amz-user-agent"]=Object(a.b)(s),T)]),S={query:Je(r),variables:i},_=Object.assign({headers:p,body:S,signerServiceInfo:{service:d?"execute-api":"appsync",region:d?h:u}},n),!(E=d||c))throw{data:{},errors:[new fe("No graphql endpoint provided.")]};C.label=10;case 10:return C.trys.push([10,12,,13]),[4,this._api.post(E,_)];case 11:return A=C.sent(),[3,13];case 12:if(O=C.sent(),this._api.isCancel(O))throw O;return A={data:{},errors:[new fe(O.message,null,null,null,null,O)]},[3,13];case 13:if((I=A.errors)&&I.length)throw A;return[2,A]}}))}))},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,i=e.authMode,o=e.authToken;void 0===t&&(t={});var s=this._options,a=s.aws_appsync_region,u=s.aws_appsync_graphqlEndpoint,c=s.aws_appsync_authenticationType,l=s.aws_appsync_apiKey,f=s.graphql_headers,d=void 0===f?function(){return{}}:f,h=i||c||"AWS_IAM";if(st.PubSub&&"function"==typeof st.PubSub.subscribe)return st.PubSub.subscribe("",{provider:ot,appSyncGraphqlEndpoint:u,authenticationType:h,apiKey:l,query:Je(n),region:a,variables:r,graphql_headers:d,additionalHeaders:t,authToken:o});throw pt.debug("No pubsub module applied for subscription"),new 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 pt.debug("set credentials for api",n),!0})).catch((function(e){return pt.warn("ensure credentials error",e),!1}))},e}(),yt=new vt(null);L.a.register(yt);var gt=function(){return(gt=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)},mt=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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},bt=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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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])}}},wt=new o.a("API"),St=new(function(){function e(e){this.Auth=r.a,this.Cache=i.a,this.Credentials=s.a,this._options=e,this._restApi=new V(e),this._graphqlApi=new vt(e),wt.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 gt(gt({},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)},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){return mt(this,void 0,void 0,(function(){return bt(this,(function(t){return[2,this._restApi.endpoint(e)]}))}))},e.prototype.getGraphqlOperationType=function(e){return this._graphqlApi.getGraphqlOperationType(e)},e.prototype.graphql=function(e,t){return this._graphqlApi.graphql(e,t)},e}())(null);L.a.register(St);t.a=St},function(e,t,n){"use strict";var r=n(38),i={keyPrefix:"aws-amplify-cache",capacityInBytes:1048576,itemMaxSize:21e4,defaultTTL:2592e5,defaultPriority:5,warningThreshold:.8,storage:(new(n(66).a)).getStorage()};function o(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 s(){return(new Date).getTime()}function a(e){return Number.isInteger?Number.isInteger(e):function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}(e)}var u={},c=(function(){function e(){}e.clear=function(){u={}},e.getItem=function(e){return u[e]||null},e.setItem=function(e,t){u[e]=t},e.removeItem=function(e){delete u[e]}}(),n(21));function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var f,d=new c.a("StorageCache"),h=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(){a(this.config.capacityInBytes)||(d.error("Invalid parameter: capacityInBytes. It should be an Integer. Setting back to default."),this.config.capacityInBytes=i.capacityInBytes),a(this.config.itemMaxSize)||(d.error("Invalid parameter: itemMaxSize. It should be an Integer. Setting back to default."),this.config.itemMaxSize=i.itemMaxSize),a(this.config.defaultTTL)||(d.error("Invalid parameter: defaultTTL. It should be an Integer. Setting back to default."),this.config.defaultTTL=i.defaultTTL),a(this.config.defaultPriority)||(d.error("Invalid parameter: defaultPriority. It should be an Integer. Setting back to default."),this.config.defaultPriority=i.defaultPriority),this.config.itemMaxSize>this.config.capacityInBytes&&(d.error("Invalid parameter: itemMaxSize. It should be smaller than capacityInBytes. Setting back to default."),this.config.itemMaxSize=i.itemMaxSize),(this.config.defaultPriority>5||this.config.defaultPriority<1)&&(d.error("Invalid parameter: defaultPriority. It should be between 1 and 5. Setting back to default."),this.config.defaultPriority=i.defaultPriority),(Number(this.config.warningThreshold)>1||Number(this.config.warningThreshold)<0)&&(d.error("Invalid parameter: warningThreshold. It should be between 0 and 1. Setting back to default."),this.config.warningThreshold=i.warningThreshold);this.config.capacityInBytes>5242880&&(d.error("Cache Capacity should be less than 5MB. Setting back to default. Setting back to default."),this.config.capacityInBytes=i.capacityInBytes)},e.prototype.fillCacheItem=function(e,t,n){var r={key:e,data:t,timestamp:s(),visitedTime:s(),priority:n.priority,expires:n.expires,type:l(t),byteSize:0};return r.byteSize=o(JSON.stringify(r)),r.byteSize=o(JSON.stringify(r)),r},e.prototype.configure=function(e){return e?(e.keyPrefix&&d.warn("Don't try to configure keyPrefix!"),this.config=Object.assign({},this.config,e,e.Cache),this.checkConfig(),this.config):this.config},e}(),p=(f=function(e,t){return(f=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}f(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),v=new c.a("Cache"),y=new(function(e){function t(t){var n=this,r=t?Object.assign({},i,t):i;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 p(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=s(),this.config.storage.setItem(t,JSON.stringify(e)),e},t.prototype._isExpired=function(e){var t=this.config.storage.getItem(e),n=JSON.parse(t);return s()>=n.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),v.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(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(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){v.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)if(void 0!==t){var i={priority:n&&void 0!==n.priority?n.priority:this.config.defaultPriority,expires:n&&void 0!==n.expires?n.expires:this.config.defaultTTL+s()};if(i.priority<1||i.priority>5)v.warn("Invalid parameter: priority due to out or range. It should be within 1 and 5.");else{var o=this.fillCacheItem(r,t,i);if(o.byteSize>this.config.itemMaxSize)v.warn("Item with key: "+e+" you are trying to put into is too big!");else try{var a=this.config.storage.getItem(r);if(a&&this._removeItem(r,JSON.parse(a).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){v.warn("setItem failed! "+e)}}}else v.warn("The value of item should not be undefined!");else v.warn("Invalid key: should not be empty or 'CurSize'")},t.prototype.getItem=function(e,t){v.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 v.warn("Invalid key: should not be empty or 'CurSize'"),null;try{if(null!=(n=this.config.storage.getItem(r))){if(!this._isExpired(r)){var i=JSON.parse(n);return(i=this._refreshItem(i,r)).data}this._removeItem(r,JSON.parse(n).byteSize),n=null}if(t&&void 0!==t.callback){var o=t.callback();return null!==o&&this.setItem(e,o,t),o}return null}catch(e){return v.warn("getItem failed! "+e),null}},t.prototype.removeItem=function(e){v.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){v.warn("removeItem failed! "+e)}},t.prototype.clear=function(){v.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(t=0;t<e.length;t+=1)this.config.storage.removeItem(e[t])}catch(e){v.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!==i.keyPrefix||(v.error("invalid keyPrefix, setting keyPrefix with timeStamp"),e.keyPrefix=s.toString()),new t(e)},t}(h));t.a=y;r.a.register(y)},function(e,t,n){"use strict";var r;n.d(t,"a",(function(){return r})),function(e){e.NO_API_KEY="No api-key configured",e.NO_CURRENT_USER="No current user",e.NO_CREDENTIALS="No credentials",e.NO_FEDERATED_JWT="No federated jwt",e.NO_AUTH_TOKEN="No auth token specified"}(r||(r={}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var r,i=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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},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={VERBOSE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5};!function(e){e.DEBUG="DEBUG",e.ERROR="ERROR",e.INFO="INFO",e.WARN="WARN",e.VERBOSE="VERBOSE"}(r||(r={}));var u=function(){function e(e,t){void 0===t&&(t=r.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):this._config},e.prototype._log=function(t){for(var n,o,s=[],u=1;u<arguments.length;u++)s[u-1]=arguments[u];var c=this.level;e.LOG_LEVEL&&(c=e.LOG_LEVEL),"undefined"!=typeof window&&window.LOG_LEVEL&&(c=window.LOG_LEVEL);var l=a[c],f=a[t];if(f>=l){var d=console.log.bind(console);t===r.ERROR&&console.error&&(d=console.error.bind(console)),t===r.WARN&&console.warn&&(d=console.warn.bind(console));var h="["+t+"] "+this._ts()+" "+this.name,p="";if(1===s.length&&"string"==typeof s[0])d(p=h+" - "+s[0]);else if(1===s.length)p=h+" "+s[0],d(h,s[0]);else if("string"==typeof s[0]){var v=s.slice(1);1===v.length&&(v=v[0]),p=h+" - "+s[0]+" "+v,d(h+" - "+s[0],v)}else p=h+" "+s,d(h,s);try{for(var y=i(this._pluggables),g=y.next();!g.done;g=y.next()){var m=g.value,b={message:p,timestamp:Date.now()};m.pushLogs([b])}}catch(e){n={error:e}}finally{try{g&&!g.done&&(o=y.return)&&o.call(y)}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,s([r.INFO],e))},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,s([r.INFO],e))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,s([r.WARN],e))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,s([r.ERROR],e))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,s([r.DEBUG],e))},e.prototype.verbose=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,s([r.VERBOSE],e))},e.prototype.addPluggable=function(e){e&&"Logging"===e.getCategoryName()&&(this._pluggables.push(e),e.configure(this._config))},e.prototype.listPluggables=function(){return this._pluggables},e.LOG_LEVEL=null,e}()},,function(e,t,n){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return h})),n.d(t,"c",(function(){return p}));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=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(r(arguments[t]));return e},o=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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},s=function(e){return/^Connection failed: Connection Timeout/.test(e.message)},a=function(e){return/^Error: Request failed with status code 5\d\d/.test(e.message)},u={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 s(e)||a(e)},Unauthorized:function(e){return/^Request failed with status code 401/.test(e.message)}},c={BadModel:function(){return!1},BadRecord:function(){return!1},ConfigError:function(){return!1},Transient:function(e){var t=f(e);return s(t)||a(t)},Unauthorized:function(e){var t=f(e);return/Connection failed.+Unauthorized/.test(t.message)}},l={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 s(e)||a(e)},Unauthorized:function(){return!1}};function f(e){var t=e.error;return r((void 0===t?{errors:[]}:t).errors,1)[0]}function d(e){return v(u,e)}function h(e){return v(c,e)}function p(e){return v(l,e)}function v(e,t){var n,r,s=i(Object.keys(e));try{for(var a=o(s),u=a.next();!u.done;u=a.next()){var c=u.value;if((0,e[c])(t))return c}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return"Unknown"}},function(e,t,n){var r;e.exports=(r=n(12),n(37),n(88),r.HmacSHA256)},function(e,t,n){"use strict";
35
+ var oe=function(){function e(e,t){var n=e||{},r=n.UserPoolId,i=n.ClientId,o=n.endpoint,s=n.fetchOptions,a=n.AdvancedSecurityDataCollectionFlag;if(!r||!i)throw new Error("Both UserPoolId and ClientId are required.");if(r.length>55||!/^[\w-]+_[0-9a-zA-Z]+$/.test(r))throw new Error("Invalid UserPoolId format.");var u=r.split("_")[0];this.userPoolId=r,this.clientId=i,this.client=new re(u,o,s),this.advancedSecurityDataCollectionFlag=!1!==a,this.storage=e.Storage||(new V).getStorage(),t&&(this.wrapRefreshSessionCallback=t)}var t=e.prototype;return t.getUserPoolId=function(){return this.userPoolId},t.getClientId=function(){return this.clientId},t.signUp=function(e,t,n,r,i,o){var s=this,a={ClientId:this.clientId,Username:e,Password:t,UserAttributes:n,ValidationData:r,ClientMetadata:o};this.getUserContextData(e)&&(a.UserContextData=this.getUserContextData(e)),this.client.request("SignUp",a,(function(t,n){if(t)return i(t,null);var r={Username:e,Pool:s,Storage:s.storage},o={user:new H(r),userConfirmed:n.UserConfirmed,userSub:n.UserSub,codeDeliveryDetails:n.CodeDeliveryDetails};return i(null,o)}))},t.getCurrentUser=function(){var e="CognitoIdentityServiceProvider."+this.clientId+".LastAuthUser",t=this.storage.getItem(e);if(t){var n={Username:t,Pool:this,Storage:this.storage};return new H(n)}return null},t.getUserContextData=function(e){if("undefined"!=typeof AmazonCognitoAdvancedSecurityData){var t=AmazonCognitoAdvancedSecurityData;if(this.advancedSecurityDataCollectionFlag){var n=t.getData(e,this.userPoolId,this.clientId);if(n)return{EncodedData:n}}return{}}},e}(),se=n(27),ae=function(){function e(e){if(!e.domain)throw new Error("The domain of cookieStorage can not be undefined.");if(this.domain=e.domain,e.path?this.path=e.path:this.path="/",Object.prototype.hasOwnProperty.call(e,"expires")?this.expires=e.expires:this.expires=365,Object.prototype.hasOwnProperty.call(e,"secure")?this.secure=e.secure:this.secure=!0,Object.prototype.hasOwnProperty.call(e,"sameSite")){if(!["strict","lax","none"].includes(e.sameSite))throw new Error('The sameSite value of cookieStorage must be "lax", "strict" or "none".');if("none"===e.sameSite&&!this.secure)throw new Error("sameSite = None requires the Secure attribute in latest browser versions.");this.sameSite=e.sameSite}else this.sameSite=null}var t=e.prototype;return t.setItem=function(e,t){var n={path:this.path,expires:this.expires,domain:this.domain,secure:this.secure};return this.sameSite&&(n.sameSite=this.sameSite),se.set(e,t,n),se.get(e)},t.getItem=function(e){return se.get(e)},t.removeItem=function(e){var t={path:this.path,expires:this.expires,domain:this.domain,secure:this.secure};return this.sameSite&&(t.sameSite=this.sameSite),se.remove(e,t)},t.clear=function(){for(var e=se.get(),t=Object.keys(e).length,n=0;n<t;++n)this.removeItem(Object.keys(e)[n]);return{}},e}()},function(e,t,n){"use strict";var r=n(94),i=n(95);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){i.isString(e)&&(e=b(e));return e instanceof o?e.format():o.prototype.format.call(e)},t.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),f=["%","/","?",";","#"].concat(l),d=["/","?","#"],h=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},m=n(96);function b(e,t,n){if(e&&i.isObject(e)&&e instanceof o)return e;var r=new o;return r.parse(e,t,n),r}o.prototype.parse=function(e,t,n){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o<e.indexOf("#")?"?":"#",c=e.split(a);c[0]=c[0].replace(/\\/g,"/");var b=e=c.join(a);if(b=b.trim(),!n&&1===e.split("#").length){var w=u.exec(b);if(w)return this.path=b,this.href=b,this.pathname=w[1],w[2]?(this.search=w[2],this.query=t?m.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var S=s.exec(b);if(S){var O=(S=S[0]).toLowerCase();this.protocol=O,b=b.substr(S.length)}if(n||S||b.match(/^\/\/[^@\/]+@[^@\/]+/)){var _="//"===b.substr(0,2);!_||S&&y[S]||(b=b.substr(2),this.slashes=!0)}if(!y[S]&&(_||S&&!g[S])){for(var E,A,I=-1,T=0;T<d.length;T++){-1!==(j=b.indexOf(d[T]))&&(-1===I||j<I)&&(I=j)}-1!==(A=-1===I?b.lastIndexOf("@"):b.lastIndexOf("@",I))&&(E=b.slice(0,A),b=b.slice(A+1),this.auth=decodeURIComponent(E)),I=-1;for(T=0;T<f.length;T++){var j;-1!==(j=b.indexOf(f[T]))&&(-1===I||j<I)&&(I=j)}-1===I&&(I=b.length),this.host=b.slice(0,I),b=b.slice(I),this.parseHost(),this.hostname=this.hostname||"";var C="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!C)for(var P=this.hostname.split(/\./),x=(T=0,P.length);T<x;T++){var k=P[T];if(k&&!k.match(h)){for(var N="",M=0,D=k.length;M<D;M++)k.charCodeAt(M)>127?N+="x":N+=k[M];if(!N.match(h)){var R=P.slice(0,T),U=P.slice(T+1),F=k.match(p);F&&(R.push(F[1]),U.unshift(F[2])),U.length&&(b="/"+U.join(".")+b),this.hostname=R.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),C||(this.hostname=r.toASCII(this.hostname));var L=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+L,this.href+=this.host,C&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!v[O])for(T=0,x=l.length;T<x;T++){var q=l[T];if(-1!==b.indexOf(q)){var z=encodeURIComponent(q);z===q&&(z=escape(q)),b=b.split(q).join(z)}}var K=b.indexOf("#");-1!==K&&(this.hash=b.substr(K),b=b.slice(0,K));var V=b.indexOf("?");if(-1!==V?(this.search=b.substr(V),this.query=b.substr(V+1),t&&(this.query=m.parse(this.query)),b=b.slice(0,V)):t&&(this.search="",this.query={}),b&&(this.pathname=b),g[O]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){L=this.pathname||"";var G=this.search||"";this.path=L+G}return this.href=this.format(),this},o.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",n=this.pathname||"",r=this.hash||"",o=!1,s="";this.host?o=e+this.host:this.hostname&&(o=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(s=m.stringify(this.query));var a=this.search||s&&"?"+s||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||g[t])&&!1!==o?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):o||(o=""),r&&"#"!==r.charAt(0)&&(r="#"+r),a&&"?"!==a.charAt(0)&&(a="?"+a),t+o+(n=n.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(a=a.replace("#","%23"))+r},o.prototype.resolve=function(e){return this.resolveObject(b(e,!1,!0)).format()},o.prototype.resolveObject=function(e){if(i.isString(e)){var t=new o;t.parse(e,!1,!0),e=t}for(var n=new o,r=Object.keys(this),s=0;s<r.length;s++){var a=r[s];n[a]=this[a]}if(n.hash=e.hash,""===e.href)return n.href=n.format(),n;if(e.slashes&&!e.protocol){for(var u=Object.keys(e),c=0;c<u.length;c++){var l=u[c];"protocol"!==l&&(n[l]=e[l])}return g[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(e.protocol&&e.protocol!==n.protocol){if(!g[e.protocol]){for(var f=Object.keys(e),d=0;d<f.length;d++){var h=f[d];n[h]=e[h]}return n.href=n.format(),n}if(n.protocol=e.protocol,e.host||y[e.protocol])n.pathname=e.pathname;else{for(var p=(e.pathname||"").split("/");p.length&&!(e.host=p.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==p[0]&&p.unshift(""),p.length<2&&p.unshift(""),n.pathname=p.join("/")}if(n.search=e.search,n.query=e.query,n.host=e.host||"",n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,n.pathname||n.search){var v=n.pathname||"",m=n.search||"";n.path=v+m}return n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var b=n.pathname&&"/"===n.pathname.charAt(0),w=e.host||e.pathname&&"/"===e.pathname.charAt(0),S=w||b||n.host&&e.pathname,O=S,_=n.pathname&&n.pathname.split("/")||[],E=(p=e.pathname&&e.pathname.split("/")||[],n.protocol&&!g[n.protocol]);if(E&&(n.hostname="",n.port=null,n.host&&(""===_[0]?_[0]=n.host:_.unshift(n.host)),n.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===p[0]?p[0]=e.host:p.unshift(e.host)),e.host=null),S=S&&(""===p[0]||""===_[0])),w)n.host=e.host||""===e.host?e.host:n.host,n.hostname=e.hostname||""===e.hostname?e.hostname:n.hostname,n.search=e.search,n.query=e.query,_=p;else if(p.length)_||(_=[]),_.pop(),_=_.concat(p),n.search=e.search,n.query=e.query;else if(!i.isNullOrUndefined(e.search)){if(E)n.hostname=n.host=_.shift(),(C=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=C.shift(),n.host=n.hostname=C.shift());return n.search=e.search,n.query=e.query,i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!_.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var A=_.slice(-1)[0],I=(n.host||e.host||_.length>1)&&("."===A||".."===A)||""===A,T=0,j=_.length;j>=0;j--)"."===(A=_[j])?_.splice(j,1):".."===A?(_.splice(j,1),T++):T&&(_.splice(j,1),T--);if(!S&&!O)for(;T--;T)_.unshift("..");!S||""===_[0]||_[0]&&"/"===_[0].charAt(0)||_.unshift(""),I&&"/"!==_.join("/").substr(-1)&&_.push("");var C,P=""===_[0]||_[0]&&"/"===_[0].charAt(0);E&&(n.hostname=n.host=P?"":_.length?_.shift():"",(C=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=C.shift(),n.host=n.hostname=C.shift()));return(S=S||n.host&&_.length)&&!P&&_.unshift(""),_.length?n.pathname=_.join("/"):(n.pathname=null,n.path=null),i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){"use strict";var r=n(77),i=n.n(r).a;t.a=i},function(e,t,n){"use strict";var r;n.d(t,"a",(function(){return r})),function(e){e.DEFAULT_MSG="Authentication Error",e.EMPTY_EMAIL="Email cannot be empty",e.EMPTY_PHONE="Phone number cannot be empty",e.EMPTY_USERNAME="Username cannot be empty",e.INVALID_USERNAME="The username should either be a string or one of the sign in types",e.EMPTY_PASSWORD="Password cannot be empty",e.EMPTY_CODE="Confirmation code cannot be empty",e.SIGN_UP_ERROR="Error creating account",e.NO_MFA="No valid MFA method provided",e.INVALID_MFA="Invalid MFA type",e.EMPTY_CHALLENGE="Challenge response cannot be empty",e.NO_USER_SESSION="Failed to get the session because the user is empty",e.NETWORK_ERROR="Network Error",e.DEVICE_CONFIG="Device tracking has not been configured in this User Pool",e.AUTOSIGNIN_ERROR="Please use your credentials to sign in"}(r||(r={}))},function(e,t,n){(function(t){var r;e.exports=(r=r||function(e,r){var i;if("undefined"!=typeof window&&window.crypto&&(i=window.crypto),"undefined"!=typeof self&&self.crypto&&(i=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(i=globalThis.crypto),!i&&"undefined"!=typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&void 0!==t&&t.crypto&&(i=t.crypto),!i)try{i=n(88)}catch(e){}var o=function(){if(i){if("function"==typeof i.getRandomValues)try{return i.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof i.randomBytes)try{return i.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),a={},u=a.lib={},c=u.Base={extend:function(e){var t=s(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},l=u.WordArray=c.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||d).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,i=e.sigBytes;if(this.clamp(),r%4)for(var o=0;o<i;o++){var s=n[o>>>2]>>>24-o%4*8&255;t[r+o>>>2]|=s<<24-(r+o)%4*8}else for(var a=0;a<i;a+=4)t[r+a>>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(o());return new l.init(t,e)}}),f=a.enc={},d=f.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new l.init(n,t/2)}},h=f.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new l.init(n,t)}},p=f.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},v=u.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,i=r.words,o=r.sigBytes,s=this.blockSize,a=o/(4*s),u=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,c=e.min(4*u,o);if(u){for(var f=0;f<u;f+=s)this._doProcessBlock(i,f);n=i.splice(0,u),r.sigBytes-=c}return new l.init(n,c)},clone:function(){var e=c.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),y=(u.Hasher=v.extend({cfg:c.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){v.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new y.HMAC.init(e,n).finalize(t)}}}),a.algo={});return a}(Math),r)}).call(this,n(31))},function(e,t,n){"use strict";var r=n(59),i=Object.prototype.toString;function o(e){return Array.isArray(e)}function s(e){return void 0===e}function a(e){return"[object ArrayBuffer]"===i.call(e)}function u(e){return null!==e&&"object"==typeof e}function c(e){if("[object Object]"!==i.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function l(e){return"[object Function]"===i.call(e)}function f(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),o(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}e.exports={isArray:o,isArrayBuffer:a,isBuffer:function(e){return null!==e&&!s(e)&&null!==e.constructor&&!s(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"[object FormData]"===i.call(e)},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&a(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:u,isPlainObject:c,isUndefined:s,isDate:function(e){return"[object Date]"===i.call(e)},isFile:function(e){return"[object File]"===i.call(e)},isBlob:function(e){return"[object Blob]"===i.call(e)},isFunction:l,isStream:function(e){return u(e)&&l(e.pipe)},isURLSearchParams:function(e){return"[object URLSearchParams]"===i.call(e)},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:f,merge:function e(){var t={};function n(n,r){c(t[r])&&c(n)?t[r]=e(t[r],n):c(n)?t[r]=e({},n):o(n)?t[r]=n.slice():t[r]=n}for(var r=0,i=arguments.length;r<i;r++)f(arguments[r],n);return t},extend:function(e,t,n){return f(t,(function(t,i){e[i]=n&&"function"==typeof t?r(t,n):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));for(var r={},i={},o=0;o<256;o++){var s=o.toString(16).toLowerCase();1===s.length&&(s="0"+s),r[o]=s,i[s]=o}function a(e){for(var t="",n=0;n<e.byteLength;n++)t+=r[e[n]];return t}},function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function i(e){return!!e&&!!e[W]}function o(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Y}(e)||Array.isArray(e)||!!e[H]||!!e.constructor[H]||d(e)||h(e))}function s(e,t,n){void 0===n&&(n=!1),0===a(e)?(n?Object.keys:J)(e).forEach((function(r){n&&"symbol"==typeof r||t(r,e[r],e)})):e.forEach((function(n,r){return t(r,n,e)}))}function a(e){var t=e[W];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:d(e)?2:h(e)?3:0}function u(e,t){return 2===a(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function c(e,t){return 2===a(e)?e.get(t):e[t]}function l(e,t,n){var r=a(e);2===r?e.set(t,n):3===r?(e.delete(t),e.add(n)):e[t]=n}function f(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function d(e){return z&&e instanceof Map}function h(e){return K&&e instanceof Set}function p(e){return e.o||e.t}function v(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=$(e);delete t[W];for(var n=J(t),r=0;r<n.length;r++){var i=n[r],o=t[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(t[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function y(e,t){return void 0===t&&(t=!1),m(e)||i(e)||!o(e)||(a(e)>1&&(e.set=e.add=e.clear=e.delete=g),Object.freeze(e),t&&s(e,(function(e,t){return y(t,!0)}),!0)),e}function g(){r(2)}function m(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function b(e){var t=Z[e];return t||r(18,e),t}function w(e,t){Z[e]||(Z[e]=t)}function S(){return B}function O(e,t){t&&(b("Patches"),e.u=[],e.s=[],e.v=t)}function _(e){E(e),e.p.forEach(I),e.p=null}function E(e){e===B&&(B=e.l)}function A(e){return B={p:[],l:B,h:e,m:!0,_:0}}function I(e){var t=e[W];0===t.i||1===t.i?t.j():t.O=!0}function T(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||b("ES5").S(t,e,i),i?(n[W].P&&(_(t),r(4)),o(e)&&(e=j(t,e),t.l||P(t,e)),t.u&&b("Patches").M(n[W],e,t.u,t.s)):e=j(t,n,[]),_(t),t.u&&t.v(t.u,t.s),e!==G?e:void 0}function j(e,t,n){if(m(t))return t;var r=t[W];if(!r)return s(t,(function(i,o){return C(e,r,t,i,o,n)}),!0),t;if(r.A!==e)return t;if(!r.P)return P(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=4===r.i||5===r.i?r.o=v(r.k):r.o;s(3===r.i?new Set(i):i,(function(t,o){return C(e,r,i,t,o,n)})),P(e,i,!1),n&&e.u&&b("Patches").R(r,n,e.u,e.s)}return r.o}function C(e,t,n,r,s,a){if(i(s)){var c=j(e,s,a&&t&&3!==t.i&&!u(t.D,r)?a.concat(r):void 0);if(l(n,r,c),!i(c))return;e.m=!1}if(o(s)&&!m(s)){if(!e.h.F&&e._<1)return;j(e,s),t&&t.A.l||P(e,s)}}function P(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&y(t,n)}function x(e,t){var n=e[W];return(n?p(n):e)[t]}function k(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function N(e){e.P||(e.P=!0,e.l&&N(e.l))}function M(e){e.o||(e.o=v(e.t))}function D(e,t,n){var r=d(t)?b("MapSet").N(t,n):h(t)?b("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:S(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=r,o=Q;n&&(i=[r],o=X);var s=Proxy.revocable(i,o),a=s.revoke,u=s.proxy;return r.k=u,r.j=a,u}(t,n):b("ES5").J(t,n);return(n?n.A:S()).p.push(r),r}function R(e){return i(e)||r(22,e),function e(t){if(!o(t))return t;var n,r=t[W],i=a(t);if(r){if(!r.P&&(r.i<4||!b("ES5").K(r)))return r.t;r.I=!0,n=U(t,i),r.I=!1}else n=U(t,i);return s(n,(function(t,i){r&&c(r.t,t)===i||l(n,t,e(i))})),3===i?new Set(n):n}(e)}function U(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return v(e)}function F(){function e(t){if(!o(t))return t;if(Array.isArray(t))return t.map(e);if(d(t))return new Map(Array.from(t.entries()).map((function(t){return[t[0],e(t[1])]})));if(h(t))return new Set(Array.from(t).map(e));var n=Object.create(Object.getPrototypeOf(t));for(var r in t)n[r]=e(t[r]);return u(t,H)&&(n[H]=t[H]),n}function t(t){return i(t)?e(t):t}var n="add";w("Patches",{$:function(t,i){return i.forEach((function(i){for(var o=i.path,s=i.op,u=t,l=0;l<o.length-1;l++){var f=a(u),d=""+o[l];0!==f&&1!==f||"__proto__"!==d&&"constructor"!==d||r(24),"function"==typeof u&&"prototype"===d&&r(24),"object"!=typeof(u=c(u,d))&&r(15,o.join("/"))}var h=a(u),p=e(i.value),v=o[o.length-1];switch(s){case"replace":switch(h){case 2:return u.set(v,p);case 3:r(16);default:return u[v]=p}case n:switch(h){case 1:return u.splice(v,0,p);case 2:return u.set(v,p);case 3:return u.add(p);default:return u[v]=p}case"remove":switch(h){case 1:return u.splice(v,1);case 2:return u.delete(v);case 3:return u.delete(i.value);default:return delete u[v]}default:r(17,s)}})),t},R:function(e,r,i,o){switch(e.i){case 0:case 4:case 2:return function(e,r,i,o){var a=e.t,l=e.o;s(e.D,(function(e,s){var f=c(a,e),d=c(l,e),h=s?u(a,e)?"replace":n:"remove";if(f!==d||"replace"!==h){var p=r.concat(e);i.push("remove"===h?{op:h,path:p}:{op:h,path:p,value:d}),o.push(h===n?{op:"remove",path:p}:"remove"===h?{op:n,path:p,value:t(f)}:{op:"replace",path:p,value:t(f)})}}))}(e,r,i,o);case 5:case 1:return function(e,r,i,o){var s=e.t,a=e.D,u=e.o;if(u.length<s.length){var c=[u,s];s=c[0],u=c[1];var l=[o,i];i=l[0],o=l[1]}for(var f=0;f<s.length;f++)if(a[f]&&u[f]!==s[f]){var d=r.concat([f]);i.push({op:"replace",path:d,value:t(u[f])}),o.push({op:"replace",path:d,value:t(s[f])})}for(var h=s.length;h<u.length;h++){var p=r.concat([h]);i.push({op:n,path:p,value:t(u[h])})}s.length<u.length&&o.push({op:"replace",path:r.concat(["length"]),value:s.length})}(e,r,i,o);case 3:return function(e,t,r,i){var o=e.t,s=e.o,a=0;o.forEach((function(e){if(!s.has(e)){var o=t.concat([a]);r.push({op:"remove",path:o,value:e}),i.unshift({op:n,path:o,value:e})}a++})),a=0,s.forEach((function(e){if(!o.has(e)){var s=t.concat([a]);r.push({op:n,path:s,value:e}),i.unshift({op:"remove",path:s,value:e})}a++}))}(e,r,i,o)}},M:function(e,t,n,r){n.push({op:"replace",path:[],value:t===G?void 0:t}),r.push({op:"replace",path:[],value:e.t})}})}n.d(t,"a",(function(){return re})),n.d(t,"b",(function(){return F})),n.d(t,"c",(function(){return H})),n.d(t,"d",(function(){return te})),n.d(t,"e",(function(){return ne}));var L,B,q="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),z="undefined"!=typeof Map,K="undefined"!=typeof Set,V="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,G=q?Symbol.for("immer-nothing"):((L={})["immer-nothing"]=!0,L),H=q?Symbol.for("immer-draftable"):"__$immer_draftable",W=q?Symbol.for("immer-state"):"__$immer_state",Y=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),J="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,$=Object.getOwnPropertyDescriptors||function(e){var t={};return J(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Z={},Q={get:function(e,t){if(t===W)return e;var n=p(e);if(!u(n,t))return function(e,t,n){var r,i=k(t,n);return i?"value"in i?i.value:null===(r=i.get)||void 0===r?void 0:r.call(e.k):void 0}(e,n,t);var r=n[t];return e.I||!o(r)?r:r===x(e.t,t)?(M(e),e.o[t]=D(e.A.h,r,e)):r},has:function(e,t){return t in p(e)},ownKeys:function(e){return Reflect.ownKeys(p(e))},set:function(e,t,n){var r=k(p(e),t);if(null==r?void 0:r.set)return r.set.call(e.k,n),!0;if(!e.P){var i=x(p(e),t),o=null==i?void 0:i[W];if(o&&o.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(f(n,i)&&(void 0!==n||u(e.t,t)))return!0;M(e),N(e)}return e.o[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.o)||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==x(e.t,t)||t in e.t?(e.D[t]=!1,M(e),N(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=p(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty:function(){r(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){r(12)}},X={};s(Q,(function(e,t){X[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),X.deleteProperty=function(e,t){return Q.deleteProperty.call(this,e[0],t)},X.set=function(e,t,n){return Q.set.call(this,e[0],t,n,e[0])};var ee=new(function(){function e(e){var t=this;this.g=V,this.F=!0,this.produce=function(e,n,i){if("function"==typeof e&&"function"!=typeof n){var s=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=s);for(var r=arguments.length,i=Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return a.produce(e,(function(e){var r;return(r=n).call.apply(r,[t,e].concat(i))}))}}var u;if("function"!=typeof n&&r(6),void 0!==i&&"function"!=typeof i&&r(7),o(e)){var c=A(t),l=D(t,e,void 0),f=!0;try{u=n(l),f=!1}finally{f?_(c):E(c)}return"undefined"!=typeof Promise&&u instanceof Promise?u.then((function(e){return O(c,i),T(e,c)}),(function(e){throw _(c),e})):(O(c,i),T(u,c))}if(!e||"object"!=typeof e){if((u=n(e))===G)return;return void 0===u&&(u=e),t.F&&y(u,!0),u}r(21,e)},this.produceWithPatches=function(e,n){return"function"==typeof e?function(n){for(var r=arguments.length,i=Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(i))}))}:[t.produce(e,n,(function(e,t){r=e,i=t})),r,i];var r,i},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){o(e)||r(8),i(e)&&(e=R(e));var t=A(this),n=D(this,e,void 0);return n[W].C=!0,E(t),n},t.finishDraft=function(e,t){var n=(e&&e[W]).A;return O(n,t),T(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!V&&r(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}var o=b("Patches").$;return i(e)?o(e,t):this.produce(e,(function(e){return o(e,t.slice(n+1))}))},e}()),te=ee.produce,ne=(ee.produceWithPatches.bind(ee),ee.setAutoFreeze.bind(ee)),re=(ee.setUseProxies.bind(ee),ee.applyPatches.bind(ee));ee.createDraft.bind(ee),ee.finishDraft.bind(ee)},function(e,t,n){"use strict";(function(e){n.d(t,"d",(function(){return l})),n.d(t,"c",(function(){return f})),n.d(t,"b",(function(){return d})),n.d(t,"a",(function(){return y}));var r=[{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"}],i=function(e){return void 0===e&&(e={}),0===Object.keys(e).length},o=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},s=function(e,t){var n=Object.assign({},e);return t&&("string"==typeof t?delete n[t]:t.forEach((function(e){delete n[e]}))),n},a=function(e,t){void 0===t&&(t="application/octet-stream");var n=e.toLowerCase(),i=r.filter((function(e){return n.endsWith("."+e.ext)}));return i.length>0?i[0].type:t},u=function(e){var t=e.toLowerCase();return!!t.startsWith("text/")||("application/json"===t||"application/xml"===t||"application/sh"===t)},c=function(){for(var e="",t="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=32;n>0;n-=1)e+=t[Math.floor(Math.random()*t.length)];return e},l=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},f=function(){if("undefined"==typeof self)return!1;var e=self;return void 0!==e.WorkerGlobalScope&&self instanceof e.WorkerGlobalScope},d=function(){return{isBrowser:"undefined"!=typeof window&&void 0!==window.document,isNode:void 0!==e&&null!=e.versions&&null!=e.versions.node}},h=function e(t,n,r){if(void 0===n&&(n=[]),void 0===r&&(r=[]),!v(t))return t;var i={};for(var o in t){if(t.hasOwnProperty(o))i[n.includes(o)?o:o[0].toLowerCase()+o.slice(1)]=r.includes(o)?t[o]:e(t[o],n,r)}return i},p=function e(t,n,r){if(void 0===n&&(n=[]),void 0===r&&(r=[]),!v(t))return t;var i={};for(var o in t){if(t.hasOwnProperty(o))i[n.includes(o)?o:o[0].toUpperCase()+o.slice(1)]=r.includes(o)?t[o]:e(t[o],n,r)}return i},v=function(e){return!(!(e instanceof Object)||e instanceof Array||e instanceof Function||e instanceof Number||e instanceof String||e instanceof Boolean)},y=function(){function e(){}return e.isEmpty=i,e.sortByField=o,e.objectLessAttributes=s,e.filenameToContentType=a,e.isTextFile=u,e.generateRandomString=c,e.makeQuerablePromise=l,e.isWebWorker=f,e.browserOrNode=d,e.transferKeyToLowerCase=h,e.transferKeyToUpperCase=p,e.isStrictObject=v,e}()}).call(this,n(48))},function(e,t,n){"use strict";var r=n(35);n(8);t.a=r.a},function(e,t,n){"use strict";var r=n(0),i=n(35),o=n(20),s=n(22),a=n(154),u=n(36),c={clockOffset:0,getDateWithClockOffset:function(){return c.clockOffset?new Date((new Date).getTime()+c.clockOffset):new Date},getClockOffset:function(){return c.clockOffset},getHeaderStringFromDate:function(e){return void 0===e&&(e=c.getDateWithClockOffset()),e.toISOString().replace(/[:\-]|\.\d{3}/g,"")},getDateFromHeaderString:function(e){var t=Object(r.f)(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()-c.getDateWithClockOffset().getTime())>=3e5},isClockSkewError:function(e){if(!e.response||!e.response.headers)return!1;var t=e.response.headers;return Boolean(["BadRequestException","InvalidSignatureException"].includes(t["x-amzn-errortype"])&&(t.date||t.Date))},setClockOffset:function(e){c.clockOffset=e}},l=n(41),f=n(14),d=n(9);function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var p=new s.a("Signer"),v=function(e,t){var n=new l.Sha256(e);return n.update(t),n.digestSync()},y=function(e){var t=e||"",n=new l.Sha256;return n.update(t),Object(f.a)(n.digestSync())},g=function(e){return Object.keys(e).map((function(e){return e.toLowerCase()})).sort().join(";")},m=function(e){var t,n,r=Object(d.parse)(e.url);return[e.method||"/",encodeURIComponent(r.pathname).replace(/%2F/gi,"/"),(n=r.query,n&&0!==n.length?n.split("&").map((function(e){var t=e.split("=");if(1===t.length)return e;var n=t[1].replace(/[!'()*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}));return t[0]+"="+n})).sort((function(e,t){var n=e.split("=")[0],r=t.split("=")[0];return n===r?e<t?-1:1:n<r?-1:1})).join("&"):""),(t=e.headers,t&&0!==Object.keys(t).length?Object.keys(t).map((function(e){return{key:e.toLowerCase(),value:t[e]?t[e].trim().replace(/\s+/g," "):""}})).sort((function(e,t){return e.key<t.key?-1:1})).map((function(e){return e.key+":"+e.value})).join("\n")+"\n":""),g(e.headers),y(e.data)].join("\n")},b=function(e){var t=(Object(d.parse)(e.url).host.match(/([^\.]+)\.(?:([^\.]*)\.)?amazonaws\.com$/)||[]).slice(1,3);return"es"===t[1]&&(t=t.reverse()),{service:e.service||t[0],region:e.region||t[1]}},w=function(e,t,n){return[e,t,n,"aws4_request"].join("/")},S=function(e,t,n,r){return[e,n,r,y(t)].join("\n")},O=function(e,t,n){p.debug(n);var r=v("AWS4"+e,t),i=v(r,n.region),o=v(i,n.service);return v(o,"aws4_request")},_=function(e,t){return Object(f.a)(v(e,t))},E=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 new Error('The attribute "body" was found on the request object. Please use the attribute "data" instead.');var r=c.getDateWithClockOffset().toISOString().replace(/[:\-]|\.\d{3}/g,""),i=r.substr(0,8),o=Object(d.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 s=m(e);p.debug(s);var a=n||b(e),u=w(i,a.region,a.service),l=S("AWS4-HMAC-SHA256",s,r,u),f=O(t.secret_key,i,a),h=_(f,l),v=function(e,t,n,r,i){return[e+" Credential="+t+"/"+n,"SignedHeaders="+r,"Signature="+i].join(", ")}("AWS4-HMAC-SHA256",t.access_key,u,g(e.headers),h);return e.headers.Authorization=v,e},e.signUrl=function(e,t,n,i){var o="object"===h(e)?e.url:e,s="object"===h(e)?e.method:"GET",a="object"===h(e)?e.body:void 0,u=c.getDateWithClockOffset().toISOString().replace(/[:\-]|\.\d{3}/g,""),l=u.substr(0,8),f=Object(d.parse)(o,!0,!0),p=(f.search,Object(r.g)(f,["search"])),v={host:p.host},y=n||b({url:Object(d.format)(p)}),g=y.region,E=y.service,A=w(l,g,E),I=t.session_token&&"iotdevicegateway"!==E,T=Object(r.a)(Object(r.a)(Object(r.a)({"X-Amz-Algorithm":"AWS4-HMAC-SHA256","X-Amz-Credential":[t.access_key,A].join("/"),"X-Amz-Date":u.substr(0,16)},I?{"X-Amz-Security-Token":""+t.session_token}:{}),i?{"X-Amz-Expires":""+i}:{}),{"X-Amz-SignedHeaders":Object.keys(v).join(",")}),j=m({method:s,url:Object(d.format)(Object(r.a)(Object(r.a)({},p),{query:Object(r.a)(Object(r.a)({},p.query),T)})),headers:v,data:a}),C=S("AWS4-HMAC-SHA256",j,u,A),P=O(t.secret_key,l,{region:g,service:E}),x=_(P,C),k=Object(r.a)({"X-Amz-Signature":x},t.session_token&&{"X-Amz-Security-Token":t.session_token});return Object(d.format)({protocol:p.protocol,slashes:!0,hostname:p.hostname,port:p.port,pathname:p.pathname,query:Object(r.a)(Object(r.a)(Object(r.a)({},p.query),T),k)})},e}(),A=n(30),I=n.n(A),T=new s.a("RestClient"),j=function(){function e(e){this._region="us-east-1",this._service="execute-api",this._custom_header=void 0,this._cancelTokenMap=null,this.Credentials=a.a,this._options=e,T.debug("API Options",this._options),null==this._cancelTokenMap&&(this._cancelTokenMap=new WeakMap)}return e.prototype.ajax=function(e,t,n){return Object(r.c)(this,void 0,void 0,(function(){var i,o,s,a,l,f,h,p,v,y,g,m,b,w,S=this;return Object(r.e)(this,(function(O){switch(O.label){case 0:return T.debug(t,e),s="us-east-1",a="execute-api",l=void 0,"string"==typeof e?(i=this._parseUrl(e),o=e):(o=e.endpoint,l=e.custom_header,s=e.region,a=e.service,i=this._parseUrl(e.endpoint)),f={method:t,url:o,host:i.host,path:i.path,headers:{},data:null,responseType:"json",timeout:0,cancelToken:null},h={},u.a.isReactNative&&(p=u.a.userAgent||"aws-amplify/0.1.x",h={"User-Agent":p}),v=Object.assign({},n),y=v.response,v.body&&("function"==typeof FormData&&v.body instanceof FormData?(h["Content-Type"]="multipart/form-data",f.data=v.body):(h["Content-Type"]="application/json; charset=UTF-8",f.data=JSON.stringify(v.body))),v.responseType&&(f.responseType=v.responseType),v.withCredentials&&(f.withCredentials=v.withCredentials),v.timeout&&(f.timeout=v.timeout),v.cancellableToken&&(f.cancelToken=v.cancellableToken.token),f.signerServiceInfo=v.signerServiceInfo,"function"!=typeof l?[3,2]:[4,l()];case 1:return m=O.sent(),[3,3];case 2:m=void 0,O.label=3;case 3:return g=m,f.headers=Object(r.a)(Object(r.a)(Object(r.a)({},h),g),v.headers),b=Object(d.parse)(o,!0,!0),b.search,w=Object(r.g)(b,["search"]),f.url=Object(d.format)(Object(r.a)(Object(r.a)({},w),{query:Object(r.a)(Object(r.a)({},w.query),v.queryStringParameters||{})})),void 0!==f.headers.Authorization?(f.headers=Object.keys(f.headers).reduce((function(e,t){return f.headers[t]&&(e[t]=f.headers[t]),e}),{}),[2,this._request(f,y)]):[2,this.Credentials.get().then((function(i){return S._signed(Object(r.a)({},f),i,y,{region:s,service:a}).catch((function(r){if(c.isClockSkewError(r)){var i=r.response.headers,o=i&&(i.date||i.Date),s=new Date(o),a=c.getDateFromHeaderString(f.headers["x-amz-date"]);if(c.isClockSkewed(s))return c.setClockOffset(s.getTime()-a.getTime()),S.ajax(e,t,n)}throw r}))}),(function(e){return T.debug("No credentials available, the request will be unsigned"),S._request(f,y)}))]}}))}))},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 I.a.isCancel(e)},e.prototype.getCancellableToken=function(){return I.a.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="";return 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):r},e.prototype._signed=function(e,t,n,i){var o=i.service,s=i.region,a=e.signerServiceInfo,u=Object(r.g)(e,["signerServiceInfo"]),c=s||this._region||this._options.region,l=o||this._service||this._options.service,f={secret_key:t.secretAccessKey,access_key:t.accessKeyId,session_token:t.sessionToken},d={region:c,service:l},h=Object.assign(d,a),p=E.sign(u,f,h);return p.data&&(p.body=p.data),T.debug("Signed Request: ",p),delete p.headers.host,I()(p).then((function(e){return n?e:e.data})).catch((function(e){throw T.debug(e),e}))},e.prototype._request=function(e,t){return void 0===t&&(t=!1),I()(e).then((function(e){return t?e:e.data})).catch((function(e){throw T.debug(e),e}))},e.prototype._parseUrl=function(e){var t=e.split("/");return{host:t[2],path:"/"+t.slice(3).join("/")}},e}(),C=n(40),P=new s.a("RestAPI"),x=function(){function e(e){this._api=null,this.Credentials=a.a,this._options=e,P.debug("API Options",this._options)}return e.prototype.getModuleName=function(){return"RestAPI"},e.prototype.configure=function(e){var t=e||{},n=t.API,i=void 0===n?{}:n,o=Object(r.g)(t,["API"]),s=Object(r.a)(Object(r.a)({},o),i);if(P.debug("configure Rest API",{opt:s}),s.aws_project_region){if(s.aws_cloud_logic_custom){var a=s.aws_cloud_logic_custom;s.endpoints="string"==typeof a?JSON.parse(a):a}s=Object.assign({},s,{region:s.aws_project_region,header:{}})}return Array.isArray(s.endpoints)?s.endpoints.forEach((function(e){void 0!==e.custom_header&&"function"!=typeof e.custom_header&&(P.warn("Rest API "+e.name+", custom_header should be a function"),e.custom_header=void 0)})):this._options&&Array.isArray(this._options.endpoints)?s.endpoints=this._options.endpoints:s.endpoints=[],this._options=Object.assign({},this._options,s),this.createInstance(),this._options},e.prototype.createInstance=function(){return P.debug("create Rest API instance"),this._api=new j(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){return Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(this,(function(t){return[2,this._api.endpoint(e)]}))}))},e.prototype.getEndpointInfo=function(e,t){var n=this._options.endpoints;if(!Array.isArray(n))throw new Error("API category not configured");var r=n.find((function(t){return t.name===e}));if(!r)throw new 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}(),k=new x(null);function N(e){return(N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}C.a.register(k);"function"==typeof Symbol&&null!=Symbol.iterator&&Symbol.iterator,"function"==typeof Symbol&&null!=Symbol.asyncIterator&&Symbol.asyncIterator;var M="function"==typeof Symbol&&null!=Symbol.toStringTag?Symbol.toStringTag:"@@toStringTag";function D(e,t){for(var n,r=/\r\n|[\n\r]/g,i=1,o=t+1;(n=r.exec(e.body))&&n.index<t;)i+=1,o=t+1-(n.index+n[0].length);return{line:i,column:o}}function R(e){return U(e.source,D(e.source,e.start))}function U(e,t){var n=e.locationOffset.column-1,r=L(n)+e.body,i=t.line-1,o=e.locationOffset.line-1,s=t.line+o,a=1===t.line?n:0,u=t.column+a,c="".concat(e.name,":").concat(s,":").concat(u,"\n"),l=r.split(/\r\n|[\n\r]/g),f=l[i];if(f.length>120){for(var d=Math.floor(u/80),h=u%80,p=[],v=0;v<f.length;v+=80)p.push(f.slice(v,v+80));return c+F([["".concat(s),p[0]]].concat(p.slice(1,d+1).map((function(e){return["",e]})),[[" ",L(h-1)+"^"],["",p[d+1]]]))}return c+F([["".concat(s-1),l[i-1]],["".concat(s),f],["",L(u-1)+"^"],["".concat(s+1),l[i+1]]])}function F(e){var t=e.filter((function(e){e[0];return void 0!==e[1]})),n=Math.max.apply(Math,t.map((function(e){return e[0].length})));return t.map((function(e){var t,r=e[0],i=e[1];return L(n-(t=r).length)+t+(i?" | "+i:" |")})).join("\n")}function L(e){return Array(e+1).join(" ")}function B(e){return(B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function z(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function K(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function V(e,t){return!t||"object"!==B(t)&&"function"!=typeof t?G(e):t}function G(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function H(e){var t="function"==typeof Map?new Map:void 0;return(H=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return W(e,arguments,$(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),J(r,e)})(e)}function W(e,t,n){return(W=Y()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&J(i,n.prototype),i}).apply(null,arguments)}function Y(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function J(e,t){return(J=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function $(e){return($=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Z=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&J(e,t)}(a,e);var t,n,r,i,o,s=(t=a,n=Y(),function(){var e,r=$(t);if(n){var i=$(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return V(this,e)});function a(e,t,n,r,i,o,u){var c,l,f,d;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(d=s.call(this,e)).name="GraphQLError",d.originalError=null!=o?o:void 0,d.nodes=Q(Array.isArray(t)?t:t?[t]:void 0);for(var h=[],p=0,v=null!==(y=d.nodes)&&void 0!==y?y:[];p<v.length;p++){var y,g=v[p].loc;null!=g&&h.push(g)}h=Q(h),d.source=null!=n?n:null===(c=h)||void 0===c?void 0:c[0].source,d.positions=null!=r?r:null===(l=h)||void 0===l?void 0:l.map((function(e){return e.start})),d.locations=r&&n?r.map((function(e){return D(n,e)})):null===(f=h)||void 0===f?void 0:f.map((function(e){return D(e.source,e.start)})),d.path=null!=i?i:void 0;var m,b=null==o?void 0:o.extensions;return null==u&&("object"==N(m=b)&&null!==m)?d.extensions=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?q(Object(n),!0).forEach((function(t){z(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},b):d.extensions=null!=u?u:{},Object.defineProperties(G(d),{message:{enumerable:!0},locations:{enumerable:null!=d.locations},path:{enumerable:null!=d.path},extensions:{enumerable:null!=d.extensions&&Object.keys(d.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=o&&o.stack?(Object.defineProperty(G(d),"stack",{value:o.stack,writable:!0,configurable:!0}),V(d)):(Error.captureStackTrace?Error.captureStackTrace(G(d),a):Object.defineProperty(G(d),"stack",{value:Error().stack,writable:!0,configurable:!0}),d)}return r=a,(i=[{key:"toString",value:function(){return function(e){var t=e.message;if(e.nodes)for(var n=0,r=e.nodes;n<r.length;n++){var i=r[n];i.loc&&(t+="\n\n"+R(i.loc))}else if(e.source&&e.locations)for(var o=0,s=e.locations;o<s.length;o++){var a=s[o];t+="\n\n"+U(e.source,a)}return t}(this)}},{key:M,get:function(){return"Object"}}])&&K(r.prototype,i),o&&K(r,o),a}(H(Error));function Q(e){return void 0===e||0===e.length?void 0:e}function X(e,t,n){return new Z("Syntax Error: ".concat(n),void 0,e,[t])}var ee=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});var te="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):void 0;function ne(e){var t=e.prototype.toJSON;"function"==typeof t||function(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}(0),e.prototype.inspect=t,te&&(e.prototype[te]=t)}var re=function(){function e(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}return e.prototype.toJSON=function(){return{start:this.start,end:this.end}},e}();ne(re);var ie=function(){function e(e,t,n,r,i,o,s){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=i,this.value=s,this.prev=o,this.next=null}return e.prototype.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},e}();function oe(e){return null!=e&&"string"==typeof e.kind}ne(ie);var se=Object.freeze({SOF:"<SOF>",EOF:"<EOF>",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"});function ae(e){return(ae="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ue(e){return ce(e,[])}function ce(e,t){switch(ae(e)){case"string":return JSON.stringify(e);case"function":return e.name?"[function ".concat(e.name,"]"):"[function]";case"object":return null===e?"null":function(e,t){if(-1!==t.indexOf(e))return"[Circular]";var n=[].concat(t,[e]),r=function(e){var t=e[String(te)];if("function"==typeof t)return t;if("function"==typeof e.inspect)return e.inspect}(e);if(void 0!==r){var i=r.call(e);if(i!==e)return"string"==typeof i?i:ce(i,n)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>2)return"[Array]";for(var n=Math.min(10,e.length),r=e.length-n,i=[],o=0;o<n;++o)i.push(ce(e[o],t));1===r?i.push("... 1 more item"):r>1&&i.push("... ".concat(r," more items"));return"["+i.join(", ")+"]"}(e,n);return function(e,t){var n=Object.keys(e);if(0===n.length)return"{}";if(t.length>2)return"["+function(e){var t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){var n=e.constructor.name;if("string"==typeof n&&""!==n)return n}return t}(e)+"]";return"{ "+n.map((function(n){return n+": "+ce(e[n],t)})).join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}function le(e,t){if(!Boolean(e))throw new Error(t)}var fe=function(e,t){return e instanceof t};function de(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var he=function(){function e(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GraphQL request",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{line:1,column:1};"string"==typeof e||le(0,"Body must be a string. Received: ".concat(ue(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||le(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||le(0,"column in locationOffset is 1-indexed and must be positive.")}var t,n,r;return t=e,(n=[{key:M,get:function(){return"Source"}}])&&de(t.prototype,n),r&&de(t,r),e}();var pe=Object.freeze({QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION"});function ve(e){var t=e.split(/\r\n|[\n\r]/g),n=function(e){for(var t,n=!0,r=!0,i=0,o=null,s=0;s<e.length;++s)switch(e.charCodeAt(s)){case 13:10===e.charCodeAt(s+1)&&++s;case 10:n=!1,r=!0,i=0;break;case 9:case 32:++i;break;default:r&&!n&&(null===o||i<o)&&(o=i),r=!1}return null!==(t=o)&&void 0!==t?t:0}(e);if(0!==n)for(var r=1;r<t.length;r++)t[r]=t[r].slice(n);for(var i=0;i<t.length&&ye(t[i]);)++i;for(var o=t.length;o>i&&ye(t[o-1]);)--o;return t.slice(i,o).join("\n")}function ye(e){for(var t=0;t<e.length;++t)if(" "!==e[t]&&"\t"!==e[t])return!1;return!0}var ge=function(){function e(e){var t=new ie(se.SOF,0,0,0,0,null);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}var t=e.prototype;return t.advance=function(){return this.lastToken=this.token,this.token=this.lookahead()},t.lookahead=function(){var e=this.token;if(e.kind!==se.EOF)do{var t;e=null!==(t=e.next)&&void 0!==t?t:e.next=be(this,e)}while(e.kind===se.COMMENT);return e},e}();function me(e){return isNaN(e)?se.EOF:e<127?JSON.stringify(String.fromCharCode(e)):'"\\u'.concat(("00"+e.toString(16).toUpperCase()).slice(-4),'"')}function be(e,t){for(var n=e.source,r=n.body,i=r.length,o=t.end;o<i;){var s=r.charCodeAt(o),a=e.line,u=1+o-e.lineStart;switch(s){case 65279:case 9:case 32:case 44:++o;continue;case 10:++o,++e.line,e.lineStart=o;continue;case 13:10===r.charCodeAt(o+1)?o+=2:++o,++e.line,e.lineStart=o;continue;case 33:return new ie(se.BANG,o,o+1,a,u,t);case 35:return Se(n,o,a,u,t);case 36:return new ie(se.DOLLAR,o,o+1,a,u,t);case 38:return new ie(se.AMP,o,o+1,a,u,t);case 40:return new ie(se.PAREN_L,o,o+1,a,u,t);case 41:return new ie(se.PAREN_R,o,o+1,a,u,t);case 46:if(46===r.charCodeAt(o+1)&&46===r.charCodeAt(o+2))return new ie(se.SPREAD,o,o+3,a,u,t);break;case 58:return new ie(se.COLON,o,o+1,a,u,t);case 61:return new ie(se.EQUALS,o,o+1,a,u,t);case 64:return new ie(se.AT,o,o+1,a,u,t);case 91:return new ie(se.BRACKET_L,o,o+1,a,u,t);case 93:return new ie(se.BRACKET_R,o,o+1,a,u,t);case 123:return new ie(se.BRACE_L,o,o+1,a,u,t);case 124:return new ie(se.PIPE,o,o+1,a,u,t);case 125:return new ie(se.BRACE_R,o,o+1,a,u,t);case 34:return 34===r.charCodeAt(o+1)&&34===r.charCodeAt(o+2)?Ae(n,o,a,u,t,e):Ee(n,o,a,u,t);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return Oe(n,o,s,a,u,t);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:return Te(n,o,a,u,t)}throw X(n,o,we(s))}var c=e.line,l=1+o-e.lineStart;return new ie(se.EOF,i,i,c,l,t)}function we(e){return e<32&&9!==e&&10!==e&&13!==e?"Cannot contain the invalid character ".concat(me(e),"."):39===e?"Unexpected single quote character ('), did you mean to use a double quote (\")?":"Cannot parse the unexpected character ".concat(me(e),".")}function Se(e,t,n,r,i){var o,s=e.body,a=t;do{o=s.charCodeAt(++a)}while(!isNaN(o)&&(o>31||9===o));return new ie(se.COMMENT,t,a,n,r,i,s.slice(t+1,a))}function Oe(e,t,n,r,i,o){var s=e.body,a=n,u=t,c=!1;if(45===a&&(a=s.charCodeAt(++u)),48===a){if((a=s.charCodeAt(++u))>=48&&a<=57)throw X(e,u,"Invalid number, unexpected digit after 0: ".concat(me(a),"."))}else u=_e(e,u,a),a=s.charCodeAt(u);if(46===a&&(c=!0,a=s.charCodeAt(++u),u=_e(e,u,a),a=s.charCodeAt(u)),69!==a&&101!==a||(c=!0,43!==(a=s.charCodeAt(++u))&&45!==a||(a=s.charCodeAt(++u)),u=_e(e,u,a),a=s.charCodeAt(u)),46===a||function(e){return 95===e||e>=65&&e<=90||e>=97&&e<=122}(a))throw X(e,u,"Invalid number, expected digit but got: ".concat(me(a),"."));return new ie(c?se.FLOAT:se.INT,t,u,r,i,o,s.slice(t,u))}function _e(e,t,n){var r=e.body,i=t,o=n;if(o>=48&&o<=57){do{o=r.charCodeAt(++i)}while(o>=48&&o<=57);return i}throw X(e,i,"Invalid number, expected digit but got: ".concat(me(o),"."))}function Ee(e,t,n,r,i){for(var o,s,a,u,c=e.body,l=t+1,f=l,d=0,h="";l<c.length&&!isNaN(d=c.charCodeAt(l))&&10!==d&&13!==d;){if(34===d)return h+=c.slice(f,l),new ie(se.STRING,t,l+1,n,r,i,h);if(d<32&&9!==d)throw X(e,l,"Invalid character within String: ".concat(me(d),"."));if(++l,92===d){switch(h+=c.slice(f,l-1),d=c.charCodeAt(l)){case 34:h+='"';break;case 47:h+="/";break;case 92:h+="\\";break;case 98:h+="\b";break;case 102:h+="\f";break;case 110:h+="\n";break;case 114:h+="\r";break;case 116:h+="\t";break;case 117:var p=(o=c.charCodeAt(l+1),s=c.charCodeAt(l+2),a=c.charCodeAt(l+3),u=c.charCodeAt(l+4),Ie(o)<<12|Ie(s)<<8|Ie(a)<<4|Ie(u));if(p<0){var v=c.slice(l+1,l+5);throw X(e,l,"Invalid character escape sequence: \\u".concat(v,"."))}h+=String.fromCharCode(p),l+=4;break;default:throw X(e,l,"Invalid character escape sequence: \\".concat(String.fromCharCode(d),"."))}f=++l}}throw X(e,l,"Unterminated string.")}function Ae(e,t,n,r,i,o){for(var s=e.body,a=t+3,u=a,c=0,l="";a<s.length&&!isNaN(c=s.charCodeAt(a));){if(34===c&&34===s.charCodeAt(a+1)&&34===s.charCodeAt(a+2))return l+=s.slice(u,a),new ie(se.BLOCK_STRING,t,a+3,n,r,i,ve(l));if(c<32&&9!==c&&10!==c&&13!==c)throw X(e,a,"Invalid character within String: ".concat(me(c),"."));10===c?(++a,++o.line,o.lineStart=a):13===c?(10===s.charCodeAt(a+1)?a+=2:++a,++o.line,o.lineStart=a):92===c&&34===s.charCodeAt(a+1)&&34===s.charCodeAt(a+2)&&34===s.charCodeAt(a+3)?(l+=s.slice(u,a)+'"""',u=a+=4):++a}throw X(e,a,"Unterminated string.")}function Ie(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Te(e,t,n,r,i){for(var o=e.body,s=o.length,a=t+1,u=0;a!==s&&!isNaN(u=o.charCodeAt(a))&&(95===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122);)++a;return new ie(se.NAME,t,a,n,r,i,o.slice(t,a))}function je(e,t){return new Ce(e,t).parseDocument()}var Ce=function(){function e(e,t){var n=function(e){return fe(e,he)}(e)?e:new he(e);this._lexer=new ge(n),this._options=t}var t=e.prototype;return t.parseName=function(){var e=this.expectToken(se.NAME);return{kind:ee.NAME,value:e.value,loc:this.loc(e)}},t.parseDocument=function(){var e=this._lexer.token;return{kind:ee.DOCUMENT,definitions:this.many(se.SOF,this.parseDefinition,se.EOF),loc:this.loc(e)}},t.parseDefinition=function(){if(this.peek(se.NAME))switch(this._lexer.token.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return this.parseTypeSystemDefinition();case"extend":return this.parseTypeSystemExtension()}else{if(this.peek(se.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},t.parseOperationDefinition=function(){var e=this._lexer.token;if(this.peek(se.BRACE_L))return{kind:ee.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(e)};var t,n=this.parseOperationType();return this.peek(se.NAME)&&(t=this.parseName()),{kind:ee.OPERATION_DEFINITION,operation:n,name:t,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseOperationType=function(){var e=this.expectToken(se.NAME);switch(e.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(e)},t.parseVariableDefinitions=function(){return this.optionalMany(se.PAREN_L,this.parseVariableDefinition,se.PAREN_R)},t.parseVariableDefinition=function(){var e=this._lexer.token;return{kind:ee.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(se.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(se.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(e)}},t.parseVariable=function(){var e=this._lexer.token;return this.expectToken(se.DOLLAR),{kind:ee.VARIABLE,name:this.parseName(),loc:this.loc(e)}},t.parseSelectionSet=function(){var e=this._lexer.token;return{kind:ee.SELECTION_SET,selections:this.many(se.BRACE_L,this.parseSelection,se.BRACE_R),loc:this.loc(e)}},t.parseSelection=function(){return this.peek(se.SPREAD)?this.parseFragment():this.parseField()},t.parseField=function(){var e,t,n=this._lexer.token,r=this.parseName();return this.expectOptionalToken(se.COLON)?(e=r,t=this.parseName()):t=r,{kind:ee.FIELD,alias:e,name:t,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(se.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},t.parseArguments=function(e){var t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(se.PAREN_L,t,se.PAREN_R)},t.parseArgument=function(){var e=this._lexer.token,t=this.parseName();return this.expectToken(se.COLON),{kind:ee.ARGUMENT,name:t,value:this.parseValueLiteral(!1),loc:this.loc(e)}},t.parseConstArgument=function(){var e=this._lexer.token;return{kind:ee.ARGUMENT,name:this.parseName(),value:(this.expectToken(se.COLON),this.parseValueLiteral(!0)),loc:this.loc(e)}},t.parseFragment=function(){var e=this._lexer.token;this.expectToken(se.SPREAD);var t=this.expectOptionalKeyword("on");return!t&&this.peek(se.NAME)?{kind:ee.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(e)}:{kind:ee.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseFragmentDefinition=function(){var e,t=this._lexer.token;return this.expectKeyword("fragment"),!0===(null===(e=this._options)||void 0===e?void 0:e.experimentalFragmentVariables)?{kind:ee.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(t)}:{kind:ee.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(t)}},t.parseFragmentName=function(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()},t.parseValueLiteral=function(e){var t=this._lexer.token;switch(t.kind){case se.BRACKET_L:return this.parseList(e);case se.BRACE_L:return this.parseObject(e);case se.INT:return this._lexer.advance(),{kind:ee.INT,value:t.value,loc:this.loc(t)};case se.FLOAT:return this._lexer.advance(),{kind:ee.FLOAT,value:t.value,loc:this.loc(t)};case se.STRING:case se.BLOCK_STRING:return this.parseStringLiteral();case se.NAME:switch(this._lexer.advance(),t.value){case"true":return{kind:ee.BOOLEAN,value:!0,loc:this.loc(t)};case"false":return{kind:ee.BOOLEAN,value:!1,loc:this.loc(t)};case"null":return{kind:ee.NULL,loc:this.loc(t)};default:return{kind:ee.ENUM,value:t.value,loc:this.loc(t)}}case se.DOLLAR:if(!e)return this.parseVariable()}throw this.unexpected()},t.parseStringLiteral=function(){var e=this._lexer.token;return this._lexer.advance(),{kind:ee.STRING,value:e.value,block:e.kind===se.BLOCK_STRING,loc:this.loc(e)}},t.parseList=function(e){var t=this,n=this._lexer.token;return{kind:ee.LIST,values:this.any(se.BRACKET_L,(function(){return t.parseValueLiteral(e)}),se.BRACKET_R),loc:this.loc(n)}},t.parseObject=function(e){var t=this,n=this._lexer.token;return{kind:ee.OBJECT,fields:this.any(se.BRACE_L,(function(){return t.parseObjectField(e)}),se.BRACE_R),loc:this.loc(n)}},t.parseObjectField=function(e){var t=this._lexer.token,n=this.parseName();return this.expectToken(se.COLON),{kind:ee.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e),loc:this.loc(t)}},t.parseDirectives=function(e){for(var t=[];this.peek(se.AT);)t.push(this.parseDirective(e));return t},t.parseDirective=function(e){var t=this._lexer.token;return this.expectToken(se.AT),{kind:ee.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e),loc:this.loc(t)}},t.parseTypeReference=function(){var e,t=this._lexer.token;return this.expectOptionalToken(se.BRACKET_L)?(e=this.parseTypeReference(),this.expectToken(se.BRACKET_R),e={kind:ee.LIST_TYPE,type:e,loc:this.loc(t)}):e=this.parseNamedType(),this.expectOptionalToken(se.BANG)?{kind:ee.NON_NULL_TYPE,type:e,loc:this.loc(t)}:e},t.parseNamedType=function(){var e=this._lexer.token;return{kind:ee.NAMED_TYPE,name:this.parseName(),loc:this.loc(e)}},t.parseTypeSystemDefinition=function(){var e=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(e.kind===se.NAME)switch(e.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(e)},t.peekDescription=function(){return this.peek(se.STRING)||this.peek(se.BLOCK_STRING)},t.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},t.parseSchemaDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");var n=this.parseDirectives(!0),r=this.many(se.BRACE_L,this.parseOperationTypeDefinition,se.BRACE_R);return{kind:ee.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:r,loc:this.loc(e)}},t.parseOperationTypeDefinition=function(){var e=this._lexer.token,t=this.parseOperationType();this.expectToken(se.COLON);var n=this.parseNamedType();return{kind:ee.OPERATION_TYPE_DEFINITION,operation:t,type:n,loc:this.loc(e)}},t.parseScalarTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");var n=this.parseName(),r=this.parseDirectives(!0);return{kind:ee.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:r,loc:this.loc(e)}},t.parseObjectTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");var n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseDirectives(!0),o=this.parseFieldsDefinition();return{kind:ee.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:o,loc:this.loc(e)}},t.parseImplementsInterfaces=function(){var e;if(!this.expectOptionalKeyword("implements"))return[];if(!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacySDLImplementsInterfaces)){var t=[];this.expectOptionalToken(se.AMP);do{t.push(this.parseNamedType())}while(this.expectOptionalToken(se.AMP)||this.peek(se.NAME));return t}return this.delimitedMany(se.AMP,this.parseNamedType)},t.parseFieldsDefinition=function(){var e;return!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacySDLEmptyFields)&&this.peek(se.BRACE_L)&&this._lexer.lookahead().kind===se.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(se.BRACE_L,this.parseFieldDefinition,se.BRACE_R)},t.parseFieldDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(se.COLON);var i=this.parseTypeReference(),o=this.parseDirectives(!0);return{kind:ee.FIELD_DEFINITION,description:t,name:n,arguments:r,type:i,directives:o,loc:this.loc(e)}},t.parseArgumentDefs=function(){return this.optionalMany(se.PAREN_L,this.parseInputValueDef,se.PAREN_R)},t.parseInputValueDef=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(se.COLON);var r,i=this.parseTypeReference();this.expectOptionalToken(se.EQUALS)&&(r=this.parseValueLiteral(!0));var o=this.parseDirectives(!0);return{kind:ee.INPUT_VALUE_DEFINITION,description:t,name:n,type:i,defaultValue:r,directives:o,loc:this.loc(e)}},t.parseInterfaceTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");var n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseDirectives(!0),o=this.parseFieldsDefinition();return{kind:ee.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:o,loc:this.loc(e)}},t.parseUnionTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");var n=this.parseName(),r=this.parseDirectives(!0),i=this.parseUnionMemberTypes();return{kind:ee.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:i,loc:this.loc(e)}},t.parseUnionMemberTypes=function(){return this.expectOptionalToken(se.EQUALS)?this.delimitedMany(se.PIPE,this.parseNamedType):[]},t.parseEnumTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");var n=this.parseName(),r=this.parseDirectives(!0),i=this.parseEnumValuesDefinition();return{kind:ee.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:i,loc:this.loc(e)}},t.parseEnumValuesDefinition=function(){return this.optionalMany(se.BRACE_L,this.parseEnumValueDefinition,se.BRACE_R)},t.parseEnumValueDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseDirectives(!0);return{kind:ee.ENUM_VALUE_DEFINITION,description:t,name:n,directives:r,loc:this.loc(e)}},t.parseInputObjectTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");var n=this.parseName(),r=this.parseDirectives(!0),i=this.parseInputFieldsDefinition();return{kind:ee.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:i,loc:this.loc(e)}},t.parseInputFieldsDefinition=function(){return this.optionalMany(se.BRACE_L,this.parseInputValueDef,se.BRACE_R)},t.parseTypeSystemExtension=function(){var e=this._lexer.lookahead();if(e.kind===se.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)},t.parseSchemaExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var t=this.parseDirectives(!0),n=this.optionalMany(se.BRACE_L,this.parseOperationTypeDefinition,se.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return{kind:ee.SCHEMA_EXTENSION,directives:t,operationTypes:n,loc:this.loc(e)}},t.parseScalarTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var t=this.parseName(),n=this.parseDirectives(!0);if(0===n.length)throw this.unexpected();return{kind:ee.SCALAR_TYPE_EXTENSION,name:t,directives:n,loc:this.loc(e)}},t.parseObjectTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseDirectives(!0),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return{kind:ee.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i,loc:this.loc(e)}},t.parseInterfaceTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseDirectives(!0),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return{kind:ee.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i,loc:this.loc(e)}},t.parseUnionTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseUnionMemberTypes();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:ee.UNION_TYPE_EXTENSION,name:t,directives:n,types:r,loc:this.loc(e)}},t.parseEnumTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseEnumValuesDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:ee.ENUM_TYPE_EXTENSION,name:t,directives:n,values:r,loc:this.loc(e)}},t.parseInputObjectTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseInputFieldsDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:ee.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:r,loc:this.loc(e)}},t.parseDirectiveDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(se.AT);var n=this.parseName(),r=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var o=this.parseDirectiveLocations();return{kind:ee.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:i,locations:o,loc:this.loc(e)}},t.parseDirectiveLocations=function(){return this.delimitedMany(se.PIPE,this.parseDirectiveLocation)},t.parseDirectiveLocation=function(){var e=this._lexer.token,t=this.parseName();if(void 0!==pe[t.value])return t;throw this.unexpected(e)},t.loc=function(e){var t;if(!0!==(null===(t=this._options)||void 0===t?void 0:t.noLocation))return new re(e,this._lexer.lastToken,this._lexer.source)},t.peek=function(e){return this._lexer.token.kind===e},t.expectToken=function(e){var t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t;throw X(this._lexer.source,t.start,"Expected ".concat(xe(e),", found ").concat(Pe(t),"."))},t.expectOptionalToken=function(e){var t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t},t.expectKeyword=function(e){var t=this._lexer.token;if(t.kind!==se.NAME||t.value!==e)throw X(this._lexer.source,t.start,'Expected "'.concat(e,'", found ').concat(Pe(t),"."));this._lexer.advance()},t.expectOptionalKeyword=function(e){var t=this._lexer.token;return t.kind===se.NAME&&t.value===e&&(this._lexer.advance(),!0)},t.unexpected=function(e){var t=null!=e?e:this._lexer.token;return X(this._lexer.source,t.start,"Unexpected ".concat(Pe(t),"."))},t.any=function(e,t,n){this.expectToken(e);for(var r=[];!this.expectOptionalToken(n);)r.push(t.call(this));return r},t.optionalMany=function(e,t,n){if(this.expectOptionalToken(e)){var r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r}return[]},t.many=function(e,t,n){this.expectToken(e);var r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r},t.delimitedMany=function(e,t){this.expectOptionalToken(e);var n=[];do{n.push(t.call(this))}while(this.expectOptionalToken(e));return n},e}();function Pe(e){var t=e.value;return xe(e.kind)+(null!=t?' "'.concat(t,'"'):"")}function xe(e){return function(e){return e===se.BANG||e===se.DOLLAR||e===se.AMP||e===se.PAREN_L||e===se.PAREN_R||e===se.SPREAD||e===se.COLON||e===se.EQUALS||e===se.AT||e===se.BRACKET_L||e===se.BRACKET_R||e===se.BRACE_L||e===se.PIPE||e===se.BRACE_R}(e)?'"'.concat(e,'"'):e}var ke={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},Ne=Object.freeze({});function Me(e,t,n){var r=e[t];if(r){if(!n&&"function"==typeof r)return r;var i=n?r.leave:r.enter;if("function"==typeof i)return i}else{var o=n?e.leave:e.enter;if(o){if("function"==typeof o)return o;var s=o[t];if("function"==typeof s)return s}}}function De(e){return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ke,r=void 0,i=Array.isArray(e),o=[e],s=-1,a=[],u=void 0,c=void 0,l=void 0,f=[],d=[],h=e;do{var p=++s===o.length,v=p&&0!==a.length;if(p){if(c=0===d.length?void 0:f[f.length-1],u=l,l=d.pop(),v){if(i)u=u.slice();else{for(var y={},g=0,m=Object.keys(u);g<m.length;g++){var b=m[g];y[b]=u[b]}u=y}for(var w=0,S=0;S<a.length;S++){var O=a[S][0],_=a[S][1];i&&(O-=w),i&&null===_?(u.splice(O,1),w++):u[O]=_}}s=r.index,o=r.keys,a=r.edits,i=r.inArray,r=r.prev}else{if(c=l?i?s:o[s]:void 0,null==(u=l?l[c]:h))continue;l&&f.push(c)}var E,A=void 0;if(!Array.isArray(u)){if(!oe(u))throw new Error("Invalid AST Node: ".concat(ue(u),"."));var I=Me(t,u.kind,p);if(I){if((A=I.call(t,u,c,l,f,d))===Ne)break;if(!1===A){if(!p){f.pop();continue}}else if(void 0!==A&&(a.push([c,A]),!p)){if(!oe(A)){f.pop();continue}u=A}}}if(void 0===A&&v&&a.push([c,u]),p)f.pop();else r={inArray:i,index:s,keys:o,edits:a,prev:r},o=(i=Array.isArray(u))?u:null!==(E=n[u.kind])&&void 0!==E?E:[],s=-1,a=[],l&&d.push(l),l=u}while(void 0!==r);return 0!==a.length&&(h=a[a.length-1][1]),h}(e,{leave:Re})}var Re={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return Fe(e.definitions,"\n\n")+"\n"},OperationDefinition:function(e){var t=e.operation,n=e.name,r=Be("(",Fe(e.variableDefinitions,", "),")"),i=Fe(e.directives," "),o=e.selectionSet;return n||i||r||"query"!==t?Fe([t,Fe([n,r]),i,o]," "):o},VariableDefinition:function(e){var t=e.variable,n=e.type,r=e.defaultValue,i=e.directives;return t+": "+n+Be(" = ",r)+Be(" ",Fe(i," "))},SelectionSet:function(e){return Le(e.selections)},Field:function(e){var t=e.alias,n=e.name,r=e.arguments,i=e.directives,o=e.selectionSet,s=Be("",t,": ")+n,a=s+Be("(",Fe(r,", "),")");return a.length>80&&(a=s+Be("(\n",qe(Fe(r,"\n")),"\n)")),Fe([a,Fe(i," "),o]," ")},Argument:function(e){return e.name+": "+e.value},FragmentSpread:function(e){return"..."+e.name+Be(" ",Fe(e.directives," "))},InlineFragment:function(e){var t=e.typeCondition,n=e.directives,r=e.selectionSet;return Fe(["...",Be("on ",t),Fe(n," "),r]," ")},FragmentDefinition:function(e){var t=e.name,n=e.typeCondition,r=e.variableDefinitions,i=e.directives,o=e.selectionSet;return"fragment ".concat(t).concat(Be("(",Fe(r,", "),")")," ")+"on ".concat(n," ").concat(Be("",Fe(i," ")," "))+o},IntValue:function(e){return e.value},FloatValue:function(e){return e.value},StringValue:function(e,t){var n=e.value;return e.block?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=-1===e.indexOf("\n"),i=" "===e[0]||"\t"===e[0],o='"'===e[e.length-1],s="\\"===e[e.length-1],a=!r||o||s||n,u="";return!a||r&&i||(u+="\n"+t),u+=t?e.replace(/\n/g,"\n"+t):e,a&&(u+="\n"),'"""'+u.replace(/"""/g,'\\"""')+'"""'}(n,"description"===t?"":" "):JSON.stringify(n)},BooleanValue:function(e){return e.value?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){return e.value},ListValue:function(e){return"["+Fe(e.values,", ")+"]"},ObjectValue:function(e){return"{"+Fe(e.fields,", ")+"}"},ObjectField:function(e){return e.name+": "+e.value},Directive:function(e){return"@"+e.name+Be("(",Fe(e.arguments,", "),")")},NamedType:function(e){return e.name},ListType:function(e){return"["+e.type+"]"},NonNullType:function(e){return e.type+"!"},SchemaDefinition:Ue((function(e){var t=e.directives,n=e.operationTypes;return Fe(["schema",Fe(t," "),Le(n)]," ")})),OperationTypeDefinition:function(e){return e.operation+": "+e.type},ScalarTypeDefinition:Ue((function(e){return Fe(["scalar",e.name,Fe(e.directives," ")]," ")})),ObjectTypeDefinition:Ue((function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return Fe(["type",t,Be("implements ",Fe(n," & ")),Fe(r," "),Le(i)]," ")})),FieldDefinition:Ue((function(e){var t=e.name,n=e.arguments,r=e.type,i=e.directives;return t+(Ke(n)?Be("(\n",qe(Fe(n,"\n")),"\n)"):Be("(",Fe(n,", "),")"))+": "+r+Be(" ",Fe(i," "))})),InputValueDefinition:Ue((function(e){var t=e.name,n=e.type,r=e.defaultValue,i=e.directives;return Fe([t+": "+n,Be("= ",r),Fe(i," ")]," ")})),InterfaceTypeDefinition:Ue((function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return Fe(["interface",t,Be("implements ",Fe(n," & ")),Fe(r," "),Le(i)]," ")})),UnionTypeDefinition:Ue((function(e){var t=e.name,n=e.directives,r=e.types;return Fe(["union",t,Fe(n," "),r&&0!==r.length?"= "+Fe(r," | "):""]," ")})),EnumTypeDefinition:Ue((function(e){var t=e.name,n=e.directives,r=e.values;return Fe(["enum",t,Fe(n," "),Le(r)]," ")})),EnumValueDefinition:Ue((function(e){return Fe([e.name,Fe(e.directives," ")]," ")})),InputObjectTypeDefinition:Ue((function(e){var t=e.name,n=e.directives,r=e.fields;return Fe(["input",t,Fe(n," "),Le(r)]," ")})),DirectiveDefinition:Ue((function(e){var t=e.name,n=e.arguments,r=e.repeatable,i=e.locations;return"directive @"+t+(Ke(n)?Be("(\n",qe(Fe(n,"\n")),"\n)"):Be("(",Fe(n,", "),")"))+(r?" repeatable":"")+" on "+Fe(i," | ")})),SchemaExtension:function(e){var t=e.directives,n=e.operationTypes;return Fe(["extend schema",Fe(t," "),Le(n)]," ")},ScalarTypeExtension:function(e){return Fe(["extend scalar",e.name,Fe(e.directives," ")]," ")},ObjectTypeExtension:function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return Fe(["extend type",t,Be("implements ",Fe(n," & ")),Fe(r," "),Le(i)]," ")},InterfaceTypeExtension:function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return Fe(["extend interface",t,Be("implements ",Fe(n," & ")),Fe(r," "),Le(i)]," ")},UnionTypeExtension:function(e){var t=e.name,n=e.directives,r=e.types;return Fe(["extend union",t,Fe(n," "),r&&0!==r.length?"= "+Fe(r," | "):""]," ")},EnumTypeExtension:function(e){var t=e.name,n=e.directives,r=e.values;return Fe(["extend enum",t,Fe(n," "),Le(r)]," ")},InputObjectTypeExtension:function(e){var t=e.name,n=e.directives,r=e.fields;return Fe(["extend input",t,Fe(n," "),Le(r)]," ")}};function Ue(e){return function(t){return Fe([t.description,e(t)],"\n")}}function Fe(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return null!==(t=null==e?void 0:e.filter((function(e){return e})).join(n))&&void 0!==t?t:""}function Le(e){return Be("{\n",qe(Fe(e,"\n")),"\n}")}function Be(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return null!=t&&""!==t?e+t+n:""}function qe(e){return Be(" ",e.replace(/\n/g,"\n "))}function ze(e){return-1!==e.indexOf("\n")}function Ke(e){return null!=e&&e.some(ze)}var Ve="undefined"!=typeof Symbol&&"function"==typeof Symbol.for,Ge=(Ve&&Symbol.for("INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER"),Ve?Symbol.for("INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER"):"@@INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER"),He=n(15),We=n(18),Ye=n(21),Je=new s.a("GraphQLAPI"),$e=function(){function e(e){this._api=null,this.Auth=We.a,this.Cache=o.a,this.Credentials=a.a,this._options=e,Je.debug("API Options",this._options)}return e.prototype.getModuleName=function(){return"GraphQLAPI"},e.prototype.configure=function(e){var t=e||{},n=t.API,i=void 0===n?{}:n,o=Object(r.g)(t,["API"]),s=Object(r.a)(Object(r.a)({},o),i);return Je.debug("configure GraphQL API",{opt:s}),s.aws_project_region&&(s=Object.assign({},s,{region:s.aws_project_region,header:{}})),void 0!==s.graphql_headers&&"function"!=typeof s.graphql_headers&&(Je.warn("graphql_headers should be a function"),s.graphql_headers=void 0),this._options=Object.assign({},this._options,s),this.createInstance(),this._options},e.prototype.createInstance=function(){return Je.debug("create Rest instance"),this._options?(this._api=new j(this._options),this._api.Credentials=this.Credentials,!0):Promise.reject("API not configured")},e.prototype._headerBasedAuth=function(e,t){return void 0===t&&(t={}),Object(r.c)(this,void 0,void 0,(function(){var n,i,s,a,u,c,l,f;return Object(r.e)(this,(function(r){switch(r.label){case 0:switch(n=this._options,i=n.aws_appsync_authenticationType,s=n.aws_appsync_apiKey,a={},e||i||"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]}return[3,16];case 1:if(!s)throw new Error(Ye.a.NO_API_KEY);return a={Authorization:null,"X-Api-Key":s},[3,17];case 2:return[4,this._ensureCredentials()];case 3:if(!r.sent())throw new Error(Ye.a.NO_CREDENTIALS);return[3,17];case 4:return r.trys.push([4,9,,10]),u=void 0,[4,o.a.getItem("federatedInfo")];case 5:return(c=r.sent())?(u=c.token,[3,8]):[3,6];case 6:return[4,We.a.currentAuthenticatedUser()];case 7:(l=r.sent())&&(u=l.token),r.label=8;case 8:if(!u)throw new Error(Ye.a.NO_FEDERATED_JWT);return a={Authorization:u},[3,10];case 9:throw r.sent(),new Error(Ye.a.NO_CURRENT_USER);case 10:return[3,17];case 11:return r.trys.push([11,13,,14]),[4,this.Auth.currentSession()];case 12:return f=r.sent(),a={Authorization:f.getAccessToken().getJwtToken()},[3,14];case 13:throw r.sent(),new Error(Ye.a.NO_CURRENT_USER);case 14:return[3,17];case 15:if(!t.Authorization)throw new Error(Ye.a.NO_AUTH_TOKEN);return a={Authorization:t.Authorization},[3,17];case 16:return a={Authorization:null},[3,17];case 17:return[2,a]}}))}))},e.prototype.getGraphqlOperationType=function(e){var t=je(e).definitions;return Object(r.f)(t,1)[0].operation},e.prototype.graphql=function(e,t){var n=e.query,i=e.variables,o=void 0===i?{}:i,s=e.authMode,a=e.authToken,u=e.userAgentSuffix,c=je("string"==typeof n?n:De(n)),l=Object(r.f)(c.definitions.filter((function(e){return"OperationDefinition"===e.kind})),1)[0],f=(void 0===l?{}:l).operation,d=t||{};switch(a&&(d.Authorization=a),f){case"query":case"mutation":var h=this._api.getCancellableToken(),p={cancellableToken:h},v=this._graphql({query:c,variables:o,authMode:s,userAgentSuffix:u},d,p);return this._api.updateRequestToBeCancellable(v,h),v;case"subscription":return this._graphqlSubscribe({query:c,variables:o,authMode:s},d);default:throw new Error("invalid operation type: "+f)}},e.prototype._graphql=function(e,t,n){var i=e.query,o=e.variables,s=e.authMode,a=e.userAgentSuffix;return void 0===t&&(t={}),void 0===n&&(n={}),Object(r.c)(this,void 0,void 0,(function(){var e,c,l,f,d,h,p,v,y,g,m,b,w,S,O,_,E,A,I,T,j;return Object(r.e)(this,(function(C){switch(C.label){case 0:return this._api?[3,2]:[4,this.createInstance()];case 1:C.sent(),C.label=2;case 2:return e=this._options,c=e.aws_appsync_region,l=e.aws_appsync_graphqlEndpoint,f=e.graphql_headers,d=void 0===f?function(){return{}}:f,h=e.graphql_endpoint,p=e.graphql_endpoint_iam_region,y=[{}],(g=!h)?[4,this._headerBasedAuth(s,t)]:[3,4];case 3:g=C.sent(),C.label=4;case 4:return m=[r.a.apply(void 0,y.concat([g]))],(b=h)?p?[4,this._headerBasedAuth(s,t)]:[3,6]:[3,8];case 5:return w=C.sent(),[3,7];case 6:w={Authorization:null},C.label=7;case 7:b=w,C.label=8;case 8:return S=[r.a.apply(void 0,m.concat([b]))],[4,d({query:i,variables:o})];case 9:if(v=r.a.apply(void 0,[r.a.apply(void 0,[r.a.apply(void 0,S.concat([C.sent()])),t]),!h&&(j={},j["x-amz-user-agent"]=Object(u.b)(a),j)]),O={query:De(i),variables:o},_=Object.assign({headers:v,body:O,signerServiceInfo:{service:h?"execute-api":"appsync",region:h?p:c}},n),!(E=h||l))throw{data:{},errors:[new Z("No graphql endpoint provided.")]};C.label=10;case 10:return C.trys.push([10,12,,13]),[4,this._api.post(E,_)];case 11:return A=C.sent(),[3,13];case 12:if(I=C.sent(),this._api.isCancel(I))throw I;return A={data:{},errors:[new Z(I.message,null,null,null,null,I)]},[3,13];case 13:if((T=A.errors)&&T.length)throw A;return[2,A]}}))}))},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,i=e.authMode,o=e.authToken;void 0===t&&(t={});var s=this._options,a=s.aws_appsync_region,u=s.aws_appsync_graphqlEndpoint,c=s.aws_appsync_authenticationType,l=s.aws_appsync_apiKey,f=s.graphql_headers,d=void 0===f?function(){return{}}:f,h=i||c||"AWS_IAM";if(He.PubSub&&"function"==typeof He.PubSub.subscribe)return He.PubSub.subscribe("",{provider:Ge,appSyncGraphqlEndpoint:u,authenticationType:h,apiKey:l,query:De(n),region:a,variables:r,graphql_headers:d,additionalHeaders:t,authToken:o});throw Je.debug("No pubsub module applied for subscription"),new 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 Je.debug("set credentials for api",n),!0})).catch((function(e){return Je.warn("ensure credentials error",e),!1}))},e}(),Ze=new $e(null);C.a.register(Ze);var Qe=new s.a("API"),Xe=new(function(){function e(e){this.Auth=i.a,this.Cache=o.a,this.Credentials=a.a,this._options=e,this._restApi=new x(e),this._graphqlApi=new $e(e),Qe.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 Object(r.a)(Object(r.a)({},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)},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){return Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(this,(function(t){return[2,this._restApi.endpoint(e)]}))}))},e.prototype.getGraphqlOperationType=function(e){return this._graphqlApi.getGraphqlOperationType(e)},e.prototype.graphql=function(e,t){return this._graphqlApi.graphql(e,t)},e}())(null);C.a.register(Xe);t.a=Xe},function(e,t,n){"use strict";var r=n(40),i=n(0),o={keyPrefix:"aws-amplify-cache",capacityInBytes:1048576,itemMaxSize:21e4,defaultTTL:2592e5,defaultPriority:5,warningThreshold:.8,storage:(new(n(70).a)).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):function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}(e)}var c={},l=(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]}}(),n(22));function f(e){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var d=new l.a("StorageCache"),h=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)||(d.error("Invalid parameter: capacityInBytes. It should be an Integer. Setting back to default."),this.config.capacityInBytes=o.capacityInBytes),u(this.config.itemMaxSize)||(d.error("Invalid parameter: itemMaxSize. It should be an Integer. Setting back to default."),this.config.itemMaxSize=o.itemMaxSize),u(this.config.defaultTTL)||(d.error("Invalid parameter: defaultTTL. It should be an Integer. Setting back to default."),this.config.defaultTTL=o.defaultTTL),u(this.config.defaultPriority)||(d.error("Invalid parameter: defaultPriority. It should be an Integer. Setting back to default."),this.config.defaultPriority=o.defaultPriority),this.config.itemMaxSize>this.config.capacityInBytes&&(d.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)&&(d.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||Number(this.config.warningThreshold)<0)&&(d.error("Invalid parameter: warningThreshold. It should be between 0 and 1. Setting back to default."),this.config.warningThreshold=o.warningThreshold);this.config.capacityInBytes>5242880&&(d.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:f(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&&d.warn("Don't try to configure keyPrefix!"),this.config=Object.assign({},this.config,e,e.Cache),this.checkConfig(),this.config):this.config},e}(),p=new l.a("Cache"),v=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 Object(i.d)(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=this.config.storage.getItem(e),n=JSON.parse(t);return a()>=n.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(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(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)if(void 0!==t){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.");else{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!");else 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)}}}else p.warn("The value of item should not be undefined!");else p.warn("Invalid key: should not be empty or 'CurSize'")},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(null!=(n=this.config.storage.getItem(r))){if(!this._isExpired(r)){var i=JSON.parse(n);return(i=this._refreshItem(i,r)).data}this._removeItem(r,JSON.parse(n).byteSize),n=null}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(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}(h));t.a=v;r.a.register(v)},function(e,t,n){"use strict";var r;n.d(t,"a",(function(){return r})),function(e){e.NO_API_KEY="No api-key configured",e.NO_CURRENT_USER="No current user",e.NO_CREDENTIALS="No credentials",e.NO_FEDERATED_JWT="No federated jwt",e.NO_AUTH_TOKEN="No auth token specified"}(r||(r={}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r,i=n(0),o={VERBOSE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5};!function(e){e.DEBUG="DEBUG",e.ERROR="ERROR",e.INFO="INFO",e.WARN="WARN",e.VERBOSE="VERBOSE"}(r||(r={}));var s=function(){function e(e,t){void 0===t&&(t=r.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):this._config},e.prototype._log=function(t){for(var n,s,a=[],u=1;u<arguments.length;u++)a[u-1]=arguments[u];var c=this.level;e.LOG_LEVEL&&(c=e.LOG_LEVEL),"undefined"!=typeof window&&window.LOG_LEVEL&&(c=window.LOG_LEVEL);var l=o[c],f=o[t];if(f>=l){var d=console.log.bind(console);t===r.ERROR&&console.error&&(d=console.error.bind(console)),t===r.WARN&&console.warn&&(d=console.warn.bind(console));var h="["+t+"] "+this._ts()+" "+this.name,p="";if(1===a.length&&"string"==typeof a[0])d(p=h+" - "+a[0]);else if(1===a.length)p=h+" "+a[0],d(h,a[0]);else if("string"==typeof a[0]){var v=a.slice(1);1===v.length&&(v=v[0]),p=h+" - "+a[0]+" "+v,d(h+" - "+a[0],v)}else p=h+" "+a,d(h,a);try{for(var y=Object(i.i)(this._pluggables),g=y.next();!g.done;g=y.next()){var m=g.value,b={message:p,timestamp:Date.now()};m.pushLogs([b])}}catch(e){n={error:e}}finally{try{g&&!g.done&&(s=y.return)&&s.call(y)}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,Object(i.h)([r.INFO],e))},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,Object(i.h)([r.INFO],e))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,Object(i.h)([r.WARN],e))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,Object(i.h)([r.ERROR],e))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,Object(i.h)([r.DEBUG],e))},e.prototype.verbose=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,Object(i.h)([r.VERBOSE],e))},e.prototype.addPluggable=function(e){e&&"Logging"===e.getCategoryName()&&(this._pluggables.push(e),e.configure(this._config))},e.prototype.listPluggables=function(){return this._pluggables},e.LOG_LEVEL=null,e}()},,function(e,t,n){"use strict";n.d(t,"a",(function(){return l})),n.d(t,"b",(function(){return f})),n.d(t,"c",(function(){return d}));var r=n(0),i=function(e){return/^Connection failed: Connection Timeout/.test(e.message)},o=function(e){return/^Error: Request failed with status code 5\d\d/.test(e.message)},s={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 i(e)||o(e)},Unauthorized:function(e){return/^Request failed with status code 401/.test(e.message)}},a={BadModel:function(){return!1},BadRecord:function(){return!1},ConfigError:function(){return!1},Transient:function(e){var t=c(e);return i(t)||o(t)},Unauthorized:function(e){var t=c(e);return/Connection failed.+Unauthorized/.test(t.message)}},u={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 i(e)||o(e)},Unauthorized:function(){return!1}};function c(e){var t=e.error;return Object(r.f)((void 0===t?{errors:[]}:t).errors,1)[0]}function l(e){return h(s,e)}function f(e){return h(a,e)}function d(e){return h(u,e)}function h(e,t){var n,i,o=Object(r.h)(Object.keys(e));try{for(var s=Object(r.i)(o),a=s.next();!a.done;a=s.next()){var u=a.value;if((0,e[u])(t))return u}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return"Unknown"}},function(e,t,n){var r;e.exports=(r=n(12),n(28),n(89),r.HmacSHA256)},function(e,t,n){"use strict";
51
36
  /*!
52
37
  * cookie
53
38
  * Copyright(c) 2012-2014 Roman Shtylman
@@ -60,7 +45,124 @@ var oe=function(){function e(e,t){var n=e||{},r=n.UserPoolId,i=n.ClientId,o=n.en
60
45
  *
61
46
  * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
62
47
  * Released under the MIT license
63
- */!function(o){if(void 0===(i="function"==typeof(r=o)?r.call(t,n,t,e):r)||(e.exports=i),!0,e.exports=o(),!!0){var s=window.Cookies,a=window.Cookies=o();a.noConflict=function(){return window.Cookies=s,a}}}((function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function i(){}function o(t,n,o){if("undefined"!=typeof document){"number"==typeof(o=e({path:"/"},i.defaults,o)).expires&&(o.expires=new Date(1*new Date+864e5*o.expires)),o.expires=o.expires?o.expires.toUTCString():"";try{var s=JSON.stringify(n);/^[\{\[]/.test(s)&&(n=s)}catch(e){}n=r.write?r.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var a="";for(var u in o)o[u]&&(a+="; "+u,!0!==o[u]&&(a+="="+o[u].split(";")[0]));return document.cookie=t+"="+n+a}}function s(e,n){if("undefined"!=typeof document){for(var i={},o=document.cookie?document.cookie.split("; "):[],s=0;s<o.length;s++){var a=o[s].split("="),u=a.slice(1).join("=");n||'"'!==u.charAt(0)||(u=u.slice(1,-1));try{var c=t(a[0]);if(u=(r.read||r)(u,c)||t(u),n)try{u=JSON.parse(u)}catch(e){}if(i[c]=u,e===c)break}catch(e){}}return e?i[e]:i}}return i.set=o,i.get=function(e){return s(e,!1)},i.getJSON=function(e){return s(e,!0)},i.remove=function(t,n){o(t,"",e(n,{expires:-1}))},i.defaults={},i.withConverter=n,i}((function(){}))}))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){e.exports=n(124)},function(e,t,n){"use strict";(function(t){var r=n(13),i=n(129),o=n(58),s={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var u,c={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==t&&"[object process]"===Object.prototype.toString.call(t))&&(u=n(59)),u),transformRequest:[function(e,t){return i(t,"Accept"),i(t,"Content-Type"),r.isFormData(e)||r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e)?e:r.isArrayBufferView(e)?e.buffer:r.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):r.isObject(e)||t&&"application/json"===t["Content-Type"]?(a(t,"application/json"),function(e,t,n){if(r.isString(e))try{return(t||JSON.parse)(e),r.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||c.transitional,n=t&&t.silentJSONParsing,i=t&&t.forcedJSONParsing,s=!n&&"json"===this.responseType;if(s||i&&r.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(s){if("SyntaxError"===e.name)throw o(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function(e){c.headers[e]={}})),r.forEach(["post","put","patch"],(function(e){c.headers[e]=r.merge(s)})),e.exports=c}).call(this,n(46))},function(e,t,n){"use strict";function r(e){this.message=e}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,e.exports=r},function(e,t,n){var r=n(81),i=n(82),o=i;o.v1=r,o.v4=i,e.exports=o},function(e,t,n){"use strict";n.d(t,"a",(function(){return $}));var r=n(3),i=n(21),o=n(76),s=n(153),a=function(){return(a=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)},u=new i.a("Parser"),c=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=a(a({},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),u.debug("parse config",e,"to amplifyconfig",n),n},l=function(){function e(){}return e.parseMobilehubConfig=c,e}(),f=n(25);function d(e,t){void 0===t&&(t={});var n=function(e){if(e&&"j"===e[0]&&":"===e[1])return e.substr(2);return e}(e);if(function(e,t){return void 0===t&&(t=!e||"{"!==e[0]&&"["!==e[0]&&'"'!==e[0]),!t}(n,t.doNotParse))try{return JSON.parse(n)}catch(e){}return e}var h=function(){return(h=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(){function e(e,t){var n=this;this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.cookies=function(e,t){return"string"==typeof e?f.parse(e,t):"object"==typeof e&&null!==e?e:{}}(e,t),new Promise((function(){n.HAS_DOCUMENT_COOKIE="object"==typeof document&&"string"==typeof document.cookie})).catch((function(){}))}return e.prototype._updateBrowserValues=function(e){this.HAS_DOCUMENT_COOKIE&&(this.cookies=f.parse(document.cookie,e))},e.prototype._emitChange=function(e){for(var t=0;t<this.changeListeners.length;++t)this.changeListeners[t](e)},e.prototype.get=function(e,t,n){return void 0===t&&(t={}),this._updateBrowserValues(n),d(this.cookies[e],t)},e.prototype.getAll=function(e,t){void 0===e&&(e={}),this._updateBrowserValues(t);var n={};for(var r in this.cookies)n[r]=d(this.cookies[r],e);return n},e.prototype.set=function(e,t,n){var r;"object"==typeof t&&(t=JSON.stringify(t)),this.cookies=h(h({},this.cookies),((r={})[e]=t,r)),this.HAS_DOCUMENT_COOKIE&&(document.cookie=f.serialize(e,t,n)),this._emitChange({name:e,value:t,options:n})},e.prototype.remove=function(e,t){var n=t=h(h({},t),{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=h({},this.cookies),delete this.cookies[e],this.HAS_DOCUMENT_COOKIE&&(document.cookie=f.serialize(e,"",n)),this._emitChange({name:e,value:void 0,options:t})},e.prototype.addChangeListener=function(e){this.changeListeners.push(e)},e.prototype.removeChangeListener=function(e){var t=this.changeListeners.indexOf(e);t>=0&&this.changeListeners.splice(t,1)},e}(),v=n(16),y=Object(v.b)().isBrowser,g=function(){function e(e){void 0===e&&(e={}),this.cookies=new p,this.store=y?window.localStorage:Object.create(null),this.cookies=e.req?new p(e.req.headers.cookie):new p,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(new 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":y?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}(),m=n(66);var b,w=n(38),S=n(8),_=n(9),E=function(e){var t=window.open(e,"_self");return t?Promise.resolve(t):Promise.reject()},A=n(73),O=n.n(A),I=n(74),T=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)},x=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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},P=function(e,t){var n,r,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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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},N="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",M=function(e,t,n){o.a.dispatch("auth",{event:e,data:t,message:n},"Auth",N)},j=new i.a("OAuth"),R=function(){function e(e){var t=e.config,n=e.cognitoClientId,r=e.scopes,i=void 0===r?[]:r;if(this._urlOpener=t.urlOpener||E,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,i,o,s){void 0===e&&(e="code"),void 0===o&&(o=r.b.Cognito);var a=this._generateState(32),u=s?a+"-"+s.split("").map((function(e){return e.charCodeAt(0).toString(16).padStart(2,"0")})).join(""):a;!function(e){window.sessionStorage.setItem("oauth_state",e)}(u);var c,l=this._generateRandom(128);c=l,window.sessionStorage.setItem("ouath_pkce_key",c);var f=this._generateChallenge(l),d=this._scopes.join(" "),h="https://"+t+"/oauth2/authorize?"+Object.entries(C(C({redirect_uri:n,response_type:e,client_id:i,identity_provider:o,scope:d,state:u},"code"===e?{code_challenge:f}:{}),"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("&");j.debug("Redirecting to "+h),this._urlOpener(h,n)},e.prototype._handleCodeFlow=function(e){return x(this,void 0,void 0,(function(){var t,n,i,o,s,a,u,c,l,f,d,h,p,v;return P(this,(function(y){switch(y.label){case 0:return t=(Object(_.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=Object(_.parse)(e).pathname||"/",i=Object(_.parse)(this._config.redirectSignIn).pathname||"/",t&&n===i?(o="https://"+this._config.domain+"/oauth2/token",M("codeFlow",{},"Retrieving tokens from "+o),s=Object(r.e)(this._config)?this._cognitoClientId:this._config.clientID,a=Object(r.e)(this._config)?this._config.redirectSignIn:this._config.redirectUri,g=window.sessionStorage.getItem("ouath_pkce_key"),window.sessionStorage.removeItem("ouath_pkce_key"),c=C({grant_type:"authorization_code",code:t,client_id:s,redirect_uri:a},(u=g)?{code_verifier:u}:{}),j.debug("Calling token endpoint: "+o+" with",c),l=Object.entries(c).map((function(e){var t=k(e,2),n=t[0],r=t[1];return encodeURIComponent(n)+"="+encodeURIComponent(r)})).join("&"),[4,fetch(o,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:l})]):[2];case 1:return[4,y.sent().json()];case 2:if(f=y.sent(),d=f.access_token,h=f.refresh_token,p=f.id_token,v=f.error)throw new Error(v);return[2,{accessToken:d,refreshToken:h,idToken:p}]}var g}))}))},e.prototype._handleImplicitFlow=function(e){return x(this,void 0,void 0,(function(){var t,n,r;return P(this,(function(i){return t=(Object(_.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}),n=t.id_token,r=t.access_token,M("implicitFlow",{},"Got tokens from "+e),j.debug("Retrieving implicit tokens from "+e+" with"),[2,{accessToken:r,idToken:n,refreshToken:null}]}))}))},e.prototype.handleAuthResponse=function(e){return x(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return P(this,(function(u){switch(u.label){case 0:if(u.trys.push([0,5,,6]),t=e?C(C({},(Object(_.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}),{})),(Object(_.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}),{})):{},n=t.error,r=t.error_description,n)throw new Error(r);return i=this._validateState(t),j.debug("Starting "+this._config.responseType+" flow with "+e),"code"!==this._config.responseType?[3,2]:(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(),j.error("Error handling auth response.",a),a;case 6:return[2]}}))}))},e.prototype._validateState=function(e){if(e){var t,n=(t=window.sessionStorage.getItem("oauth_state"),window.sessionStorage.removeItem("oauth_state"),t),r=e.state;if(n&&n!==r)throw new Error("Invalid state in OAuth flow");return r}},e.prototype.signOut=function(){return x(this,void 0,void 0,(function(){var e,t,n;return P(this,(function(i){return e="https://"+this._config.domain+"/logout?",t=Object(r.e)(this._config)?this._cognitoClientId:this._config.oauth.clientID,n=Object(r.e)(this._config)?this._config.redirectSignOut:this._config.returnTo,e+=Object.entries({client_id:t,logout_uri:encodeURIComponent(n)}).map((function(e){var t=k(e,2);return t[0]+"="+t[1]})).join("&"),M("oAuthSignOut",{oAuth:"signOut"},"Signing out from "+e),j.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(O()(e))},e.prototype._base64URL=function(e){return e.toString(T.a).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]=Math.random()*"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~".length|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}(),D=n(11),U=(b=function(e,t){return(b=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}b(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),F=new i.a("AuthError"),L=function(e){function t(n){var r=this,i=q[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,F.error(r.log),r}return U(t,e),t}(Error),B=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 U(t,e),t}(L),q={noConfig:{message:D.a.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\t\t\t\tRefer to our docs site for help upgrading Amplify packages (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js)\n "},missingAuthConfig:{message:D.a.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:D.a.EMPTY_USERNAME},invalidUsername:{message:D.a.INVALID_USERNAME},emptyPassword:{message:D.a.EMPTY_PASSWORD},emptyCode:{message:D.a.EMPTY_CODE},signUpError:{message:D.a.SIGN_UP_ERROR,log:"The first parameter should either be non-null string or object"},noMFA:{message:D.a.NO_MFA},invalidMFA:{message:D.a.INVALID_MFA},emptyChallengeResponse:{message:D.a.EMPTY_CHALLENGE},noUserSession:{message:D.a.NO_USER_SESSION},deviceConfig:{message:D.a.DEVICE_CONFIG},networkError:{message:D.a.NETWORK_ERROR},autoSignInError:{message:D.a.AUTOSIGNIN_ERROR},default:{message:D.a.DEFAULT_MSG}};function z(e){return(z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var 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)},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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},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;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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,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 i.a("AuthClass"),Y="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",J=function(e,t,n){o.a.dispatch("auth",{event:e,data:t,message:n},"Auth",Y)},$=new(function(){function e(e){var t=this;this.userPool=null,this.user=null,this.oAuthFlowInProgress=!1,this.autoSignInInitiated=!1,this.Credentials=s.a,this.wrapRefreshSessionCallback=function(e){return function(t,n){return n?J("tokenRefresh",void 0,"New token retrieved"):J("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),o.a.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.parseMobilehubConfig(e).Auth,e);this._config=n;var i=this._config,o=i.userPoolId,s=i.userPoolWebClientId,a=i.cookieStorage,u=i.oauth,c=i.region,f=i.identityPoolId,d=i.mandatorySignIn,h=i.refreshHandlers,p=i.identityPoolRegion,y=i.clientMetadata,b=i.endpoint;if(this._config.storage){if(!this._isValidAuthStorage(this._config.storage))throw W.error("The storage in the Auth config is not valid!"),new Error("Empty storage object");this._storage=this._config.storage}else this._storage=a?new S.i(a):e.ssr?new g:(new m.a).getStorage();if(this._storageSync=Promise.resolve(),"function"==typeof this._storage.sync&&(this._storageSync=this._storage.sync()),o){var w={UserPoolId:o,ClientId:s,endpoint:b};w.Storage=this._storage,this.userPool=new S.g(w,this.wrapRefreshSessionCallback)}this.Credentials.configure({mandatorySignIn:d,region:p||c,userPoolId:o,identityPoolId:f,refreshHandlers:h,storage:this._storage});var _=u?Object(r.e)(this._config.oauth)?u:u.awsCognito:void 0;if(_){var E=Object.assign({cognitoClientId:s,UserPoolId:o,domain:_.domain,scopes:_.scope,redirectSignIn:_.redirectSignIn,redirectSignOut:_.redirectSignOut,responseType:_.responseType,Storage:this._storage,urlOpener:_.urlOpener,clientMetadata:y},_.options);this._oAuthHandler=new R({scopes:E.scopes,config:E,cognitoClientId:E.cognitoClientId});var A={};!function(e){if(Object(v.b)().isBrowser&&window.location)e({url:window.location.href});else if(!Object(v.b)().isNode)throw new Error("Not supported")}((function(e){var n=e.url;A[n]||(A[n]=!0,t._handleAuthResponse(n))}))}(J("configured",null,"The Auth category has been configured successfully"),this.autoSignInInitiated||"function"!=typeof this._storage.getItem)||(this.isTrueStorageValue("amplify-polling-started")&&(J("autoSignIn_failure",null,r.a.AutoSignInError),this._storage.removeItem("amplify-auto-sign-in")),this._storage.removeItem("amplify-polling-started"));return this._config},e.prototype.signUp=function(e){for(var t,n,i,o=this,s=[],a=1;a<arguments.length;a++)s[a-1]=arguments[a];if(!this.userPool)return this.rejectNoUserPool();var u,c=null,l=null,f=[],d=null,h={enabled:!1},p={},v={};if(e&&"string"==typeof e){c=e,l=s?s[0]:null;var y=s?s[1]:null,g=s?s[2]:null;y&&f.push(new S.f({Name:"email",Value:y})),g&&f.push(new S.f({Name:"phone_number",Value:g}))}else{if(!e||"object"!==z(e))return this.rejectAuthError(r.a.SignUpError);c=e.username,l=e.password,e&&e.clientMetadata?u=e.clientMetadata:this._config.clientMetadata&&(u=this._config.clientMetadata);var m=e.attributes;m&&Object.keys(m).map((function(e){f.push(new S.f({Name:e,Value:m[e]}))}));var b=e.validationData;b&&(d=[],Object.keys(b).map((function(e){d.push(new S.f({Name:e,Value:b[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:{},v=null!==(i=h.clientMetaData)&&void 0!==i?i:{})}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?(J("signUp_failure",n,c+" failed to signup"),t(n)):(J("signUp",r,c+" has signed up successfully"),h.enabled&&o.handleAutoSignIn(c,l,p,v,r),e(r))}),u)}))):this.rejectAuthError(r.a.EmptyPassword):this.rejectAuthError(r.a.EmptyUsername)},e.prototype.handleAutoSignIn=function(e,t,n,r,i){this.autoSignInInitiated=!0;var o=new S.a({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;o.a.listen("auth",(function n(r){"confirmSignUp"===r.payload.event&&t.signInAfterUserConfirmed(e,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),J("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 H(this,void 0,void 0,(function(){var r,i,s=this;return V(this,(function(a){switch(a.label){case 0:r=this.createCognitoUser(e.getUsername()),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,r.authenticateUser(e,this.authCallbacks(r,(function(r){J("autoSignIn",r,e.getUsername()+" has signed in successfully"),t&&o.a.remove("auth",t),n&&(clearInterval(n),s._storage.removeItem("amplify-polling-started")),s._storage.removeItem("amplify-auto-sign-in")}),(function(e){W.error(e),s._storage.removeItem("amplify-auto-sign-in")})))];case 2:return a.sent(),[3,4];case 3:return i=a.sent(),W.error(i),[3,4];case 4:return[2]}}))}))},e.prototype.confirmSignUp=function(e,t,n){var i=this;if(!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(r.a.EmptyUsername);if(!t)return this.rejectAuthError(r.a.EmptyCode);var o,s=this.createCognitoUser(e),a=!n||"boolean"!=typeof n.forceAliasCreation||n.forceAliasCreation;return n&&n.clientMetadata?o=n.clientMetadata:this._config.clientMetadata&&(o=this._config.clientMetadata),new Promise((function(n,u){s.confirmRegistration(t,a,(function(t,o){t?u(t):(J("confirmSignUp",o,e+" has been confirmed successfully"),i.isTrueStorageValue("amplify-auto-sign-in")&&!i.autoSignInInitiated&&(J("autoSignIn_failure",null,r.a.AutoSignInError),i._storage.removeItem("amplify-auto-sign-in")),n(o))}),o)}))},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(r.a.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 i=null,o=null,s={};if("string"==typeof e)i=e,o=t;else{if(!Object(r.h)(e))return this.rejectAuthError(r.a.InvalidUsername);void 0!==t&&W.warn("The password should be defined under the first parameter object!"),i=e.username,o=e.password,s=e.validationData}if(!i)return this.rejectAuthError(r.a.EmptyUsername);var a=new S.a({Username:i,Password:o,ValidationData:s,ClientMetadata:n});return o?this.signInWithPassword(a):this.signInWithoutPassword(a)},e.prototype.authCallbacks=function(e,t,n){var r=this,i=this;return{onSuccess:function(o){return H(r,void 0,void 0,(function(){var r,s,a,u;return V(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,J("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),J("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 new 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)return W.debug("get MFA Options failed",e),void n(e);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 H(n,void 0,void 0,(function(){var n,a;return V(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];case 3:return n=u.sent(),o(new 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:return(a=r._getMfaTypeFromUserData(s))?(i(a),[2]):(o("invalid MFA Type"),[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;if(r)0===r.length?t="NOMFA":W.debug("invalid case for getPreferredMFA",e);else 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 H(n,void 0,void 0,(function(){var n;return V(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(new 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 H(this,void 0,void 0,(function(){var n,i,o,s,a,u,c=this;return V(this,(function(l){switch(l.label){case 0:return n=this._config.clientMetadata,[4,this._getUserData(e,{bypassCache:!0,clientMetadata:n})];case 1:switch(i=l.sent(),o=null,s=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 s={PreferredMfa:!0,Enabled:!0},[3,7];case 3:return o={PreferredMfa:!0,Enabled:!0},[3,7];case 4:return a=i.UserMFASettingList,[4,this._getMfaTypeFromUserData(i)];case 5:if("NOMFA"===(u=l.sent()))return[2,Promise.resolve("No change for mfa type")];if("SMS_MFA"===u)o={PreferredMfa:!1,Enabled:!1};else{if("SOFTWARE_TOKEN_MFA"!==u)return[2,this.rejectAuthError(r.a.InvalidMFA)];s={PreferredMfa:!1,Enabled:!1}}return a&&0!==a.length&&a.forEach((function(e){"SMS_MFA"===e?o={PreferredMfa:!1,Enabled:!1}:"SOFTWARE_TOKEN_MFA"===e&&(s={PreferredMfa:!1,Enabled:!1})})),[3,7];case 6:return W.debug("no validmfa method provided"),[2,this.rejectAuthError(r.a.NoMFA)];case 7:return this,[2,new Promise((function(t,r){e.setUserMfaPreference(o,s,(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 H(c,void 0,void 0,(function(){var i;return V(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(new 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)return W.debug("disable mfa failed",e),void n(e);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)return W.debug("enable mfa failed",e),void n(e);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){J("signIn",e,"A user "+e.getUsername()+" has been signed in"),W.debug("verifyTotpToken success",t),n(t)}})}))},e.prototype.confirmSignIn=function(e,t,n,i){var o=this;if(void 0===i&&(i=this._config.clientMetadata),!t)return this.rejectAuthError(r.a.EmptyCode);var s=this;return new Promise((function(r,a){e.sendMFACode(t,{onSuccess:function(t){return H(o,void 0,void 0,(function(){var n,i;return V(this,(function(o){switch(o.label){case 0:W.debug(t),o.label=1;case 1:return o.trys.push([1,4,5,6]),[4,this.Credentials.clear()];case 2:return o.sent(),[4,this.Credentials.set(t,"session")];case 3:return n=o.sent(),W.debug("succeed to get cognito credentials",n),[3,6];case 4:return i=o.sent(),W.debug("cannot get cognito credentials",i),[3,6];case 5:return s.user=e,J("signIn",e,"A user "+e.getUsername()+" has been signed in"),r(e),[7];case 6:return[2]}}))}))},onFailure:function(e){W.debug("confirm signIn failure",e),a(e)}},n,i)}))},e.prototype.completeNewPassword=function(e,t,n,i){var o=this;if(void 0===n&&(n={}),void 0===i&&(i=this._config.clientMetadata),!t)return this.rejectAuthError(r.a.EmptyPassword);var s=this;return new Promise((function(r,a){e.completeNewPasswordChallenge(t,n,{onSuccess:function(t){return H(o,void 0,void 0,(function(){var n,i;return V(this,(function(o){switch(o.label){case 0:W.debug(t),o.label=1;case 1:return o.trys.push([1,4,5,6]),[4,this.Credentials.clear()];case 2:return o.sent(),[4,this.Credentials.set(t,"session")];case 3:return n=o.sent(),W.debug("succeed to get cognito credentials",n),[3,6];case 4:return i=o.sent(),W.debug("cannot get cognito credentials",i),[3,6];case 5:return s.user=e,J("signIn",e,"A user "+e.getUsername()+" has been signed in"),r(e),[7];case 6:return[2]}}))}))},onFailure:function(e){W.debug("completeNewPassword failure",e),J("completeNewPassword_failure",e,o.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,r(e)},mfaSetup:function(t,n){W.debug("signIn mfa setup",t),e.challengeName=t,e.challengeParam=n,r(e)},totpRequired:function(t,n){W.debug("signIn mfa setup",t),e.challengeName=t,e.challengeParam=n,r(e)}},i)}))},e.prototype.sendCustomChallengeAnswer=function(e,t,n){var i=this;if(void 0===n&&(n=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!t)return this.rejectAuthError(r.a.EmptyChallengeResponse);return new Promise((function(r,o){e.sendCustomChallengeAnswer(t,i.authCallbacks(e,r,o),n)}))},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 H(this,void 0,void 0,(function(){var e,t,n=this;return V(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),new Error(e);case 3:return t=this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI"),[2,new Promise((function(e,r){return H(n,void 0,void 0,(function(){var n,i=this;return V(this,(function(o){if(this.userPool){if(!(n=this.userPool.getCurrentUser()))return W.debug("Failed to get user from user pool"),[2,r(new Error("No current user."))];n.getSession((function(o,s){return H(i,void 0,void 0,(function(){var i,s=this;return V(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(new 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{J("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):(J("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(new 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&&a.indexOf("_verified")<0){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"===z(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 H(this,void 0,void 0,(function(){var t=this;return V(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:return this.isSignedInHostedUI()?[2,new Promise((function(e,n){t.oAuthSignOutRedirect(e,n)}))]:(J("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 H(t,void 0,void 0,(function(){var t,i,s=this;return V(this,(function(a){switch(a.label){case 0:return this.isOAuthInProgress()?(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"),o.a.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),o.a.remove("auth",n),e())}o.a.listen("auth",n)}))]):[3,2];case 1:a.sent(),a.label=2;case 2:return(t=this.userPool.getCurrentUser())?(i=this._config.clientMetadata,t.getSession((function(i,o){return H(s,void 0,void 0,(function(){var s,a,u,c,l=this;return V(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];case 3:return s=f.sent(),r(new Error("Session is invalid due to: "+i.message+" and failed to clean up invalid session: "+s.message)),[2];case 4:return r(i),[2];case 5:return(a=!!e&&e.bypassCache)?[4,this.Credentials.clear()]:[3,7];case 6:f.sent(),f.label=7;case 7:return u=this._config.clientMetadata,c=o.getAccessToken().decodePayload().scope,(void 0===c?"":c).split(" ").includes("aws.cognito.signin.user.admin")?(t.getUserData((function(e,i){return H(l,void 0,void 0,(function(){var o,s,a,u,c,l,f;return V(this,(function(d){switch(d.label){case 0:if(!e)return[3,7];if(W.debug("getting user data failed",e),!this.isSessionInvalid(e))return[3,5];d.label=1;case 1:return d.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return d.sent(),[3,4];case 3:return o=d.sent(),r(new 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),d.label=6;case 6:return[2];case 7:for(s=i.PreferredMfaSetting||"NOMFA",a=[],u=0;u<i.UserAttributes.length;u++)c={Name:i.UserAttributes[u].Name,Value:i.UserAttributes[u].Value},l=new S.f(c),a.push(l);return f=this.attributesToObject(a),Object.assign(t,{attributes:f,preferredMFA:s}),[2,n(t)]}}))}))}),{bypassCache:a,clientMetadata:u}),[2]):(W.debug("Unable to get the user data because the aws.cognito.signin.user.admin is not in the scopes of the access token"),[2,n(t)])}}))}))}),{clientMetadata:i}),[2]):(W.debug("Failed to get user from user pool"),r("No current user"),[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 H(this,void 0,void 0,(function(){var t,n,r,i,o;return V(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=K(K({},r.user),{token:r.token}))}catch(e){W.debug("cannot load federated user from auth storage")}return t?(this.user=t,W.debug("get current authenticated federated user",this.user),[2,this.user]):[3,5];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(new 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(r.a.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 H(t,void 0,void 0,(function(){var t;return V(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(new 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 H(this,void 0,void 0,(function(){var e,t,n=this;return V(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)}return t?[2,this.Credentials.refreshFederatedToken(t)]:[2,this.currentSession().then((function(e){return W.debug("getting session success",e),n.Credentials.set(e,"session")})).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(r.a.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 H(this,void 0,void 0,(function(){var n,r,i=this;return V(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 H(i,void 0,void 0,(function(){var i,s=this;return V(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(new 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){Object(v.b)().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 H(this,void 0,void 0,(function(){var t;return V(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:return this.userPool?(t=this.userPool.getCurrentUser())?[4,this.cognitoIdentitySignOut(e,t)]:[3,5]:[3,7];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 J("signOut",this.user,"A user has been signed out"),this.user=null,[2]}}))}))},e.prototype.cleanCachedItems=function(){return H(this,void 0,void 0,(function(){return V(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(r.a.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),J("forgotPassword_failure",t,e+" forgotPassword failed"),i(t)},inputVerificationCode:function(t){J("forgotPassword",n,e+" has initiated forgot password flow"),r(t)}},t)}))},e.prototype.forgotPasswordSubmit=function(e,t,n,i){if(void 0===i&&(i=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(r.a.EmptyUsername);if(!t)return this.rejectAuthError(r.a.EmptyCode);if(!n)return this.rejectAuthError(r.a.EmptyPassword);var o=this.createCognitoUser(e);return new Promise((function(r,s){o.confirmPassword(t,n,{onSuccess:function(t){J("forgotPasswordSubmit",o,e+" forgotPasswordSubmit successful"),r(t)},onFailure:function(t){J("forgotPasswordSubmit_failure",t,e+" forgotPasswordSubmit failed"),s(t)}},i)}))},e.prototype.currentUserInfo=function(){return H(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return V(this,(function(a){switch(a.label){case 0:return(e=this.Credentials.getCredSource())&&"aws"!==e&&"userPool"!==e?[3,9]:[4,this.currentUserPoolUser().catch((function(e){return W.error(e)}))];case 1:if(!(s=a.sent()))return[2,null];a.label=2;case 2:return a.trys.push([2,8,,9]),[4,this.userAttributes(s)];case 3:t=a.sent(),n=this.attributesToObject(t),r=null,a.label=4;case 4:return a.trys.push([4,6,,7]),[4,this.currentCredentials()];case 5:return r=a.sent(),[3,7];case 6:return i=a.sent(),W.debug("Failed to retrieve credentials while getting current user info",i),[3,7];case 7:return[2,{id:r?r.identityId:void 0,username:s.getUsername(),attributes:n}];case 8:return o=a.sent(),W.error("currentUserInfo error",o),[2,{}];case 9:return"federated"===e?[2,(s=this.user)||{}]:[2]}}))}))},e.prototype.federatedSignIn=function(e,t,n){return H(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p;return V(this,(function(v){switch(v.label){case 0:if(!this._config.identityPoolId&&!this._config.userPoolId)throw new Error("Federation requires either a User Pool or Identity Pool in config");if(void 0===e&&this._config.identityPoolId&&!this._config.userPoolId)throw new Error("Federation with Identity Pools requires tokens passed as arguments");return Object(r.f)(e)||Object(r.g)(e)||Object(r.d)(e)||void 0===e?(i=e||{provider:r.b.Cognito},u=Object(r.f)(i)?i.provider:i.customProvider,Object(r.f)(i),o=i.customState,this._config.userPoolId&&(s=Object(r.e)(this._config.oauth)?this._config.userPoolWebClientId:this._config.oauth.clientID,a=Object(r.e)(this._config.oauth)?this._config.oauth.redirectSignIn:this._config.oauth.redirectUri,this._oAuthHandler.oauthSignIn(this._config.oauth.responseType,this._config.oauth.domain,a,s,u,o)),[3,4]):[3,1];case 1:u=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\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tYou 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:u,token:l,identity_id:f,user:n,expires_at:d},"federation")];case 2:return h=v.sent(),[4,this.currentAuthenticatedUser()];case 3:return p=v.sent(),J("signIn",p,"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 H(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,f,d,h,p;return V(this,(function(y){switch(y.label){case 0:if(this.oAuthFlowInProgress)return W.debug("Skipping URL "+e+" current flow in progress"),[2];y.label=1;case 1:if(y.trys.push([1,,8,9]),this.oAuthFlowInProgress=!0,!this._config.userPoolId)throw new Error("OAuth responses require a User Pool defined in config");if(J("parsingCallbackUrl",{url:e},"The callback url is being parsed"),t=e||(Object(v.b)().isBrowser?window.location.href:""),n=!!(Object(_.parse)(t).query||"").split("&").map((function(e){return e.split("=")})).find((function(e){var t=G(e,1)[0];return"code"===t||"error"===t})),r=!!(Object(_.parse)(t).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).find((function(e){var t=G(e,1)[0];return"access_token"===t||"error"===t})),!n&&!r)return[3,7];this._storage.setItem("amplify-redirected-from-hosted-ui","true"),y.label=2;case 2:return y.trys.push([2,6,,7]),[4,this._oAuthHandler.handleAuthResponse(t)];case 3:return i=y.sent(),o=i.accessToken,s=i.idToken,a=i.refreshToken,u=i.state,c=new S.h({IdToken:new S.c({IdToken:s}),RefreshToken:new S.d({RefreshToken:a}),AccessToken:new S.b({AccessToken:o})}),l=void 0,this._config.identityPoolId?[4,this.Credentials.set(c,"session")]:[3,5];case 4:l=y.sent(),W.debug("AWS credentials",l),y.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),J("signIn",d,"A user "+d.getUsername()+" has been signed in"),J("cognitoHostedUI",d,"A user "+d.getUsername()+" has been signed in via Cognito Hosted UI"),f&&(h=u.split("-").splice(1).join("-"),J("customOAuthState",h.match(/.{2}/g).map((function(e){return String.fromCharCode(parseInt(e,16))})).join(""),"State for user "+d.getUsername())),[2,l];case 6:return p=y.sent(),W.debug("Error in cognito hosted auth response",p),window&&void 0!==window.history&&window.history.replaceState({},null,this._config.oauth.redirectSignIn),J("signIn_failure",p,"The OAuth response flow failed"),J("cognitoHostedUI_failure",p,"A failure occurred when returning to the Cognito Hosted UI"),J("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 S.e(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?r.a.NoConfig:r.a.MissingAuthConfig},e.prototype.rejectAuthError=function(e){return Promise.reject(new L(e))},e.prototype.rejectNoUserPool=function(){var e=this.noUserPoolErrorHandler(this._config);return Promise.reject(new B(e))},e.prototype.rememberDevice=function(){return H(this,void 0,void 0,(function(){var e,t;return V(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 L(r.a.DeviceConfig)):"NetworkError"===e.code?n(new L(r.a.NetworkError)):n(e)}})}))]}}))}))},e.prototype.forgetDevice=function(){return H(this,void 0,void 0,(function(){var e,t;return V(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 L(r.a.DeviceConfig)):"NetworkError"===e.code?n(new L(r.a.NetworkError)):n(e)}})}))]}}))}))},e.prototype.fetchDevices=function(){return H(this,void 0,void 0,(function(){var e,t;return V(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),new Error("The user is not authenticated");case 3:return e.getCachedDeviceKeyAndPassword(),[2,new Promise((function(t,n){var i={onSuccess:function(e){var n=e.Devices.map((function(e){var t=e.DeviceAttributes.find((function(e){return"device_name"===e.Name}))||{};return{id:e.DeviceKey,name:t.Value}}));t(n)},onFailure:function(e){"InvalidParameterException"===e.code?n(new L(r.a.DeviceConfig)):"NetworkError"===e.code?n(new L(r.a.NetworkError)):n(e)}};e.listDevices(60,null,i)}))]}}))}))},e}())(null);w.a.register($)},function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return i}));var r={userAgent:"aws-amplify/4.7.6 js",product:"",navigator:null,isReactNative:!1};if("undefined"!=typeof navigator&&navigator.product)switch(r.product=navigator.product||"",r.navigator=navigator||null,navigator.product){case"ReactNative":r.userAgent="aws-amplify/4.7.6 react-native",r.isReactNative=!0;break;default:r.userAgent="aws-amplify/4.7.6 js",r.isReactNative=!1}var i=function(e){return""+r.userAgent+(e||"")}},,,function(e,t,n){"use strict";n.r(t),n.d(t,"locateWindow",(function(){return i}));const r={};function i(){return"undefined"!=typeof window?window:"undefined"!=typeof self?self:r}},function(e,t,n){var r;e.exports=(r=n(12),function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,s=t.algo,a=[],u=[];!function(){function t(t){for(var n=e.sqrt(t),r=2;r<=n;r++)if(!(t%r))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var r=2,i=0;i<64;)t(r)&&(i<8&&(a[i]=n(e.pow(r,.5))),u[i]=n(e.pow(r,1/3)),i++),r++}();var c=[],l=s.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],l=n[5],f=n[6],d=n[7],h=0;h<64;h++){if(h<16)c[h]=0|e[t+h];else{var p=c[h-15],v=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,y=c[h-2],g=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;c[h]=v+c[h-7]+g+c[h-16]}var m=r&i^r&o^i&o,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),w=d+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&f)+u[h]+c[h];d=f,f=l,l=a,a=s+w|0,s=o,o=i,i=r,r=w+(b+m)|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+f|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),r.SHA256)},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(21),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.a("Amplify"),s=new(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.a,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).forEach((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):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}())},function(e,t,n){var r,i,o;e.exports=(o=n(12),i=(r=o).lib.WordArray,r.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var i=[],o=0;o<n;o+=3)for(var s=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<n;a++)i.push(r.charAt(s>>>6*(3-a)&63));var u=r.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,n=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var o=0;o<n.length;o++)r[n.charCodeAt(o)]=o}var s=n.charAt(64);if(s){var a=e.indexOf(s);-1!==a&&(t=a)}return function(e,t,n){for(var r=[],o=0,s=0;s<t;s++)if(s%4){var a=n[e.charCodeAt(s-1)]<<s%4*2,u=n[e.charCodeAt(s)]>>>6-s%4*2,c=a|u;r[o>>>2]|=c<<24-o%4*8,o++}return i.create(r,o)}(e,t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},o.enc.Base64)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(0).__exportStar(n(141),t)},function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return A}));var r,i,o=n(18),s=n(3),a=n(32),u=n(19),c=n(21),l=n(76),f=n(14),d=n(10),h=n(1),p=n(4),v=n(5),y=n(2),g=n(23),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)},b=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,t 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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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])}}},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},_=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(S(arguments[t]));return e},E=new c.a("DataStore");!function(e){e.CONNECTED="CONNECTED"}(r||(r={})),function(e){e[e.none=0]="none",e[e.unauth=1]="unauth",e[e.auth=2]="auth"}(i||(i={}));var A=function(){function t(e,t,n,r,i,s){void 0===n&&(n={}),void 0===s&&(s={Auth:a.a,API:o.a,Cache:u.a}),this.schema=e,this.syncPredicates=t,this.amplifyConfig=n,this.authModeStrategy=r,this.errorHandler=i,this.amplifyContext=s,this.typeQuery=new WeakMap,this.buffer=[]}return t.prototype.buildSubscription=function(e,t,n,r,i,o,s){var a=this.amplifyConfig.aws_appsync_authenticationType,u=this.getAuthorizationInfo(t,r,a,i,o,s)||{},c=u.isOwner,l=u.ownerField,f=u.ownerValue,d=S(Object(p.c)(e,t,n,c,l),3);return{authMode:s,opType:d[0],opName:d[1],query:d[2],isOwner:c,ownerField:l,ownerValue:f}},t.prototype.getAuthorizationInfo=function(e,t,n,r,o,a){void 0===r&&(r={}),void 0===o&&(o={});var u=Object(p.e)(e);if(a===s.c.AWS_IAM&&u.find((function(e){return"private"===e.authStrategy&&"iam"===e.provider}))&&t===i.unauth)return null;var c,l=u.filter((function(e){return"groups"===e.authStrategy&&["userPools","oidc"].includes(e.provider)}));return a!==s.c.AMAZON_COGNITO_USER_POOLS&&a!==s.c.OPENID_CONNECT||!l.find((function(e){var t=Object(p.j)(r,e),n=Object(p.j)(o,e);return _(t,n).find((function(t){return e.groups.find((function(e){return e===t}))}))}))?((a===s.c.AMAZON_COGNITO_USER_POOLS?u.filter((function(e){return"owner"===e.authStrategy&&"userPools"===e.provider})):[]).forEach((function(e){var t=r[e.identityClaim];t&&(c={authMode:s.c.AMAZON_COGNITO_USER_POOLS,isOwner:!e.areSubscriptionsPublic,ownerField:e.ownerField,ownerValue:t})})),c||((a===s.c.OPENID_CONNECT?u.filter((function(e){return"owner"===e.authStrategy&&"oidc"===e.provider})):[]).forEach((function(e){var t=o[e.identityClaim];t&&(c={authMode:s.c.OPENID_CONNECT,isOwner:!e.areSubscriptionsPublic,ownerField:e.ownerField,ownerValue:t})})),c||{authMode:a||n,isOwner:!1})):{authMode:a,isOwner:!1}},t.prototype.hubQueryCompletionListener=function(e,t){t.payload.event===f.CONTROL_MSG.SUBSCRIPTION_ACK&&e()},t.prototype.start=function(){var t=this;return[new d.a((function(n){var o,s,a=[],u={},c=i.none;return b(t,void 0,void 0,(function(){var t,d,_,A,O,I,T,C,x,P,k=this;return w(this,(function(N){switch(N.label){case 0:return N.trys.push([0,2,,3]),[4,this.amplifyContext.Auth.currentCredentials()];case 1:return t=N.sent(),c=t.authenticated?i.auth:i.unauth,[3,3];case 2:return N.sent(),[3,3];case 3:return N.trys.push([3,5,,6]),[4,this.amplifyContext.Auth.currentSession()];case 4:return d=N.sent(),o=d.getIdToken().decodePayload(),[3,6];case 5:return N.sent(),[3,6];case 6:if(N.trys.push([6,11,,12]),_=this.amplifyConfig,A=_.aws_cognito_region,O=_.Auth,!A||O&&!O.region)throw"Auth is not configured";return I=void 0,[4,this.amplifyContext.Cache.getItem("federatedInfo")];case 7:return(T=N.sent())?(I=T.token,[3,10]):[3,8];case 8:return[4,this.amplifyContext.Auth.currentAuthenticatedUser()];case 9:(C=N.sent())&&(I=C.token),N.label=10;case 10:return I&&(x=I.split(".")[1],s=JSON.parse(e.from(x,"base64").toString("utf8"))),[3,12];case 11:return P=N.sent(),E.debug("error getting OIDC JWT",P),[3,12];case 12:return Object.values(this.schema.namespaces).forEach((function(e){Object.values(e.models).filter((function(e){return e.syncable})).forEach((function(t){return b(k,void 0,void 0,(function(){var r,i,d,_,A,O,I,T,C=this;return w(this,(function(x){switch(x.label){case 0:return[4,Object(p.h)({authModeStrategy:this.authModeStrategy,defaultAuthMode:this.amplifyConfig.aws_appsync_authenticationType,modelName:t.name,schema:this.schema})];case 1:return r=x.sent(),i=r.READ,u=m(m({},u),((O={})[t.name]=((I={})[p.a.CREATE]=[],I[p.a.UPDATE]=[],I[p.a.DELETE]=[],I),O)),d=[p.a.CREATE,p.a.UPDATE,p.a.DELETE],(T={})[p.a.CREATE]=0,T[p.a.UPDATE]=0,T[p.a.DELETE]=0,_=T,A=function(r){return b(C,void 0,void 0,(function(){var d,O,I,T,C,x,P,k,N,M,j,R,D,U=this;return w(this,(function(F){switch(F.label){case 0:return d=this.buildSubscription(e,t,r,c,o,s,i[_[r]]),O=d.opType,I=d.opName,T=d.query,C=d.isOwner,x=d.ownerField,P=d.ownerValue,k=d.authMode,[4,Object(p.i)(k,this.amplifyConfig)];case 1:if(N=F.sent(),M={},C){if(!P)return n.error("Owner field required, sign in is needed in order to perform this operation"),[2];M[x]=P}return E.debug("Attempting "+r+" subscription with authMode: "+i[_[r]]),j=y.f,R=this.amplifyContext.API.graphql(m(m({query:T,variables:M},{authMode:k}),{authToken:N,userAgentSuffix:j})),u[t.name][O].push(R.map((function(e){return e.value})).subscribe({next:function(e){var n=e.data,r=e.errors;if(Array.isArray(r)&&r.length>0){var i=r.map((function(e){return e.message}));return E.warn("Skipping incoming subscription. Messages: "+i.join("\n")),void U.drainBuffer()}var o=v.a.getPredicates(U.syncPredicates.get(t),!1),s=n[I];U.passesPredicateValidation(s,o)&&U.pushToBuffer(O,t,s),U.drainBuffer()},error:function(e){return b(U,void 0,void 0,(function(){var o,s,a,c,l,d;return w(this,(function(p){switch(p.label){case 0:if(o=e.error,s=S((void 0===o?{errors:[]}:o).errors,1),a=s[0],c=(void 0===a?{}:a).message,(l=void 0===c?"":c).includes(f.CONTROL_MSG.REALTIME_SUBSCRIPTION_INIT_ERROR)||l.includes(f.CONTROL_MSG.CONNECTION_FAILED)){if(u[t.name][O].forEach((function(e){return e.unsubscribe()})),u[t.name][O]=[],_[r]++,!(_[r]>=i.length))return E.debug(r+" subscription failed with authMode: "+i[_[r]-1]+". Retrying with authMode: "+i[_[r]]),A(r),[2];E.debug(r+" subscription failed with authMode: "+i[_[r]-1])}E.warn("subscriptionError",l),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:l,model:t.name,operation:r,errorType:Object(g.b)(e),process:h.i.subscribe,remoteModel:null,cause:e})];case 2:return p.sent(),[3,4];case 3:return d=p.sent(),E.error("Subscription error handler failed with:",d),[3,4];case 4:return"function"==typeof D&&D(),l.includes('"errorType":"Unauthorized"')||l.includes('"errorType":"OperationDisabled"')||n.error(l),[2]}}))}))}})),a.push(b(U,void 0,void 0,(function(){var e,t=this;return w(this,(function(n){switch(n.label){case 0:return[4,new Promise((function(n){D=n,e=t.hubQueryCompletionListener.bind(t,n),l.a.listen("api",e)}))];case 1:return n.sent(),l.a.remove("api",e),[2]}}))}))),[2]}}))}))},d.forEach((function(e){return A(e)})),[2]}}))}))}))})),Promise.all(a).then((function(){return n.next(r.CONNECTED)})),[2]}}))})),function(){Object.keys(u).forEach((function(e){u[e][p.a.CREATE].forEach((function(e){return e.unsubscribe()})),u[e][p.a.UPDATE].forEach((function(e){return e.unsubscribe()})),u[e][p.a.DELETE].forEach((function(e){return e.unsubscribe()}))}))}})),new d.a((function(e){return t.dataObserver=e,t.drainBuffer(),function(){t.dataObserver=null}}))]},t.prototype.passesPredicateValidation=function(e,t){if(!t)return!0;var n=t.predicates,r=t.type;return Object(y.D)(e,r,n)},t.prototype.pushToBuffer=function(e,t,n){this.buffer.push([e,t,n])},t.prototype.drainBuffer=function(){var e=this;this.dataObserver&&(this.buffer.forEach((function(t){return e.dataObserver.next(t)})),this.buffer=[])},t}()}).call(this,n(6).Buffer)},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var i=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,i=n;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}},function(e,t,n){var r;e.exports=(r=n(12),function(){if("function"==typeof ArrayBuffer){var e=r.lib.WordArray,t=e.init;(e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var n=e.byteLength,r=[],i=0;i<n;i++)r[i>>>2]|=e[i]<<24-i%4*8;t.call(this,r,n)}else t.apply(this,arguments)}).prototype=e}}(),r.lib.WordArray)},function(e,t,n){"use strict";n.r(t),t.default=function(e,t){return t=t||{},new Promise((function(n,r){var i=new XMLHttpRequest,o=[],s=[],a={},u=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:u,headers:{keys:function(){return o},entries:function(){return s},get:function(e){return a[e.toLowerCase()]},has:function(e){return e.toLowerCase()in a}}}};for(var c in i.open(t.method||"get",e,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,n){o.push(t=t.toLowerCase()),s.push([t,n]),a[t]=a[t]?a[t]+","+n:n})),n(u())},i.onerror=r,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(c,t.headers[c]);i.send(t.body||null)}))}},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var u,c=[],l=!1,f=-1;function d(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&h())}function h(){if(!l){var e=a(d);l=!0;for(var t=c.length;t;){for(u=c,c=[];++f<t;)u&&u[f].run();f=-1,t=c.length}u=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new p(e,t)),1!==c.length||l||a(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r=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){var s=i;if(!r.has(s))throw new Error("Invalid field for model. field: "+s+", model: "+n);return function(t){return e.sortPredicateGroupsMap.get(o).push({field:s,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 new 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}()},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var i=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,i=n;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(101),i=n(52),o=n(65),s=n(36),a=function(){function e(e){e?(this.operation=function(e){return new Promise((function(t,n){var r=(0,s.locateWindow)().msCrypto.subtle.importKey("raw",u(e),i.SHA_256_HMAC_ALGO,!1,["sign"]);r.oncomplete=function(){r.result&&t(r.result),n(new Error("ImportKey completed without importing key."))},r.onerror=function(){n(new Error("ImportKey failed to import key."))}}))}(e).then((function(e){return(0,s.locateWindow)().msCrypto.subtle.sign(i.SHA_256_HMAC_ALGO,e)})),this.operation.catch((function(){}))):this.operation=Promise.resolve((0,s.locateWindow)().msCrypto.subtle.digest("SHA-256"))}return e.prototype.update=function(e){var t=this;(0,r.isEmptyData)(e)||(this.operation=this.operation.then((function(n){return n.onerror=function(){t.operation=Promise.reject(new Error("Error encountered updating hash"))},n.process(u(e)),n})),this.operation.catch((function(){})))},e.prototype.digest=function(){return this.operation.then((function(e){return new Promise((function(t,n){e.onerror=function(){n(new Error("Error encountered finalizing hash"))},e.oncomplete=function(){e.result&&t(new Uint8Array(e.result)),n(new Error("Error encountered finalizing hash"))},e.finish()}))}))},e}();function u(e){return"string"==typeof e?(0,o.fromUtf8)(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.Sha256=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EMPTY_DATA_SHA_256=t.SHA_256_HMAC_ALGO=t.SHA_256_HASH=void 0,t.SHA_256_HASH={name:"SHA-256"},t.SHA_256_HMAC_ALGO={name:"HMAC",hash:t.SHA_256_HASH},t.EMPTY_DATA_SHA_256=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(102),i=n(52),o=n(36),s=function(){function e(e){this.toHash=new Uint8Array(0),void 0!==e&&(this.key=new Promise((function(t,n){(0,o.locateWindow)().crypto.subtle.importKey("raw",(0,r.convertToBuffer)(e),i.SHA_256_HMAC_ALGO,!1,["sign"]).then(t,n)})),this.key.catch((function(){})))}return e.prototype.update=function(e){if(!(0,r.isEmptyData)(e)){var t=(0,r.convertToBuffer)(e),n=new Uint8Array(this.toHash.byteLength+t.byteLength);n.set(this.toHash,0),n.set(t,this.toHash.byteLength),this.toHash=n}},e.prototype.digest=function(){var e=this;return this.key?this.key.then((function(t){return(0,o.locateWindow)().crypto.subtle.sign(i.SHA_256_HMAC_ALGO,t,e.toHash).then((function(e){return new Uint8Array(e)}))})):(0,r.isEmptyData)(this.toHash)?Promise.resolve(i.EMPTY_DATA_SHA_256):Promise.resolve().then((function(){return(0,o.locateWindow)().crypto.subtle.digest(i.SHA_256_HASH,e.toHash)})).then((function(e){return Promise.resolve(new Uint8Array(e))}))},e}();t.Sha256=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MAX_HASHABLE_LENGTH=t.INIT=t.KEY=t.DIGEST_LENGTH=t.BLOCK_SIZE=void 0,t.BLOCK_SIZE=64,t.DIGEST_LENGTH=32,t.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),t.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1},function(e,t,n){(function(t){var r;e.exports=(r=r||function(e,r){var i;if("undefined"!=typeof window&&window.crypto&&(i=window.crypto),"undefined"!=typeof self&&self.crypto&&(i=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(i=globalThis.crypto),!i&&"undefined"!=typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&void 0!==t&&t.crypto&&(i=t.crypto),!i)try{i=n(123)}catch(e){}var o=function(){if(i){if("function"==typeof i.getRandomValues)try{return i.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof i.randomBytes)try{return i.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),a={},u=a.lib={},c=u.Base={extend:function(e){var t=s(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},l=u.WordArray=c.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||d).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,i=e.sigBytes;if(this.clamp(),r%4)for(var o=0;o<i;o++){var s=n[o>>>2]>>>24-o%4*8&255;t[r+o>>>2]|=s<<24-(r+o)%4*8}else for(var a=0;a<i;a+=4)t[r+a>>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(o());return new l.init(t,e)}}),f=a.enc={},d=f.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new l.init(n,t/2)}},h=f.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new l.init(n,t)}},p=f.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},v=u.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,i=r.words,o=r.sigBytes,s=this.blockSize,a=o/(4*s),u=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,c=e.min(4*u,o);if(u){for(var f=0;f<u;f+=s)this._doProcessBlock(i,f);n=i.splice(0,u),r.sigBytes-=c}return new l.init(n,c)},clone:function(){var e=c.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),y=(u.Hasher=v.extend({cfg:c.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){v.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new y.HMAC.init(e,n).finalize(t)}}}),a.algo={});return a}(Math),r)}).call(this,n(27))},function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},function(e,t,n){"use strict";var r=n(13);function i(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var o;if(n)o=n(t);else if(r.isURLSearchParams(t))o=t.toString();else{var s=[];r.forEach(t,(function(e,t){null!=e&&(r.isArray(e)?t+="[]":e=[e],r.forEach(e,(function(e){r.isDate(e)?e=e.toISOString():r.isObject(e)&&(e=JSON.stringify(e)),s.push(i(t)+"="+i(e))})))})),o=s.join("&")}if(o){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}},function(e,t,n){"use strict";e.exports=function(e,t,n,r,i){return e.config=t,n&&(e.code=n),e.request=r,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}},function(e,t,n){"use strict";var r=n(13),i=n(130),o=n(131),s=n(57),a=n(132),u=n(135),c=n(136),l=n(60),f=n(29),d=n(30);e.exports=function(e){return new Promise((function(t,n){var h,p=e.data,v=e.headers,y=e.responseType;function g(){e.cancelToken&&e.cancelToken.unsubscribe(h),e.signal&&e.signal.removeEventListener("abort",h)}r.isFormData(p)&&delete v["Content-Type"];var m=new XMLHttpRequest;if(e.auth){var b=e.auth.username||"",w=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";v.Authorization="Basic "+btoa(b+":"+w)}var S=a(e.baseURL,e.url);function _(){if(m){var r="getAllResponseHeaders"in m?u(m.getAllResponseHeaders()):null,o={data:y&&"text"!==y&&"json"!==y?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m};i((function(e){t(e),g()}),(function(e){n(e),g()}),o),m=null}}if(m.open(e.method.toUpperCase(),s(S,e.params,e.paramsSerializer),!0),m.timeout=e.timeout,"onloadend"in m?m.onloadend=_:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(_)},m.onabort=function(){m&&(n(l("Request aborted",e,"ECONNABORTED",m)),m=null)},m.onerror=function(){n(l("Network Error",e,null,m)),m=null},m.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",r=e.transitional||f.transitional;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(l(t,e,r.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",m)),m=null},r.isStandardBrowserEnv()){var E=(e.withCredentials||c(S))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;E&&(v[e.xsrfHeaderName]=E)}"setRequestHeader"in m&&r.forEach(v,(function(e,t){void 0===p&&"content-type"===t.toLowerCase()?delete v[t]:m.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(m.withCredentials=!!e.withCredentials),y&&"json"!==y&&(m.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&m.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&m.upload&&m.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(h=function(e){m&&(n(!e||e&&e.type?new d("canceled"):e),m.abort(),m=null)},e.cancelToken&&e.cancelToken.subscribe(h),e.signal&&(e.signal.aborted?h():e.signal.addEventListener("abort",h))),p||(p=null),m.send(p)}))}},function(e,t,n){"use strict";var r=n(58);e.exports=function(e,t,n,i,o){var s=new Error(e);return r(s,t,n,i,o)}},function(e,t,n){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";var r=n(13);e.exports=function(e,t){t=t||{};var n={};function i(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function o(n){return r.isUndefined(t[n])?r.isUndefined(e[n])?void 0:i(void 0,e[n]):i(e[n],t[n])}function s(e){if(!r.isUndefined(t[e]))return i(void 0,t[e])}function a(n){return r.isUndefined(t[n])?r.isUndefined(e[n])?void 0:i(void 0,e[n]):i(void 0,t[n])}function u(n){return n in t?i(e[n],t[n]):n in e?i(void 0,e[n]):void 0}var c={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u};return r.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=c[e]||o,i=t(e);r.isUndefined(i)&&t!==u||(n[e]=i)})),n}},function(e,t){e.exports={version:"0.26.0"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BLOCK_SIZE=64,t.DIGEST_LENGTH=32,t.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),t.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1},function(e,t,n){"use strict";n.r(t),n.d(t,"fromUtf8",(function(){return r})),n.d(t,"toUtf8",(function(){return i}));const r=e=>"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):(e=>{const t=[];for(let n=0,r=e.length;n<r;n++){const r=e.charCodeAt(n);if(r<128)t.push(r);else if(r<2048)t.push(r>>6|192,63&r|128);else if(n+1<e.length&&55296==(64512&r)&&56320==(64512&e.charCodeAt(n+1))){const i=65536+((1023&r)<<10)+(1023&e.charCodeAt(++n));t.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}else t.push(r>>12|224,r>>6&63|128,63&r|128)}return Uint8Array.from(t)})(e),i=e=>"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):(e=>{let t="";for(let n=0,r=e.length;n<r;n++){const r=e[n];if(r<128)t+=String.fromCharCode(r);else if(192<=r&&r<224){const i=e[++n];t+=String.fromCharCode((31&r)<<6|63&i)}else if(240<=r&&r<365){const i="%"+[r,e[++n],e[++n],e[++n]].map(e=>e.toString(16)).join("%");t+=decodeURIComponent(i)}else t+=String.fromCharCode((15&r)<<12|(63&e[++n])<<6|63&e[++n])}return t})(e)},function(e,t,n){"use strict";n.d(t,"a",(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}()},function(e,t,n){"use strict";(function(e){var r;if(n.d(t,"a",(function(){return i})),"undefined"!=typeof window&&window.crypto&&(r=window.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==e&&e.crypto&&(r=e.crypto),!r)try{r=n(89)}catch(e){}function i(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")}}).call(this,n(27))},function(e,t,n){"use strict";var r,i,o=n(91);function s(e,t,n){if(e._observer)a(e._observer,t,n);else if(e._observers){var r=[];e._observers.forEach((function(e){r.push(e)})),r.forEach((function(e){a(e,t,n)}))}}function a(e,t,n){if(!e.closed)switch(t){case"next":return e.next(n);case"error":return e.error(n);case"complete":return e.complete(n)}}function u(e){return e._observer||e._observers&&e._observers.size>0}function c(e){var t=this;this._observer=null,this._observers=null,this._observable=new o((function(n){return function(e,t){!u(e)&&t&&t.start&&t.start()}(t,e),function(e,t){e._observers?e._observers.add(t):e._observer?(e._observers=new Set,e._observers.add(e._observer),e._observers.add(t),e._observer=null):e._observer=t}(t,n),function(){!function(e,t){e._observers?e._observers.delete(t):e._observer===t&&(e._observer=null)}(t,n),function(e,t){!u(e)&&t&&t.pause&&t.pause()}(t,e)}}))}r=c.prototype,i={get observable(){return this._observable},get observed(){return u(this)},next:function(e){s(this,"next",e)},error:function(e){s(this,"error",e)},complete:function(e){s(this,"complete",e)}},Object.keys(i).forEach((function(e){var t=Object.getOwnPropertyDescriptor(i,e);t.enumerable=!1,Object.defineProperty(r,e,t)})),e.exports=c},function(e,t,n){var r=n(98),i=n(99),o=i;o.v1=r,o.v4=i,e.exports=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebCryptoSha256=t.Ie11Sha256=void 0,(0,n(0).__exportStar)(n(100),t);var r=n(51);Object.defineProperty(t,"Ie11Sha256",{enumerable:!0,get:function(){return r.Sha256}});var i=n(53);Object.defineProperty(t,"WebCryptoSha256",{enumerable:!0,get:function(){return i.Sha256}})},function(e,t,n){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r=n(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,r){void 0===r&&(r=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(n),s=Math.max(i,o),a=0,u=e.map([t,n],(function(t){var n=s-e.getVersionPrecision(t),r=t+new Array(n+1).join(".0");return e.map(r.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(u[0][s]>u[1][s])return 1;if(u[0][s]===u[1][s]){if(s===a)return 0;s-=1}else if(u[0][s]<u[1][s])return-1}},e.map=function(e,t){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n+=1)r.push(t(e[n]));return r},e.find=function(e,t){var n,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,r=e.length;n<r;n+=1){var i=e[n];if(t(i,n))return i}},e.assign=function(e){for(var t,n,r=e,i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var a=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){r[t]=e[t]}))};for(t=0,n=o.length;t<n;t+=1)a();return e},e.getBrowserAlias=function(e){return r.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return r.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,n){"use strict";t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18);function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=function(){function e(){}var t,n;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},t=e,(n=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}])&&s(t,n),e}();t.default=a,e.exports=t.default},91:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r=u(n(92)),i=u(n(93)),o=u(n(94)),s=u(n(95)),a=u(n(17));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=a.default.find(r.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=a.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=a.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=a.default.find(s.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return a.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,n={},r=0,i={},o=0;if(Object.keys(e).forEach((function(t){var s=e[t];"string"==typeof s?(i[t]=s,o+=1):"object"==typeof s&&(n[t]=s,r+=1)})),r>0){var s=Object.keys(n),u=a.default.find(s,(function(e){return t.isOS(e)}));if(u){var c=this.satisfies(n[u]);if(void 0!==c)return c}var l=a.default.find(s,(function(e){return t.isPlatform(e)}));if(l){var f=this.satisfies(n[l]);if(void 0!==f)return f}}if(o>0){var d=Object.keys(i),h=a.default.find(d,(function(e){return t.isBrowser(e,!0)}));if(void 0!==h)return this.compareVersion(i[h])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),i=a.default.getBrowserTypeByAlias(r);return t&&i&&(r=i.toLowerCase()),r===n},t.compareVersion=function(e){var t=[0],n=e,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(a.default.compareVersions(i,n,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=c,e.exports=t.default},92:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=s,e.exports=t.default},93:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(t),r={name:o.OS_MAP.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=i.default.getAndroidVersionName(t),r={name:o.OS_MAP.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:o.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=s,e.exports=t.default},94:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=s,e.exports=t.default},95:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=s,e.exports=t.default}})},function(e){e.exports=JSON.parse('{"name":"@aws-sdk/client-cognito-identity","description":"AWS SDK for JavaScript Cognito Identity Client for Node.js, Browser and React Native","version":"3.6.1","scripts":{"clean":"yarn remove-definitions && yarn remove-dist && yarn remove-documentation","build-documentation":"yarn remove-documentation && typedoc ./","prepublishOnly":"yarn build","pretest":"yarn build:cjs","remove-definitions":"rimraf ./types","remove-dist":"rimraf ./dist","remove-documentation":"rimraf ./docs","test:unit":"mocha **/cjs/**/*.spec.js","test:e2e":"mocha **/cjs/**/*.ispec.js && karma start karma.conf.js","test":"yarn test:unit","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig.es.json","build":"yarn build:cjs && yarn build:es","postbuild":"downlevel-dts types types/ts3.4"},"main":"./dist/cjs/index.js","types":"./types/index.d.ts","module":"./dist/es/index.js","browser":{"./runtimeConfig":"./runtimeConfig.browser"},"react-native":{"./runtimeConfig":"./runtimeConfig.native"},"sideEffects":false,"dependencies":{"@aws-crypto/sha256-browser":"^1.0.0","@aws-crypto/sha256-js":"^1.0.0","@aws-sdk/config-resolver":"3.6.1","@aws-sdk/credential-provider-node":"3.6.1","@aws-sdk/fetch-http-handler":"3.6.1","@aws-sdk/hash-node":"3.6.1","@aws-sdk/invalid-dependency":"3.6.1","@aws-sdk/middleware-content-length":"3.6.1","@aws-sdk/middleware-host-header":"3.6.1","@aws-sdk/middleware-logger":"3.6.1","@aws-sdk/middleware-retry":"3.6.1","@aws-sdk/middleware-serde":"3.6.1","@aws-sdk/middleware-signing":"3.6.1","@aws-sdk/middleware-stack":"3.6.1","@aws-sdk/middleware-user-agent":"3.6.1","@aws-sdk/node-config-provider":"3.6.1","@aws-sdk/node-http-handler":"3.6.1","@aws-sdk/protocol-http":"3.6.1","@aws-sdk/smithy-client":"3.6.1","@aws-sdk/types":"3.6.1","@aws-sdk/url-parser":"3.6.1","@aws-sdk/url-parser-native":"3.6.1","@aws-sdk/util-base64-browser":"3.6.1","@aws-sdk/util-base64-node":"3.6.1","@aws-sdk/util-body-length-browser":"3.6.1","@aws-sdk/util-body-length-node":"3.6.1","@aws-sdk/util-user-agent-browser":"3.6.1","@aws-sdk/util-user-agent-node":"3.6.1","@aws-sdk/util-utf8-browser":"3.6.1","@aws-sdk/util-utf8-node":"3.6.1","tslib":"^2.0.0"},"devDependencies":{"@aws-sdk/client-documentation-generator":"3.6.1","@aws-sdk/client-iam":"3.6.1","@types/chai":"^4.2.11","@types/mocha":"^8.0.4","@types/node":"^12.7.5","downlevel-dts":"0.7.0","jest":"^26.1.0","rimraf":"^3.0.0","typedoc":"^0.19.2","typescript":"~4.1.2"},"engines":{"node":">=10.0.0"},"typesVersions":{"<4.0":{"types/*":["types/ts3.4/*"]}},"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-cognito-identity","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"clients/client-cognito-identity"}}')},function(e,t,n){var r;e.exports=(r=n(55),function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,s=t.algo,a=[],u=[];!function(){function t(t){for(var n=e.sqrt(t),r=2;r<=n;r++)if(!(t%r))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var r=2,i=0;i<64;)t(r)&&(i<8&&(a[i]=n(e.pow(r,.5))),u[i]=n(e.pow(r,1/3)),i++),r++}();var c=[],l=s.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],l=n[5],f=n[6],d=n[7],h=0;h<64;h++){if(h<16)c[h]=0|e[t+h];else{var p=c[h-15],v=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,y=c[h-2],g=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;c[h]=v+c[h-7]+g+c[h-16]}var m=r&i^r&o^i&o,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),w=d+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&f)+u[h]+c[h];d=f,f=l,l=a,a=s+w|0,s=o,o=i,i=r,r=w+(b+m)|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+f|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),r.SHA256)},function(e,t,n){var r,i,o;e.exports=(o=n(55),i=(r=o).lib.WordArray,r.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var i=[],o=0;o<n;o+=3)for(var s=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<n;a++)i.push(r.charAt(s>>>6*(3-a)&63));var u=r.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,n=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var o=0;o<n.length;o++)r[n.charCodeAt(o)]=o}var s=n.charAt(64);if(s){var a=e.indexOf(s);-1!==a&&(t=a)}return function(e,t,n){for(var r=[],o=0,s=0;s<t;s++)if(s%4){var a=n[e.charCodeAt(s-1)]<<s%4*2,u=n[e.charCodeAt(s)]>>>6-s%4*2,c=a|u;r[o>>>2]|=c<<24-o%4*8,o++}return i.create(r,o)}(e,t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},o.enc.Base64)},function(e,t,n){e.exports=n(143).Observable},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(21),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.a("Hub"),u="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default";var 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)return void a.warn("No listeners for "+e);this.patterns=s(this.patterns.filter((function(e){return e!==n})))}else{var r=this.listeners[e];if(!r)return void a.warn("No listeners for "+e);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"),function(e){return void 0!==e.onHubCapsule}(t))a.warn("WARNING onHubCapsule is Deprecated. Please pass in a callback."),r=t.onHubCapsule.bind(t);else{if("function"!=typeof t)throw new Error("No callback supplied to Hub");r=t}if(e instanceof RegExp)this.patterns.push({pattern:e,callback:r});else{var o=this.listeners[e];o||(o=[],this.listeners[e]=o),o.push({name:n,callback:r})}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)return void a.warn("Cannot perform pattern matching without a message key");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__")},,,,,function(e,t,n){var r,i,o=n(42),s=n(43),a=0,u=0;e.exports=function(e,t,n){var c=t&&n||0,l=t||[],f=(e=e||{}).node||r,d=void 0!==e.clockseq?e.clockseq:i;if(null==f||null==d){var h=o();null==f&&(f=r=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==d&&(d=i=16383&(h[6]<<8|h[7]))}var p=void 0!==e.msecs?e.msecs:(new Date).getTime(),v=void 0!==e.nsecs?e.nsecs:u+1,y=p-a+(v-u)/1e4;if(y<0&&void 0===e.clockseq&&(d=d+1&16383),(y<0||p>a)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=p,u=v,i=d;var g=(1e4*(268435455&(p+=122192928e5))+v)%4294967296;l[c++]=g>>>24&255,l[c++]=g>>>16&255,l[c++]=g>>>8&255,l[c++]=255&g;var m=p/4294967296*1e4&268435455;l[c++]=m>>>8&255,l[c++]=255&m,l[c++]=m>>>24&15|16,l[c++]=m>>>16&255,l[c++]=d>>>8|128,l[c++]=255&d;for(var b=0;b<6;++b)l[c+b]=f[b];return t||s(l)}},function(e,t,n){var r=n(42),i=n(43);e.exports=function(e,t,n){var o=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[o+a]=s[a];return t||i(s)}},function(e,t,n){"use strict";t.byteLength=function(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=c(e),s=r[0],a=r[1],u=new o(function(e,t,n){return 3*(t+n)/4-n}(0,s,a)),l=0,f=a>0?s-4:s;for(n=0;n<f;n+=4)t=i[e.charCodeAt(n)]<<18|i[e.charCodeAt(n+1)]<<12|i[e.charCodeAt(n+2)]<<6|i[e.charCodeAt(n+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===a&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=0,a=n-i;s<a;s+=16383)o.push(l(e,s,s+16383>a?a:s+16383));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)r[a]=s[a],i[s.charCodeAt(a)]=a;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var i,o,s=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){
48
+ */!function(o){if(void 0===(i="function"==typeof(r=o)?r.call(t,n,t,e):r)||(e.exports=i),!0,e.exports=o(),!!0){var s=window.Cookies,a=window.Cookies=o();a.noConflict=function(){return window.Cookies=s,a}}}((function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function i(){}function o(t,n,o){if("undefined"!=typeof document){"number"==typeof(o=e({path:"/"},i.defaults,o)).expires&&(o.expires=new Date(1*new Date+864e5*o.expires)),o.expires=o.expires?o.expires.toUTCString():"";try{var s=JSON.stringify(n);/^[\{\[]/.test(s)&&(n=s)}catch(e){}n=r.write?r.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var a="";for(var u in o)o[u]&&(a+="; "+u,!0!==o[u]&&(a+="="+o[u].split(";")[0]));return document.cookie=t+"="+n+a}}function s(e,n){if("undefined"!=typeof document){for(var i={},o=document.cookie?document.cookie.split("; "):[],s=0;s<o.length;s++){var a=o[s].split("="),u=a.slice(1).join("=");n||'"'!==u.charAt(0)||(u=u.slice(1,-1));try{var c=t(a[0]);if(u=(r.read||r)(u,c)||t(u),n)try{u=JSON.parse(u)}catch(e){}if(i[c]=u,e===c)break}catch(e){}}return e?i[e]:i}}return i.set=o,i.get=function(e){return s(e,!1)},i.getJSON=function(e){return s(e,!0)},i.remove=function(t,n){o(t,"",e(n,{expires:-1}))},i.defaults={},i.withConverter=n,i}((function(){}))}))},function(e,t,n){var r;e.exports=(r=n(12),function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,s=t.algo,a=[],u=[];!function(){function t(t){for(var n=e.sqrt(t),r=2;r<=n;r++)if(!(t%r))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var r=2,i=0;i<64;)t(r)&&(i<8&&(a[i]=n(e.pow(r,.5))),u[i]=n(e.pow(r,1/3)),i++),r++}();var c=[],l=s.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],l=n[5],f=n[6],d=n[7],h=0;h<64;h++){if(h<16)c[h]=0|e[t+h];else{var p=c[h-15],v=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,y=c[h-2],g=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;c[h]=v+c[h-7]+g+c[h-16]}var m=r&i^r&o^i&o,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),w=d+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&f)+u[h]+c[h];d=f,f=l,l=a,a=s+w|0,s=o,o=i,i=r,r=w+(b+m)|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+f|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),r.SHA256)},function(e,t,n){var r,i,o;e.exports=(o=n(12),i=(r=o).lib.WordArray,r.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var i=[],o=0;o<n;o+=3)for(var s=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<n;a++)i.push(r.charAt(s>>>6*(3-a)&63));var u=r.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,n=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var o=0;o<n.length;o++)r[n.charCodeAt(o)]=o}var s=n.charAt(64);if(s){var a=e.indexOf(s);-1!==a&&(t=a)}return function(e,t,n){for(var r=[],o=0,s=0;s<t;s++)if(s%4){var a=n[e.charCodeAt(s-1)]<<s%4*2,u=n[e.charCodeAt(s)]>>>6-s%4*2,c=a|u;r[o>>>2]|=c<<24-o%4*8,o++}return i.create(r,o)}(e,t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},o.enc.Base64)},function(e,t,n){e.exports=n(126)},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";(function(t){var r=n(13),i=n(131),o=n(61),s={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var u,c={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==t&&"[object process]"===Object.prototype.toString.call(t))&&(u=n(62)),u),transformRequest:[function(e,t){return i(t,"Accept"),i(t,"Content-Type"),r.isFormData(e)||r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e)?e:r.isArrayBufferView(e)?e.buffer:r.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):r.isObject(e)||t&&"application/json"===t["Content-Type"]?(a(t,"application/json"),function(e,t,n){if(r.isString(e))try{return(t||JSON.parse)(e),r.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||c.transitional,n=t&&t.silentJSONParsing,i=t&&t.forcedJSONParsing,s=!n&&"json"===this.responseType;if(s||i&&r.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(s){if("SyntaxError"===e.name)throw o(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function(e){c.headers[e]={}})),r.forEach(["post","put","patch"],(function(e){c.headers[e]=r.merge(s)})),e.exports=c}).call(this,n(48))},function(e,t,n){"use strict";function r(e){this.message=e}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,e.exports=r},function(e,t,n){var r=n(82),i=n(83),o=i;o.v1=r,o.v4=i,e.exports=o},function(e,t,n){"use strict";n.d(t,"a",(function(){return B}));var r=n(0),i=n(3),o=n(22),s=n(78),a=n(154),u=new o.a("Parser"),c=function(e){var t,n={};if(e.aws_mobile_analytics_app_id){var i={AWSPinpoint:{appId:e.aws_mobile_analytics_app_id,region:e.aws_mobile_analytics_app_region}};n.Analytics=i}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=Object(r.a)(Object(r.a)({},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),u.debug("parse config",e,"to amplifyconfig",n),n},l=function(){function e(){}return e.parseMobilehubConfig=c,e}(),f=n(26);function d(e,t){void 0===t&&(t={});var n=function(e){if(e&&"j"===e[0]&&":"===e[1])return e.substr(2);return e}(e);if(function(e,t){return void 0===t&&(t=!e||"{"!==e[0]&&"["!==e[0]&&'"'!==e[0]),!t}(n,t.doNotParse))try{return JSON.parse(n)}catch(e){}return e}var h=function(){return(h=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(){function e(e,t){var n=this;this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.cookies=function(e,t){return"string"==typeof e?f.parse(e,t):"object"==typeof e&&null!==e?e:{}}(e,t),new Promise((function(){n.HAS_DOCUMENT_COOKIE="object"==typeof document&&"string"==typeof document.cookie})).catch((function(){}))}return e.prototype._updateBrowserValues=function(e){this.HAS_DOCUMENT_COOKIE&&(this.cookies=f.parse(document.cookie,e))},e.prototype._emitChange=function(e){for(var t=0;t<this.changeListeners.length;++t)this.changeListeners[t](e)},e.prototype.get=function(e,t,n){return void 0===t&&(t={}),this._updateBrowserValues(n),d(this.cookies[e],t)},e.prototype.getAll=function(e,t){void 0===e&&(e={}),this._updateBrowserValues(t);var n={};for(var r in this.cookies)n[r]=d(this.cookies[r],e);return n},e.prototype.set=function(e,t,n){var r;"object"==typeof t&&(t=JSON.stringify(t)),this.cookies=h(h({},this.cookies),((r={})[e]=t,r)),this.HAS_DOCUMENT_COOKIE&&(document.cookie=f.serialize(e,t,n)),this._emitChange({name:e,value:t,options:n})},e.prototype.remove=function(e,t){var n=t=h(h({},t),{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=h({},this.cookies),delete this.cookies[e],this.HAS_DOCUMENT_COOKIE&&(document.cookie=f.serialize(e,"",n)),this._emitChange({name:e,value:void 0,options:t})},e.prototype.addChangeListener=function(e){this.changeListeners.push(e)},e.prototype.removeChangeListener=function(e){var t=this.changeListeners.indexOf(e);t>=0&&this.changeListeners.splice(t,1)},e}(),v=n(17),y=Object(v.b)().isBrowser,g=function(){function e(e){void 0===e&&(e={}),this.cookies=new p,this.store=y?window.localStorage:Object.create(null),this.cookies=e.req?new p(e.req.headers.cookie):new p,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(new 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":y?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}(),m=n(70);var b=n(40),w=n(8),S=n(9),O=function(e){var t=window.open(e,"_self");return t?Promise.resolve(t):Promise.reject()},_=n(28),E=n.n(_),A=n(29),I=n.n(A),T="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",j=function(e,t,n){s.a.dispatch("auth",{event:e,data:t,message:n},"Auth",T)},C=new o.a("OAuth"),P=function(){function e(e){var t=e.config,n=e.cognitoClientId,r=e.scopes,i=void 0===r?[]:r;if(this._urlOpener=t.urlOpener||O,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,o,s,a){void 0===e&&(e="code"),void 0===s&&(s=i.b.Cognito);var u=this._generateState(32),c=a?u+"-"+a.split("").map((function(e){return e.charCodeAt(0).toString(16).padStart(2,"0")})).join(""):u;!function(e){window.sessionStorage.setItem("oauth_state",e)}(c);var l,f=this._generateRandom(128);l=f,window.sessionStorage.setItem("ouath_pkce_key",l);var d=this._generateChallenge(f),h=this._scopes.join(" "),p="https://"+t+"/oauth2/authorize?"+Object.entries(Object(r.a)(Object(r.a)({redirect_uri:n,response_type:e,client_id:o,identity_provider:s,scope:h,state:c},"code"===e?{code_challenge:d}:{}),"code"===e?{code_challenge_method:"S256"}:{})).map((function(e){var t=Object(r.f)(e,2),n=t[0],i=t[1];return encodeURIComponent(n)+"="+encodeURIComponent(i)})).join("&");C.debug("Redirecting to "+p),this._urlOpener(p,n)},e.prototype._handleCodeFlow=function(e){return Object(r.c)(this,void 0,void 0,(function(){var t,n,o,s,a,u,c,l,f,d,h,p,v,y;return Object(r.e)(this,(function(g){switch(g.label){case 0:return t=(Object(S.parse)(e).query||"").split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n,i=Object(r.f)(t,2),o=i[0],s=i[1];return Object(r.a)(Object(r.a)({},e),((n={})[o]=s,n))}),{code:void 0}).code,n=Object(S.parse)(e).pathname||"/",o=Object(S.parse)(this._config.redirectSignIn).pathname||"/",t&&n===o?(s="https://"+this._config.domain+"/oauth2/token",j("codeFlow",{},"Retrieving tokens from "+s),a=Object(i.e)(this._config)?this._cognitoClientId:this._config.clientID,u=Object(i.e)(this._config)?this._config.redirectSignIn:this._config.redirectUri,m=window.sessionStorage.getItem("ouath_pkce_key"),window.sessionStorage.removeItem("ouath_pkce_key"),c=m,l=Object(r.a)({grant_type:"authorization_code",code:t,client_id:a,redirect_uri:u},c?{code_verifier:c}:{}),C.debug("Calling token endpoint: "+s+" with",l),f=Object.entries(l).map((function(e){var t=Object(r.f)(e,2),n=t[0],i=t[1];return encodeURIComponent(n)+"="+encodeURIComponent(i)})).join("&"),[4,fetch(s,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:f})]):[2];case 1:return[4,g.sent().json()];case 2:if(d=g.sent(),h=d.access_token,p=d.refresh_token,v=d.id_token,y=d.error)throw new Error(y);return[2,{accessToken:h,refreshToken:p,idToken:v}]}var m}))}))},e.prototype._handleImplicitFlow=function(e){return Object(r.c)(this,void 0,void 0,(function(){var t,n,i;return Object(r.e)(this,(function(o){return t=(Object(S.parse)(e).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n,i=Object(r.f)(t,2),o=i[0],s=i[1];return Object(r.a)(Object(r.a)({},e),((n={})[o]=s,n))}),{id_token:void 0,access_token:void 0}),n=t.id_token,i=t.access_token,j("implicitFlow",{},"Got tokens from "+e),C.debug("Retrieving implicit tokens from "+e+" with"),[2,{accessToken:i,idToken:n,refreshToken:null}]}))}))},e.prototype.handleAuthResponse=function(e){return Object(r.c)(this,void 0,void 0,(function(){var t,n,i,o,s,a,u;return Object(r.e)(this,(function(c){switch(c.label){case 0:if(c.trys.push([0,5,,6]),t=e?Object(r.a)(Object(r.a)({},(Object(S.parse)(e).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n=Object(r.f)(t,2),i=n[0],o=n[1];return e[i]=o,e}),{})),(Object(S.parse)(e).query||"").split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n=Object(r.f)(t,2),i=n[0],o=n[1];return e[i]=o,e}),{})):{},n=t.error,i=t.error_description,n)throw new Error(i);return o=this._validateState(t),C.debug("Starting "+this._config.responseType+" flow with "+e),"code"!==this._config.responseType?[3,2]:(s=[{}],[4,this._handleCodeFlow(e)]);case 1:return[2,r.a.apply(void 0,[r.a.apply(void 0,s.concat([c.sent()])),{state:o}])];case 2:return a=[{}],[4,this._handleImplicitFlow(e)];case 3:return[2,r.a.apply(void 0,[r.a.apply(void 0,a.concat([c.sent()])),{state:o}])];case 4:return[3,6];case 5:throw u=c.sent(),C.error("Error handling auth response.",u),u;case 6:return[2]}}))}))},e.prototype._validateState=function(e){if(e){var t,n=(t=window.sessionStorage.getItem("oauth_state"),window.sessionStorage.removeItem("oauth_state"),t),r=e.state;if(n&&n!==r)throw new Error("Invalid state in OAuth flow");return r}},e.prototype.signOut=function(){return Object(r.c)(this,void 0,void 0,(function(){var e,t,n;return Object(r.e)(this,(function(o){return e="https://"+this._config.domain+"/logout?",t=Object(i.e)(this._config)?this._cognitoClientId:this._config.oauth.clientID,n=Object(i.e)(this._config)?this._config.redirectSignOut:this._config.returnTo,e+=Object.entries({client_id:t,logout_uri:encodeURIComponent(n)}).map((function(e){var t=Object(r.f)(e,2);return t[0]+"="+t[1]})).join("&"),j("oAuthSignOut",{oAuth:"signOut"},"Signing out from "+e),C.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(I.a).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]=Math.random()*"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~".length|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}(),x=n(11),k=new o.a("AuthError"),N=function(e){function t(n){var r=this,i=D[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,k.error(r.log),r}return Object(r.d)(t,e),t}(Error),M=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 Object(r.d)(t,e),t}(N),D={noConfig:{message:x.a.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\t\t\t\tRefer to our docs site for help upgrading Amplify packages (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js)\n "},missingAuthConfig:{message:x.a.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:x.a.EMPTY_USERNAME},invalidUsername:{message:x.a.INVALID_USERNAME},emptyPassword:{message:x.a.EMPTY_PASSWORD},emptyCode:{message:x.a.EMPTY_CODE},signUpError:{message:x.a.SIGN_UP_ERROR,log:"The first parameter should either be non-null string or object"},noMFA:{message:x.a.NO_MFA},invalidMFA:{message:x.a.INVALID_MFA},emptyChallengeResponse:{message:x.a.EMPTY_CHALLENGE},noUserSession:{message:x.a.NO_USER_SESSION},deviceConfig:{message:x.a.DEVICE_CONFIG},networkError:{message:x.a.NETWORK_ERROR},autoSignInError:{message:x.a.AUTOSIGNIN_ERROR},default:{message:x.a.DEFAULT_MSG}};function R(e){return(R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var U=new o.a("AuthClass"),F="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",L=function(e,t,n){s.a.dispatch("auth",{event:e,data:t,message:n},"Auth",F)},B=new(function(){function e(e){var t=this;this.userPool=null,this.user=null,this.oAuthFlowInProgress=!1,this.autoSignInInitiated=!1,this.Credentials=a.a,this.wrapRefreshSessionCallback=function(e){return function(t,n){return n?L("tokenRefresh",void 0,"New token retrieved"):L("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),s.a.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||{};U.debug("configure Auth");var n=Object.assign({},this._config,l.parseMobilehubConfig(e).Auth,e);this._config=n;var r=this._config,o=r.userPoolId,s=r.userPoolWebClientId,a=r.cookieStorage,u=r.oauth,c=r.region,f=r.identityPoolId,d=r.mandatorySignIn,h=r.refreshHandlers,p=r.identityPoolRegion,y=r.clientMetadata,b=r.endpoint;if(this._config.storage){if(!this._isValidAuthStorage(this._config.storage))throw U.error("The storage in the Auth config is not valid!"),new Error("Empty storage object");this._storage=this._config.storage}else this._storage=a?new w.i(a):e.ssr?new g:(new m.a).getStorage();if(this._storageSync=Promise.resolve(),"function"==typeof this._storage.sync&&(this._storageSync=this._storage.sync()),o){var S={UserPoolId:o,ClientId:s,endpoint:b};S.Storage=this._storage,this.userPool=new w.g(S,this.wrapRefreshSessionCallback)}this.Credentials.configure({mandatorySignIn:d,region:p||c,userPoolId:o,identityPoolId:f,refreshHandlers:h,storage:this._storage});var O=u?Object(i.e)(this._config.oauth)?u:u.awsCognito:void 0;if(O){var _=Object.assign({cognitoClientId:s,UserPoolId:o,domain:O.domain,scopes:O.scope,redirectSignIn:O.redirectSignIn,redirectSignOut:O.redirectSignOut,responseType:O.responseType,Storage:this._storage,urlOpener:O.urlOpener,clientMetadata:y},O.options);this._oAuthHandler=new P({scopes:_.scopes,config:_,cognitoClientId:_.cognitoClientId});var E={};!function(e){if(Object(v.b)().isBrowser&&window.location)e({url:window.location.href});else if(!Object(v.b)().isNode)throw new Error("Not supported")}((function(e){var n=e.url;E[n]||(E[n]=!0,t._handleAuthResponse(n))}))}(L("configured",null,"The Auth category has been configured successfully"),this.autoSignInInitiated||"function"!=typeof this._storage.getItem)||(this.isTrueStorageValue("amplify-polling-started")&&(L("autoSignIn_failure",null,i.a.AutoSignInError),this._storage.removeItem("amplify-auto-sign-in")),this._storage.removeItem("amplify-polling-started"));return this._config},e.prototype.signUp=function(e){for(var t,n,r,o=this,s=[],a=1;a<arguments.length;a++)s[a-1]=arguments[a];if(!this.userPool)return this.rejectNoUserPool();var u,c=null,l=null,f=[],d=null,h={enabled:!1},p={},v={};if(e&&"string"==typeof e){c=e,l=s?s[0]:null;var y=s?s[1]:null,g=s?s[2]:null;y&&f.push(new w.f({Name:"email",Value:y})),g&&f.push(new w.f({Name:"phone_number",Value:g}))}else{if(!e||"object"!==R(e))return this.rejectAuthError(i.a.SignUpError);c=e.username,l=e.password,e&&e.clientMetadata?u=e.clientMetadata:this._config.clientMetadata&&(u=this._config.clientMetadata);var m=e.attributes;m&&Object.keys(m).map((function(e){f.push(new w.f({Name:e,Value:m[e]}))}));var b=e.validationData;b&&(d=[],Object.keys(b).map((function(e){d.push(new w.f({Name:e,Value:b[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:{},v=null!==(r=h.clientMetaData)&&void 0!==r?r:{})}return c?l?(U.debug("signUp attrs:",f),U.debug("signUp validation data:",d),new Promise((function(e,t){o.userPool.signUp(c,l,f,d,(function(n,r){n?(L("signUp_failure",n,c+" failed to signup"),t(n)):(L("signUp",r,c+" has signed up successfully"),h.enabled&&o.handleAutoSignIn(c,l,p,v,r),e(r))}),u)}))):this.rejectAuthError(i.a.EmptyPassword):this.rejectAuthError(i.a.EmptyUsername)},e.prototype.handleAutoSignIn=function(e,t,n,r,i){this.autoSignInInitiated=!0;var o=new w.a({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;s.a.listen("auth",(function n(r){"confirmSignUp"===r.payload.event&&t.signInAfterUserConfirmed(e,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),L("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 Object(r.c)(this,void 0,void 0,(function(){var i,o,a=this;return Object(r.e)(this,(function(r){switch(r.label){case 0:i=this.createCognitoUser(e.getUsername()),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,i.authenticateUser(e,this.authCallbacks(i,(function(r){L("autoSignIn",r,e.getUsername()+" has signed in successfully"),t&&s.a.remove("auth",t),n&&(clearInterval(n),a._storage.removeItem("amplify-polling-started")),a._storage.removeItem("amplify-auto-sign-in")}),(function(e){U.error(e),a._storage.removeItem("amplify-auto-sign-in")})))];case 2:return r.sent(),[3,4];case 3:return o=r.sent(),U.error(o),[3,4];case 4:return[2]}}))}))},e.prototype.confirmSignUp=function(e,t,n){var r=this;if(!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(i.a.EmptyUsername);if(!t)return this.rejectAuthError(i.a.EmptyCode);var o,s=this.createCognitoUser(e),a=!n||"boolean"!=typeof n.forceAliasCreation||n.forceAliasCreation;return n&&n.clientMetadata?o=n.clientMetadata:this._config.clientMetadata&&(o=this._config.clientMetadata),new Promise((function(n,u){s.confirmRegistration(t,a,(function(t,o){t?u(t):(L("confirmSignUp",o,e+" has been confirmed successfully"),r.isTrueStorageValue("amplify-auto-sign-in")&&!r.autoSignInInitiated&&(L("autoSignIn_failure",null,i.a.AutoSignInError),r._storage.removeItem("amplify-auto-sign-in")),n(o))}),o)}))},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(i.a.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,o=null,s={};if("string"==typeof e)r=e,o=t;else{if(!Object(i.h)(e))return this.rejectAuthError(i.a.InvalidUsername);void 0!==t&&U.warn("The password should be defined under the first parameter object!"),r=e.username,o=e.password,s=e.validationData}if(!r)return this.rejectAuthError(i.a.EmptyUsername);var a=new w.a({Username:r,Password:o,ValidationData:s,ClientMetadata:n});return o?this.signInWithPassword(a):this.signInWithoutPassword(a)},e.prototype.authCallbacks=function(e,t,n){var i=this,o=this;return{onSuccess:function(s){return Object(r.c)(i,void 0,void 0,(function(){var i,a,u,c;return Object(r.e)(this,(function(r){switch(r.label){case 0:U.debug(s),delete e.challengeName,delete e.challengeParam,r.label=1;case 1:return r.trys.push([1,4,5,9]),[4,this.Credentials.clear()];case 2:return r.sent(),[4,this.Credentials.set(s,"session")];case 3:return i=r.sent(),U.debug("succeed to get cognito credentials",i),[3,9];case 4:return a=r.sent(),U.debug("cannot get cognito credentials",a),[3,9];case 5:return r.trys.push([5,7,,8]),[4,this.currentUserPoolUser()];case 6:return u=r.sent(),o.user=u,L("signIn",u,"A user "+e.getUsername()+" has been signed in"),t(u),[3,8];case 7:return c=r.sent(),U.error("Failed to get the signed in user",c),n(c),[3,8];case 8:return[7];case 9:return[2]}}))}))},onFailure:function(t){U.debug("signIn failure",t),L("signIn_failure",t,e.getUsername()+" failed to signin"),n(t)},customChallenge:function(n){U.debug("signIn custom challenge answer required"),e.challengeName="CUSTOM_CHALLENGE",e.challengeParam=n,t(e)},mfaRequired:function(n,r){U.debug("signIn MFA required"),e.challengeName=n,e.challengeParam=r,t(e)},mfaSetup:function(n,r){U.debug("signIn mfa setup",n),e.challengeName=n,e.challengeParam=r,t(e)},newPasswordRequired:function(n,r){U.debug("signIn new password"),e.challengeName="NEW_PASSWORD_REQUIRED",e.challengeParam={userAttributes:n,requiredAttributes:r},t(e)},totpRequired:function(n,r){U.debug("signIn totpRequired"),e.challengeName=n,e.challengeParam=r,t(e)},selectMFAType:function(n,r){U.debug("signIn selectMFAType",n),e.challengeName=n,e.challengeParam=r,t(e)}}},e.prototype.signInWithPassword=function(e){var t=this;if(this.pendingSignIn)throw new 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)return U.debug("get MFA Options failed",e),void n(e);U.debug("get MFA options success",r),t(r)}))}))},e.prototype.getPreferredMFA=function(e,t){var n=this,i=this;return new Promise((function(o,s){var a=n._config.clientMetadata,u=!!t&&t.bypassCache;e.getUserData((function(t,a){return Object(r.c)(n,void 0,void 0,(function(){var n,u;return Object(r.e)(this,(function(r){switch(r.label){case 0:if(!t)return[3,5];if(U.debug("getting preferred mfa failed",t),!this.isSessionInvalid(t))return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return r.sent(),[3,4];case 3:return n=r.sent(),s(new Error("Session is invalid due to: "+t.message+" and failed to clean up invalid session: "+n.message)),[2];case 4:return s(t),[2];case 5:return(u=i._getMfaTypeFromUserData(a))?(o(u),[2]):(s("invalid MFA Type"),[2])}}))}))}),{bypassCache:u,clientMetadata:a})}))},e.prototype._getMfaTypeFromUserData=function(e){var t=null,n=e.PreferredMfaSetting;if(n)t=n;else{var r=e.UserMFASettingList;if(r)0===r.length?t="NOMFA":U.debug("invalid case for getPreferredMFA",e);else t=e.MFAOptions?"SMS_MFA":"NOMFA"}return t},e.prototype._getUserData=function(e,t){var n=this;return new Promise((function(i,o){e.getUserData((function(t,s){return Object(r.c)(n,void 0,void 0,(function(){var n;return Object(r.e)(this,(function(r){switch(r.label){case 0:if(!t)return[3,5];if(U.debug("getting user data failed",t),!this.isSessionInvalid(t))return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return r.sent(),[3,4];case 3:return n=r.sent(),o(new 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:i(s),r.label=6;case 6:return[2]}}))}))}),t)}))},e.prototype.setPreferredMFA=function(e,t){return Object(r.c)(this,void 0,void 0,(function(){var n,o,s,a,u,c,l=this;return Object(r.e)(this,(function(f){switch(f.label){case 0:return n=this._config.clientMetadata,[4,this._getUserData(e,{bypassCache:!0,clientMetadata:n})];case 1:switch(o=f.sent(),s=null,a=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 a={PreferredMfa:!0,Enabled:!0},[3,7];case 3:return s={PreferredMfa:!0,Enabled:!0},[3,7];case 4:return u=o.UserMFASettingList,[4,this._getMfaTypeFromUserData(o)];case 5:if("NOMFA"===(c=f.sent()))return[2,Promise.resolve("No change for mfa type")];if("SMS_MFA"===c)s={PreferredMfa:!1,Enabled:!1};else{if("SOFTWARE_TOKEN_MFA"!==c)return[2,this.rejectAuthError(i.a.InvalidMFA)];a={PreferredMfa:!1,Enabled:!1}}return u&&0!==u.length&&u.forEach((function(e){"SMS_MFA"===e?s={PreferredMfa:!1,Enabled:!1}:"SOFTWARE_TOKEN_MFA"===e&&(a={PreferredMfa:!1,Enabled:!1})})),[3,7];case 6:return U.debug("no validmfa method provided"),[2,this.rejectAuthError(i.a.NoMFA)];case 7:return this,[2,new Promise((function(t,i){e.setUserMfaPreference(s,a,(function(o,s){if(o)return U.debug("Set user mfa preference error",o),i(o);U.debug("Set user mfa success",s),U.debug("Caching the latest user data into local"),e.getUserData((function(n,o){return Object(r.c)(l,void 0,void 0,(function(){var o;return Object(r.e)(this,(function(r){switch(r.label){case 0:if(!n)return[3,5];if(U.debug("getting user data failed",n),!this.isSessionInvalid(n))return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return r.sent(),[3,4];case 3:return o=r.sent(),i(new Error("Session is invalid due to: "+n.message+" and failed to clean up invalid session: "+o.message)),[2];case 4:return[2,i(n)];case 5:return[2,t(s)]}}))}))}),{bypassCache:!0,clientMetadata:n})}))}))]}}))}))},e.prototype.disableSMS=function(e){return new Promise((function(t,n){e.disableMFA((function(e,r){if(e)return U.debug("disable mfa failed",e),void n(e);U.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)return U.debug("enable mfa failed",e),void n(e);U.debug("enable mfa succeed",r),t(r)}))}))},e.prototype.setupTOTP=function(e){return new Promise((function(t,n){e.associateSoftwareToken({onFailure:function(e){U.debug("associateSoftwareToken failed",e),n(e)},associateSecretCode:function(e){U.debug("associateSoftwareToken sucess",e),t(e)}})}))},e.prototype.verifyTotpToken=function(e,t){return U.debug("verification totp token",e,t),new Promise((function(n,r){e.verifySoftwareToken(t,"My TOTP device",{onFailure:function(e){U.debug("verifyTotpToken failed",e),r(e)},onSuccess:function(t){L("signIn",e,"A user "+e.getUsername()+" has been signed in"),U.debug("verifyTotpToken success",t),n(t)}})}))},e.prototype.confirmSignIn=function(e,t,n,o){var s=this;if(void 0===o&&(o=this._config.clientMetadata),!t)return this.rejectAuthError(i.a.EmptyCode);var a=this;return new Promise((function(i,u){e.sendMFACode(t,{onSuccess:function(t){return Object(r.c)(s,void 0,void 0,(function(){var n,o;return Object(r.e)(this,(function(r){switch(r.label){case 0:U.debug(t),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,this.Credentials.clear()];case 2:return r.sent(),[4,this.Credentials.set(t,"session")];case 3:return n=r.sent(),U.debug("succeed to get cognito credentials",n),[3,6];case 4:return o=r.sent(),U.debug("cannot get cognito credentials",o),[3,6];case 5:return a.user=e,L("signIn",e,"A user "+e.getUsername()+" has been signed in"),i(e),[7];case 6:return[2]}}))}))},onFailure:function(e){U.debug("confirm signIn failure",e),u(e)}},n,o)}))},e.prototype.completeNewPassword=function(e,t,n,o){var s=this;if(void 0===n&&(n={}),void 0===o&&(o=this._config.clientMetadata),!t)return this.rejectAuthError(i.a.EmptyPassword);var a=this;return new Promise((function(i,u){e.completeNewPasswordChallenge(t,n,{onSuccess:function(t){return Object(r.c)(s,void 0,void 0,(function(){var n,o;return Object(r.e)(this,(function(r){switch(r.label){case 0:U.debug(t),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,this.Credentials.clear()];case 2:return r.sent(),[4,this.Credentials.set(t,"session")];case 3:return n=r.sent(),U.debug("succeed to get cognito credentials",n),[3,6];case 4:return o=r.sent(),U.debug("cannot get cognito credentials",o),[3,6];case 5:return a.user=e,L("signIn",e,"A user "+e.getUsername()+" has been signed in"),i(e),[7];case 6:return[2]}}))}))},onFailure:function(e){U.debug("completeNewPassword failure",e),L("completeNewPassword_failure",e,s.user+" failed to complete the new password flow"),u(e)},mfaRequired:function(t,n){U.debug("signIn MFA required"),e.challengeName=t,e.challengeParam=n,i(e)},mfaSetup:function(t,n){U.debug("signIn mfa setup",t),e.challengeName=t,e.challengeParam=n,i(e)},totpRequired:function(t,n){U.debug("signIn mfa setup",t),e.challengeName=t,e.challengeParam=n,i(e)}},o)}))},e.prototype.sendCustomChallengeAnswer=function(e,t,n){var r=this;if(void 0===n&&(n=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!t)return this.rejectAuthError(i.a.EmptyChallengeResponse);return new Promise((function(i,o){e.sendCustomChallengeAnswer(t,r.authCallbacks(e,i,o),n)}))},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 Object(r.c)(this,void 0,void 0,(function(){var e,t,n=this;return Object(r.e)(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._storageSync];case 1:return i.sent(),[3,3];case 2:throw e=i.sent(),U.debug("Failed to sync cache info into memory",e),new Error(e);case 3:return t=this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI"),[2,new Promise((function(e,i){return Object(r.c)(n,void 0,void 0,(function(){var n,o=this;return Object(r.e)(this,(function(s){if(this.userPool){if(!(n=this.userPool.getCurrentUser()))return U.debug("Failed to get user from user pool"),[2,i(new Error("No current user."))];n.getSession((function(s,a){return Object(r.c)(o,void 0,void 0,(function(){var o,a=this;return Object(r.e)(this,(function(r){switch(r.label){case 0:if(!s)return[3,5];if(U.debug("Failed to get the user session",s),!this.isSessionInvalid(s))return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(n)];case 2:return r.sent(),[3,4];case 3:return o=r.sent(),i(new Error("Session is invalid due to: "+s.message+" and failed to clean up invalid session: "+o.message)),[2];case 4:return[2,i(s)];case 5:n.deleteUser((function(r,o){if(r)i(r);else{L("userDeleted",o,"The authenticated user has been deleted."),n.signOut(),a.user=null;try{a.cleanCachedItems()}catch(e){U.debug("failed to clear cached items")}t?a.oAuthSignOutRedirect(e,i):(L("signOut",a.user,"A user has been signed out"),e(o))}})),r.label=6;case 6:return[2]}}))}))}))}else U.debug("no Congito User pool"),i(new 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&&a.indexOf("_verified")<0){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"===R(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 Object(r.c)(this,void 0,void 0,(function(){var t=this;return Object(r.e)(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(),U.debug("failed to clear cached items"),[3,4];case 4:return this.isSignedInHostedUI()?[2,new Promise((function(e,n){t.oAuthSignOutRedirect(e,n)}))]:(L("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,i){t._storageSync.then((function(){return Object(r.c)(t,void 0,void 0,(function(){var t,o,a=this;return Object(r.e)(this,(function(u){switch(u.label){case 0:return this.isOAuthInProgress()?(U.debug("OAuth signIn in progress, waiting for resolution..."),[4,new Promise((function(e){var t=setTimeout((function(){U.debug("OAuth signIn in progress timeout"),s.a.remove("auth",n),e()}),1e4);function n(r){var i=r.payload.event;"cognitoHostedUI"!==i&&"cognitoHostedUI_failure"!==i||(U.debug("OAuth signIn resolved: "+i),clearTimeout(t),s.a.remove("auth",n),e())}s.a.listen("auth",n)}))]):[3,2];case 1:u.sent(),u.label=2;case 2:return(t=this.userPool.getCurrentUser())?(o=this._config.clientMetadata,t.getSession((function(o,s){return Object(r.c)(a,void 0,void 0,(function(){var a,u,c,l,f=this;return Object(r.e)(this,(function(d){switch(d.label){case 0:if(!o)return[3,5];if(U.debug("Failed to get the user session",o),!this.isSessionInvalid(o))return[3,4];d.label=1;case 1:return d.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return d.sent(),[3,4];case 3:return a=d.sent(),i(new Error("Session is invalid due to: "+o.message+" and failed to clean up invalid session: "+a.message)),[2];case 4:return i(o),[2];case 5:return(u=!!e&&e.bypassCache)?[4,this.Credentials.clear()]:[3,7];case 6:d.sent(),d.label=7;case 7:return c=this._config.clientMetadata,l=s.getAccessToken().decodePayload().scope,(void 0===l?"":l).split(" ").includes("aws.cognito.signin.user.admin")?(t.getUserData((function(e,o){return Object(r.c)(f,void 0,void 0,(function(){var s,a,u,c,l,f,d;return Object(r.e)(this,(function(r){switch(r.label){case 0:if(!e)return[3,7];if(U.debug("getting user data failed",e),!this.isSessionInvalid(e))return[3,5];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return r.sent(),[3,4];case 3:return s=r.sent(),i(new Error("Session is invalid due to: "+e.message+" and failed to clean up invalid session: "+s.message)),[2];case 4:return i(e),[3,6];case 5:n(t),r.label=6;case 6:return[2];case 7:for(a=o.PreferredMfaSetting||"NOMFA",u=[],c=0;c<o.UserAttributes.length;c++)l={Name:o.UserAttributes[c].Name,Value:o.UserAttributes[c].Value},f=new w.f(l),u.push(f);return d=this.attributesToObject(u),Object.assign(t,{attributes:d,preferredMFA:a}),[2,n(t)]}}))}))}),{bypassCache:u,clientMetadata:c}),[2]):(U.debug("Unable to get the user data because the aws.cognito.signin.user.admin is not in the scopes of the access token"),[2,n(t)])}}))}))}),{clientMetadata:o}),[2]):(U.debug("Failed to get user from user pool"),i("No current user"),[2])}}))}))})).catch((function(e){return U.debug("Failed to sync cache info into memory",e),i(e)}))})):this.rejectNoUserPool()},e.prototype.isOAuthInProgress=function(){return this.oAuthFlowInProgress},e.prototype.currentAuthenticatedUser=function(e){return Object(r.c)(this,void 0,void 0,(function(){var t,n,i,o,s;return Object(r.e)(this,(function(a){switch(a.label){case 0:U.debug("getting current authenticated user"),t=null,a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this._storageSync];case 2:return a.sent(),[3,4];case 3:throw n=a.sent(),U.debug("Failed to sync cache info into memory",n),n;case 4:try{(i=JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")))&&(t=Object(r.a)(Object(r.a)({},i.user),{token:i.token}))}catch(e){U.debug("cannot load federated user from auth storage")}return t?(this.user=t,U.debug("get current authenticated federated user",this.user),[2,this.user]):[3,5];case 5:U.debug("get current authenticated userpool user"),o=null,a.label=6;case 6:return a.trys.push([6,8,,9]),[4,this.currentUserPoolUser(e)];case 7:return o=a.sent(),[3,9];case 8:return"No userPool"===(s=a.sent())&&U.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"),U.debug("The user is not authenticated by the error",s),[2,Promise.reject("The user is not authenticated")];case 9:return this.user=o,[2,this.user]}}))}))},e.prototype.currentSession=function(){var e=this;return U.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){U.debug("Failed to get the current session",e),n(e)}))})).catch((function(e){U.debug("Failed to get the current user",e),n(e)}))})):Promise.reject(new Error("No User Pool in the configuration."))},e.prototype.userSession=function(e){var t=this;if(!e)return U.debug("the user is null"),this.rejectAuthError(i.a.NoUserSession);var n=this._config.clientMetadata;return new Promise((function(i,o){U.debug("Getting the session from this user:",e),e.getSession((function(n,s){return Object(r.c)(t,void 0,void 0,(function(){var t;return Object(r.e)(this,(function(r){switch(r.label){case 0:if(!n)return[3,5];if(U.debug("Failed to get the session from user",e),!this.isSessionInvalid(n))return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return r.sent(),[3,4];case 3:return t=r.sent(),o(new Error("Session is invalid due to: "+n.message+" and failed to clean up invalid session: "+t.message)),[2];case 4:return o(n),[2];case 5:return U.debug("Succeed to get the user session",s),i(s),[2]}}))}))}),{clientMetadata:n})}))},e.prototype.currentUserCredentials=function(){return Object(r.c)(this,void 0,void 0,(function(){var e,t,n=this;return Object(r.e)(this,(function(r){switch(r.label){case 0:U.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(),U.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){U.debug("failed to get or parse item aws-amplify-federatedInfo",e)}return t?[2,this.Credentials.refreshFederatedToken(t)]:[2,this.currentSession().then((function(e){return U.debug("getting session success",e),n.Credentials.set(e,"session")})).catch((function(){return U.debug("getting guest credentials"),n.Credentials.set(null,"guest")}))]}}))}))},e.prototype.currentCredentials=function(){return U.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(i.a.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 Object(r.c)(this,void 0,void 0,(function(){var n,i,o=this;return Object(r.e)(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,this._storageSync];case 1:return s.sent(),[3,3];case 2:throw n=s.sent(),U.debug("Failed to sync cache info into memory",n),n;case 3:return i=this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI"),[2,new Promise((function(n,s){if(e&&e.global){U.debug("user global sign out",t);var a=o._config.clientMetadata;t.getSession((function(e,a){return Object(r.c)(o,void 0,void 0,(function(){var o,a=this;return Object(r.e)(this,(function(r){switch(r.label){case 0:if(!e)return[3,5];if(U.debug("failed to get the user session",e),!this.isSessionInvalid(e))return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return r.sent(),[3,4];case 3:return o=r.sent(),s(new Error("Session is invalid due to: "+e.message+" and failed to clean up invalid session: "+o.message)),[2];case 4:return[2,s(e)];case 5:return t.globalSignOut({onSuccess:function(e){if(U.debug("global sign out success"),!i)return n();a.oAuthSignOutRedirect(n,s)},onFailure:function(e){return U.debug("global sign out failed",e),s(e)}}),[2]}}))}))}),{clientMetadata:a})}else U.debug("user sign out",t),t.signOut((function(){if(!i)return n();o.oAuthSignOutRedirect(n,s)}))}))]}}))}))},e.prototype.oAuthSignOutRedirect=function(e,t){Object(v.b)().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 Object(r.c)(this,void 0,void 0,(function(){var t;return Object(r.e)(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(),U.debug("failed to clear cached items"),[3,3];case 3:return this.userPool?(t=this.userPool.getCurrentUser())?[4,this.cognitoIdentitySignOut(e,t)]:[3,5]:[3,7];case 4:return n.sent(),[3,6];case 5:U.debug("no current Cognito user"),n.label=6;case 6:return[3,8];case 7:U.debug("no Cognito User pool"),n.label=8;case 8:return L("signOut",this.user,"A user has been signed out"),this.user=null,[2]}}))}))},e.prototype.cleanCachedItems=function(){return Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(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?(U.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(i.a.EmptyUsername);var n=this.createCognitoUser(e);return new Promise((function(r,i){n.forgotPassword({onSuccess:function(){r()},onFailure:function(t){U.debug("forgot password failure",t),L("forgotPassword_failure",t,e+" forgotPassword failed"),i(t)},inputVerificationCode:function(t){L("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(i.a.EmptyUsername);if(!t)return this.rejectAuthError(i.a.EmptyCode);if(!n)return this.rejectAuthError(i.a.EmptyPassword);var o=this.createCognitoUser(e);return new Promise((function(i,s){o.confirmPassword(t,n,{onSuccess:function(t){L("forgotPasswordSubmit",o,e+" forgotPasswordSubmit successful"),i(t)},onFailure:function(t){L("forgotPasswordSubmit_failure",t,e+" forgotPasswordSubmit failed"),s(t)}},r)}))},e.prototype.currentUserInfo=function(){return Object(r.c)(this,void 0,void 0,(function(){var e,t,n,i,o,s,a;return Object(r.e)(this,(function(r){switch(r.label){case 0:return(e=this.Credentials.getCredSource())&&"aws"!==e&&"userPool"!==e?[3,9]:[4,this.currentUserPoolUser().catch((function(e){return U.error(e)}))];case 1:if(!(a=r.sent()))return[2,null];r.label=2;case 2:return r.trys.push([2,8,,9]),[4,this.userAttributes(a)];case 3:t=r.sent(),n=this.attributesToObject(t),i=null,r.label=4;case 4:return r.trys.push([4,6,,7]),[4,this.currentCredentials()];case 5:return i=r.sent(),[3,7];case 6:return o=r.sent(),U.debug("Failed to retrieve credentials while getting current user info",o),[3,7];case 7:return[2,{id:i?i.identityId:void 0,username:a.getUsername(),attributes:n}];case 8:return s=r.sent(),U.error("currentUserInfo error",s),[2,{}];case 9:return"federated"===e?[2,(a=this.user)||{}]:[2]}}))}))},e.prototype.federatedSignIn=function(e,t,n){return Object(r.c)(this,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h,p,v;return Object(r.e)(this,(function(r){switch(r.label){case 0:if(!this._config.identityPoolId&&!this._config.userPoolId)throw new Error("Federation requires either a User Pool or Identity Pool in config");if(void 0===e&&this._config.identityPoolId&&!this._config.userPoolId)throw new Error("Federation with Identity Pools requires tokens passed as arguments");return Object(i.f)(e)||Object(i.g)(e)||Object(i.d)(e)||void 0===e?(o=e||{provider:i.b.Cognito},c=Object(i.f)(o)?o.provider:o.customProvider,Object(i.f)(o),s=o.customState,this._config.userPoolId&&(a=Object(i.e)(this._config.oauth)?this._config.userPoolWebClientId:this._config.oauth.clientID,u=Object(i.e)(this._config.oauth)?this._config.oauth.redirectSignIn:this._config.oauth.redirectUri,this._oAuthHandler.oauthSignIn(this._config.oauth.responseType,this._config.oauth.domain,u,a,c,s)),[3,4]):[3,1];case 1:c=e;try{(l=JSON.stringify(JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")).user))&&U.warn("There is already a signed in user: "+l+" in your app.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tYou should not call Auth.federatedSignIn method again as it may cause unexpected behavior.")}catch(e){}return f=t.token,d=t.identity_id,h=t.expires_at,[4,this.Credentials.set({provider:c,token:f,identity_id:d,user:n,expires_at:h},"federation")];case 2:return p=r.sent(),[4,this.currentAuthenticatedUser()];case 3:return v=r.sent(),L("signIn",v,"A user "+v.username+" has been signed in"),U.debug("federated sign in credentials",p),[2,p];case 4:return[2]}}))}))},e.prototype._handleAuthResponse=function(e){return Object(r.c)(this,void 0,void 0,(function(){var t,n,i,o,s,a,u,c,l,f,d,h,p,y;return Object(r.e)(this,(function(g){switch(g.label){case 0:if(this.oAuthFlowInProgress)return U.debug("Skipping URL "+e+" current flow in progress"),[2];g.label=1;case 1:if(g.trys.push([1,,8,9]),this.oAuthFlowInProgress=!0,!this._config.userPoolId)throw new Error("OAuth responses require a User Pool defined in config");if(L("parsingCallbackUrl",{url:e},"The callback url is being parsed"),t=e||(Object(v.b)().isBrowser?window.location.href:""),n=!!(Object(S.parse)(t).query||"").split("&").map((function(e){return e.split("=")})).find((function(e){var t=Object(r.f)(e,1)[0];return"code"===t||"error"===t})),i=!!(Object(S.parse)(t).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).find((function(e){var t=Object(r.f)(e,1)[0];return"access_token"===t||"error"===t})),!n&&!i)return[3,7];this._storage.setItem("amplify-redirected-from-hosted-ui","true"),g.label=2;case 2:return g.trys.push([2,6,,7]),[4,this._oAuthHandler.handleAuthResponse(t)];case 3:return o=g.sent(),s=o.accessToken,a=o.idToken,u=o.refreshToken,c=o.state,l=new w.h({IdToken:new w.c({IdToken:a}),RefreshToken:new w.d({RefreshToken:u}),AccessToken:new w.b({AccessToken:s})}),f=void 0,this._config.identityPoolId?[4,this.Credentials.set(l,"session")]:[3,5];case 4:f=g.sent(),U.debug("AWS credentials",f),g.label=5;case 5:return d=/-/.test(c),(h=this.createCognitoUser(l.getIdToken().decodePayload()["cognito:username"])).setSignInUserSession(l),window&&void 0!==window.history&&window.history.replaceState({},null,this._config.oauth.redirectSignIn),L("signIn",h,"A user "+h.getUsername()+" has been signed in"),L("cognitoHostedUI",h,"A user "+h.getUsername()+" has been signed in via Cognito Hosted UI"),d&&(p=c.split("-").splice(1).join("-"),L("customOAuthState",p.match(/.{2}/g).map((function(e){return String.fromCharCode(parseInt(e,16))})).join(""),"State for user "+h.getUsername())),[2,f];case 6:return y=g.sent(),U.debug("Error in cognito hosted auth response",y),window&&void 0!==window.history&&window.history.replaceState({},null,this._config.oauth.redirectSignIn),L("signIn_failure",y,"The OAuth response flow failed"),L("cognitoHostedUI_failure",y,"A failure occurred when returning to the Cognito Hosted UI"),L("customState_failure",y,"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 w.e(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?i.a.NoConfig:i.a.MissingAuthConfig},e.prototype.rejectAuthError=function(e){return Promise.reject(new N(e))},e.prototype.rejectNoUserPool=function(){var e=this.noUserPoolErrorHandler(this._config);return Promise.reject(new M(e))},e.prototype.rememberDevice=function(){return Object(r.c)(this,void 0,void 0,(function(){var e,t;return Object(r.e)(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(),U.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 N(i.a.DeviceConfig)):"NetworkError"===e.code?n(new N(i.a.NetworkError)):n(e)}})}))]}}))}))},e.prototype.forgetDevice=function(){return Object(r.c)(this,void 0,void 0,(function(){var e,t;return Object(r.e)(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(),U.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 N(i.a.DeviceConfig)):"NetworkError"===e.code?n(new N(i.a.NetworkError)):n(e)}})}))]}}))}))},e.prototype.fetchDevices=function(){return Object(r.c)(this,void 0,void 0,(function(){var e,t;return Object(r.e)(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(),U.debug("The user is not authenticated by the error",t),new Error("The user is not authenticated");case 3:return e.getCachedDeviceKeyAndPassword(),[2,new Promise((function(t,n){var r={onSuccess:function(e){var n=e.Devices.map((function(e){var t=e.DeviceAttributes.find((function(e){return"device_name"===e.Name}))||{};return{id:e.DeviceKey,name:t.Value}}));t(n)},onFailure:function(e){"InvalidParameterException"===e.code?n(new N(i.a.DeviceConfig)):"NetworkError"===e.code?n(new N(i.a.NetworkError)):n(e)}};e.listDevices(60,null,r)}))]}}))}))},e}())(null);b.a.register(B)},function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return i}));var r={userAgent:"aws-amplify/4.7.6 js",product:"",navigator:null,isReactNative:!1};if("undefined"!=typeof navigator&&navigator.product)switch(r.product=navigator.product||"",r.navigator=navigator||null,navigator.product){case"ReactNative":r.userAgent="aws-amplify/4.7.6 react-native",r.isReactNative=!0;break;default:r.userAgent="aws-amplify/4.7.6 js",r.isReactNative=!1}var i=function(e){return""+r.userAgent+(e||"")}},,,function(e,t,n){"use strict";n.r(t),n.d(t,"locateWindow",(function(){return i}));var r={};function i(){return"undefined"!=typeof window?window:"undefined"!=typeof self?self:r}},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(0),i=n(22),o=new i.a("Amplify"),s=new(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.Notifications=null,this.Logger=i.a,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).forEach((function(e){var n=Object(r.f)(e,2),i=(n[0],n[1]);Object.keys(i).forEach((function(e){t._modules[e]&&(i[e]=t._modules[e])}))})),this._components.map((function(e){e.configure(t._config)})),this._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}())},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(67).__exportStar(n(143),t)},function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return w}));var r,i,o=n(0),s=n(19),a=n(3),u=n(35),c=n(20),l=n(22),f=n(78),d=n(15),h=n(10),p=n(1),v=n(4),y=n(5),g=n(2),m=n(24),b=new l.a("DataStore");!function(e){e.CONNECTED="CONNECTED"}(r||(r={})),function(e){e[e.none=0]="none",e[e.unauth=1]="unauth",e[e.auth=2]="auth"}(i||(i={}));var w=function(){function t(e,t,n,r,i,o){void 0===n&&(n={}),void 0===o&&(o={Auth:u.a,API:s.a,Cache:c.a}),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 t.prototype.buildSubscription=function(e,t,n,r,i,s,a){var u=this.amplifyConfig.aws_appsync_authenticationType,c=this.getAuthorizationInfo(t,r,u,i,s,a)||{},l=c.isOwner,f=c.ownerField,d=c.ownerValue,h=Object(o.f)(Object(v.c)(e,t,n,l,f),3);return{authMode:a,opType:h[0],opName:h[1],query:h[2],isOwner:l,ownerField:f,ownerValue:d}},t.prototype.getAuthorizationInfo=function(e,t,n,r,s,u){void 0===r&&(r={}),void 0===s&&(s={});var c=Object(v.e)(e);if(u===a.c.AWS_IAM&&c.find((function(e){return"private"===e.authStrategy&&"iam"===e.provider}))&&t===i.unauth)return null;var l,f=c.filter((function(e){return"groups"===e.authStrategy&&["userPools","oidc"].includes(e.provider)}));return u!==a.c.AMAZON_COGNITO_USER_POOLS&&u!==a.c.OPENID_CONNECT||!f.find((function(e){var t=Object(v.j)(r,e),n=Object(v.j)(s,e);return Object(o.h)(t,n).find((function(t){return e.groups.find((function(e){return e===t}))}))}))?((u===a.c.AMAZON_COGNITO_USER_POOLS?c.filter((function(e){return"owner"===e.authStrategy&&"userPools"===e.provider})):[]).forEach((function(e){var t=r[e.identityClaim];t&&(l={authMode:a.c.AMAZON_COGNITO_USER_POOLS,isOwner:!e.areSubscriptionsPublic,ownerField:e.ownerField,ownerValue:t})})),l||((u===a.c.OPENID_CONNECT?c.filter((function(e){return"owner"===e.authStrategy&&"oidc"===e.provider})):[]).forEach((function(e){var t=s[e.identityClaim];t&&(l={authMode:a.c.OPENID_CONNECT,isOwner:!e.areSubscriptionsPublic,ownerField:e.ownerField,ownerValue:t})})),l||{authMode:u||n,isOwner:!1})):{authMode:u,isOwner:!1}},t.prototype.hubQueryCompletionListener=function(e,t){t.payload.event===d.CONTROL_MSG.SUBSCRIPTION_ACK&&e()},t.prototype.start=function(){var t=this;return[new h.a((function(n){var s,a,u=[],c={},l=i.none;return Object(o.c)(t,void 0,void 0,(function(){var t,h,w,S,O,_,E,A,I,T,j=this;return Object(o.e)(this,(function(C){switch(C.label){case 0:return C.trys.push([0,2,,3]),[4,this.amplifyContext.Auth.currentCredentials()];case 1:return t=C.sent(),l=t.authenticated?i.auth:i.unauth,[3,3];case 2:return C.sent(),[3,3];case 3:return C.trys.push([3,5,,6]),[4,this.amplifyContext.Auth.currentSession()];case 4:return h=C.sent(),s=h.getIdToken().decodePayload(),[3,6];case 5:return C.sent(),[3,6];case 6:if(C.trys.push([6,11,,12]),w=this.amplifyConfig,S=w.aws_cognito_region,O=w.Auth,!S||O&&!O.region)throw"Auth is not configured";return _=void 0,[4,this.amplifyContext.Cache.getItem("federatedInfo")];case 7:return(E=C.sent())?(_=E.token,[3,10]):[3,8];case 8:return[4,this.amplifyContext.Auth.currentAuthenticatedUser()];case 9:(A=C.sent())&&(_=A.token),C.label=10;case 10:return _&&(I=_.split(".")[1],a=JSON.parse(e.from(I,"base64").toString("utf8"))),[3,12];case 11:return T=C.sent(),b.debug("error getting OIDC JWT",T),[3,12];case 12:return Object.values(this.schema.namespaces).forEach((function(e){Object.values(e.models).filter((function(e){return e.syncable})).forEach((function(t){return Object(o.c)(j,void 0,void 0,(function(){var r,i,h,w,S,O,_,E,A=this;return Object(o.e)(this,(function(I){switch(I.label){case 0:return[4,Object(v.h)({authModeStrategy:this.authModeStrategy,defaultAuthMode:this.amplifyConfig.aws_appsync_authenticationType,modelName:t.name,schema:this.schema})];case 1:return r=I.sent(),i=r.READ,c=Object(o.a)(Object(o.a)({},c),((O={})[t.name]=((_={})[v.a.CREATE]=[],_[v.a.UPDATE]=[],_[v.a.DELETE]=[],_),O)),h=[v.a.CREATE,v.a.UPDATE,v.a.DELETE],(E={})[v.a.CREATE]=0,E[v.a.UPDATE]=0,E[v.a.DELETE]=0,w=E,S=function(r){return Object(o.c)(A,void 0,void 0,(function(){var h,O,_,E,A,I,T,j,C,P,x,k,N,M=this;return Object(o.e)(this,(function(D){switch(D.label){case 0:return h=this.buildSubscription(e,t,r,l,s,a,i[w[r]]),O=h.opType,_=h.opName,E=h.query,A=h.isOwner,I=h.ownerField,T=h.ownerValue,j=h.authMode,[4,Object(v.i)(j,this.amplifyConfig)];case 1:if(C=D.sent(),P={},A){if(!T)return n.error("Owner field required, sign in is needed in order to perform this operation"),[2];P[I]=T}return b.debug("Attempting "+r+" subscription with authMode: "+i[w[r]]),x=g.f,k=this.amplifyContext.API.graphql(Object(o.a)(Object(o.a)({query:E,variables:P},{authMode:j}),{authToken:C,userAgentSuffix:x})),c[t.name][O].push(k.map((function(e){return e.value})).subscribe({next:function(e){var n=e.data,r=e.errors;if(Array.isArray(r)&&r.length>0){var i=r.map((function(e){return e.message}));return b.warn("Skipping incoming subscription. Messages: "+i.join("\n")),void M.drainBuffer()}var o=y.a.getPredicates(M.syncPredicates.get(t),!1),s=n[_];M.passesPredicateValidation(s,o)&&M.pushToBuffer(O,t,s),M.drainBuffer()},error:function(e){return Object(o.c)(M,void 0,void 0,(function(){var s,a,u,l,f,h;return Object(o.e)(this,(function(v){switch(v.label){case 0:if(s=e.error,a=Object(o.f)((void 0===s?{errors:[]}:s).errors,1),u=a[0],l=(void 0===u?{}:u).message,(f=void 0===l?"":l).includes(d.CONTROL_MSG.REALTIME_SUBSCRIPTION_INIT_ERROR)||f.includes(d.CONTROL_MSG.CONNECTION_FAILED)){if(c[t.name][O].forEach((function(e){return e.unsubscribe()})),c[t.name][O]=[],w[r]++,!(w[r]>=i.length))return b.debug(r+" subscription failed with authMode: "+i[w[r]-1]+". Retrying with authMode: "+i[w[r]]),S(r),[2];b.debug(r+" subscription failed with authMode: "+i[w[r]-1])}b.warn("subscriptionError",f),v.label=1;case 1:return v.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:f,model:t.name,operation:r,errorType:Object(m.b)(e),process:p.i.subscribe,remoteModel:null,cause:e})];case 2:return v.sent(),[3,4];case 3:return h=v.sent(),b.error("Subscription error handler failed with:",h),[3,4];case 4:return"function"==typeof N&&N(),f.includes('"errorType":"Unauthorized"')||f.includes('"errorType":"OperationDisabled"')||n.error(f),[2]}}))}))}})),u.push(Object(o.c)(M,void 0,void 0,(function(){var e,t=this;return Object(o.e)(this,(function(n){switch(n.label){case 0:return[4,new Promise((function(n){N=n,e=t.hubQueryCompletionListener.bind(t,n),f.a.listen("api",e)}))];case 1:return n.sent(),f.a.remove("api",e),[2]}}))}))),[2]}}))}))},h.forEach((function(e){return S(e)})),[2]}}))}))}))})),Promise.all(u).then((function(){return n.next(r.CONNECTED)})),[2]}}))})),function(){Object.keys(c).forEach((function(e){c[e][v.a.CREATE].forEach((function(e){return e.unsubscribe()})),c[e][v.a.UPDATE].forEach((function(e){return e.unsubscribe()})),c[e][v.a.DELETE].forEach((function(e){return e.unsubscribe()}))}))}})),new h.a((function(e){return t.dataObserver=e,t.drainBuffer(),function(){t.dataObserver=null}}))]},t.prototype.passesPredicateValidation=function(e,t){if(!t)return!0;var n=t.predicates,r=t.type;return Object(g.D)(e,r,n)},t.prototype.pushToBuffer=function(e,t,n){this.buffer.push([e,t,n])},t.prototype.drainBuffer=function(){var e=this;this.dataObserver&&(this.buffer.forEach((function(t){return e.dataObserver.next(t)})),this.buffer=[])},t}()}).call(this,n(6).Buffer)},,function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var i=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,i=n;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}},function(e,t,n){var r;e.exports=(r=n(12),function(){if("function"==typeof ArrayBuffer){var e=r.lib.WordArray,t=e.init;(e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var n=e.byteLength,r=[],i=0;i<n;i++)r[i>>>2]|=e[i]<<24-i%4*8;t.call(this,r,n)}else t.apply(this,arguments)}).prototype=e}}(),r.lib.WordArray)},function(e,t,n){"use strict";n.r(t),t.default=function(e,t){return t=t||{},new Promise((function(n,r){var i=new XMLHttpRequest,o=[],s=[],a={},u=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:u,headers:{keys:function(){return o},entries:function(){return s},get:function(e){return a[e.toLowerCase()]},has:function(e){return e.toLowerCase()in a}}}};for(var c in i.open(t.method||"get",e,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,n){o.push(t=t.toLowerCase()),s.push([t,n]),a[t]=a[t]?a[t]+","+n:n})),n(u())},i.onerror=r,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(c,t.headers[c]);i.send(t.body||null)}))}},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var u,c=[],l=!1,f=-1;function d(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&h())}function h(){if(!l){var e=a(d);l=!0;for(var t=c.length;t;){for(u=c,c=[];++f<t;)u&&u[f].run();f=-1,t=c.length}u=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new p(e,t)),1!==c.length||l||a(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r=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){var s=i;if(!r.has(s))throw new Error("Invalid field for model. field: "+s+", model: "+n);return function(t){return e.sortPredicateGroupsMap.get(o).push({field:s,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 new 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}()},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var i=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,i=n;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(103),i=n(54),o=n(69),s=n(39),a=function(){function e(e){e?(this.operation=function(e){return new Promise((function(t,n){var r=(0,s.locateWindow)().msCrypto.subtle.importKey("raw",u(e),i.SHA_256_HMAC_ALGO,!1,["sign"]);r.oncomplete=function(){r.result&&t(r.result),n(new Error("ImportKey completed without importing key."))},r.onerror=function(){n(new Error("ImportKey failed to import key."))}}))}(e).then((function(e){return(0,s.locateWindow)().msCrypto.subtle.sign(i.SHA_256_HMAC_ALGO,e)})),this.operation.catch((function(){}))):this.operation=Promise.resolve((0,s.locateWindow)().msCrypto.subtle.digest("SHA-256"))}return e.prototype.update=function(e){var t=this;(0,r.isEmptyData)(e)||(this.operation=this.operation.then((function(n){return n.onerror=function(){t.operation=Promise.reject(new Error("Error encountered updating hash"))},n.process(u(e)),n})),this.operation.catch((function(){})))},e.prototype.digest=function(){return this.operation.then((function(e){return new Promise((function(t,n){e.onerror=function(){n(new Error("Error encountered finalizing hash"))},e.oncomplete=function(){e.result&&t(new Uint8Array(e.result)),n(new Error("Error encountered finalizing hash"))},e.finish()}))}))},e}();function u(e){return"string"==typeof e?(0,o.fromUtf8)(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.Sha256=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EMPTY_DATA_SHA_256=t.SHA_256_HMAC_ALGO=t.SHA_256_HASH=void 0,t.SHA_256_HASH={name:"SHA-256"},t.SHA_256_HMAC_ALGO={name:"HMAC",hash:t.SHA_256_HASH},t.EMPTY_DATA_SHA_256=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(104),i=n(54),o=n(39),s=function(){function e(e){this.toHash=new Uint8Array(0),void 0!==e&&(this.key=new Promise((function(t,n){(0,o.locateWindow)().crypto.subtle.importKey("raw",(0,r.convertToBuffer)(e),i.SHA_256_HMAC_ALGO,!1,["sign"]).then(t,n)})),this.key.catch((function(){})))}return e.prototype.update=function(e){if(!(0,r.isEmptyData)(e)){var t=(0,r.convertToBuffer)(e),n=new Uint8Array(this.toHash.byteLength+t.byteLength);n.set(this.toHash,0),n.set(t,this.toHash.byteLength),this.toHash=n}},e.prototype.digest=function(){var e=this;return this.key?this.key.then((function(t){return(0,o.locateWindow)().crypto.subtle.sign(i.SHA_256_HMAC_ALGO,t,e.toHash).then((function(e){return new Uint8Array(e)}))})):(0,r.isEmptyData)(this.toHash)?Promise.resolve(i.EMPTY_DATA_SHA_256):Promise.resolve().then((function(){return(0,o.locateWindow)().crypto.subtle.digest(i.SHA_256_HASH,e.toHash)})).then((function(e){return Promise.resolve(new Uint8Array(e))}))},e}();t.Sha256=s},function(e,t,n){"use strict";n.r(t),n.d(t,"__extends",(function(){return i})),n.d(t,"__assign",(function(){return o})),n.d(t,"__rest",(function(){return s})),n.d(t,"__decorate",(function(){return a})),n.d(t,"__param",(function(){return u})),n.d(t,"__metadata",(function(){return c})),n.d(t,"__awaiter",(function(){return l})),n.d(t,"__generator",(function(){return f})),n.d(t,"__createBinding",(function(){return d})),n.d(t,"__exportStar",(function(){return h})),n.d(t,"__values",(function(){return p})),n.d(t,"__read",(function(){return v})),n.d(t,"__spread",(function(){return y})),n.d(t,"__spreadArrays",(function(){return g})),n.d(t,"__await",(function(){return m})),n.d(t,"__asyncGenerator",(function(){return b})),n.d(t,"__asyncDelegator",(function(){return w})),n.d(t,"__asyncValues",(function(){return S})),n.d(t,"__makeTemplateObject",(function(){return O})),n.d(t,"__importStar",(function(){return _})),n.d(t,"__importDefault",(function(){return E})),n.d(t,"__classPrivateFieldGet",(function(){return A})),n.d(t,"__classPrivateFieldSet",(function(){return I}));
49
+ /*! *****************************************************************************
50
+ Copyright (c) Microsoft Corporation.
51
+
52
+ Permission to use, copy, modify, and/or distribute this software for any
53
+ purpose with or without fee is hereby granted.
54
+
55
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
56
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
57
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
58
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
59
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
60
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
61
+ PERFORMANCE OF THIS SOFTWARE.
62
+ ***************************************************************************** */
63
+ var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function i(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function s(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function a(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function u(e,t){return function(n,r){t(n,r,e)}}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function f(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next: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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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 d(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}function h(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||(t[n]=e[n])}function p(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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(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 y(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(v(arguments[t]));return e}function g(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}function m(e){return this instanceof m?(this.v=e,this):new m(e)}function b(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{(n=i[e](t)).value instanceof m?Promise.resolve(n.value.v).then(u,c):l(o[0][2],n)}catch(e){l(o[0][3],e)}var n}function u(e){a("next",e)}function c(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function w(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:m(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function S(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=p(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}function O(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function _(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function E(e){return e&&e.__esModule?e:{default:e}}function A(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function I(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MAX_HASHABLE_LENGTH=t.INIT=t.KEY=t.DIGEST_LENGTH=t.BLOCK_SIZE=void 0,t.BLOCK_SIZE=64,t.DIGEST_LENGTH=32,t.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),t.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1},function(e,t,n){"use strict";n.r(t),n.d(t,"__extends",(function(){return i})),n.d(t,"__assign",(function(){return o})),n.d(t,"__rest",(function(){return s})),n.d(t,"__decorate",(function(){return a})),n.d(t,"__param",(function(){return u})),n.d(t,"__metadata",(function(){return c})),n.d(t,"__awaiter",(function(){return l})),n.d(t,"__generator",(function(){return f})),n.d(t,"__createBinding",(function(){return d})),n.d(t,"__exportStar",(function(){return h})),n.d(t,"__values",(function(){return p})),n.d(t,"__read",(function(){return v})),n.d(t,"__spread",(function(){return y})),n.d(t,"__spreadArrays",(function(){return g})),n.d(t,"__await",(function(){return m})),n.d(t,"__asyncGenerator",(function(){return b})),n.d(t,"__asyncDelegator",(function(){return w})),n.d(t,"__asyncValues",(function(){return S})),n.d(t,"__makeTemplateObject",(function(){return O})),n.d(t,"__importStar",(function(){return _})),n.d(t,"__importDefault",(function(){return E})),n.d(t,"__classPrivateFieldGet",(function(){return A})),n.d(t,"__classPrivateFieldSet",(function(){return I}));
64
+ /*! *****************************************************************************
65
+ Copyright (c) Microsoft Corporation.
66
+
67
+ Permission to use, copy, modify, and/or distribute this software for any
68
+ purpose with or without fee is hereby granted.
69
+
70
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
71
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
72
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
73
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
74
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
75
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
76
+ PERFORMANCE OF THIS SOFTWARE.
77
+ ***************************************************************************** */
78
+ var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function i(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function s(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function a(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function u(e,t){return function(n,r){t(n,r,e)}}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function f(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next: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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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 d(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}function h(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||(t[n]=e[n])}function p(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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(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 y(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(v(arguments[t]));return e}function g(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}function m(e){return this instanceof m?(this.v=e,this):new m(e)}function b(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{(n=i[e](t)).value instanceof m?Promise.resolve(n.value.v).then(u,c):l(o[0][2],n)}catch(e){l(o[0][3],e)}var n}function u(e){a("next",e)}function c(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function w(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:m(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function S(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=p(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}function O(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function _(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function E(e){return e&&e.__esModule?e:{default:e}}function A(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function I(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}},function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},function(e,t,n){"use strict";var r=n(13);function i(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var o;if(n)o=n(t);else if(r.isURLSearchParams(t))o=t.toString();else{var s=[];r.forEach(t,(function(e,t){null!=e&&(r.isArray(e)?t+="[]":e=[e],r.forEach(e,(function(e){r.isDate(e)?e=e.toISOString():r.isObject(e)&&(e=JSON.stringify(e)),s.push(i(t)+"="+i(e))})))})),o=s.join("&")}if(o){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}},function(e,t,n){"use strict";e.exports=function(e,t,n,r,i){return e.config=t,n&&(e.code=n),e.request=r,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}},function(e,t,n){"use strict";var r=n(13),i=n(132),o=n(133),s=n(60),a=n(134),u=n(137),c=n(138),l=n(63),f=n(32),d=n(33);e.exports=function(e){return new Promise((function(t,n){var h,p=e.data,v=e.headers,y=e.responseType;function g(){e.cancelToken&&e.cancelToken.unsubscribe(h),e.signal&&e.signal.removeEventListener("abort",h)}r.isFormData(p)&&delete v["Content-Type"];var m=new XMLHttpRequest;if(e.auth){var b=e.auth.username||"",w=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";v.Authorization="Basic "+btoa(b+":"+w)}var S=a(e.baseURL,e.url);function O(){if(m){var r="getAllResponseHeaders"in m?u(m.getAllResponseHeaders()):null,o={data:y&&"text"!==y&&"json"!==y?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m};i((function(e){t(e),g()}),(function(e){n(e),g()}),o),m=null}}if(m.open(e.method.toUpperCase(),s(S,e.params,e.paramsSerializer),!0),m.timeout=e.timeout,"onloadend"in m?m.onloadend=O:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(O)},m.onabort=function(){m&&(n(l("Request aborted",e,"ECONNABORTED",m)),m=null)},m.onerror=function(){n(l("Network Error",e,null,m)),m=null},m.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",r=e.transitional||f.transitional;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(l(t,e,r.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",m)),m=null},r.isStandardBrowserEnv()){var _=(e.withCredentials||c(S))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;_&&(v[e.xsrfHeaderName]=_)}"setRequestHeader"in m&&r.forEach(v,(function(e,t){void 0===p&&"content-type"===t.toLowerCase()?delete v[t]:m.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(m.withCredentials=!!e.withCredentials),y&&"json"!==y&&(m.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&m.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&m.upload&&m.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(h=function(e){m&&(n(!e||e&&e.type?new d("canceled"):e),m.abort(),m=null)},e.cancelToken&&e.cancelToken.subscribe(h),e.signal&&(e.signal.aborted?h():e.signal.addEventListener("abort",h))),p||(p=null),m.send(p)}))}},function(e,t,n){"use strict";var r=n(61);e.exports=function(e,t,n,i,o){var s=new Error(e);return r(s,t,n,i,o)}},function(e,t,n){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";var r=n(13);e.exports=function(e,t){t=t||{};var n={};function i(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function o(n){return r.isUndefined(t[n])?r.isUndefined(e[n])?void 0:i(void 0,e[n]):i(e[n],t[n])}function s(e){if(!r.isUndefined(t[e]))return i(void 0,t[e])}function a(n){return r.isUndefined(t[n])?r.isUndefined(e[n])?void 0:i(void 0,e[n]):i(void 0,t[n])}function u(n){return n in t?i(e[n],t[n]):n in e?i(void 0,e[n]):void 0}var c={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u};return r.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=c[e]||o,i=t(e);r.isUndefined(i)&&t!==u||(n[e]=i)})),n}},function(e,t){e.exports={version:"0.26.0"}},function(e,t,n){"use strict";n.r(t),n.d(t,"__extends",(function(){return i})),n.d(t,"__assign",(function(){return o})),n.d(t,"__rest",(function(){return s})),n.d(t,"__decorate",(function(){return a})),n.d(t,"__param",(function(){return u})),n.d(t,"__metadata",(function(){return c})),n.d(t,"__awaiter",(function(){return l})),n.d(t,"__generator",(function(){return f})),n.d(t,"__createBinding",(function(){return d})),n.d(t,"__exportStar",(function(){return h})),n.d(t,"__values",(function(){return p})),n.d(t,"__read",(function(){return v})),n.d(t,"__spread",(function(){return y})),n.d(t,"__spreadArrays",(function(){return g})),n.d(t,"__await",(function(){return m})),n.d(t,"__asyncGenerator",(function(){return b})),n.d(t,"__asyncDelegator",(function(){return w})),n.d(t,"__asyncValues",(function(){return S})),n.d(t,"__makeTemplateObject",(function(){return O})),n.d(t,"__importStar",(function(){return _})),n.d(t,"__importDefault",(function(){return E})),n.d(t,"__classPrivateFieldGet",(function(){return A})),n.d(t,"__classPrivateFieldSet",(function(){return I}));
79
+ /*! *****************************************************************************
80
+ Copyright (c) Microsoft Corporation.
81
+
82
+ Permission to use, copy, modify, and/or distribute this software for any
83
+ purpose with or without fee is hereby granted.
84
+
85
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
86
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
87
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
88
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
89
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
90
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
91
+ PERFORMANCE OF THIS SOFTWARE.
92
+ ***************************************************************************** */
93
+ var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function i(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function s(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function a(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function u(e,t){return function(n,r){t(n,r,e)}}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function f(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next: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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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 d(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}function h(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||(t[n]=e[n])}function p(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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(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 y(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(v(arguments[t]));return e}function g(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}function m(e){return this instanceof m?(this.v=e,this):new m(e)}function b(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{(n=i[e](t)).value instanceof m?Promise.resolve(n.value.v).then(u,c):l(o[0][2],n)}catch(e){l(o[0][3],e)}var n}function u(e){a("next",e)}function c(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function w(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:m(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function S(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=p(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}function O(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function _(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function E(e){return e&&e.__esModule?e:{default:e}}function A(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function I(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BLOCK_SIZE=64,t.DIGEST_LENGTH=32,t.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),t.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1},function(e,t,n){"use strict";n.r(t),n.d(t,"fromUtf8",(function(){return r})),n.d(t,"toUtf8",(function(){return i}));var r=function(e){return"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e.charCodeAt(n);if(i<128)t.push(i);else if(i<2048)t.push(i>>6|192,63&i|128);else if(n+1<e.length&&55296==(64512&i)&&56320==(64512&e.charCodeAt(n+1))){var o=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n));t.push(o>>18|240,o>>12&63|128,o>>6&63|128,63&o|128)}else t.push(i>>12|224,i>>6&63|128,63&i|128)}return Uint8Array.from(t)}(e)},i=function(e){return"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):function(e){for(var t="",n=0,r=e.length;n<r;n++){var i=e[n];if(i<128)t+=String.fromCharCode(i);else if(192<=i&&i<224){var o=e[++n];t+=String.fromCharCode((31&i)<<6|63&o)}else if(240<=i&&i<365){var s="%"+[i,e[++n],e[++n],e[++n]].map((function(e){return e.toString(16)})).join("%");t+=decodeURIComponent(s)}else t+=String.fromCharCode((15&i)<<12|(63&e[++n])<<6|63&e[++n])}return t}(e)}},function(e,t,n){"use strict";n.d(t,"a",(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}()},function(e,t,n){"use strict";(function(e){var r;if(n.d(t,"a",(function(){return i})),"undefined"!=typeof window&&window.crypto&&(r=window.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==e&&e.crypto&&(r=e.crypto),!r)try{r=n(90)}catch(e){}function i(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")}}).call(this,n(31))},function(e,t,n){"use strict";var r,i,o=n(92);function s(e,t,n){if(e._observer)a(e._observer,t,n);else if(e._observers){var r=[];e._observers.forEach((function(e){r.push(e)})),r.forEach((function(e){a(e,t,n)}))}}function a(e,t,n){if(!e.closed)switch(t){case"next":return e.next(n);case"error":return e.error(n);case"complete":return e.complete(n)}}function u(e){return e._observer||e._observers&&e._observers.size>0}function c(e){var t=this;this._observer=null,this._observers=null,this._observable=new o((function(n){return function(e,t){!u(e)&&t&&t.start&&t.start()}(t,e),function(e,t){e._observers?e._observers.add(t):e._observer?(e._observers=new Set,e._observers.add(e._observer),e._observers.add(t),e._observer=null):e._observer=t}(t,n),function(){!function(e,t){e._observers?e._observers.delete(t):e._observer===t&&(e._observer=null)}(t,n),function(e,t){!u(e)&&t&&t.pause&&t.pause()}(t,e)}}))}r=c.prototype,i={get observable(){return this._observable},get observed(){return u(this)},next:function(e){s(this,"next",e)},error:function(e){s(this,"error",e)},complete:function(e){s(this,"complete",e)}},Object.keys(i).forEach((function(e){var t=Object.getOwnPropertyDescriptor(i,e);t.enumerable=!1,Object.defineProperty(r,e,t)})),e.exports=c},function(e,t,n){var r=n(99),i=n(100),o=i;o.v1=r,o.v4=i,e.exports=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebCryptoSha256=t.Ie11Sha256=void 0,(0,n(101).__exportStar)(n(102),t);var r=n(53);Object.defineProperty(t,"Ie11Sha256",{enumerable:!0,get:function(){return r.Sha256}});var i=n(55);Object.defineProperty(t,"WebCryptoSha256",{enumerable:!0,get:function(){return i.Sha256}})},function(e,t,n){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r=n(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,r){void 0===r&&(r=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(n),s=Math.max(i,o),a=0,u=e.map([t,n],(function(t){var n=s-e.getVersionPrecision(t),r=t+new Array(n+1).join(".0");return e.map(r.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(u[0][s]>u[1][s])return 1;if(u[0][s]===u[1][s]){if(s===a)return 0;s-=1}else if(u[0][s]<u[1][s])return-1}},e.map=function(e,t){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n+=1)r.push(t(e[n]));return r},e.find=function(e,t){var n,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,r=e.length;n<r;n+=1){var i=e[n];if(t(i,n))return i}},e.assign=function(e){for(var t,n,r=e,i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var a=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){r[t]=e[t]}))};for(t=0,n=o.length;t<n;t+=1)a();return e},e.getBrowserAlias=function(e){return r.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return r.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,n){"use strict";t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18);function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=function(){function e(){}var t,n;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},t=e,(n=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}])&&s(t,n),e}();t.default=a,e.exports=t.default},91:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r=u(n(92)),i=u(n(93)),o=u(n(94)),s=u(n(95)),a=u(n(17));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=a.default.find(r.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=a.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=a.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=a.default.find(s.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return a.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,n={},r=0,i={},o=0;if(Object.keys(e).forEach((function(t){var s=e[t];"string"==typeof s?(i[t]=s,o+=1):"object"==typeof s&&(n[t]=s,r+=1)})),r>0){var s=Object.keys(n),u=a.default.find(s,(function(e){return t.isOS(e)}));if(u){var c=this.satisfies(n[u]);if(void 0!==c)return c}var l=a.default.find(s,(function(e){return t.isPlatform(e)}));if(l){var f=this.satisfies(n[l]);if(void 0!==f)return f}}if(o>0){var d=Object.keys(i),h=a.default.find(d,(function(e){return t.isBrowser(e,!0)}));if(void 0!==h)return this.compareVersion(i[h])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),i=a.default.getBrowserTypeByAlias(r);return t&&i&&(r=i.toLowerCase()),r===n},t.compareVersion=function(e){var t=[0],n=e,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(a.default.compareVersions(i,n,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=c,e.exports=t.default},92:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=s,e.exports=t.default},93:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(t),r={name:o.OS_MAP.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=i.default.getAndroidVersionName(t),r={name:o.OS_MAP.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:o.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=s,e.exports=t.default},94:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=s,e.exports=t.default},95:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=s,e.exports=t.default}})},function(e){e.exports=JSON.parse('{"name":"@aws-sdk/client-cognito-identity","description":"AWS SDK for JavaScript Cognito Identity Client for Node.js, Browser and React Native","version":"3.6.1","scripts":{"clean":"yarn remove-definitions && yarn remove-dist && yarn remove-documentation","build-documentation":"yarn remove-documentation && typedoc ./","prepublishOnly":"yarn build","pretest":"yarn build:cjs","remove-definitions":"rimraf ./types","remove-dist":"rimraf ./dist","remove-documentation":"rimraf ./docs","test:unit":"mocha **/cjs/**/*.spec.js","test:e2e":"mocha **/cjs/**/*.ispec.js && karma start karma.conf.js","test":"yarn test:unit","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig.es.json","build":"yarn build:cjs && yarn build:es","postbuild":"downlevel-dts types types/ts3.4"},"main":"./dist/cjs/index.js","types":"./types/index.d.ts","module":"./dist/es/index.js","browser":{"./runtimeConfig":"./runtimeConfig.browser"},"react-native":{"./runtimeConfig":"./runtimeConfig.native"},"sideEffects":false,"dependencies":{"@aws-crypto/sha256-browser":"^1.0.0","@aws-crypto/sha256-js":"^1.0.0","@aws-sdk/config-resolver":"3.6.1","@aws-sdk/credential-provider-node":"3.6.1","@aws-sdk/fetch-http-handler":"3.6.1","@aws-sdk/hash-node":"3.6.1","@aws-sdk/invalid-dependency":"3.6.1","@aws-sdk/middleware-content-length":"3.6.1","@aws-sdk/middleware-host-header":"3.6.1","@aws-sdk/middleware-logger":"3.6.1","@aws-sdk/middleware-retry":"3.6.1","@aws-sdk/middleware-serde":"3.6.1","@aws-sdk/middleware-signing":"3.6.1","@aws-sdk/middleware-stack":"3.6.1","@aws-sdk/middleware-user-agent":"3.6.1","@aws-sdk/node-config-provider":"3.6.1","@aws-sdk/node-http-handler":"3.6.1","@aws-sdk/protocol-http":"3.6.1","@aws-sdk/smithy-client":"3.6.1","@aws-sdk/types":"3.6.1","@aws-sdk/url-parser":"3.6.1","@aws-sdk/url-parser-native":"3.6.1","@aws-sdk/util-base64-browser":"3.6.1","@aws-sdk/util-base64-node":"3.6.1","@aws-sdk/util-body-length-browser":"3.6.1","@aws-sdk/util-body-length-node":"3.6.1","@aws-sdk/util-user-agent-browser":"3.6.1","@aws-sdk/util-user-agent-node":"3.6.1","@aws-sdk/util-utf8-browser":"3.6.1","@aws-sdk/util-utf8-node":"3.6.1","tslib":"^2.0.0"},"devDependencies":{"@aws-sdk/client-documentation-generator":"3.6.1","@aws-sdk/client-iam":"3.6.1","@types/chai":"^4.2.11","@types/mocha":"^8.0.4","@types/node":"^12.7.5","downlevel-dts":"0.7.0","jest":"^26.1.0","rimraf":"^3.0.0","typedoc":"^0.19.2","typescript":"~4.1.2"},"engines":{"node":">=10.0.0"},"typesVersions":{"<4.0":{"types/*":["types/ts3.4/*"]}},"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-cognito-identity","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"clients/client-cognito-identity"}}')},function(e,t,n){e.exports=n(145).Observable},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(0),i=new(n(22).a)("Hub"),o="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default";var s=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)return void i.warn("No listeners for "+e);this.patterns=Object(r.h)(this.patterns.filter((function(e){return e!==n})))}else{var o=this.listeners[e];if(!o)return void i.warn("No listeners for "+e);this.listeners[e]=Object(r.h)(o.filter((function(e){return e.callback!==t})))}},e.prototype.dispatch=function(e,t,n,s){(void 0===n&&(n=""),this.protectedChannels.indexOf(e)>-1)&&(s===o||i.warn("WARNING: "+e+" is protected and dispatching on it can have unintended consequences"));var a={channel:e,payload:Object(r.a)({},t),source:n,patternInfo:[]};try{this._toListeners(a)}catch(e){i.error(e)}},e.prototype.listen=function(e,t,n){var r,o=this;if(void 0===n&&(n="noname"),function(e){return void 0!==e.onHubCapsule}(t))i.warn("WARNING onHubCapsule is Deprecated. Please pass in a callback."),r=t.onHubCapsule.bind(t);else{if("function"!=typeof t)throw new Error("No callback supplied to Hub");r=t}if(e instanceof RegExp)this.patterns.push({pattern:e,callback:r});else{var s=this.listeners[e];s||(s=[],this.listeners[e]=s),s.push({name:n,callback:r})}return function(){o.remove(e,r)}},e.prototype._toListeners=function(e){var t=e.channel,n=e.payload,o=this.listeners[t];if(o&&o.forEach((function(r){i.debug("Dispatching to "+t+" with ",n);try{r.callback(e)}catch(e){i.error(e)}})),this.patterns.length>0){if(!n.message)return void i.warn("Cannot perform pattern matching without a message key");var s=n.message;this.patterns.forEach((function(t){var n=s.match(t.pattern);if(n){var o=Object(r.f)(n).slice(1),a=Object(r.a)(Object(r.a)({},e),{patternInfo:o});try{t.callback(a)}catch(e){i.error(e)}}}))}},e}())("__default__")},,,,function(e,t,n){var r,i,o=n(44),s=n(45),a=0,u=0;e.exports=function(e,t,n){var c=t&&n||0,l=t||[],f=(e=e||{}).node||r,d=void 0!==e.clockseq?e.clockseq:i;if(null==f||null==d){var h=o();null==f&&(f=r=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==d&&(d=i=16383&(h[6]<<8|h[7]))}var p=void 0!==e.msecs?e.msecs:(new Date).getTime(),v=void 0!==e.nsecs?e.nsecs:u+1,y=p-a+(v-u)/1e4;if(y<0&&void 0===e.clockseq&&(d=d+1&16383),(y<0||p>a)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=p,u=v,i=d;var g=(1e4*(268435455&(p+=122192928e5))+v)%4294967296;l[c++]=g>>>24&255,l[c++]=g>>>16&255,l[c++]=g>>>8&255,l[c++]=255&g;var m=p/4294967296*1e4&268435455;l[c++]=m>>>8&255,l[c++]=255&m,l[c++]=m>>>24&15|16,l[c++]=m>>>16&255,l[c++]=d>>>8|128,l[c++]=255&d;for(var b=0;b<6;++b)l[c+b]=f[b];return t||s(l)}},function(e,t,n){var r=n(44),i=n(45);e.exports=function(e,t,n){var o=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[o+a]=s[a];return t||i(s)}},function(e,t,n){"use strict";t.byteLength=function(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=c(e),s=r[0],a=r[1],u=new o(function(e,t,n){return 3*(t+n)/4-n}(0,s,a)),l=0,f=a>0?s-4:s;for(n=0;n<f;n+=4)t=i[e.charCodeAt(n)]<<18|i[e.charCodeAt(n+1)]<<12|i[e.charCodeAt(n+2)]<<6|i[e.charCodeAt(n+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===a&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=0,a=n-i;s<a;s+=16383)o.push(l(e,s,s+16383>a?a:s+16383));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)r[a]=s[a],i[s.charCodeAt(a)]=a;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var i,o,s=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){
64
94
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
65
- t.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,l=-7,f=n?i-1:0,d=n?-1:1,h=e[t+f];for(f+=d,o=h&(1<<-l)-1,h>>=-l,l+=a;l>0;o=256*o+e[t+f],f+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+e[t+f],f+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,r),o-=c}return(h?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,u,c=8*o-i-1,l=(1<<c)-1,f=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,p=r?1:-1,v=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+f>=1?d/u:d*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*u-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[n+h]=255&a,h+=p,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[n+h]=255&s,h+=p,s/=256,c-=8);e[n+h-p]|=128*v}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t){},function(e,t){},function(e,t,n){var r,i,o,s;e.exports=(r=n(12),o=(i=r).lib.Base,s=i.enc.Utf8,void(i.algo.HMAC=o.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var n=e.blockSize,r=4*n;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),o=this._iKey=t.clone(),a=i.words,u=o.words,c=0;c<n;c++)a[c]^=1549556828,u[c]^=909522486;i.sigBytes=o.sigBytes=r,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(n))}})))},function(e,t){},function(e,t,n){e.exports=self.fetch||(self.fetch=n(45).default||n(45))},function(e,t,n){e.exports=n(92).Observable},function(e,t,n){"use strict";(function(e){!function(e,t){function n(e){return"function"==typeof Symbol&&Boolean(Symbol[e])}function r(e){return n(e)?Symbol[e]:"@@"+e}function i(e){setTimeout((function(){throw e}))}function o(e,t){var n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function s(e){var t=e.constructor;return void 0!==t&&null===(t=t[r("species")])&&(t=void 0),void 0!==t?t:d}function a(e,t){Object.keys(t).forEach((function(n){var r=Object.getOwnPropertyDescriptor(t,n);r.enumerable=!1,Object.defineProperty(e,n,r)}))}function u(e){var t=e._cleanup;if(t){e._cleanup=void 0;try{t()}catch(e){i(e)}}}function c(e){return void 0===e._observer}function l(e,t){if(Object(e)!==e)throw new TypeError("Observer must be an object");this._cleanup=void 0,this._observer=e;try{var n=o(e,"start");n&&n.call(e,this)}catch(e){i(e)}if(!c(this)){e=new f(this);try{var r=t.call(void 0,e);if(null!=r){if("function"==typeof r.unsubscribe)s=r,r=function(){s.unsubscribe()};else if("function"!=typeof r)throw new TypeError(r+" is not a function");this._cleanup=r}}catch(t){return void e.error(t)}var s;c(this)&&u(this)}}function f(e){this._subscription=e}function d(e){if(!(this instanceof d))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}"function"!=typeof Symbol||Symbol.observable||(Symbol.observable=Symbol("observable")),a(l.prototype={},{get closed(){return c(this)},unsubscribe:function(){var e;c(e=this)||(e._observer=void 0,u(e))}}),a(f.prototype={},{get closed(){return c(this._subscription)},next:function(e){var t=this._subscription;if(!c(t)){var n=t._observer;try{var r=o(n,"next");r&&r.call(n,e)}catch(e){i(e)}}},error:function(e){var t=this._subscription;if(c(t))i(e);else{var n=t._observer;t._observer=void 0;try{var r=o(n,"error");if(!r)throw e;r.call(n,e)}catch(e){i(e)}u(t)}},complete:function(){var e=this._subscription;if(!c(e)){var t=e._observer;e._observer=void 0;try{var n=o(t,"complete");n&&n.call(t)}catch(e){i(e)}u(e)}}}),a(d.prototype,{subscribe:function(e){for(var t=[],n=1;n<arguments.length;++n)t.push(arguments[n]);return"function"==typeof e?e={next:e,error:t[0],complete:t[1]}:"object"==typeof e&&null!==e||(e={}),new l(e,this._subscriber)},forEach:function(e){var t=this;return new Promise((function(n,r){if("function"!=typeof e)return Promise.reject(new TypeError(e+" is not a function"));t.subscribe({_subscription:null,start:function(e){if(Object(e)!==e)throw new TypeError(e+" is not an object");this._subscription=e},next:function(t){var n=this._subscription;if(!n.closed)try{e(t)}catch(e){r(e),n.unsubscribe()}},error:r,complete:n})}))},map:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(s(this))((function(n){return t.subscribe({next:function(t){if(!n.closed){try{t=e(t)}catch(e){return n.error(e)}n.next(t)}},error:function(e){n.error(e)},complete:function(){n.complete()}})}))},filter:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(s(this))((function(n){return t.subscribe({next:function(t){if(!n.closed){try{if(!e(t))return}catch(e){return n.error(e)}n.next(t)}},error:function(e){n.error(e)},complete:function(){n.complete()}})}))},reduce:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=s(this),r=arguments.length>1,i=!1,o=arguments[1],a=o;return new n((function(n){return t.subscribe({next:function(t){if(!n.closed){var o=!i;if(i=!0,!o||r)try{a=e(a,t)}catch(e){return n.error(e)}else a=t}},error:function(e){n.error(e)},complete:function(){if(!i&&!r)return n.error(new TypeError("Cannot reduce an empty sequence"));n.next(a),n.complete()}})}))}}),Object.defineProperty(d.prototype,r("observable"),{value:function(){return this},writable:!0,configurable:!0}),a(d,{from:function(e){var t="function"==typeof this?this:d;if(null==e)throw new TypeError(e+" is not an object");var i=o(e,r("observable"));if(i){var s=i.call(e);if(Object(s)!==s)throw new TypeError(s+" is not an object");return s.constructor===t?s:new t((function(e){return s.subscribe(e)}))}if(n("iterator")&&(i=o(e,r("iterator"))))return new t((function(t){for(var n,r=i.call(e)[Symbol.iterator]();!(n=r.next()).done;){var o=n.value;if(t.next(o),t.closed)return}t.complete()}));if(Array.isArray(e))return new t((function(t){for(var n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}));throw new TypeError(e+" is not observable")},of:function(){for(var e=[],t=0;t<arguments.length;++t)e.push(arguments[t]);var n="function"==typeof this?this:d;return new n((function(t){for(var n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}))}}),Object.defineProperty(d,r("species"),{get:function(){return this},configurable:!0}),Object.defineProperty(d,"extensions",{value:{observableSymbol:r("observable"),setHostReportError:function(e){i=e}}}),e.Observable=d}(t)}).call(this,n(47)(e))},function(e,t,n){(function(e,r){var i;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(o){t&&t.nodeType,e&&e.nodeType;var s="object"==typeof r&&r;s.global!==s&&s.window!==s&&s.self;var a,u=2147483647,c=/^xn--/,l=/[^\x20-\x7E]/,f=/[\x2E\u3002\uFF0E\uFF61]/g,d={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},h=Math.floor,p=String.fromCharCode;function v(e){throw new RangeError(d[e])}function y(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function g(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+y((e=e.replace(f,".")).split("."),t).join(".")}function m(e){for(var t,n,r=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(n=e.charCodeAt(i++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),i--):r.push(t);return r}function b(e){return y(e,(function(e){var t="";return e>65535&&(t+=p((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=p(e)})).join("")}function w(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function S(e,t,n){var r=0;for(e=n?h(e/700):e>>1,e+=h(e/t);e>455;r+=36)e=h(e/35);return h(r+36*e/(e+38))}function _(e){var t,n,r,i,o,s,a,c,l,f,d,p=[],y=e.length,g=0,m=128,w=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&v("not-basic"),p.push(e.charCodeAt(r));for(i=n>0?n+1:0;i<y;){for(o=g,s=1,a=36;i>=y&&v("invalid-input"),((c=(d=e.charCodeAt(i++))-48<10?d-22:d-65<26?d-65:d-97<26?d-97:36)>=36||c>h((u-g)/s))&&v("overflow"),g+=c*s,!(c<(l=a<=w?1:a>=w+26?26:a-w));a+=36)s>h(u/(f=36-l))&&v("overflow"),s*=f;w=S(g-o,t=p.length+1,0==o),h(g/t)>u-m&&v("overflow"),m+=h(g/t),g%=t,p.splice(g++,0,m)}return b(p)}function E(e){var t,n,r,i,o,s,a,c,l,f,d,y,g,b,_,E=[];for(y=(e=m(e)).length,t=128,n=0,o=72,s=0;s<y;++s)(d=e[s])<128&&E.push(p(d));for(r=i=E.length,i&&E.push("-");r<y;){for(a=u,s=0;s<y;++s)(d=e[s])>=t&&d<a&&(a=d);for(a-t>h((u-n)/(g=r+1))&&v("overflow"),n+=(a-t)*g,t=a,s=0;s<y;++s)if((d=e[s])<t&&++n>u&&v("overflow"),d==t){for(c=n,l=36;!(c<(f=l<=o?1:l>=o+26?26:l-o));l+=36)_=c-f,b=36-f,E.push(p(w(f+_%b,0))),c=h(_/b);E.push(p(w(c,0))),o=S(n,g,r==i),n=0,++r}++n,++t}return E.join("")}a={version:"1.4.1",ucs2:{decode:m,encode:b},decode:_,encode:E,toASCII:function(e){return g(e,(function(e){return l.test(e)?"xn--"+E(e):e}))},toUnicode:function(e){return g(e,(function(e){return c.test(e)?_(e.slice(4).toLowerCase()):e}))}},void 0===(i=function(){return a}.call(t,n,t,e))||(e.exports=i)}()}).call(this,n(47)(e),n(27))},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";t.decode=t.parse=n(96),t.encode=t.stringify=n(97)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,o){t=t||"&",n=n||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var l=0;l<c;++l){var f,d,h,p,v=e[l].replace(a,"%20"),y=v.indexOf(n);y>=0?(f=v.substr(0,y),d=v.substr(y+1)):(f=v,d=""),h=decodeURIComponent(f),p=decodeURIComponent(d),r(s,h)?i(s[h])?s[h].push(p):s[h]=[s[h],p]:s[h]=p}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,a){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),(function(s){var a=encodeURIComponent(r(s))+n;return i(e[s])?o(e[s],(function(e){return a+encodeURIComponent(r(e))})).join(t):a+encodeURIComponent(r(e[s]))})).join(t):a?encodeURIComponent(r(a))+n+encodeURIComponent(r(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var s=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}},function(e,t,n){var r,i,o=n(49),s=n(50),a=0,u=0;e.exports=function(e,t,n){var c=t&&n||0,l=t||[],f=(e=e||{}).node||r,d=void 0!==e.clockseq?e.clockseq:i;if(null==f||null==d){var h=o();null==f&&(f=r=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==d&&(d=i=16383&(h[6]<<8|h[7]))}var p=void 0!==e.msecs?e.msecs:(new Date).getTime(),v=void 0!==e.nsecs?e.nsecs:u+1,y=p-a+(v-u)/1e4;if(y<0&&void 0===e.clockseq&&(d=d+1&16383),(y<0||p>a)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=p,u=v,i=d;var g=(1e4*(268435455&(p+=122192928e5))+v)%4294967296;l[c++]=g>>>24&255,l[c++]=g>>>16&255,l[c++]=g>>>8&255,l[c++]=255&g;var m=p/4294967296*1e4&268435455;l[c++]=m>>>8&255,l[c++]=255&m,l[c++]=m>>>24&15|16,l[c++]=m>>>16&255,l[c++]=d>>>8|128,l[c++]=255&d;for(var b=0;b<6;++b)l[c+b]=f[b];return t||s(l)}},function(e,t,n){var r=n(49),i=n(50);e.exports=function(e,t,n){var o=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[o+a]=s[a];return t||i(s)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(51),i=n(53),o=n(107),s=n(115),a=n(117),u=n(36),c=function(){function e(e){(0,s.supportsWebCrypto)((0,u.locateWindow)())?this.hash=new i.Sha256(e):(0,a.isMsWindow)((0,u.locateWindow)())?this.hash=new r.Sha256(e):this.hash=new o.Sha256(e)}return e.prototype.update=function(e,t){this.hash.update(e,t)},e.prototype.digest=function(){return this.hash.digest()},e}();t.Sha256=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyData=void 0,t.isEmptyData=function(e){return"string"==typeof e?0===e.length:0===e.byteLength}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=t.numToUint8=t.isEmptyData=t.convertToBuffer=void 0;var r=n(103);Object.defineProperty(t,"convertToBuffer",{enumerable:!0,get:function(){return r.convertToBuffer}});var i=n(104);Object.defineProperty(t,"isEmptyData",{enumerable:!0,get:function(){return i.isEmptyData}});var o=n(105);Object.defineProperty(t,"numToUint8",{enumerable:!0,get:function(){return o.numToUint8}});var s=n(106);Object.defineProperty(t,"uint32ArrayFrom",{enumerable:!0,get:function(){return s.uint32ArrayFrom}})},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var r=n(65),i=void 0!==e&&e.from?function(t){return e.from(t,"utf8")}:r.fromUtf8;t.convertToBuffer=function(e){return e instanceof Uint8Array?e:"string"==typeof e?i(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}}).call(this,n(6).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyData=void 0,t.isEmptyData=function(e){return"string"==typeof e?0===e.length:0===e.byteLength}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.numToUint8=void 0,t.numToUint8=function(e){return new Uint8Array([(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=void 0,t.uint32ArrayFrom=function(e){if(!Array.from){for(var t=new Uint32Array(e.length);0<e.length;)t[0]=e[0];return t}return Uint32Array.from(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),(0,n(0).__exportStar)(n(108),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(0),i=n(54),o=n(109),s=n(110),a=function(){function e(e){if(this.hash=new o.RawSha256,e){this.outer=new o.RawSha256;var t=function(e){var t=(0,s.convertToBuffer)(e);if(t.byteLength>i.BLOCK_SIZE){var n=new o.RawSha256;n.update(t),t=n.digest()}var r=new Uint8Array(i.BLOCK_SIZE);return r.set(t),r}(e),n=new Uint8Array(i.BLOCK_SIZE);n.set(t);for(var r=0;r<i.BLOCK_SIZE;r++)t[r]^=54,n[r]^=92;this.hash.update(t),this.outer.update(n);for(r=0;r<t.byteLength;r++)t[r]=0}}return e.prototype.update=function(e){if(!(0,s.isEmptyData)(e)&&!this.error)try{this.hash.update((0,s.convertToBuffer)(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return(0,r.__awaiter)(this,void 0,void 0,(function(){return(0,r.__generator)(this,(function(e){return[2,this.digestSync()]}))}))},e}();t.Sha256=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RawSha256=void 0;var r=n(54),i=function(){function e(){this.state=Int32Array.from(r.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,n=e.byteLength;if(this.bytesHashed+=n,8*this.bytesHashed>r.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[t++],n--,this.bufferLength===r.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(t.setUint8(this.bufferLength++,128),n%r.BLOCK_SIZE>=r.BLOCK_SIZE-8){for(var i=this.bufferLength;i<r.BLOCK_SIZE;i++)t.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(i=this.bufferLength;i<r.BLOCK_SIZE-8;i++)t.setUint8(i,0);t.setUint32(r.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),t.setUint32(r.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}var o=new Uint8Array(r.DIGEST_LENGTH);for(i=0;i<8;i++)o[4*i]=this.state[i]>>>24&255,o[4*i+1]=this.state[i]>>>16&255,o[4*i+2]=this.state[i]>>>8&255,o[4*i+3]=this.state[i]>>>0&255;return o},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],u=t[5],c=t[6],l=t[7],f=0;f<r.BLOCK_SIZE;f++){if(f<16)this.temp[f]=(255&e[4*f])<<24|(255&e[4*f+1])<<16|(255&e[4*f+2])<<8|255&e[4*f+3];else{var d=this.temp[f-2],h=(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,p=((d=this.temp[f-15])>>>7|d<<25)^(d>>>18|d<<14)^d>>>3;this.temp[f]=(h+this.temp[f-7]|0)+(p+this.temp[f-16]|0)}var v=(((a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7))+(a&u^~a&c)|0)+(l+(r.KEY[f]+this.temp[f]|0)|0)|0,y=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&i^n&o^i&o)|0;l=c,c=u,u=a,a=s+v|0,s=o,o=i,i=n,n=v+y|0}t[0]+=n,t[1]+=i,t[2]+=o,t[3]+=s,t[4]+=a,t[5]+=u,t[6]+=c,t[7]+=l},e}();t.RawSha256=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=t.numToUint8=t.isEmptyData=t.convertToBuffer=void 0;var r=n(111);Object.defineProperty(t,"convertToBuffer",{enumerable:!0,get:function(){return r.convertToBuffer}});var i=n(112);Object.defineProperty(t,"isEmptyData",{enumerable:!0,get:function(){return i.isEmptyData}});var o=n(113);Object.defineProperty(t,"numToUint8",{enumerable:!0,get:function(){return o.numToUint8}});var s=n(114);Object.defineProperty(t,"uint32ArrayFrom",{enumerable:!0,get:function(){return s.uint32ArrayFrom}})},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var r=n(146),i=void 0!==e&&e.from?function(t){return e.from(t,"utf8")}:r.fromUtf8;t.convertToBuffer=function(e){return e instanceof Uint8Array?e:"string"==typeof e?i(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}}).call(this,n(6).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyData=void 0,t.isEmptyData=function(e){return"string"==typeof e?0===e.length:0===e.byteLength}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.numToUint8=void 0,t.numToUint8=function(e){return new Uint8Array([(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=void 0,t.uint32ArrayFrom=function(e){if(!Array.from){for(var t=new Uint32Array(e.length);0<e.length;)t[0]=e[0];return t}return Uint32Array.from(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(0).__exportStar(n(116),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.supportsZeroByteGCM=t.supportsSubtleCrypto=t.supportsSecureRandom=t.supportsWebCrypto=void 0;var r=n(0),i=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function o(e){return"object"==typeof e&&"object"==typeof e.crypto&&"function"==typeof e.crypto.getRandomValues}function s(e){return e&&i.every((function(t){return"function"==typeof e[t]}))}t.supportsWebCrypto=function(e){return!(!o(e)||"object"!=typeof e.crypto.subtle)&&s(e.crypto.subtle)},t.supportsSecureRandom=o,t.supportsSubtleCrypto=s,t.supportsZeroByteGCM=function(e){return r.__awaiter(this,void 0,void 0,(function(){var t;return r.__generator(this,(function(n){switch(n.label){case 0:if(!s(e))return[2,!1];n.label=1;case 1:return n.trys.push([1,4,,5]),[4,e.generateKey({name:"AES-GCM",length:128},!1,["encrypt"])];case 2:return t=n.sent(),[4,e.encrypt({name:"AES-GCM",iv:new Uint8Array(Array(12)),additionalData:new Uint8Array(Array(16)),tagLength:128},t,new Uint8Array(0))];case 3:return[2,16===n.sent().byteLength];case 4:return n.sent(),[2,!1];case 5:return[2]}}))}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0);r.__exportStar(n(118),t),r.__exportStar(n(119),t),r.__exportStar(n(120),t),r.__exportStar(n(121),t),r.__exportStar(n(122),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isMsWindow=void 0;var r=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];t.isMsWindow=function(e){if(function(e){return"MSInputMethodContext"in e&&"msCrypto"in e}(e)&&void 0!==e.msCrypto.subtle){var t=e.msCrypto,n=t.getRandomValues,i=t.subtle;return r.map((function(e){return i[e]})).concat(n).every((function(e){return"function"==typeof e}))}return!1}},function(e,t){},function(e,t,n){"use strict";var r=n(13),i=n(56),o=n(125),s=n(62);var a=function e(t){var n=new o(t),a=i(o.prototype.request,n);return r.extend(a,o.prototype,n),r.extend(a,n),a.create=function(n){return e(s(t,n))},a}(n(29));a.Axios=o,a.Cancel=n(30),a.CancelToken=n(138),a.isCancel=n(61),a.VERSION=n(63).version,a.all=function(e){return Promise.all(e)},a.spread=n(139),a.isAxiosError=n(140),e.exports=a,e.exports.default=a},function(e,t,n){"use strict";var r=n(13),i=n(57),o=n(126),s=n(127),a=n(62),u=n(137),c=u.validators;function l(e){this.defaults=e,this.interceptors={request:new o,response:new o}}l.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var n=t.transitional;void 0!==n&&u.assertOptions(n,{silentJSONParsing:c.transitional(c.boolean),forcedJSONParsing:c.transitional(c.boolean),clarifyTimeoutError:c.transitional(c.boolean)},!1);var r=[],i=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(i=i&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var o,l=[];if(this.interceptors.response.forEach((function(e){l.push(e.fulfilled,e.rejected)})),!i){var f=[s,void 0];for(Array.prototype.unshift.apply(f,r),f=f.concat(l),o=Promise.resolve(t);f.length;)o=o.then(f.shift(),f.shift());return o}for(var d=t;r.length;){var h=r.shift(),p=r.shift();try{d=h(d)}catch(e){p(e);break}}try{o=s(d)}catch(e){return Promise.reject(e)}for(;l.length;)o=o.then(l.shift(),l.shift());return o},l.prototype.getUri=function(e){return e=a(this.defaults,e),i(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function(e){l.prototype[e]=function(t,n){return this.request(a(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(e){l.prototype[e]=function(t,n,r){return this.request(a(r||{},{method:e,url:t,data:n}))}})),e.exports=l},function(e,t,n){"use strict";var r=n(13);function i(){this.handlers=[]}i.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){r.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=i},function(e,t,n){"use strict";var r=n(13),i=n(128),o=n(61),s=n(29),a=n(30);function u(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new a("canceled")}e.exports=function(e){return u(e),e.headers=e.headers||{},e.data=i.call(e,e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||s.adapter)(e).then((function(t){return u(e),t.data=i.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(u(e),t&&t.response&&(t.response.data=i.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,n){"use strict";var r=n(13),i=n(29);e.exports=function(e,t,n){var o=this||i;return r.forEach(n,(function(n){e=n.call(o,e,t)})),e}},function(e,t,n){"use strict";var r=n(13);e.exports=function(e,t){r.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))}},function(e,t,n){"use strict";var r=n(60);e.exports=function(e,t,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},function(e,t,n){"use strict";var r=n(13);e.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,i,o,s){var a=[];a.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(i)&&a.push("path="+i),r.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,n){"use strict";var r=n(133),i=n(134);e.exports=function(e,t){return e&&!r(t)?i(e,t):t}},function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var r=n(13),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,o,s={};return e?(r.forEach(e.split("\n"),(function(e){if(o=e.indexOf(":"),t=r.trim(e.substr(0,o)).toLowerCase(),n=r.trim(e.substr(o+1)),t){if(s[t]&&i.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([n]):s[t]?s[t]+", "+n:n}})),s):s}},function(e,t,n){"use strict";var r=n(13);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=i(window.location.href),function(t){var n=r.isString(t)?i(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},function(e,t,n){"use strict";var r=n(63).version,i={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){i[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var o={};i.transitional=function(e,t,n){function i(e,t){return"[Axios v"+r+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,r,s){if(!1===e)throw new Error(i(r," has been removed"+(t?" in "+t:"")));return t&&!o[r]&&(o[r]=!0,console.warn(i(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,s)}},e.exports={assertOptions:function(e,t,n){if("object"!=typeof e)throw new TypeError("options must be an object");for(var r=Object.keys(e),i=r.length;i-- >0;){var o=r[i],s=t[o];if(s){var a=e[o],u=void 0===a||s(a,o,e);if(!0!==u)throw new TypeError("option "+o+" must be "+u)}else if(!0!==n)throw Error("Unknown option "+o)}},validators:i}},function(e,t,n){"use strict";var r=n(30);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;this.promise.then((function(e){if(n._listeners){var t,r=n._listeners.length;for(t=0;t<r;t++)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},i.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){"use strict";var r=n(13);e.exports=function(e){return r.isObject(e)&&!0===e.isAxiosError}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(64),o=n(142),s=n(145),a=function(){function e(e){if(this.hash=new o.RawSha256,e){this.outer=new o.RawSha256;var t=function(e){var t=u(e);if(t.byteLength>i.BLOCK_SIZE){var n=new o.RawSha256;n.update(t),t=n.digest()}var r=new Uint8Array(i.BLOCK_SIZE);return r.set(t),r}(e),n=new Uint8Array(i.BLOCK_SIZE);n.set(t);for(var r=0;r<i.BLOCK_SIZE;r++)t[r]^=54,n[r]^=92;this.hash.update(t),this.outer.update(n);for(r=0;r<t.byteLength;r++)t[r]=0}}return e.prototype.update=function(e){if(!function(e){if("string"==typeof e)return 0===e.length;return 0===e.byteLength}(e)&&!this.error)try{this.hash.update(u(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.digestSync()]}))}))},e}();function u(e){return"string"==typeof e?s.fromUtf8(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.Sha256=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(64),i=function(){function e(){this.state=Int32Array.from(r.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,n=e.byteLength;if(this.bytesHashed+=n,8*this.bytesHashed>r.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[t++],n--,this.bufferLength===r.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(t.setUint8(this.bufferLength++,128),n%r.BLOCK_SIZE>=r.BLOCK_SIZE-8){for(var i=this.bufferLength;i<r.BLOCK_SIZE;i++)t.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(i=this.bufferLength;i<r.BLOCK_SIZE-8;i++)t.setUint8(i,0);t.setUint32(r.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),t.setUint32(r.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}var o=new Uint8Array(r.DIGEST_LENGTH);for(i=0;i<8;i++)o[4*i]=this.state[i]>>>24&255,o[4*i+1]=this.state[i]>>>16&255,o[4*i+2]=this.state[i]>>>8&255,o[4*i+3]=this.state[i]>>>0&255;return o},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],u=t[5],c=t[6],l=t[7],f=0;f<r.BLOCK_SIZE;f++){if(f<16)this.temp[f]=(255&e[4*f])<<24|(255&e[4*f+1])<<16|(255&e[4*f+2])<<8|255&e[4*f+3];else{var d=this.temp[f-2],h=(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,p=((d=this.temp[f-15])>>>7|d<<25)^(d>>>18|d<<14)^d>>>3;this.temp[f]=(h+this.temp[f-7]|0)+(p+this.temp[f-16]|0)}var v=(((a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7))+(a&u^~a&c)|0)+(l+(r.KEY[f]+this.temp[f]|0)|0)|0,y=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&i^n&o^i&o)|0;l=c,c=u,u=a,a=s+v|0,s=o,o=i,i=n,n=v+y|0}t[0]+=n,t[1]+=i,t[2]+=o,t[3]+=s,t[4]+=a,t[5]+=u,t[6]+=c,t[7]+=l},e}();t.RawSha256=i},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}Object.defineProperty(t,"__esModule",{value:!0}),t.Observable=void 0;var s=function(){return"function"==typeof Symbol},a=function(e){return s()&&Boolean(Symbol[e])},u=function(e){return a(e)?Symbol[e]:"@@"+e};s()&&!a("observable")&&(Symbol.observable=Symbol("observable"));var c=u("iterator"),l=u("observable"),f=u("species");function d(e,t){var n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function h(e){var t=e.constructor;return void 0!==t&&null===(t=t[f])&&(t=void 0),void 0!==t?t:E}function p(e){return e instanceof E}function v(e){v.log?v.log(e):setTimeout((function(){throw e}))}function y(e){Promise.resolve().then((function(){try{e()}catch(e){v(e)}}))}function g(e){var t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{var n=d(t,"unsubscribe");n&&n.call(t)}}catch(e){v(e)}}function m(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function b(e,t,n){e._state="running";var r=e._observer;try{var i=d(r,t);switch(t){case"next":i&&i.call(r,n);break;case"error":if(m(e),!i)throw n;i.call(r,n);break;case"complete":m(e),i&&i.call(r)}}catch(e){v(e)}"closed"===e._state?g(e):"running"===e._state&&(e._state="ready")}function w(e,t,n){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:n}],void y((function(){return function(e){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var n=0;n<t.length&&(b(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e)}))):void b(e,t,n);e._queue.push({type:t,value:n})}}var S=function(){function e(t,n){r(this,e),this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var i=new _(this);try{this._cleanup=n.call(void 0,i)}catch(e){i.error(e)}"initializing"===this._state&&(this._state="ready")}return o(e,[{key:"unsubscribe",value:function(){"closed"!==this._state&&(m(this),g(this))}},{key:"closed",get:function(){return"closed"===this._state}}]),e}(),_=function(){function e(t){r(this,e),this._subscription=t}return o(e,[{key:"next",value:function(e){w(this._subscription,"next",e)}},{key:"error",value:function(e){w(this._subscription,"error",e)}},{key:"complete",value:function(){w(this._subscription,"complete")}},{key:"closed",get:function(){return"closed"===this._subscription._state}}]),e}(),E=function(){function e(t){if(r(this,e),!(this instanceof e))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof t)throw new TypeError("Observable initializer must be a function");this._subscriber=t}return o(e,[{key:"subscribe",value:function(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new S(e,this._subscriber)}},{key:"forEach",value:function(e){var t=this;return new Promise((function(n,r){if("function"==typeof e)var i=t.subscribe({next:function(t){try{e(t,o)}catch(e){r(e),i.unsubscribe()}},error:r,complete:n});else r(new TypeError(e+" is not a function"));function o(){i.unsubscribe(),n()}}))}},{key:"map",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(h(this))((function(n){return t.subscribe({next:function(t){try{t=e(t)}catch(e){return n.error(e)}n.next(t)},error:function(e){n.error(e)},complete:function(){n.complete()}})}))}},{key:"filter",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(h(this))((function(n){return t.subscribe({next:function(t){try{if(!e(t))return}catch(e){return n.error(e)}n.next(t)},error:function(e){n.error(e)},complete:function(){n.complete()}})}))}},{key:"reduce",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=h(this),r=arguments.length>1,i=!1,o=arguments[1],s=o;return new n((function(n){return t.subscribe({next:function(t){var o=!i;if(i=!0,!o||r)try{s=e(s,t)}catch(e){return n.error(e)}else s=t},error:function(e){n.error(e)},complete:function(){if(!i&&!r)return n.error(new TypeError("Cannot reduce an empty sequence"));n.next(s),n.complete()}})}))}},{key:"concat",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=h(this);return new i((function(t){var r,o=0;return function e(s){r=s.subscribe({next:function(e){t.next(e)},error:function(e){t.error(e)},complete:function(){o===n.length?(r=void 0,t.complete()):e(i.from(n[o++]))}})}(e),function(){r&&(r.unsubscribe(),r=void 0)}}))}},{key:"flatMap",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=h(this);return new n((function(r){var i=[],o=t.subscribe({next:function(t){if(e)try{t=e(t)}catch(e){return r.error(e)}var o=n.from(t).subscribe({next:function(e){r.next(e)},error:function(e){r.error(e)},complete:function(){var e=i.indexOf(o);e>=0&&i.splice(e,1),s()}});i.push(o)},error:function(e){r.error(e)},complete:function(){s()}});function s(){o.closed&&0===i.length&&r.complete()}return function(){i.forEach((function(e){return e.unsubscribe()})),o.unsubscribe()}}))}},{key:l,value:function(){return this}}],[{key:"from",value:function(t){var n="function"==typeof this?this:e;if(null==t)throw new TypeError(t+" is not an object");var r=d(t,l);if(r){var i=r.call(t);if(Object(i)!==i)throw new TypeError(i+" is not an object");return p(i)&&i.constructor===n?i:new n((function(e){return i.subscribe(e)}))}if(a("iterator")&&(r=d(t,c)))return new n((function(e){y((function(){if(!e.closed){var n=!0,i=!1,o=void 0;try{for(var s,a=r.call(t)[Symbol.iterator]();!(n=(s=a.next()).done);n=!0){var u=s.value;if(e.next(u),e.closed)return}}catch(e){i=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}e.complete()}}))}));if(Array.isArray(t))return new n((function(e){y((function(){if(!e.closed){for(var n=0;n<t.length;++n)if(e.next(t[n]),e.closed)return;e.complete()}}))}));throw new TypeError(t+" is not observable")}},{key:"of",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i="function"==typeof this?this:e;return new i((function(e){y((function(){if(!e.closed){for(var t=0;t<n.length;++t)if(e.next(n[t]),e.closed)return;e.complete()}}))}))}},{key:f,get:function(){return this}}]),e}();t.Observable=E,s()&&Object.defineProperty(E,Symbol("extensions"),{value:{symbol:l,hostReportError:v},configurable:!0})},function(e,t,n){"use strict";n.r(t),n.d(t,"DataStore",(function(){return dn})),n.d(t,"DataStoreClass",(function(){return fn})),n.d(t,"initSchema",(function(){return Gt})),n.d(t,"Predicates",(function(){return A.b})),n.d(t,"ModelPredicateCreator",(function(){return A.a})),n.d(t,"ModelSortPredicateCreator",(function(){return O.a})),n.d(t,"utils",(function(){return hn})),n.d(t,"isSchemaModel",(function(){return v.w})),n.d(t,"isAssociatedWith",(function(){return v.l})),n.d(t,"isTargetNameAssociation",(function(){return v.x})),n.d(t,"isModelAttributeAuth",(function(){return v.o})),n.d(t,"isModelAttributeKey",(function(){return v.q})),n.d(t,"isModelAttributePrimaryKey",(function(){return v.r})),n.d(t,"isModelAttributeCompositeKey",(function(){return v.p})),n.d(t,"ModelAttributeAuthAllow",(function(){return v.e})),n.d(t,"ModelAttributeAuthProvider",(function(){return v.f})),n.d(t,"GraphQLScalarType",(function(){return v.c})),n.d(t,"isGraphQLScalarType",(function(){return v.n})),n.d(t,"isModelFieldType",(function(){return v.s})),n.d(t,"isNonModelFieldType",(function(){return v.t})),n.d(t,"isEnumFieldType",(function(){return v.m})),n.d(t,"OpType",(function(){return v.h})),n.d(t,"isPredicateObj",(function(){return v.v})),n.d(t,"isPredicateGroup",(function(){return v.u})),n.d(t,"QueryOne",(function(){return v.j})),n.d(t,"SortDirection",(function(){return v.k})),n.d(t,"AuthModeStrategyType",(function(){return v.a})),n.d(t,"ModelOperation",(function(){return v.g})),n.d(t,"syncExpression",(function(){return v.y})),n.d(t,"ProcessName",(function(){return v.i})),n.d(t,"DISCARD",(function(){return v.b})),n.d(t,"LimitTimerRaceResolvedValues",(function(){return v.d}));var r=n(18),i=n(21),o=n(16),s=n(76),a=n(38),u=n(32),c=n(19),l=n(15),f=n(31),d=n(10),h=n(17),p=n(3),v=n(1),y=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,t 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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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="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(m(arguments[t]));return e};function w(e){return"private"!==e.allow||e.provider?"public"!==e.allow||e.provider?e.provider:v.f.API_KEY:v.f.USER_POOLS}function S(e){var t=e.rules,n=e.currentUser,r=new Set;return t.forEach((function(e){switch(e.allow){case v.e.CUSTOM:e.provider&&e.provider!==v.f.FUNCTION||r.add(p.c.AWS_LAMBDA);break;case v.e.GROUPS:case v.e.OWNER:n&&(e.provider===v.f.USER_POOLS?r.add(p.c.AMAZON_COGNITO_USER_POOLS):e.provider===v.f.OIDC&&r.add(p.c.OPENID_CONNECT));break;case v.e.PRIVATE:n&&(e.provider&&e.provider!==v.f.USER_POOLS?e.provider===v.f.IAM&&r.add(p.c.AWS_IAM):r.add(p.c.AMAZON_COGNITO_USER_POOLS));break;case v.e.PUBLIC:e.provider===v.f.IAM?r.add(p.c.AWS_IAM):e.provider&&e.provider!==v.f.API_KEY||r.add(p.c.API_KEY)}})),Array.from(r)}var _=function(e){return function(t){var n=t.schema,r=t.modelName;return y(void 0,void 0,void 0,(function(){var t,i,o,s,a;return g(this,(function(u){switch(u.label){case 0:e.Auth=e.Auth||h.a,u.label=1;case 1:return u.trys.push([1,3,,4]),[4,e.Auth.currentAuthenticatedUser()];case 2:return t=u.sent(),[3,4];case 3:return u.sent(),[3,4];case 4:return(i=n.namespaces.user.models[r].attributes)&&(o=i.find((function(e){return"auth"===e.type})),null===(a=null==o?void 0:o.properties)||void 0===a?void 0:a.rules)?(c=o.properties.rules,l=[v.e.CUSTOM,v.e.OWNER,v.e.GROUPS,v.e.PRIVATE,v.e.PUBLIC],f=[v.f.FUNCTION,v.f.USER_POOLS,v.f.OIDC,v.f.IAM,v.f.API_KEY],s=b(c).sort((function(e,t){return e.allow===t.allow?f.indexOf(w(e))-f.indexOf(w(t)):l.indexOf(e.allow)-l.indexOf(t.allow)})),[2,S({currentUser:t,rules:s})]):[2,[]]}var c,l,f}))}))}},E=function(){return[]},A=n(5),O=n(48),I=function(){function e(){this._queue=[],this._pending=!1}return e.prototype.isLocked=function(){return this._pending},e.prototype.acquire=function(){var e=this,t=new Promise((function(t){return e._queue.push(t)}));return this._pending||this._dispatchNext(),t},e.prototype.runExclusive=function(e){return this.acquire().then((function(t){var n;try{n=e()}catch(e){throw t(),e}return Promise.resolve(n).then((function(e){return t(),e}),(function(e){throw t(),e}))}))},e.prototype._dispatchNext=function(){this._queue.length>0?(this._pending=!0,this._queue.shift()(this._dispatchNext.bind(this))):this._pending=!1},e}(),T=n(68),C=n.n(T),x=n(2);let P,k;const N=new WeakMap,M=new WeakMap,j=new WeakMap,R=new WeakMap,D=new WeakMap;let U={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return M.get(e);if("objectStoreNames"===t)return e.objectStoreNames||j.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return B(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function F(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(k||(k=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(q(this),t),B(N.get(this))}:function(...t){return B(e.apply(q(this),t))}:function(t,...n){const r=e.call(q(this),t,...n);return j.set(r,t.sort?t.sort():[t]),B(r)}}function L(e){return"function"==typeof e?F(e):(e instanceof IDBTransaction&&function(e){if(M.has(e))return;const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",o),e.removeEventListener("abort",o)},i=()=>{t(),r()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",o),e.addEventListener("abort",o)});M.set(e,t)}(e),t=e,(P||(P=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,U):e);var t}function B(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t(B(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",o)});return t.then(t=>{t instanceof IDBCursor&&N.set(t,e)}).catch(()=>{}),D.set(t,e),t}(e);if(R.has(e))return R.get(e);const t=L(e);return t!==e&&(R.set(e,t),D.set(t,e)),t}const q=e=>D.get(e);function z(e,t,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const s=indexedDB.open(e,t),a=B(s);return r&&s.addEventListener("upgradeneeded",e=>{r(B(s.result),e.oldVersion,e.newVersion,B(s.transaction))}),n&&s.addEventListener("blocked",()=>n()),a.then(e=>{o&&e.addEventListener("close",()=>o()),i&&e.addEventListener("versionchange",()=>i())}).catch(()=>{}),a}function K(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",()=>t()),B(n).then(()=>{})}const H=["get","getKey","getAll","getAllKeys","count"],V=["put","add","delete","clear"],G=new Map;function W(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(G.get(t))return G.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=V.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!H.includes(n))return;const o=async function(e,...t){const o=this.transaction(e,i?"readwrite":"readonly");let s=o.store;r&&(s=s.index(t.shift()));const a=await s[n](...t);return i&&await o.done,a};return G.set(t,o),o}function Y(e){return(Y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}U=(e=>({...e,get:(t,n,r)=>W(t,n)||e.get(t,n,r),has:(t,n)=>!!W(t,n)||e.has(t,n)}))(U);var 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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},$=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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof Q?Q(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)}))}}},Q=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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},X=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(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(X(arguments[t]));return e},te=new i.a("DataStore"),ne=new(function(){function e(){this.dbName="amplify-datastore"}return e.prototype.checkPrivate=function(){return J(this,void 0,void 0,(function(){return $(this,(function(e){switch(e.label){case 0:return[4,Object(x.x)().then((function(e){return e}))];case 1:return e.sent()?(te.error("IndexedDB not supported in this browser's private mode"),[2,Promise.reject("IndexedDB not supported in this browser's private mode")]):[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 J(this,void 0,void 0,(function(){var o,s,a=this;return $(this,(function(u){switch(u.label){case 0:return[4,this.checkPrivate()];case 1:return u.sent(),this.initPromise?[3,2]:(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="amplify-datastore-"+i),this.schema=e,this.namespaceResolver=t,this.modelInstanceCreator=n,this.getModelConstructorByModelName=r,u.label=5;case 5:return u.trys.push([5,8,,9]),this.db?[3,7]:(2,o=this,[4,z(this.dbName,2,{upgrade:function(t,n,r,i){return J(a,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h,p,v,y,g=this;return $(this,(function(m){switch(m.label){case 0:if(0===n)return Object.keys(e.namespaces).forEach((function(n){var r=e.namespaces[n];Object.keys(r.models).forEach((function(e){var r=g.getStorename(n,e);g.createObjectStoreForModel(t,n,r,e)}))})),[2];if(1!==n||2!==r)return[3,16];m.label=1;case 1:m.trys.push([1,14,,15]),m.label=2;case 2:m.trys.push([2,11,12,13]),o=Q(i.objectStoreNames),s=o.next(),m.label=3;case 3:return s.done?[3,10]:(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=m.sent(),d=0,m.label=5;case 5:return f&&f.value?[4,l.put(f.value)]:[3,8];case 6:return m.sent(),[4,f.continue()];case 7:return f=m.sent(),d++,[3,5];case 8:t.deleteObjectStore(c),te.debug(d+" "+a+" records migrated"),m.label=9;case 9:return s=o.next(),[3,3];case 10:return[3,13];case 11:return h=m.sent(),v={error:h},[3,13];case 12:try{s&&!s.done&&(y=o.return)&&y.call(o)}finally{if(v)throw v.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,g.getStorename(n,e)]})).filter((function(e){var t=X(e,2)[1];return!o.has(t)})).forEach((function(e){var r=X(e,2),i=r[0],o=r[1];g.createObjectStoreForModel(t,n,o,i)}))})),[3,15];case 14:throw p=m.sent(),te.error("Error migrating IndexedDB data",p),i.abort(),p;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 J(this,void 0,void 0,(function(){var n,r;return $(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 J(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,y,g,m,b,w,S,_,E,O,I,T,C,P,k,N,M=this;return $(this,(function(j){switch(j.label){case 0:return[4,this.checkPrivate()];case 1:return j.sent(),i=Object.getPrototypeOf(e).constructor,o=this.getStorenameForModel(i),s=Object(x.C)(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=M.getStorename(a,t);return u.add(i),{storeName:i,item:n,instance:r}})),l=this.db.transaction(ee([o],Array.from(u.values())),"readwrite"),f=l.objectStore(o),[4,this._get(f,e.id)];case 2:if(d=j.sent(),t&&d&&(h=A.a.getPredicates(t),p=h.predicates,y=h.type,!Object(x.D)(d,y,p)))throw g="Conditional update failed",te.error(g,{model:d,condition:p}),new Error(g);m=[],j.label=3;case 3:j.trys.push([3,11,12,17]),b=Z(c),j.label=4;case 4:return[4,b.next()];case 5:return(w=j.sent()).done?[3,10]:(S=w.value,_=S.storeName,E=S.item,O=S.instance,I=l.objectStore(_),T=E.id,[4,this._get(I,T)]);case 6:return C=j.sent(),P=void 0===C?v.h.INSERT:v.h.UPDATE,T!==e.id&&P!==v.h.INSERT?[3,9]:[4,I.index("byId").getKey(E.id)];case 7:return k=j.sent(),[4,I.put(E,k)];case 8:j.sent(),m.push([O,P]),j.label=9;case 9:return[3,4];case 10:return[3,17];case 11:return N=j.sent(),n={error:N},[3,17];case 12:return j.trys.push([12,,15,16]),w&&!w.done&&(r=b.return)?[4,r.call(b)]:[3,14];case 13:j.sent(),j.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 j.sent(),[2,m]}}))}))},e.prototype.load=function(e,t,n){var r,i,o,s,a,u,c,l,f,d;return J(this,void 0,void 0,(function(){var h,p,v,y,g,m,b,w,S,_,E,A,O,I,T,C,P,k,N,M,j=this;return $(this,(function(R){switch(R.label){case 0:if(h=this.schema.namespaces[e],p=h.relationships[t].relationTypes,v=p.map((function(t){var n=t.modelName;return j.getStorename(e,n)})),y=this.getModelConstructorByModelName(e,t),0===v.length)return[2,n.map((function(e){return j.modelInstanceCreator(y,e)}))];g=this.db.transaction(ee(v),"readonly"),R.label=1;case 1:R.trys.push([1,34,35,40]),m=Z(p),R.label=2;case 2:return[4,m.next()];case 3:if((b=R.sent()).done)return[3,33];switch(w=b.value,S=w.fieldName,_=w.modelName,E=w.targetName,A=this.getStorename(e,_),O=g.objectStore(A),I=this.getModelConstructorByModelName(e,_),w.relationType){case"HAS_ONE":return[3,4];case"BELONGS_TO":return[3,17];case"HAS_MANY":return[3,30]}return[3,31];case 4:R.trys.push([4,10,11,16]),r=Z(n),R.label=5;case 5:return[4,r.next()];case 6:return(i=R.sent()).done?[3,9]:(P=i.value,T=P[E]?E:S,P[T]?[4,this._get(O,P[T])]:[3,9]);case 7:k=R.sent(),P[S]=k&&this.modelInstanceCreator(I,k),R.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return C=R.sent(),c={error:C},[3,16];case 11:return R.trys.push([11,,14,15]),i&&!i.done&&(l=r.return)?[4,l.call(r)]:[3,13];case 12:R.sent(),R.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:R.trys.push([17,23,24,29]),o=Z(n),R.label=18;case 18:return[4,o.next()];case 19:return(s=R.sent()).done?[3,22]:(P=s.value)[E]?[4,this._get(O,P[E])]:[3,21];case 20:k=R.sent(),P[S]=k&&this.modelInstanceCreator(I,k),delete P[E],R.label=21;case 21:return[3,18];case 22:return[3,29];case 23:return N=R.sent(),f={error:N},[3,29];case 24:return R.trys.push([24,,27,28]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,26];case 25:R.sent(),R.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 Object(x.h)(w.relationType),[3,32];case 32:return[3,2];case 33:return[3,40];case 34:return M=R.sent(),a={error:M},[3,40];case 35:return R.trys.push([35,,38,39]),b&&!b.done&&(u=m.return)?[4,u.call(m)]:[3,37];case 36:R.sent(),R.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 j.modelInstanceCreator(y,e)}))]}}))}))},e.prototype.query=function(e,t,n){return J(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l=this;return $(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),o=t&&A.a.getPredicates(t),s=o&&this.idFromPredicate(o),a=n&&n.sort,u=n&&n.limit,[4,J(l,void 0,void 0,(function(){var e,t,i;return $(this,(function(c){switch(c.label){case 0:return s?[4,this.getById(r,s)]:[3,2];case 1:return[2,(e=c.sent())?[e]:[]];case 2:return o?[4,this.filterOnPredicate(r,o)]:[3,4];case 3:return t=c.sent(),[2,this.inMemoryPagination(t,n)];case 4:return a?[4,this.getAll(r)]:[3,6];case 5:return i=c.sent(),[2,this.inMemoryPagination(i,n)];case 6:return u?[2,this.enginePagination(r,n)]:[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 J(this,void 0,void 0,(function(){return $(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 J(this,void 0,void 0,(function(){return $(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 Object(v.v)(e)&&"id"===e.field&&"eq"===e.operator}));return n&&n.operand},e.prototype.filterOnPredicate=function(e,t){return J(this,void 0,void 0,(function(){var n,r,i;return $(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 Object(x.D)(e,r,n)})):i]}}))}))},e.prototype.inMemoryPagination=function(e,t){if(t&&e.length>1){if(t.sort){var n=O.a.getPredicates(t.sort);if(n.length){var r=Object(x.B)(n);e.sort(r)}}var i=t.page,o=void 0===i?0:i,s=t.limit,a=void 0===s?0:s,u=Math.max(0,o*a)||0,c=a>0?u+a:e.length;return e.slice(u,c)}return e},e.prototype.enginePagination=function(e,t){return J(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l;return $(this,(function(f){switch(f.label){case 0:return t?(r=t.page,i=void 0===r?0:r,o=t.limit,s=void 0===o?0:o,a=Math.max(0,i*s)||0,[4,this.db.transaction(e).objectStore(e).openCursor()]):[3,7];case 1:return(u=f.sent())&&a>0?[4,u.advance(a)]:[3,3];case 2:f.sent(),f.label=3;case 3:c=[],l="number"==typeof s&&s>0,f.label=4;case 4:return u&&u.value?(c.push(u.value),l&&c.length===s?[3,6]:[4,u.continue()]):[3,6];case 5:return u=f.sent(),[3,4];case 6:return n=c,[3,9];case 7:return[4,this.db.getAll(e)];case 8:n=f.sent(),f.label=9;case 9:return[2,n]}}))}))},e.prototype.queryOne=function(e,t){return void 0===t&&(t=v.j.FIRST),J(this,void 0,void 0,(function(){var n,r,i;return $(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===v.j.FIRST?"next":"prev")];case 2:return r=o.sent(),[2,(i=r?r.value:void 0)&&this.modelInstanceCreator(e,i)]}}))}))},e.prototype.delete=function(e,t){return J(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return $(this,(function(g){switch(g.label){case 0:return[4,this.checkPrivate()];case 1:return g.sent(),n=[],Object(x.u)(e)?(o=e,s=this.namespaceResolver(o),a=this.getStorenameForModel(o),[4,this.query(o,t)]):[3,9];case 2:return r=g.sent(),v=this.schema.namespaces[s].relationships[o.name].relationTypes,void 0===t?[3,5]:[4,this.deleteTraverse(v,r,o.name,s,n)];case 3:return g.sent(),[4,this.deleteItem(n)];case 4:return g.sent(),y=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[r,y]];case 5:return[4,this.deleteTraverse(v,r,o.name,s,n)];case 6:return g.sent(),[4,this.db.transaction([a],"readwrite").objectStore(a).clear()];case 7:return g.sent(),y=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[r,y]];case 8:return[3,17];case 9:return i=e,o=Object.getPrototypeOf(i).constructor,s=this.namespaceResolver(o),a=this.getStorenameForModel(o),t?(u=this.db.transaction([a],"readwrite"),c=u.objectStore(a),[4,this._get(c,i.id)]):[3,13];case 10:if(void 0===(l=g.sent()))return p="Model instance not found in storage",te.warn(p,{model:i}),[2,[[i],[]]];if(f=A.a.getPredicates(t),d=f.predicates,h=f.type,!Object(x.D)(l,h,d))throw p="Conditional update failed",te.error(p,{model:l,condition:d}),new Error(p);return[4,u.done];case 11:return g.sent(),v=this.schema.namespaces[s].relationships[o.name].relationTypes,[4,this.deleteTraverse(v,[i],o.name,s,n)];case 12:return g.sent(),[3,15];case 13:return v=this.schema.namespaces[s].relationships[o.name].relationTypes,[4,this.deleteTraverse(v,[i],o.name,s,n)];case 14:g.sent(),g.label=15;case 15:return[4,this.deleteItem(n)];case 16:return g.sent(),y=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[[i],y]];case 17:return[2]}}))}))},e.prototype.deleteItem=function(e){var t,n,r,i,o,s;return J(this,void 0,void 0,(function(){var a,u,c,l,f,d,h,p,v,y,g,m;return $(this,(function(b){switch(b.label){case 0:a=e.map((function(e){return e.storeName})),u=this.db.transaction(ee(a),"readwrite"),b.label=1;case 1:b.trys.push([1,22,23,28]),t=Z(e),b.label=2;case 2:return[4,t.next()];case 3:if((n=b.sent()).done)return[3,21];c=n.value,l=c.storeName,f=c.items,d=u.objectStore(l),b.label=4;case 4:b.trys.push([4,14,15,20]),h=Z(f),b.label=5;case 5:return[4,h.next()];case 6:return(p=b.sent()).done?[3,13]:(v=p.value)?(y=void 0,"object"!==Y(v)?[3,8]:[4,d.index("byId").getKey(v.id)]):[3,12];case 7:return y=b.sent(),[3,10];case 8:return[4,d.index("byId").getKey(v.toString())];case 9:y=b.sent(),b.label=10;case 10:return void 0===y?[3,12]:[4,d.delete(y)];case 11:b.sent(),b.label=12;case 12:return[3,5];case 13:return[3,20];case 14:return g=b.sent(),o={error:g},[3,20];case 15:return b.trys.push([15,,18,19]),p&&!p.done&&(s=h.return)?[4,s.call(h)]:[3,17];case 16:b.sent(),b.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 m=b.sent(),r={error:m},[3,28];case 23:return b.trys.push([23,,26,27]),n&&!n.done&&(i=t.return)?[4,i.call(t)]:[3,25];case 24:b.sent(),b.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,v,y;return J(this,void 0,void 0,(function(){var g,m,b,w,S,_,E,A,O,I,T,C,P,k,N=this;return $(this,(function(M){switch(M.label){case 0:M.trys.push([0,35,36,41]),o=Z(e),M.label=1;case 1:return[4,o.next()];case 2:if((s=M.sent()).done)return[3,34];switch(g=s.value,m=g.relationType,g.fieldName,b=g.modelName,w=g.targetName,S=this.getStorename(r,b),_=Object(x.i)(this.schema.namespaces[r].relationships[b].relationTypes,n)||Object(x.j)(this.schema.namespaces[r].relationships[b].indexes,g.associatedWith),m){case"HAS_ONE":return[3,3];case"HAS_MANY":return[3,17];case"BELONGS_TO":return[3,31]}return[3,32];case 3:M.trys.push([3,10,11,16]),a=Z(t),M.label=4;case 4:return[4,a.next()];case 5:return(u=M.sent()).done?[3,9]:(T=u.value,E=_||"byId",(A=w in T?T[w]:T.id)?[4,this.db.transaction(S,"readwrite").objectStore(S).index(E).get(A)]:[3,9]);case 6:return O=M.sent(),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,O?[O]:[],b,r,i)];case 7:M.sent(),M.label=8;case 8:return[3,4];case 9:return[3,16];case 10:return I=M.sent(),h={error:I},[3,16];case 11:return M.trys.push([11,,14,15]),u&&!u.done&&(p=a.return)?[4,p.call(a)]:[3,13];case 12:M.sent(),M.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:M.trys.push([17,24,25,30]),c=Z(t),M.label=18;case 18:return[4,c.next()];case 19:return(l=M.sent()).done?[3,23]:(T=l.value,[4,this.db.transaction(S,"readwrite").objectStore(S).index(_).getAll(T.id)]);case 20:return C=M.sent(),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,C,b,r,i)];case 21:M.sent(),M.label=22;case 22:return[3,18];case 23:return[3,30];case 24:return P=M.sent(),v={error:P},[3,30];case 25:return M.trys.push([25,,28,29]),l&&!l.done&&(y=c.return)?[4,y.call(c)]:[3,27];case 26:M.sent(),M.label=27;case 27:return[3,29];case 28:if(v)throw v.error;return[7];case 29:return[7];case 30:case 31:return[3,33];case 32:return Object(x.h)(m),[3,33];case 33:return[3,1];case 34:return[3,41];case 35:return k=M.sent(),f={error:k},[3,41];case 36:return M.trys.push([36,,39,40]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,38];case 37:M.sent(),M.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 N.modelInstanceCreator(N.getModelConstructorByModelName(r,n),e)}))}),[2]}}))}))},e.prototype.clear=function(){var e;return J(this,void 0,void 0,(function(){return $(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,K(this.dbName)];case 2:return t.sent(),this.db=void 0,this.initPromise=void 0,[2]}}))}))},e.prototype.batchSave=function(e,t){return J(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h;return $(this,(function(p){switch(p.label){case 0:return 0===t.length?[2,[]]:[4,this.checkPrivate()];case 1:p.sent(),n=[],r=this.getStorenameForModel(e),i=this.db.transaction(r,"readwrite"),o=i.store,s=function(t){var r,i,s,u,c;return $(this,(function(l){switch(l.label){case 0:return r=Object(x.C)(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:return u=l.sent(),s?[3,3]:(c=r.find((function(e){return e.instance.id===i})).instance,n.push([c,u?v.h.UPDATE:v.h.INSERT]),[4,o.put(c,u)]);case 2:return l.sent(),[3,5];case 3:return n.push([t,v.h.DELETE]),u?[4,o.delete(u)]:[3,5];case 4:l.sent(),l.label=5;case 5:return[2]}}))},a=this,p.label=2;case 2:p.trys.push([2,7,8,9]),u=Q(t),c=u.next(),p.label=3;case 3:return c.done?[3,6]:(l=c.value,[5,s(l)]);case 4:p.sent(),p.label=5;case 5:return c=u.next(),[3,3];case 6:return[3,9];case 7:return f=p.sent(),d={error:f},[3,9];case 8:try{c&&!c.done&&(h=u.return)&&h.call(u)}finally{if(d)throw d.error}return[7];case 9:return[4,i.done];case 10:return p.sent(),[2,n]}}))}))},e.prototype.createObjectStoreForModel=function(e,t,n,r){return J(this,void 0,void 0,(function(){var i;return $(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}()),re=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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},ie=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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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])}}},oe=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},se=function(){var e=this;this.db=new Map,this.getAllKeys=function(){return re(e,void 0,void 0,(function(){return ie(this,(function(e){return[2,Array.from(this.db.keys())]}))}))},this.multiGet=function(t){return re(e,void 0,void 0,(function(){var e=this;return ie(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 re(e,void 0,void 0,(function(){var e=this;return ie(this,(function(r){return t.forEach((function(t){return e.db.delete(t)})),"function"==typeof n&&n(),[2]}))}))},this.multiSet=function(t,n){return re(e,void 0,void 0,(function(){var e=this;return ie(this,(function(r){return t.forEach((function(t){var n=oe(t,2),r=n[0],i=n[1];e.setItem(r,i)})),"function"==typeof n&&n(),[2]}))}))},this.setItem=function(t,n){return re(e,void 0,void 0,(function(){return ie(this,(function(e){return[2,this.db.set(t,n)]}))}))},this.removeItem=function(t){return re(e,void 0,void 0,(function(){return ie(this,(function(e){return[2,this.db.delete(t)]}))}))},this.getItem=function(t){return re(e,void 0,void 0,(function(){return ie(this,(function(e){return[2,this.db.get(t)]}))}))}};var ae=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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},ue=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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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])}}},ce=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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},le=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},fe=new Map,de=function(){function e(){this._collectionInMemoryIndex=new Map,this.storage=new se}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 fe.has(e)||fe.set(e,Object(x.z)()),fe.get(e)},e.prototype.init=function(){return ae(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b;return ue(this,(function(w){switch(w.label){case 0:return this._collectionInMemoryIndex.clear(),[4,this.storage.getAllKeys()];case 1:e=w.sent(),t=[],w.label=2;case 2:w.trys.push([2,12,13,14]),n=ce(e),r=n.next(),w.label=3;case 3:return r.done?[3,11]:(i=r.value,o=le(i.split("::"),5),s=o[0],a=o[1],u=o[2],c=o[3],l=o[4],"@AmplifyDatastore"!==s?[3,10]:"Data"!==u?[3,9]:(f=void 0,void 0!==l?[3,7]:(d=c,h=this.getMonotonicFactory(a)(),p=this.getLegacyKeyForItem(a,d),v=this.getKeyForItem(a,d,h),[4,this.storage.getItem(p)])));case 4:return y=w.sent(),[4,this.storage.setItem(v,y)];case 5:return w.sent(),[4,this.storage.removeItem(p)];case 6:return w.sent(),f=h,[3,8];case 7:f=c,w.label=8;case 8:return this.getCollectionIndex(a).set(l,f),[3,10];case 9:"Collection"===u&&t.push(i),w.label=10;case 10:return r=n.next(),[3,3];case 11:return[3,14];case 12:return g=w.sent(),m={error:g},[3,14];case 13:try{r&&!r.done&&(b=n.return)&&b.call(n)}finally{if(m)throw m.error}return[7];case 14:return t.length>0?[4,this.storage.multiRemove(t)]:[3,16];case 15:w.sent(),w.label=16;case 16:return[2]}}))}))},e.prototype.save=function(e,t){return ae(this,void 0,void 0,(function(){var n,r;return ue(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 ae(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,y,g,m,b,w,S,_,E,A=this;return ue(this,(function(O){switch(O.label){case 0:if(0===t.length)return[2,[]];n=[],r=this.getCollectionIndex(e),i=new Set,o=new Set,s=[],a={};try{for(u=ce(t),c=u.next();!c.done;c=u.next())l=c.value,f=l.id,d=l._deleted,h=r.get(f)||this.getMonotonicFactory(e)(),b=this.getKeyForItem(e,f,h),s.push(b),a[b]={ulid:h,model:l},d?i.add(b):o.add(b)}catch(e){w={error:e}}finally{try{c&&!c.done&&(S=u.return)&&S.call(u)}finally{if(w)throw w.error}}return[4,this.storage.multiGet(s)];case 1:return p=O.sent(),y=p.filter((function(e){return!!le(e,2)[1]})).reduce((function(e,t){var n=le(t,1)[0];return e.add(n)}),new Set),[4,new Promise((function(e,t){if(0!==i.size){var n=Array.from(i);n.forEach((function(e){return r.delete(a[e].model.id)})),A.storage.multiRemove(n,(function(n){n&&n.length>0?t(n):e()}))}else e()}))];case 2:return O.sent(),[4,new Promise((function(e,t){if(0!==o.size){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)})),A.storage.multiSet(n,(function(n){n&&n.length>0?t(n):e()}))}else e()}))];case 3:O.sent();try{for(g=ce(s),m=g.next();!m.done;m=g.next())b=m.value,i.has(b)&&y.has(b)?n.push([a[b].model,v.h.DELETE]):o.has(b)&&n.push([a[b].model,y.has(b)?v.h.UPDATE:v.h.INSERT])}catch(e){_={error:e}}finally{try{m&&!m.done&&(E=g.return)&&E.call(g)}finally{if(_)throw _.error}}return[2,n]}}))}))},e.prototype.get=function(e,t){return ae(this,void 0,void 0,(function(){var n,r,i;return ue(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 i=o.sent(),[2,i&&JSON.parse(i)]}}))}))},e.prototype.getOne=function(e,t){return ae(this,void 0,void 0,(function(){var n,r,i,o,s,a,u;return ue(this,(function(c){switch(c.label){case 0:return n=this.getCollectionIndex(t),r=le(e===v.j.FIRST?function(){var e,t,r,i,o;try{for(var s=ce(n),a=s.next();!a.done;a=s.next()){i=(r=le(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(){var e,t,r,i,o;try{for(var s=ce(n),a=s.next();!a.done;a=s.next())i=(r=le(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),i=r[0],o=r[1],s=this.getKeyForItem(t,i,o),(u=s)?[4,this.storage.getItem(s)]:[3,2];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 ae(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b;return ue(this,(function(w){switch(w.label){case 0:n=this.getCollectionIndex(e),i=(r=t||{}).page,o=void 0===i?0:i,s=r.limit,a=void 0===s?0:s,u=Math.max(0,o*a)||0,c=a>0?u+a:void 0,l=[],f=0;try{for(d=ce(n),h=d.next();!h.done&&(p=le(h.value,2),v=p[0],y=p[1],++f<=u||(l.push(this.getKeyForItem(e,v,y)),f!==c));h=d.next());}catch(e){m={error:e}}finally{try{h&&!h.done&&(b=d.return)&&b.call(d)}finally{if(m)throw m.error}}return[4,this.storage.multiGet(l)];case 1:return g=w.sent(),[2,g.filter((function(e){return le(e,2)[1]})).map((function(e){var t=le(e,2)[1];return JSON.parse(t)}))]}}))}))},e.prototype.delete=function(e,t){return ae(this,void 0,void 0,(function(){var n,r;return ue(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 ae(this,void 0,void 0,(function(){var e,t;return ue(this,(function(n){switch(n.label){case 0:return[4,this.storage.getAllKeys()];case 1:return e=n.sent(),t=e.filter((function(e){return e.startsWith("@AmplifyDatastore")})),[4,this.storage.multiRemove(t)];case 2:return n.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"@AmplifyDatastore::"+e+"::Data"},e}();function he(e){return(he="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var pe,ve=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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},ye=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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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])}}},ge=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof me?me(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)}))}}},me=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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},be=new i.a("DataStore"),we=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 ve(this,void 0,void 0,(function(){var i,o=this;return ye(this,(function(s){switch(s.label){case 0:return this.initPromise?[3,1]:(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:return s.trys.push([4,7,,8]),this.db?[3,6]:(this.db=new de,[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 ve(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,y,g,m,b,w,S,_,E,O,I,T,C=this;return ye(this,(function(P){switch(P.label){case 0:return i=Object.getPrototypeOf(e).constructor,o=this.getStorenameForModel(i),s=Object(x.C)(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=C.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&&(f=A.a.getPredicates(t),d=f.predicates,h=f.type,!Object(x.D)(l,h,d)))throw p="Conditional update failed",be.error(p,{model:l,condition:d}),new Error(p);y=[],P.label=2;case 2:P.trys.push([2,9,10,15]),g=ge(c),P.label=3;case 3:return[4,g.next()];case 4:return(m=P.sent()).done?[3,8]:(b=m.value,w=b.storeName,S=b.item,_=b.instance,E=S.id,[4,this.db.get(E,w)]);case 5:return O=P.sent(),I=O?v.h.UPDATE:v.h.INSERT,E!==e.id&&I!==v.h.INSERT?[3,7]:[4,this.db.save(S,w)];case 6:P.sent(),y.push([_,I]),P.label=7;case 7:return[3,3];case 8:return[3,15];case 9:return T=P.sent(),n={error:T},[3,15];case 10:return P.trys.push([10,,13,14]),m&&!m.done&&(r=g.return)?[4,r.call(g)]:[3,12];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,y]}}))}))},e.prototype.load=function(e,t,n){var r,i,o,s,a,u,c,l,f,d;return ve(this,void 0,void 0,(function(){var h,p,v,y,g,m,b,w,S,_,E,A,O,I,T,C,P,k,N,M=this;return ye(this,(function(j){switch(j.label){case 0:if(h=this.schema.namespaces[e],p=h.relationships[t].relationTypes,v=p.map((function(t){var n=t.modelName;return M.getStorename(e,n)})),y=this.getModelConstructorByModelName(e,t),0===v.length)return[2,n.map((function(e){return M.modelInstanceCreator(y,e)}))];j.label=1;case 1:j.trys.push([1,34,35,40]),g=ge(p),j.label=2;case 2:return[4,g.next()];case 3:if((m=j.sent()).done)return[3,33];switch(b=m.value,w=b.fieldName,S=b.modelName,_=b.targetName,E=b.relationType,A=this.getStorename(e,S),O=this.getModelConstructorByModelName(e,S),E){case"HAS_ONE":return[3,4];case"BELONGS_TO":return[3,17];case"HAS_MANY":return[3,30]}return[3,31];case 4:j.trys.push([4,10,11,16]),r=ge(n),j.label=5;case 5:return[4,r.next()];case 6:return(i=j.sent()).done?[3,9]:(C=i.value,I=C[_]?_:w,C[I]?[4,this.db.get(C[I],A)]:[3,9]);case 7:P=j.sent(),C[w]=P&&this.modelInstanceCreator(O,P),j.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return T=j.sent(),c={error:T},[3,16];case 11:return j.trys.push([11,,14,15]),i&&!i.done&&(l=r.return)?[4,l.call(r)]:[3,13];case 12:j.sent(),j.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:j.trys.push([17,23,24,29]),o=ge(n),j.label=18;case 18:return[4,o.next()];case 19:return(s=j.sent()).done?[3,22]:(C=s.value)[_]?[4,this.db.get(C[_],A)]:[3,21];case 20:P=j.sent(),C[w]=P&&this.modelInstanceCreator(O,P),delete C[_],j.label=21;case 21:return[3,18];case 22:return[3,29];case 23:return k=j.sent(),f={error:k},[3,29];case 24:return j.trys.push([24,,27,28]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,26];case 25:j.sent(),j.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 Object(x.h)(E),[3,32];case 32:return[3,2];case 33:return[3,40];case 34:return N=j.sent(),a={error:N},[3,40];case 35:return j.trys.push([35,,38,39]),m&&!m.done&&(u=g.return)?[4,u.call(g)]:[3,37];case 36:j.sent(),j.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 M.modelInstanceCreator(y,e)}))]}}))}))},e.prototype.query=function(e,t,n){return ve(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l=this;return ye(this,(function(f){switch(f.label){case 0:return r=this.getStorenameForModel(e),i=this.namespaceResolver(e),o=t&&A.a.getPredicates(t),s=o&&this.idFromPredicate(o),a=n&&n.sort,u=n&&n.limit,[4,ve(l,void 0,void 0,(function(){var e,t,i;return ye(this,(function(c){switch(c.label){case 0:return s?[4,this.getById(r,s)]:[3,2];case 1:return[2,(e=c.sent())?[e]:[]];case 2:return o?[4,this.filterOnPredicate(r,o)]:[3,4];case 3:return t=c.sent(),[2,this.inMemoryPagination(t,n)];case 4:return a||u?[4,this.getAll(r)]:[3,6];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 ve(this,void 0,void 0,(function(){return ye(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 ve(this,void 0,void 0,(function(){return ye(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 Object(v.v)(e)&&"id"===e.field&&"eq"===e.operator}));return n&&n.operand},e.prototype.filterOnPredicate=function(e,t){return ve(this,void 0,void 0,(function(){var n,r,i;return ye(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 Object(x.D)(e,r,n)})):i]}}))}))},e.prototype.inMemoryPagination=function(e,t){if(t&&e.length>1){if(t.sort){var n=O.a.getPredicates(t.sort);if(n.length){var r=Object(x.B)(n);e.sort(r)}}var i=t.page,o=void 0===i?0:i,s=t.limit,a=void 0===s?0:s,u=Math.max(0,o*a)||0,c=a>0?u+a:e.length;return e.slice(u,c)}return e},e.prototype.queryOne=function(e,t){return void 0===t&&(t=v.j.FIRST),ve(this,void 0,void 0,(function(){var n,r;return ye(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 ve(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p;return ye(this,(function(v){switch(v.label){case 0:return n=[],Object(x.u)(e)?(o=e,s=this.namespaceResolver(o),[4,this.query(o,t)]):[3,8];case 1:return r=v.sent(),h=this.schema.namespaces[s].relationships[o.name].relationTypes,void 0===t?[3,4]:[4,this.deleteTraverse(h,r,o.name,s,n)];case 2:return v.sent(),[4,this.deleteItem(n)];case 3:return v.sent(),p=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[r,p]];case 4:return[4,this.deleteTraverse(h,r,o.name,s,n)];case 5:return v.sent(),[4,this.deleteItem(n)];case 6:return v.sent(),p=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[r,p]];case 7:return[3,15];case 8:return i=e,o=Object.getPrototypeOf(i).constructor,s=this.namespaceResolver(o),a=this.getStorenameForModel(o),t?[4,this.db.get(i.id,a)]:[3,11];case 9:if(void 0===(u=v.sent()))return d="Model instance not found in storage",be.warn(d,{model:i}),[2,[[i],[]]];if(c=A.a.getPredicates(t),l=c.predicates,f=c.type,!Object(x.D)(u,f,l))throw d="Conditional update failed",be.error(d,{model:u,condition:l}),new Error(d);return h=this.schema.namespaces[s].relationships[o.name].relationTypes,[4,this.deleteTraverse(h,[i],o.name,s,n)];case 10:return v.sent(),[3,13];case 11:return h=this.schema.namespaces[s].relationships[o.name].relationTypes,[4,this.deleteTraverse(h,[i],o.name,s,n)];case 12:v.sent(),v.label=13;case 13:return[4,this.deleteItem(n)];case 14:return v.sent(),p=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[[i],p]];case 15:return[2]}}))}))},e.prototype.deleteItem=function(e){var t,n,r,i,o,s;return ve(this,void 0,void 0,(function(){var a,u,c,l,f,d,h,p,v;return ye(this,(function(y){switch(y.label){case 0:y.trys.push([0,17,18,23]),t=ge(e),y.label=1;case 1:return[4,t.next()];case 2:if((n=y.sent()).done)return[3,16];a=n.value,u=a.storeName,c=a.items,y.label=3;case 3:y.trys.push([3,9,10,15]),l=ge(c),y.label=4;case 4:return[4,l.next()];case 5:return(f=y.sent()).done?[3,8]:(d=f.value)?"object"!==he(d)?[3,7]:(h=d.id,[4,this.db.delete(h,u)]):[3,7];case 6:y.sent(),y.label=7;case 7:return[3,4];case 8:return[3,15];case 9:return p=y.sent(),o={error:p},[3,15];case 10:return y.trys.push([10,,13,14]),f&&!f.done&&(s=l.return)?[4,s.call(l)]:[3,12];case 11:y.sent(),y.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 v=y.sent(),r={error:v},[3,23];case 18:return y.trys.push([18,,21,22]),n&&!n.done&&(i=t.return)?[4,i.call(t)]:[3,20];case 19:y.sent(),y.label=20;case 20:return[3,22];case 21:if(r)throw r.error;return[7];case 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,v,y;return ve(this,void 0,void 0,(function(){var g,m,b,w,S,_,E,A,O,I,T,C,P,k,N,M=this;return ye(this,(function(j){switch(j.label){case 0:j.trys.push([0,35,36,41]),o=ge(e),j.label=1;case 1:return[4,o.next()];case 2:if((s=j.sent()).done)return[3,34];switch(g=s.value,m=g.relationType,b=g.modelName,w=g.targetName,S=this.getStorename(r,b),_=Object(x.i)(this.schema.namespaces[r].relationships[b].relationTypes,n)||Object(x.j)(this.schema.namespaces[r].relationships[b].indexes,g.associatedWith),m){case"HAS_ONE":return[3,3];case"HAS_MANY":return[3,17];case"BELONGS_TO":return[3,31]}return[3,32];case 3:j.trys.push([3,10,11,16]),a=ge(t),j.label=4;case 4:return[4,a.next()];case 5:return(u=j.sent()).done?[3,9]:(T=u.value,E=_||"byId",(A=w in T?T[w]:T.id)?[4,this.db.getAll(S)]:[3,9]);case 6:return C=j.sent(),O=C.filter((function(e){return e[E]===A})),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,O,b,r,i)];case 7:j.sent(),j.label=8;case 8:return[3,4];case 9:return[3,16];case 10:return I=j.sent(),h={error:I},[3,16];case 11:return j.trys.push([11,,14,15]),u&&!u.done&&(p=a.return)?[4,p.call(a)]:[3,13];case 12:j.sent(),j.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:j.trys.push([17,24,25,30]),c=ge(t),j.label=18;case 18:return[4,c.next()];case 19:return(l=j.sent()).done?[3,23]:(T=l.value,[4,this.db.getAll(S)]);case 20:return C=j.sent(),P=C.filter((function(e){return e[_]===T.id})),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,P,b,r,i)];case 21:j.sent(),j.label=22;case 22:return[3,18];case 23:return[3,30];case 24:return k=j.sent(),v={error:k},[3,30];case 25:return j.trys.push([25,,28,29]),l&&!l.done&&(y=c.return)?[4,y.call(c)]:[3,27];case 26:j.sent(),j.label=27;case 27:return[3,29];case 28:if(v)throw v.error;return[7];case 29:return[7];case 30:case 31:return[3,33];case 32:return Object(x.h)(m),[3,33];case 33:return[3,1];case 34:return[3,41];case 35:return N=j.sent(),f={error:N},[3,41];case 36:return j.trys.push([36,,39,40]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,38];case 37:j.sent(),j.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 M.modelInstanceCreator(M.getModelConstructorByModelName(r,n),e)}))}),[2]}}))}))},e.prototype.clear=function(){return ve(this,void 0,void 0,(function(){return ye(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 ve(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d;return ye(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=Object(x.C)(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(u=me(t),c=u.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}()),Se=function(){return Object(o.b)().isBrowser&&window.indexedDB||Object(o.c)()&&self.indexedDB?ne:we},_e=function(){return(_e=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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Ae=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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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])}}},Oe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},Ie=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},Te=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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ce=new i.a("DataStore"),xe=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||Se(),this.pushStream=new C.a}return e.getNamespace=function(){return{name:x.c,relationships:{},enums:{},models:{},nonModels:{}}},e.prototype.init=function(){return Ee(this,void 0,void 0,(function(){var e,t;return Ae(this,(function(n){switch(n.label){case 0:return void 0===this.initialized?[3,2]:[4,this.initialized];case 1:return n.sent(),[2];case 2:return Ce.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];case 3:return n.sent(),[2]}}))}))},e.prototype.save=function(e,t,n,r){return Ee(this,void 0,void 0,(function(){var i,o=this;return Ae(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=Ie(s,2),c=u[0],l=u[1],f=!!n;if(l===v.h.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:A.a.getPredicates(t,!1),savedElement:c})})),[2,i]}}))}))},e.prototype.delete=function(e,t,n){return Ee(this,void 0,void 0,(function(){var r,i,o,s,a=this;return Ae(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 s=Ie.apply(void 0,[u.sent(),2]),i=s[0],r=s[1],o=new Set(i.map((function(e){return e.id}))),Object(x.u)(e)||Array.isArray(r)||(r=[r]),r.forEach((function(r){var i,s=Object.getPrototypeOf(r).constructor;Object(x.u)(e)||(i=o.has(r.id)?A.a.getPredicates(t,!1):void 0),a.pushStream.next({model:s,opType:v.h.DELETE,element:r,mutator:n,condition:i})})),[2,[i,r]]}}))}))},e.prototype.query=function(e,t,n){return Ee(this,void 0,void 0,(function(){return Ae(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=v.j.FIRST),Ee(this,void 0,void 0,(function(){return Ae(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=!e,i=A.a.getPredicates(t,!1)||{},o=i.predicates,s=i.type,a=!!o,u=this.pushStream.observable.filter((function(e){var t=e.mutator;return!n||t!==n})).map((function(e){e.mutator;return Oe(e,["mutator"])}));return r||(u=u.filter((function(t){var n=t.model,r=t.element;return e===n&&(!a||Object(x.D)(r,s,o))}))),u},e.prototype.clear=function(e){return void 0===e&&(e=!0),Ee(this,void 0,void 0,(function(){return Ae(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 Ee(this,void 0,void 0,(function(){var r,i=this;return Ae(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=Ie(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){var r,i;if(!(n&&n.length))return null;var o=Ie(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,y=h.compositeKeys,g=void 0===y?[]:y;if(c.forEach((function(e){var n,r,i,o,s,c=Object(v.x)(null===(s=d[e])||void 0===s?void 0:s.association)||e;if(!Object(x.E)(a[c],t[c])){u[c]=void 0===t[c]?null:t[c];try{for(var l=Te(g),f=l.next();!f.done;f=l.next()){var h=f.value;if(h.has(c))try{for(var p=(i=void 0,Te(h)),y=p.next();!y.done;y=p.next()){var m=y.value;u[m]=t[m]}}catch(e){i={error:e}}finally{try{y&&!y.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 m=Te(p),b=m.next();!b.done;b=m.next()){var w=b.value;u[w]=t[w]}}catch(e){r={error:e}}finally{try{b&&!b.done&&(i=m.return)&&i.call(m)}finally{if(r)throw r.error}}if(0===Object.keys(u).length)return null;var S=t.id,_=t._version,E=t._lastChangedAt,A=t._deleted;return _e(_e({},u),{id:S,_version:_,_lastChangedAt:E,_deleted:A})},e}(),Pe=function(){function e(e,t,n,r,i,o){this.mutex=new I,this.storage=new xe(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 Ee(this,void 0,void 0,(function(){return Ae(this,(function(i){return[2,this.runExclusive((function(i){return i.save(e,t,n,r)}))]}))}))},e.prototype.delete=function(e,t,n){return Ee(this,void 0,void 0,(function(){return Ae(this,(function(r){return[2,this.runExclusive((function(r){if(Object(x.u)(e)){var i=e;return r.delete(i,t,n)}var o=e;return r.delete(o,t,n)}))]}))}))},e.prototype.query=function(e,t,n){return Ee(this,void 0,void 0,(function(){return Ae(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=v.j.FIRST),Ee(this,void 0,void 0,(function(){return Ae(this,(function(n){return[2,this.runExclusive((function(n){return n.queryOne(e,t)}))]}))}))},e.getNamespace=function(){return xe.getNamespace()},e.prototype.observe=function(e,t,n){return this.storage.observe(e,t,n)},e.prototype.clear=function(){return Ee(this,void 0,void 0,(function(){return Ae(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 Ee(this,void 0,void 0,(function(){return Ae(this,(function(e){return[2,this.storage.init()]}))}))},e}(),ke=n(14),Ne=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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Me=(new(function(){function e(){}return e.prototype.networkMonitor=function(t){if(Object(o.b)().isNode)return d.a.from([{online:!0}]);var n=Object(o.c)()?self:window;return new d.a((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 o=Ne(e._observers),s=o.next();!s.done;s=o.next()){i(s.value)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},e._observers=[],e}())).networkMonitor(),je=function(){return(je=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)},Re=(new i.a("DataStore"),function(){function e(){this.connectionStatus={online:!1}}return e.prototype.status=function(){var e=this;if(this.observer)throw new Error("Subscriber already exists");return new d.a((function(t){return e.observer=t,e.subscription=Me.subscribe((function(n){var r=n.online;e.connectionStatus.online=r;var i=je({},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=je({},e.connectionStatus);e.observer.next(t)}),5e3))},e}()),De=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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Ue=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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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])}}},Fe=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},Le=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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Be=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Fe(arguments[t]));return e},qe=function(){function e(e,t){this.outbox=e,this.ownSymbol=t}return e.prototype.merge=function(e,t){return De(this,void 0,void 0,(function(){var n,r,i,o,s;return Ue(this,(function(a){switch(a.label){case 0:return[4,this.outbox.getForModel(e,t)];case 1:return r=a.sent(),i=t._deleted,0!==r.length?[3,5]:i?(n=v.h.DELETE,[4,e.delete(t,void 0,this.ownSymbol)]):[3,3];case 2:return a.sent(),[3,5];case 3:return[4,e.save(t,void 0,this.ownSymbol)];case 4:o=Fe.apply(void 0,[a.sent(),1]),s=Fe(o[0],2),n=s[1],a.label=5;case 5:return[2,n]}}))}))},e.prototype.mergePage=function(e,t,n){return De(this,void 0,void 0,(function(){var r,i,o,s,a,u,c;return Ue(this,(function(l){switch(l.label){case 0:r=new Map;try{for(i=Le(n),o=i.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=Be(r.values()),[4,e.batchSave(t,a,this.ownSymbol)];case 1:return[2,l.sent()]}}))}))},e}(),ze=n(4),Ke=function(){return(Ke=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)},He=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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Ve=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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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])}}},Ge=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},We=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},Ye=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 He(this,void 0,void 0,(function(){var n=this;return Ve(this,(function(r){return e.runExclusive((function(e){return He(n,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f=this;return Ve(this,(function(d){switch(d.label){case 0:return n=this.schema.namespaces[x.d].models.MutationEvent,r=A.a.createFromExisting(n,(function(e){return e.modelId("eq",t.modelId).id("ne",f.inProgressMutationEventId)})),[4,e.query(this.MutationEvent,r)];case 1:return i=We.apply(void 0,[d.sent(),1]),void 0!==(o=i[0])?[3,3]:[4,e.save(t,void 0,this.ownSymbol)];case 2:return d.sent(),[2];case 3:return s=t.operation,o.operation!==ze.a.CREATE?[3,8]:s!==ze.a.DELETE?[3,5]:[4,e.delete(this.MutationEvent,r)];case 4:return d.sent(),[3,7];case 5:return a=this.mergeUserFields(o,t),[4,e.save(this.MutationEvent.copyOf(o,(function(e){e.data=a.data})),void 0,this.ownSymbol)];case 6:d.sent(),d.label=7;case 7:return[3,12];case 8:return u=t.condition,c=JSON.parse(u),l=void 0,0!==Object.keys(c).length?[3,10]:(l=this.mergeUserFields(o,t),[4,e.delete(this.MutationEvent,r)]);case 9:d.sent(),d.label=10;case 10:return l=l||t,[4,e.save(l,void 0,this.ownSymbol)];case 11:d.sent(),d.label=12;case 12:return[2]}}))}))})),[2]}))}))},e.prototype.dequeue=function(e,t,n){return He(this,void 0,void 0,(function(){var r;return Ve(this,(function(i){switch(i.label){case 0:return[4,this.peek(e)];case 1:return r=i.sent(),t?[4,this.syncOutboxVersionsOnDequeue(e,t,r,n)]:[3,3];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 He(this,void 0,void 0,(function(){var t;return Ve(this,(function(n){switch(n.label){case 0:return[4,e.queryOne(this.MutationEvent,v.j.FIRST)];case 1:return t=n.sent(),this.inProgressMutationEventId=t?t.id:void 0,[2,t]}}))}))},e.prototype.getForModel=function(e,t){return He(this,void 0,void 0,(function(){var n;return Ve(this,(function(r){switch(r.label){case 0:return n=this.schema.namespaces[x.d].models.MutationEvent,[4,e.query(this.MutationEvent,A.a.createFromExisting(n,(function(e){return e.modelId("eq",t.id)})))];case 1:return[2,r.sent()]}}))}))},e.prototype.getModelIds=function(e){return He(this,void 0,void 0,(function(){var t,n;return Ve(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 He(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,v=this;return Ve(this,(function(y){switch(y.label){case 0:return n.operation!==r?[2]:(i=t._version,o=t._lastChangedAt,t._deleted,s=Ge(t,["_version","_lastChangedAt","_deleted"]),a=this.removeTimestampFields(n.model,s),(u=JSON.parse(n.data))?(u._version,u._lastChangedAt,u._deleted,c=Ge(u,["_version","_lastChangedAt","_deleted"]),l=this.removeTimestampFields(n.model,c),Object(x.E)(a,l,!0)?(f=this.schema.namespaces[x.d].models.MutationEvent,d=A.a.createFromExisting(f,(function(e){return e.modelId("eq",t.id).id("ne",v.inProgressMutationEventId)})),[4,e.query(this.MutationEvent,d)]):[2]):[2]);case 1:return(h=y.sent()).length?(p=h.map((function(e){var t=JSON.parse(e.data),n=Ke(Ke({},t),{_version:i,_lastChangedAt:o});return v.MutationEvent.copyOf(e,(function(e){e.data=JSON.stringify(n)}))})),[4,e.delete(this.MutationEvent,d)]):[2];case 2:return y.sent(),[4,Promise.all(p.map((function(t){return He(v,void 0,void 0,(function(){return Ve(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=Ge(n,["_version","id","_lastChangedAt","_deleted"]),u=JSON.parse(t.data),c=(u.id,u._version,u._lastChangedAt,u._deleted,Ge(u,["id","_version","_lastChangedAt","_deleted"])),l=JSON.stringify(Ke(Ke({id:i,_version:r,_lastChangedAt:o,_deleted:s},a),c));return this.modelInstanceCreator(this.MutationEvent,Ke(Ke({},t),{data:l}))},e.prototype.removeTimestampFields=function(e,t){var n,r,i="createdAt",o="updatedAt",s=null===(n=this.schema.namespaces[x.e].models[e].attributes)||void 0===n?void 0:n.find((function(e){return"model"===e.type})),a=null===(r=null==s?void 0:s.properties)||void 0===r?void 0:r.timestamps;return a&&(i=a.createdAt,o=a.updatedAt),delete t[i],delete t[o],t},e}(),Je=n(152),$e=n(23),Ze=function(){return(Ze=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)},Qe=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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Xe=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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},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},nt=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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},rt=new i.a("DataStore"),it=function(){function e(e,t,n,i,o,s,a,u,c,l,f){void 0===a&&(a={}),this.schema=e,this.storage=t,this.userClasses=n,this.outbox=i,this.modelInstanceCreator=o,this.MutationEvent=s,this.amplifyConfig=a,this.authModeStrategy=u,this.errorHandler=c,this.conflictHandler=l,this.amplifyContext=f,this.typeQuery=new WeakMap,this.processing=!1,this.amplifyContext.API=this.amplifyContext.API||r.a,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})).forEach((function(n){var r=tt(Object(ze.b)(t,n,"CREATE"),1)[0],i=tt(Object(ze.b)(t,n,"UPDATE"),1)[0],o=tt(Object(ze.b)(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 d.a((function(t){return e.observer=t,e.resume(),function(){e.pause()}}))},e.prototype.resume=function(){return Qe(this,void 0,void 0,(function(){var e,t,n,r,i,o=this;return Xe(this,(function(s){switch(s.label){case 0:if(this.processing||!this.isReady())return[2];this.processing=!0,t=x.e,n=function(){var n,i,s,a,u,c,l,f,d,h,p,v,y,g,m,b;return Xe(this,(function(w){switch(w.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,w.label=1;case 1:return w.trys.push([1,4,,5]),[4,Object(ze.h)({authModeStrategy:r.authModeStrategy,defaultAuthMode:r.amplifyConfig.aws_appsync_authenticationType,modelName:n,schema:r.schema})];case 2:return d=w.sent(),h=d[i.toUpperCase()],p=0,[4,(v=function(){return Qe(o,void 0,void 0,(function(){var r,o;return Xe(this,(function(c){switch(c.label){case 0:return c.trys.push([0,2,,4]),rt.debug("Attempting mutation with authMode: "+h[p]),[4,this.jitteredRetry(t,n,i,s,a,u,this.MutationEvent,e,h[p])];case 1:return r=c.sent(),rt.debug("Mutation sent successfully with authMode: "+h[p]),[2,r];case 2:if(o=c.sent(),++p>=h.length)throw rt.debug("Mutation failed with authMode: "+h[p-1]),o;return rt.debug("Mutation failed with authMode: "+h[p-1]+". Retrying with authMode: "+h[p]),[4,v()];case 3:return[2,c.sent()];case 4:return[2]}}))}))})()];case 3:return b=tt.apply(void 0,[w.sent(),3]),c=b[0],l=b[1],f=b[2],[3,5];case 4:return"Offline"===(y=w.sent()).message||"RetryMutation"===y.message?[2,"continue"]:[3,5];case 5:return void 0!==c?[3,7]:(rt.debug("done retrying"),[4,r.storage.runExclusive((function(e){return Qe(o,void 0,void 0,(function(){return Xe(this,(function(t){switch(t.label){case 0:return[4,this.outbox.dequeue(e)];case 1:return t.sent(),[2]}}))}))}))]);case 6:return w.sent(),[2,"continue"];case 7:return g=c.data[l],m=!1,[4,r.storage.runExclusive((function(e){return Qe(o,void 0,void 0,(function(){return Xe(this,(function(t){switch(t.label){case 0:return[4,this.outbox.dequeue(e,g,i)];case 1:return t.sent(),[4,this.outbox.peek(e)];case 2:return m=void 0!==t.sent(),[2]}}))}))}))];case 8:return w.sent(),r.observer.next({operation:i,modelDefinition:f,model:g,hasMore:m}),[2]}}))},r=this,s.label=1;case 1:return(i=this.processing)?[4,this.outbox.peek(this.storage)]:[3,3];case 2:i=void 0!==(e=s.sent()),s.label=3;case 3:return i?[5,n()]:[3,5];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 Qe(this,void 0,void 0,(function(){var c=this;return Xe(this,(function(l){switch(l.label){case 0:return[4,Object(Je.d)((function(t,n,r,i,o,s,a){return Qe(c,void 0,void 0,(function(){var c,l,f,d,h,p,y,g,m,b,w,S,_,E,A,O,I,T,C,P,k,N,M,j,R,D,U;return Xe(this,(function(F){switch(F.label){case 0:return c=tt(this.createQueryVariables(e,t,n,r,i),5),l=c[0],f=c[1],d=c[2],h=c[3],p=c[4],[4,Object(ze.i)(u,this.amplifyConfig)];case 1:y=F.sent(),g={query:l,variables:f,authMode:u,authToken:y,userAgentSuffix:x.f},m=0,b=this.opTypeFromTransformerOperation(n),F.label=2;case 2:return F.trys.push([2,4,,20]),[4,this.amplifyContext.API.graphql(g)];case 3:return[2,[F.sent(),h,p]];case 4:if(!((w=F.sent()).errors&&w.errors.length>0))return[3,18];if(S=tt(w.errors,1),_=S[0],E=_.originalError,A=(void 0===E?{}:E).code,O=void 0===A?null:A,"Unauthorized"===_.errorType)throw new Je.a("Unauthorized");if("Network Error"===_.message||"ECONNABORTED"===O){if(!this.processing)throw new Je.a("Offline");throw new Error("Network Error")}return"ConflictUnhandled"!==_.errorType?[3,13]:(m++,I=void 0,m>10?(I=v.b,[3,8]):[3,5]);case 5:return F.trys.push([5,7,,8]),[4,this.conflictHandler({modelConstructor:o,localModel:this.modelInstanceCreator(o,f.input),remoteModel:this.modelInstanceCreator(o,_.data),operation:b,attempts:m})];case 6:return I=F.sent(),[3,8];case 7:return T=F.sent(),rt.warn("conflict trycatch",T),[3,20];case 8:return I!==v.b?[3,11]:(C=tt(Object(ze.b)(this.schema.namespaces[e],p,"GET"),1),P=tt(C[0],3),k=P[1],N=P[2],[4,Object(ze.i)(u,this.amplifyConfig)]);case 9:return M=F.sent(),[4,this.amplifyContext.API.graphql({query:N,variables:{id:f.input.id},authMode:u,authToken:M,userAgentSuffix:x.f})];case 10:return[2,[F.sent(),k,p]];case 11:return j=this.schema.namespaces[e],R=Object(ze.d)(j.relationships,p,b,o,I,d,s,this.modelInstanceCreator,a.id),[4,this.storage.save(R)];case 12:throw F.sent(),new Je.a("RetryMutation");case 13:return F.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:Object($e.a)(_),errorInfo:_.errorInfo,process:v.i.mutate,cause:_,remoteModel:_.data?this.modelInstanceCreator(o,_.data):null})];case 14:return F.sent(),[3,17];case 15:return D=F.sent(),rt.warn("Mutation error handler failed with:",D),[3,17];case 16:return[2,_.data?[{data:(U={},U[h]=_.data,U)},h,p]:[]];case 17:return[3,19];case 18:throw new Je.a(w);case 19:return[3,20];case 20:if(g)return[3,2];F.label=21;case 21:return[2]}}))}))}),[t,n,r,i,o,s,a],st)];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],u=this.schema.namespaces[e].keys[t].primaryKey,c=this.typeQuery.get(a),l=tt(c.find((function(e){return tt(e,1)[0]===n})),3),f=l[1],d=l[2],h=JSON.parse(r),p=h._version,y=et(h,["_version"]),g={};if(u&&u.length)try{for(var m=nt(u),b=m.next();!b.done;b=m.next()){var w=b.value;g[w]=y[w]}}catch(e){o={error:e}}finally{try{b&&!b.done&&(s=m.return)&&s.call(m)}finally{if(o)throw o.error}}else g.id=y.id;var S=n===ze.a.DELETE?g:Object.values(a.fields).filter((function(e){var t=e.name,r=e.type,i=e.association;return Object(v.s)(r)?!(!Object(v.x)(i)||"BELONGS_TO"!==i.connectionType):n!==ze.a.UPDATE||y.hasOwnProperty(t)})).map((function(e){var t=e.name,n=e.type,r=e.association,i=t,o=y[t];return Object(v.s)(n)&&Object(v.x)(r)&&(i=r.targetName,o=y[i]),[i,o]})).reduce((function(e,t){var n=tt(t,2),r=n[0],i=n[1];return e[r]=i,e}),{}),_=Ze(Ze({},S),{_version:p}),E=JSON.parse(i);return[d,Ze({input:_},n===ze.a.CREATE?{}:{condition:Object.keys(E).length>0?E:null}),E,f,a]},e.prototype.opTypeFromTransformerOperation=function(e){switch(e){case ze.a.CREATE:return v.h.INSERT;case ze.a.DELETE:return v.h.DELETE;case ze.a.UPDATE:return v.h.UPDATE;case ze.a.GET:break;default:Object(x.h)(e)}},e.prototype.pause=function(){this.processing=!1},e}(),ot=Object(Je.b)(3e5),st=function(e,t,n){var r=ot(e);return!1===r&&"Network Error"===(null==n?void 0:n.message)?3e5:r},at=n(41),ut=function(){return(ut=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)},ct=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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},lt=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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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])}}},ft=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},dt=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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ht={items:[],nextToken:null,startedAt:null},pt=new i.a("DataStore"),vt=function(){function e(e,t,n,i,o,s){void 0===n&&(n={}),this.schema=e,this.syncPredicates=t,this.amplifyConfig=n,this.authModeStrategy=i,this.errorHandler=o,this.amplifyContext=s,this.typeQuery=new WeakMap,s.API=s.API||r.a,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})).forEach((function(n){var r=ft(Object(ze.b)(t,n,"LIST"),1),i=ft(r[0]).slice(1);e.typeQuery.set(n,i)}))}))},e.prototype.graphqlFilterFromPredicate=function(e){if(!this.syncPredicates)return null;var t=A.a.getPredicates(this.syncPredicates.get(e),!1);return t?Object(ze.l)(t):null},e.prototype.retrievePage=function(e,t,n,r,i){return void 0===r&&(r=null),ct(this,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h,p,v,y,g,m=this;return lt(this,(function(b){switch(b.label){case 0:return o=ft(this.typeQuery.get(e),2),s=o[0],a=o[1],u={limit:r,nextToken:n,lastSync:t,filter:i},[4,Object(ze.h)({authModeStrategy:this.authModeStrategy,defaultAuthMode:this.amplifyConfig.aws_appsync_authenticationType,modelName:e.name,schema:this.schema})];case 1:return c=b.sent(),l=c.READ,f=0,[4,(d=function(){return ct(m,void 0,void 0,(function(){var t,n,r,i;return lt(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,4]),pt.debug("Attempting sync with authMode: "+l[f]),[4,this.jitteredRetry({query:a,variables:u,opName:s,modelDefinition:e,authMode:l[f]})];case 1:return t=o.sent(),pt.debug("Sync successful with authMode: "+l[f]),[2,t];case 2:if(n=o.sent(),++f>=l.length){if(r=l[f-1],pt.debug("Sync failed with authMode: "+r,n),Object(ze.f)(n)||Object(ze.g)(n))return pt.warn("User is unauthorized to query "+s+" with auth mode "+r+". No data could be returned."),[2,{data:(i={},i[s]=ht,i)}];throw n}return pt.debug("Sync failed with authMode: "+l[f-1]+". Retrying with authMode: "+l[f]),[4,d()];case 3:return[2,o.sent()];case 4:return[2]}}))}))})()];case 2:return h=b.sent().data,p=h[s],v=p.items,y=p.nextToken,g=p.startedAt,[2,{nextToken:y,startedAt:g,items:v}]}}))}))},e.prototype.partialDataFeatureFlagEnabled=function(){try{var e=sessionStorage.getItem("datastorePartialData");return Boolean(e)}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 ct(this,void 0,void 0,(function(){var e=this;return lt(this,(function(a){switch(a.label){case 0:return[4,Object(Je.c)((function(t,n){return ct(e,void 0,void 0,(function(){var e,a,u,c,l,f=this;return lt(this,(function(d){switch(d.label){case 0:return d.trys.push([0,3,,8]),[4,Object(ze.i)(o,this.amplifyConfig)];case 1:return e=d.sent(),[4,this.amplifyContext.API.graphql({query:t,variables:n,authMode:o,authToken:e,userAgentSuffix:x.f})];case 2:return[2,d.sent()];case 3:if(a=d.sent(),u=Object(ze.f)(a)||Object(ze.g)(a))throw new Je.a(u);return c=Boolean(a&&a.data&&a.data[r]&&a.data[r].items),this.partialDataFeatureFlagEnabled()?c?((l=a).data[r].items=l.data[r].items.filter((function(e){return null!==e})),a.errors?[4,Promise.all(a.errors.map((function(e){return ct(f,void 0,void 0,(function(){var t;return lt(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:Object($e.c)(e),process:v.i.sync,remoteModel:null,cause:e})];case 1:return n.sent(),[3,3];case 2:return t=n.sent(),pt.error("Sync error handler failed with:",t),[3,3];case 3:return[2]}}))}))})))]:[3,5]):[3,6]:[3,7];case 4:d.sent(),s.a.dispatch("datastore",{event:"syncQueriesPartialSyncError",data:{errors:a.errors,modelName:i.name}}),d.label=5;case 5:return[2,l];case 6:throw a;case 7:if(a&&a.errors&&a.errors.some((function(e){return"Unauthorized"===e.errorType})))return l=a,c?l.data[r].items=l.data[r].items.filter((function(e){return null!==e})):l.data[r]=ut(ut({},ht),l.data[r]),pt.warn("queryError","User is unauthorized to query "+r+", some items could not be returned."),[2,l];throw a;case 8:return[2]}}))}))}),[t,n])];case 1:return[2,a.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 d.a((function(r){var a=Object.values(t.schema.namespaces).reduce((function(t,n){var r,i;try{for(var o=dt(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),u=Array.from(a.entries()).filter((function(e){return ft(e,1)[0].syncable})).map((function(e){var a=ft(e,2),u=a[0],c=ft(a[1],2),l=c[0],f=c[1];return ct(t,void 0,void 0,(function(){var e,t,a,c,d,h,p,v,y,g=this;return lt(this,(function(m){switch(m.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),v=p.map((function(e){return s.get(l+"_"+e)})),y=new Promise((function(s){return ct(g,void 0,void 0,(function(){var p,y;return lt(this,(function(g){switch(g.label){case 0:return[4,Promise.all(v)];case 1:g.sent(),g.label=2;case 2:return n?(p=Math.min(i-d,o),[4,this.retrievePage(u,f,t,p,h)]):[2];case 3:y=g.sent(),c=y.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}),g.label=4;case 4:if(!e)return[3,2];g.label=5;case 5:return s(),[2]}}))}))})),s.set(l+"_"+u.name,y),[4,y];case 1:return m.sent(),[2]}}))}))}));return Promise.all(u).then((function(){r.complete()})),function(){n=!1}}))},e}(),yt=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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},gt=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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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])}}},mt=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},bt=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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},wt=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(mt(arguments[t]));return e},St=Object(o.b)().isNode,_t=new i.a("DataStore"),Et=Symbol("sync");!function(e){e.SYNC_ENGINE_STORAGE_SUBSCRIBED="storageSubscribed",e.SYNC_ENGINE_SUBSCRIPTIONS_ESTABLISHED="subscriptionsEstablished",e.SYNC_ENGINE_SYNC_QUERIES_STARTED="syncQueriesStarted",e.SYNC_ENGINE_SYNC_QUERIES_READY="syncQueriesReady",e.SYNC_ENGINE_MODEL_SYNCED="modelSynced",e.SYNC_ENGINE_OUTBOX_MUTATION_ENQUEUED="outboxMutationEnqueued",e.SYNC_ENGINE_OUTBOX_MUTATION_PROCESSED="outboxMutationProcessed",e.SYNC_ENGINE_OUTBOX_STATUS="outboxStatus",e.SYNC_ENGINE_NETWORK_STATUS="networkStatus",e.SYNC_ENGINE_READY="ready"}(pe||(pe={}));var At=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 Ye(this.schema,d,o,Et),this.modelMerger=new qe(this.outbox,Et),this.syncQueriesProcessor=new vt(this.schema,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,a,this.amplifyContext),this.subscriptionsProcessor=new at.b(this.schema,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,a,this.amplifyContext),this.mutationsProcessor=new it(this.schema,this.storage,this.userModelClasses,this.outbox,this.modelInstanceCreator,d,this.amplifyConfig,this.authModeStrategy,a,s,this.amplifyContext),this.datastoreConnectivity=new Re}return e.prototype.getModelSyncedStatus=function(e){return this.modelSyncedStatus.get(e)},e.prototype.start=function(e){var t=this;return new d.a((function(n){_t.log("starting sync engine...");var r=[];return yt(t,void 0,void 0,(function(){var t,i,o,s=this;return gt(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 yt(s,void 0,void 0,(function(){var t,o,s,a,u,c=this;return gt(this,(function(l){switch(l.label){case 0:return!i||this.online?[3,10]:(this.online=i,n.next({type:pe.SYNC_ENGINE_NETWORK_STATUS,data:{active:this.online}}),o=void 0,St?(_t.warn("Realtime disabled when in a server-side environment"),[3,6]):[3,1]);case 1:u=mt(this.subscriptionsProcessor.start(),2),t=u[0],o=u[1],l.label=2;case 2:return l.trys.push([2,4,,5]),[4,new Promise((function(e,n){var i=t.subscribe({next:function(t){t===at.a.CONNECTED&&e()},error:function(e){n(e),c.disconnectionHandler()(e)}});r.push(i)}))];case 3:return l.sent(),[3,5];case 4:return s=l.sent(),n.error(s),[2];case 5:_t.log("Realtime ready"),n.next({type:pe.SYNC_ENGINE_SUBSCRIPTIONS_ESTABLISHED}),l.label=6;case 6:return l.trys.push([6,8,,9]),[4,new Promise((function(e,t){var i=c.syncQueriesObservable().subscribe({next:function(t){t.type===pe.SYNC_ENGINE_SYNC_QUERIES_READY&&e(),n.next(t)},complete:function(){e()},error:function(e){t(e)}});i&&r.push(i)}))];case 7:return l.sent(),[3,9];case 8:return a=l.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=c.userModelClasses[t.name],s=c.modelInstanceCreator(o,r);c.storage.runExclusive((function(e){return c.modelMerger.merge(e,s)})),n.next({type:pe.SYNC_ENGINE_OUTBOX_MUTATION_PROCESSED,data:{model:o,element:s}}),n.next({type:pe.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:!i}})}))),St||r.push(o.subscribe((function(e){var t=mt(e,3),n=(t[0],t[1]),r=t[2],i=c.userModelClasses[n.name],o=c.modelInstanceCreator(i,r);c.storage.runExclusive((function(e){return c.modelMerger.merge(e,o)}))}))),[3,11];case 10:i||(this.online=i,n.next({type:pe.SYNC_ENGINE_NETWORK_STATUS,data:{active:this.online}}),r.forEach((function(e){return e.unsubscribe()})),r=[]),l.label=11;case 11:return e(),[2]}}))}))}))})),this.storage.observe(null,null,Et).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 yt(s,void 0,void 0,(function(){var e,s,u,c;return gt(this,(function(l){switch(l.label){case 0:return e=this.schema.namespaces[this.namespaceResolver(r)],s=this.modelClasses.MutationEvent,u=Object(ze.k)(a),c=Object(ze.d)(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:pe.SYNC_ENGINE_OUTBOX_MUTATION_ENQUEUED,data:{model:r,element:o}}),n.next({type:pe.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:!1}}),[4,i];case 2:return l.sent(),this.online&&this.mutationsProcessor.resume(),[2]}}))}))}}),n.next({type:pe.SYNC_ENGINE_STORAGE_SUBSCRIBED}),[4,this.outbox.peek(this.storage)];case 4:return o=void 0===a.sent(),n.next({type:pe.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:o}}),[4,i];case 5:return a.sent(),n.next({type:pe.SYNC_ENGINE_READY}),[2]}}))})),function(){r.forEach((function(e){return e.unsubscribe()}))}}))},e.prototype.getModelsMetadataWithNextFullSync=function(e){return yt(this,void 0,void 0,(function(){var t,n=this;return gt(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,u=(t.lastSyncPredicate,!s||s+a<e?0:o);return[n.schema.namespaces[r].models[i],[r,u]]}))]))]}}))}))},e.prototype.syncQueriesObservable=function(){var e=this;return this.online?new d.a((function(t){var n,r;return yt(e,void 0,void 0,(function(){var e,i,o=this;return gt(this,(function(s){switch(s.label){case 0:e=function(){var e,s,a,u,c,l,f,d,h;return gt(this,(function(p){switch(p.label){case 0:return e=new WeakMap,[4,i.getModelsMetadataWithNextFullSync(Date.now())];case 1:return s=p.sent(),a=new Set(s.keys()),[4,new Promise((function(r){n=o.syncQueriesProcessor.start(s).subscribe({next:function(i){var s=i.namespace,h=i.modelDefinition,p=i.items,y=i.done,g=i.startedAt,m=i.isFullSync;return yt(o,void 0,void 0,(function(){var i,o,b,w,S,_,E=this;return gt(this,(function(A){switch(A.label){case 0:return i=this.userModelClasses[h.name],e.has(i)||(e.set(i,{new:0,updated:0,deleted:0}),l=Object(x.k)(),d=void 0===d?g:Math.max(d,g)),[4,this.storage.runExclusive((function(t){return yt(E,void 0,void 0,(function(){var n,r,o,s,a,u,c,l,f,d,h,y,g,m,b;return gt(this,(function(w){switch(w.label){case 0:return[4,this.outbox.getModelIds(t)];case 1:n=w.sent(),r=[],o=p.filter((function(e){return!n.has(e.id)||(r.push(e),!1)})),s=[],w.label=2;case 2:w.trys.push([2,7,8,9]),a=bt(r),u=a.next(),w.label=3;case 3:return u.done?[3,6]:(c=u.value,[4,this.modelMerger.merge(t,c)]);case 4:void 0!==(l=w.sent())&&s.push([c,l]),w.label=5;case 5:return u=a.next(),[3,3];case 6:return[3,9];case 7:return f=w.sent(),m={error:f},[3,9];case 8:try{u&&!u.done&&(b=a.return)&&b.call(a)}finally{if(m)throw m.error}return[7];case 9:return h=(d=s.push).apply,y=[s],[4,this.modelMerger.mergePage(t,i,o)];case 10:return h.apply(d,y.concat([wt.apply(void 0,[w.sent()])])),g=e.get(i),s.forEach((function(e){var t=mt(e,2)[1];switch(t){case v.h.INSERT:g.new++;break;case v.h.UPDATE:g.updated++;break;case v.h.DELETE:g.deleted++;break;default:Object(x.h)(t)}})),[2]}}))}))}))];case 1:return A.sent(),y?(o=h.name,[4,this.getModelMetadata(s,o)]):[3,4];case 2:return b=A.sent(),w=b.lastFullSync,S=b.fullSyncInterval,c=S,u=void 0===u?w:Math.max(u,m?g:w),b=this.modelClasses.ModelMetadata.copyOf(b,(function(e){e.lastSync=g,e.lastFullSync=m?g:b.lastFullSync})),[4,this.storage.save(b,void 0,Et)];case 3:A.sent(),_=e.get(i),this.modelSyncedStatus.set(i,!0),t.next({type:pe.SYNC_ENGINE_MODEL_SYNCED,data:{model:i,isFullSync:m,isDeltaSync:!m,counts:_}}),a.delete(h),0===a.size&&(f=Object(x.k)()-l,r(),t.next({type:pe.SYNC_ENGINE_SYNC_QUERIES_READY}),n.unsubscribe()),A.label=4;case 4:return[2]}}))}))},error:function(e){t.error(e)}}),t.next({type:pe.SYNC_ENGINE_SYNC_QUERIES_STARTED,data:{models:Array.from(a).map((function(e){return e.name}))}})}))];case 2:return p.sent(),h=u+c-(d+f),_t.debug("Next fullSync in "+h/1e3+" seconds. ("+new Date(Date.now()+h)+")"),[4,new Promise((function(e){r=setTimeout(e,h)}))];case 3:return p.sent(),[2]}}))},i=this,s.label=1;case 1:return t.closed?[3,3]:[5,e()];case 2:return s.sent(),[3,1];case 3:return[2]}}))})),function(){n&&n.unsubscribe(),r&&clearTimeout(r)}})):d.a.of()},e.prototype.disconnectionHandler=function(){var e=this;return function(t){ke.CONTROL_MSG.CONNECTION_CLOSED!==t&&ke.CONTROL_MSG.TIMEOUT_DISCONNECT!==t||e.datastoreConnectivity.socketDisconnected()}},e.prototype.unsubscribeConnectivity=function(){this.datastoreConnectivity.unsubscribe()},e.prototype.setupModels=function(e){return yt(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,f,d,h,p=this;return gt(this,(function(v){switch(v.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})).forEach((function(t){if(r.push([e.name,t]),e.name===x.e){var n=p.userModelClasses[t.name];p.modelSyncedStatus.set(n,!1)}}))})),o=r.map((function(e){var r=mt(e,2),o=r[0],s=r[1];return yt(p,void 0,void 0,(function(){var e,r,a,u,c,l,f,d,h;return gt(this,(function(p){switch(p.label){case 0:return[4,this.getModelMetadata(o,s.name)];case 1:return e=p.sent(),r=A.a.getPredicates(this.syncPredicates.get(s),!1),a=r?JSON.stringify(r):null,void 0!==e?[3,3]:[4,this.storage.save(this.modelInstanceCreator(n,{model:s.name,namespace:o,lastSync:null,fullSyncInterval:t,lastFullSync:null,lastSyncPredicate:a}),void 0,Et)];case 2:return l=mt.apply(void 0,[p.sent(),1]),f=mt(l[0],1),i=f[0],[3,5];case 3:return u=e.lastSyncPredicate?e.lastSyncPredicate:null,c=u!==a,[4,this.storage.save(this.modelClasses.ModelMetadata.copyOf(e,(function(e){e.fullSyncInterval=t,c&&(e.lastSync=null,e.lastFullSync=null,e.lastSyncPredicate=a)})))];case 4:d=mt.apply(void 0,[p.sent(),1]),h=mt(d[0],1),i=h[0],p.label=5;case 5:return[2,i]}}))}))})),s={},v.label=1;case 1:return v.trys.push([1,6,7,8]),[4,Promise.all(o)];case 2:a=bt.apply(void 0,[v.sent()]),u=a.next(),v.label=3;case 3:if(u.done)return[3,5];c=u.value,l=c.model,s[l]=c,v.label=4;case 4:return u=a.next(),[3,3];case 5:return[3,8];case 6:return f=v.sent(),d={error:f},[3,8];case 7:try{u&&!u.done&&(h=a.return)&&h.call(a)}finally{if(d)throw d.error}return[7];case 8:return[2,s]}}))}))},e.prototype.getModelsMetadata=function(){return yt(this,void 0,void 0,(function(){var e;return gt(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 yt(this,void 0,void 0,(function(){var n,r,i;return gt(this,(function(o){switch(o.label){case 0:return n=this.modelClasses.ModelMetadata,r=A.a.createFromExisting(this.schema.namespaces[x.d].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 i=mt.apply(void 0,[o.sent(),1]),[2,i[0]]}}))}))},e.prototype.getModelDefinition=function(e){var t=this.namespaceResolver(e);return this.schema.namespaces[t].models[e.name]},e.getNamespace=function(){return{name:x.d,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}();function Ot(e){return(Ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var It=function(){return(It=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)},Tt=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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Ct=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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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])}}},xt=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},Pt=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},kt=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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Nt=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Pt(arguments[t]));return e};Object(l.e)(!0),Object(l.b)();var Mt,jt,Rt,Dt,Ut,Ft=new i.a("DataStore"),Lt=Object(x.z)(Date.now()),Bt=o.a.browserOrNode().isNode,qt=new WeakMap,zt=new WeakMap,Kt=function(e){var t=qt.get(e);return Mt.namespaces[t].models[e.name]},Ht=function(e){return Object(x.u)(e)&&qt.has(e)},Vt=function(e){return qt.get(e)},Gt=function(e){var t;if(void 0!==Mt)return console.warn("The schema has already been initialized"),Rt;Ft.log("validating schema",{schema:e});var n=It({name:x.e},e);Ft.log("DataStore","Init models"),Rt=Yt(n),Ft.log("DataStore","Models initialized");var r={name:x.a,relationships:{},enums:{},nonModels:{},models:{Setting:{name:"Setting",pluralName:"Settings",syncable:!1,fields:{id:{name:"id",type:"ID",isRequired:!0,isArray:!1},key:{name:"key",type:"String",isRequired:!0,isArray:!1},value:{name:"value",type:"String",isRequired:!0,isArray:!1}}}}},i=Pe.getNamespace(),o=At.getNamespace();return Dt=Yt(r),Ut=Yt(i),jt=Yt(o),Mt={namespaces:(t={},t[r.name]=r,t[n.name]=n,t[i.name]=i,t[o.name]=o,t),version:e.version},Object.keys(Mt.namespaces).forEach((function(e){var t,n,r=Pt(Object(x.g)(Mt.namespaces[e]),2),i=r[0],o=r[1];Mt.namespaces[e].relationships=i,Mt.namespaces[e].keys=o;var s=new Map;Object.values(Mt.namespaces[e].models).forEach((function(e){var t=[];Object.values(e.fields).filter((function(t){return t.association&&"BELONGS_TO"===t.association.connectionType&&t.type.model!==e.name})).forEach((function(e){return t.push(e.type.model)})),s.set(e.name,t)}));for(var a=new Map,u=1e3;u>0&&0!==s.size;){if(0===--u)throw new Error("Models are not topologically sortable. Please verify your schema.");try{for(var c=(t=void 0,kt(Array.from(s.keys()))),l=c.next();!l.done;l=c.next()){var f=l.value,d=s.get(f);d.every((function(e){return a.has(e)}))&&a.set(f,d)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}Array.from(a.keys()).forEach((function(e){return s.delete(e)}))}Mt.namespaces[e].modelTopologicalOrdering=a})),Rt},Wt=function(){if(void 0===Mt){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 Ft.error(e),new Error(e)}},Yt=function(e){var t={};return Object.entries(e.models).forEach((function(n){var r=Pt(n,2),i=r[0],o=r[1],s=tn(o);t[i]=s,qt.set(s,e.name)})),Object.entries(e.nonModels||{}).forEach((function(e){var n=Pt(e,2),r=n[0],i=n[1],o=on(i);t[r]=o})),t},Jt=new WeakSet;function $t(e,t){return Jt.add(t),new e(t)}var Zt,Qt=function(e){return function(t,n){var r=e.fields[t];if(void 0!==r){var i=r.type,o=r.isRequired,s=r.isArrayNullable,a=r.name,u=r.isArray;if((!u&&o||u&&!s)&&null==n)throw new Error("Field "+a+" is required");if(Object(v.n)(i)){var c=v.c.getJSType(i),l=v.c.getValidationFunction(i);if("AWSJSON"===i){if(Ot(n)===c)return;if("string"==typeof n)try{return void JSON.parse(n)}catch(e){throw new Error("Field "+a+" is an invalid JSON object. "+n)}}if(u){var f=c;if(o||(f=c+" | null | undefined"),!Array.isArray(n)&&!s)throw new Error("Field "+a+" should be of type ["+f+"], "+Ot(n)+" received. "+n);if(!Object(x.w)(n)&&n.some((function(e){return Object(x.w)(e)?o:Ot(e)!==c}))){var d=n.map((function(e){return null===e?"null":Ot(e)})).join(",");throw new Error("All elements in the "+a+" array should be of type "+f+", ["+d+"] received. "+n)}if(l&&!Object(x.w)(n))if(!n.map((function(e){return Object(x.w)(e)?!(!Object(x.w)(e)||o):l(e)})).every((function(e){return e})))throw new Error("All elements in the "+a+" array should be of type "+i+", validation failed for one or more elements. "+n)}else{if(!o&&void 0===n)return;if(Ot(n)!==c&&null!==n)throw new Error("Field "+a+" should be of type "+c+", "+Ot(n)+" received. "+n);if(!Object(x.w)(n)&&l&&!l(n))throw new Error("Field "+a+" should be of type "+i+", validation failed. "+n)}}}}},Xt=function(e,t,n){var r=e.fields[t]||{},i=r.isArray,o=r.type;if("string"==typeof n&&(i||"AWSJSON"===o||Object(v.t)(o)||Object(v.s)(o)))try{return JSON.parse(n)}catch(e){}return"number"==typeof n&&"Boolean"===o?Boolean(n):n},en=function(e,t,n){var r=Qt(t);Object.entries(e).forEach((function(e){var i=Pt(e,2),o=i[0],s=i[1],a=Xt(t,o,s);r(o,a),n[o]=a}))},tn=function(e){var t=function(){function n(t){return Object(l.d)(this,(function(n){en(t,e,n);var r=Jt.has(t)?t:{},i=r.id,o=r._version,s=r._lastChangedAt,a=r._deleted,u=null!=i,c=u?i:e.syncable?Object(f.v4)():Lt();u||nn(n,e),n.id=c,e.syncable&&(n._version=o,n._lastChangedAt=s,n._deleted=a)}))}return n.copyOf=function(t,n){var r,i=Object.getPrototypeOf(t||{}).constructor;if(!Ht(i)){var o="The source object is not a valid model";throw Ft.error(o,{source:t}),new Error(o)}var s=Object(l.d)(t,(function(r){n(r),r.id=t.id;var i=Qt(e);Object.entries(r).forEach((function(t){var n=Pt(t,2),r=n[0],o=n[1],s=Xt(e,r,o);i(r,s)}))}),(function(e){return r=e})),a=zt.has(t);if(r.length||a)if(a){var u=Pt(zt.get(t),2),c=u[0],f=u[1],d=Object(x.y)(f,c,r);zt.set(s,[d,f]),rn(d,e)}else zt.set(s,[r,t]),rn(r,e);return s},n.fromJSON=function(n){var r=this;if(Array.isArray(n))return n.map((function(e){return r.fromJSON(e)}));var i=$t(t,n),o=Qt(e);return Object.entries(i).forEach((function(e){var t=Pt(e,2),n=t[0],r=t[1];o(n,r)})),i},n}();return t[l.c]=!0,Object.defineProperty(t,"name",{value:e.name}),t},nn=function(e,t){var n=Object.keys(e),r=t.fields;n.forEach((function(e){if(r[e]&&r[e].isReadOnly)throw new Error(e+" is read-only.")}))},rn=function(e,t){var n=e.map((function(e){return[e.path[0],e.value]})),r=t.fields;n.forEach((function(e){var t=Pt(e,2),n=t[0];if(t[1]&&r[n]&&r[n].isReadOnly)throw new Error(n+" is read-only.")}))},on=function(e){var t=function(t){return Object(l.d)(this,(function(n){en(t,e,n)}))};return t[l.c]=!0,Object.defineProperty(t,"name",{value:e.name}),Object(x.A)(t),t};function sn(e){return"string"==typeof e}function an(e){var t=e.localModel,n=e.modelConstructor,r=e.remoteModel._version;return $t(n,It(It({},t),{_version:r}))}function un(e){Ft.warn(e)}function cn(e,t){var n;switch(e){case x.a:n=Dt[t];break;case x.e:n=Rt[t];break;case x.d:n=jt[t];break;case x.c:n=Ut[t];break;default:Object(x.h)(e)}if(Ht(n))return n;var r="Model name is not valid for namespace. modelName: "+t+", namespace: "+e;throw Ft.error(r),new Error(r)}function ln(e,t){return Tt(this,void 0,void 0,(function(){var n,r,i=this;return Ct(this,(function(o){switch(o.label){case 0:return n=Dt.Setting,r=Mt.namespaces[x.a].models.Setting,[4,e.runExclusive((function(e){return Tt(i,void 0,void 0,(function(){var i,o;return Ct(this,(function(s){switch(s.label){case 0:return[4,e.query(n,A.a.createFromExisting(r,(function(e){return e.key("eq","schemaVersion")})),{page:0,limit:1})];case 1:return i=Pt.apply(void 0,[s.sent(),1]),void 0===(o=i[0])||void 0===o.value?[3,4]:JSON.parse(o.value)===t?[3,3]:[4,e.clear(!1)];case 2:s.sent(),s.label=3;case 3:return[3,6];case 4:return[4,e.save($t(n,{key:"schemaVersion",value:JSON.stringify(t)}))];case 5:s.sent(),s.label=6;case 6:return[2]}}))}))}))];case 1:return o.sent(),[2]}}))}))}var fn=function(){function e(){var e=this;this.Auth=u.a,this.API=r.a,this.Cache=c.a,this.amplifyConfig={},this.syncPredicates=new WeakMap,this.amplifyContext={Auth:this.Auth,API:this.API,Cache:this.Cache},this.start=function(){return Tt(e,void 0,void 0,(function(){var e,t,n,r=this;return Ct(this,(function(i){switch(i.label){case 0:return void 0!==this.initialized?[3,1]:(Ft.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 Pe(Mt,Vt,cn,$t,this.storageAdapter,this.sessionId),[4,this.storage.init()];case 4:return i.sent(),Wt(),[4,ln(this.storage,Mt.version)];case 5:return i.sent(),(e=this.amplifyConfig.aws_appsync_graphqlEndpoint)?(Ft.debug("GraphQL endpoint available",e),t=this,[4,this.processSyncExpressions()]):[3,7];case 6:return t.syncPredicates=i.sent(),this.sync=new At(Mt,Vt,jt,Rt,this.storage,$t,this.conflictHandler,this.errorHandler,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,this.amplifyContext),n=1e3*this.fullSyncInterval*60,Zt=this.sync.start({fullSyncInterval:n}).subscribe({next:function(e){var t=e.type,n=e.data;t===(Bt?pe.SYNC_ENGINE_SYNC_QUERIES_READY:pe.SYNC_ENGINE_STORAGE_SUBSCRIBED)&&r.initResolve(),s.a.dispatch("datastore",{event:t,data:n})},error:function(e){Ft.warn("Sync error",e),r.initReject()}}),[3,8];case 7:Ft.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 Tt(e,void 0,void 0,(function(){var e,i,o,s,a;return Ct(this,(function(u){switch(u.label){case 0:return[4,this.start()];case 1:if(u.sent(),!Ht(t))throw e="Constructor is not for a valid model",Ft.error(e,{modelConstructor:t}),new Error(e);return"string"==typeof n&&void 0!==r&&Ft.warn("Pagination is ignored when querying by id"),i=Kt(t),o=sn(n)?A.a.createForId(i,n):Object(A.c)(n)?void 0:A.a.createFromExisting(i,n),s=this.processPagination(i,r),Ft.debug("params ready",{modelConstructor:t,predicate:A.a.getPredicates(o,!1),pagination:It(It({},s),{sort:O.a.getPredicates(s&&s.sort,!1)})}),[4,this.storage.query(t,o,s)];case 2:return a=u.sent(),[2,sn(n)?a[0]:a]}}))}))},this.save=function(t,n){return Tt(e,void 0,void 0,(function(){var e,r,i,o,s,a,u=this;return Ct(this,(function(c){switch(c.label){case 0:return[4,this.start()];case 1:if(c.sent(),e=zt.get(t),r=t?t.constructor:void 0,!Ht(r))throw i="Object is not an instance of a valid model",Ft.error(i,{model:t}),new Error(i);return o=Kt(r),s=A.a.createFromExisting(o,n),[4,this.storage.runExclusive((function(n){return Tt(u,void 0,void 0,(function(){return Ct(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,A.a.createForId(o,t.id))]}}))}))}))];case 2:return a=Pt.apply(void 0,[c.sent(),1]),[2,a[0]]}}))}))},this.setConflictHandler=function(t){var n=t.DataStore;return n&&n.conflictHandler?n.conflictHandler:e.conflictHandler===an&&t.conflictHandler?t.conflictHandler:e.conflictHandler||an},this.setErrorHandler=function(t){var n=t.DataStore;return n&&n.errorHandler?n.errorHandler:e.errorHandler===un&&t.errorHandler?t.errorHandler:e.errorHandler||un},this.delete=function(t,n){return Tt(e,void 0,void 0,(function(){var e,r,i,o,s,a,u,c,l;return Ct(this,(function(f){switch(f.label){case 0:return[4,this.start()];case 1:if(f.sent(),!t)throw u="Model or Model Constructor required",Ft.error(u,{modelOrConstructor:t}),new Error(u);if(!Ht(t))return[3,3];if(o=t,!n)throw u="Id to delete or criteria required. Do you want to delete all? Pass Predicates.ALL",Ft.error(u,{idOrCriteria:n}),new Error(u);if("string"==typeof n)e=A.a.createForId(Kt(o),n);else if(!(e=A.a.createFromExisting(Kt(o),n))||!A.a.isValidPredicate(e))throw u="Criteria required. Do you want to delete all? Pass Predicates.ALL",Ft.error(u,{condition:e}),new Error(u);return[4,this.storage.delete(o,e)];case 2:return r=Pt.apply(void 0,[f.sent(),1]),[2,r[0]];case 3:if(i=t,o=Object.getPrototypeOf(i||{}).constructor,!Ht(o))throw u="Object is not an instance of a valid model",Ft.error(u,{model:i}),new Error(u);if(s=Kt(o),a=A.a.createForId(s,i.id),n){if("function"!=typeof n)throw u="Invalid criteria",Ft.error(u,{idOrCriteria:n}),new Error(u);e=n(a)}else e=a;return[4,this.storage.delete(i,e)];case 4:return c=Pt.apply(void 0,[f.sent(),1]),l=Pt(c[0],1),[2,l[0]]}}))}))},this.observe=function(t,n){var r,i=t&&Ht(t)?t:void 0;if(t&&void 0===i){var o=t,s=o&&Object.getPrototypeOf(o).constructor;if(Ht(s))return n&&Ft.warn("idOrCriteria is ignored when using a model instance",{model:o,idOrCriteria:n}),e.observe(s,o.id);var a="The model is not an instance of a PersistentModelConstructor";throw Ft.error(a,{model:o}),new Error(a)}if(void 0!==n&&void 0===i){a="Cannot provide criteria without a modelConstructor";throw Ft.error(a,n),new Error(a)}if(i&&!Ht(i)){a="Constructor is not for a valid model";throw Ft.error(a,{modelConstructor:i}),new Error(a)}return r="string"==typeof n?A.a.createForId(Kt(i),n):i&&A.a.createFromExisting(Kt(i),n),new d.a((function(t){var n;return Tt(e,void 0,void 0,(function(){var e=this;return Ct(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){var t=e.model;return Vt(t)===x.e})).subscribe({next:function(n){return Tt(e,void 0,void 0,(function(){var e,r;return Ct(this,(function(i){switch(i.label){case 0:return e=n,"DELETE"===n.opType?[3,2]:[4,this.query(n.model,n.element.id)];case 1:r=i.sent(),e=It(It({},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 d.a((function(i){var o,a,u=new Map,c=new Map,l=[],f=function(){var e=w();S(e)},d=new x.b({callback:f,errorHandler:i.error,maxInterval:2e3}),h=(r||{}).sort,p=h?{sort:h}:void 0,v=Kt(t);a=sn(n)?A.a.createForId(v,n):Object(A.c)(n)?void 0:A.a.createFromExisting(v,n);var y=A.a.getPredicates(a,!1)||{},g=y.predicates,m=y.type,b=!!g;Tt(e,void 0,void 0,(function(){var e,r=this;return Ct(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 u.set(e.id,e)})),o=this.observe(t).subscribe((function(e){var t,n,i=e.element,o=e.model,s=e.opType;if(b&&!Object(x.D)(i,m,g)){if("UPDATE"!==s||!u.has(i.id)&&!c.has(i.id))return;l.push(i.id)}"DELETE"===s?l.push(i.id):c.set(i.id,i);var a=null!==(n=null===(t=r.sync)||void 0===t?void 0:t.getModelSyncedStatus(o))&&void 0!==n&&n;(c.size-l.length>=r.syncPageSize||a)&&d.resolve(),d.start()})),f(),[3,3];case 2:return e=s.sent(),i.error(e),[3,3];case 3:return[2]}}))}));var w=function(){var n,i,o=null!==(i=null===(n=e.sync)||void 0===n?void 0:n.getModelSyncedStatus(t))&&void 0!==i&&i,s=Nt(Array.from(u.values()),Array.from(c.values()));return(null==r?void 0:r.sort)&&_(s),u.clear(),s.forEach((function(e){return u.set(e.id,e)})),l.forEach((function(e){return u.delete(e)})),{items:Array.from(u.values()),isSynced:o}},S=function(e){i.next(e),c.clear(),l=[]},_=function(n){var i=Kt(t),o=e.processPagination(i,r),s=O.a.getPredicates(o.sort);if(s.length){var a=Object(x.B)(s);n.sort(a)}};return s.a.listen("datastore",(function e(n){var r,i=n.payload,o=i.event,a=i.data;o===pe.SYNC_ENGINE_MODEL_SYNCED&&(null===(r=null==a?void 0:a.model)||void 0===r?void 0:r.name)===t.name&&(f(),s.a.remove("api",e))})),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=t.DataStore,r=t.authModeStrategyType,i=(t.conflictHandler,t.errorHandler,t.maxRecordsToSync),o=t.syncPageSize,s=t.fullSyncInterval,a=t.syncExpressions,u=t.authProviders,c=t.storageAdapter,l=xt(t,["DataStore","authModeStrategyType","conflictHandler","errorHandler","maxRecordsToSync","syncPageSize","fullSyncInterval","syncExpressions","authProviders","storageAdapter"]);switch(e.amplifyConfig=It(It({},l),e.amplifyConfig),e.conflictHandler=e.setConflictHandler(t),e.errorHandler=e.setErrorHandler(t),n&&n.authModeStrategyType||r||v.a.DEFAULT){case v.a.MULTI_AUTH:e.authModeStrategy=_(e.amplifyContext);break;case v.a.DEFAULT:default:e.authModeStrategy=E}e.amplifyConfig.authProviders=n&&n.authProviders||u,e.syncExpressions=n&&n.syncExpressions||a||e.syncExpressions,e.maxRecordsToSync=n&&n.maxRecordsToSync||i||e.maxRecordsToSync||1e4,e.amplifyConfig.maxRecordsToSync=e.maxRecordsToSync,e.syncPageSize=n&&n.syncPageSize||o||e.syncPageSize||1e3,e.amplifyConfig.syncPageSize=e.syncPageSize,e.fullSyncInterval=n&&n.fullSyncInterval||s||e.fullSyncInterval||1440,e.storageAdapter=n&&n.storageAdapter||c||e.storageAdapter||void 0,e.sessionId=e.retrieveSessionId()},this.clear=function(){return Tt(this,void 0,void 0,(function(){return Ct(this,(function(e){switch(e.label){case 0:return Wt(),void 0!==this.storage?[3,2]:(this.storage=new Pe(Mt,Vt,cn,$t,this.storageAdapter,this.sessionId),[4,this.storage.init()]);case 1:e.sent(),e.label=2;case 2:return Zt&&!Zt.closed&&Zt.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 Tt(this,void 0,void 0,(function(){return Ct(this,(function(e){switch(e.label){case 0:return void 0===this.initialized?[3,2]:[4,this.start()];case 1:e.sent(),e.label=2;case 2:return Zt&&!Zt.closed&&Zt.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 new Error("Limit is required when requesting a page");if(void 0!==o){if("number"!=typeof o)throw new Error("Page should be a number");if(o<0)throw new Error("Page can't be negative")}if(void 0!==i){if("number"!=typeof i)throw new Error("Limit should be a number");if(i<0)throw new Error("Limit can't be negative")}return s&&(n=O.a.createFromExisting(e,t.sort)),{limit:i,page:o,sort:n}}},e.prototype.processSyncExpressions=function(){return Tt(this,void 0,void 0,(function(){var e,t=this;return Ct(this,(function(n){switch(n.label){case 0:return this.syncExpressions&&this.syncExpressions.length?[4,Promise.all(this.syncExpressions.map((function(e){return Tt(t,void 0,void 0,(function(){var t,n,r,i,o,s;return Ct(this,(function(a){switch(a.label){case 0:return[4,e];case 1:return t=a.sent(),n=t.modelConstructor,r=t.conditionProducer,i=Kt(n),[4,this.unwrapPromise(r)];case 2:return o=a.sent(),Object(A.c)(o)?[2,[i,null]]:(s=this.createFromCondition(i,o),[2,[i,s]])}}))}))})))]:[2,new WeakMap];case 1:return e=n.sent(),[2,this.weakMapFromEntries(e)]}}))}))},e.prototype.createFromCondition=function(e,t){try{return A.a.createFromExisting(e,t)}catch(e){throw Ft.error("Error creating Sync Predicate"),e}},e.prototype.unwrapPromise=function(e){return Tt(this,void 0,void 0,(function(){var t;return Ct(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=Pt(t,2),r=n[0],i=n[1];if(e.has(r)){var o=r.name;return Ft.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];return e+"-"+Pt(t.split("."),1)[0]}}catch(e){return}},e}(),dn=new fn;a.a.register(dn);var hn={USER:x.e,traverseModel:x.C,validatePredicate:x.D,isNonModelConstructor:x.v,isModelConstructor:x.u}},function(e,t,n){"use strict";n.r(t),n.d(t,"fromUtf8",(function(){return r})),n.d(t,"toUtf8",(function(){return i}));var r=function(e){return"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e.charCodeAt(n);if(i<128)t.push(i);else if(i<2048)t.push(i>>6|192,63&i|128);else if(n+1<e.length&&55296==(64512&i)&&56320==(64512&e.charCodeAt(n+1))){var o=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n));t.push(o>>18|240,o>>12&63|128,o>>6&63|128,63&o|128)}else t.push(i>>12|224,i>>6&63|128,63&i|128)}return Uint8Array.from(t)}(e)},i=function(e){return"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):function(e){for(var t="",n=0,r=e.length;n<r;n++){var i=e[n];if(i<128)t+=String.fromCharCode(i);else if(192<=i&&i<224){var o=e[++n];t+=String.fromCharCode((31&i)<<6|63&o)}else if(240<=i&&i<365){var s="%"+[i,e[++n],e[++n],e[++n]].map((function(e){return e.toString(16)})).join("%");t+=decodeURIComponent(s)}else t+=String.fromCharCode((15&i)<<12|(63&e[++n])<<6|63&e[++n])}return t}(e)}},function(e,t,n){"use strict";n.r(t),n.d(t,"fromUtf8",(function(){return r})),n.d(t,"toUtf8",(function(){return i}));const r=e=>"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):(e=>{const t=[];for(let n=0,r=e.length;n<r;n++){const r=e.charCodeAt(n);if(r<128)t.push(r);else if(r<2048)t.push(r>>6|192,63&r|128);else if(n+1<e.length&&55296==(64512&r)&&56320==(64512&e.charCodeAt(n+1))){const i=65536+((1023&r)<<10)+(1023&e.charCodeAt(++n));t.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}else t.push(r>>12|224,r>>6&63|128,63&r|128)}return Uint8Array.from(t)})(e),i=e=>"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):(e=>{let t="";for(let n=0,r=e.length;n<r;n++){const r=e[n];if(r<128)t+=String.fromCharCode(r);else if(192<=r&&r<224){const i=e[++n];t+=String.fromCharCode((31&r)<<6|63&i)}else if(240<=r&&r<365){const i="%"+[r,e[++n],e[++n],e[++n]].map(e=>e.toString(16)).join("%");t+=decodeURIComponent(i)}else t+=String.fromCharCode((15&r)<<12|(63&e[++n])<<6|63&e[++n])}return t})(e)},,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return f})),n.d(t,"d",(function(){return d})),n.d(t,"b",(function(){return h})),n.d(t,"c",(function(){return p}));var r,i=n(21),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,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,t 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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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="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=new i.a("Util"),f=function(e){function t(t){var n=e.call(this,t)||this;return n.nonRetryable=!0,n}return o(t,e),t}(Error);function d(e,t,n,r){return void 0===r&&(r=1),s(this,void 0,void 0,(function(){var i,o;return a(this,(function(s){switch(s.label){case 0:if("function"!=typeof e)throw Error("functionToRetry must be a function");l.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,c(t))];case 2:return[2,s.sent()];case 3:if(i=s.sent(),l.debug("error on "+e.name,i),(a=i)&&a.nonRetryable)throw l.debug(e.name+" non retryable error",i),i;return o=n(r,t,i),l.debug(e.name+" retrying in "+o+" ms"),!1===o?[3,6]:[4,new Promise((function(e){return setTimeout(e,o)}))];case 4:return s.sent(),[4,d(e,t,n,r+1)];case 5:return[2,s.sent()];case 6:throw i;case 7:return[3,8];case 8:return[2]}var a}))}))}function h(e){void 0===e&&(e=3e5);return function(t){var n=100*Math.pow(2,t)+100*Math.random();return!(n>e)&&n}}var p=function(e,t,n){return void 0===n&&(n=3e5),d(e,t,h(n))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return Zi}));var r=n(21),i=n(66),o=n(16),s=n(152),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,t 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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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])}}},c=new r.a("CognitoCredentials"),l=new Promise((function(e,t){return Object(o.b)().isBrowser?(window.gapi&&window.gapi.auth2?window.gapi.auth2:null)?(c.debug("google api already loaded"),e()):void setTimeout((function(){return e()}),2e3):(c.debug("not in the browser, directly resolved"),e())})),f=function(){function e(){this.initialized=!1,this.refreshGoogleToken=this.refreshGoogleToken.bind(this),this._refreshGoogleTokenImpl=this._refreshGoogleTokenImpl.bind(this)}return e.prototype.refreshGoogleToken=function(){return a(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return this.initialized?[3,2]:(c.debug("need to wait for the Google SDK loaded"),[4,l]);case 1:e.sent(),this.initialized=!0,c.debug("finish waiting"),e.label=2;case 2:return[2,this._refreshGoogleTokenImpl()]}}))}))},e.prototype._refreshGoogleTokenImpl=function(){var e=null;return Object(o.b)().isBrowser&&(e=window.gapi&&window.gapi.auth2?window.gapi.auth2:null),e?new Promise((function(t,n){e.getAuthInstance().then((function(e){e||(c.debug("google Auth undefined"),n(new s.a("google Auth undefined")));var r=e.currentUser.get();r.isSignedIn()?(c.debug("refreshing the google access token"),r.reloadAuthResponse().then((function(e){var n=e.id_token,r=e.expires_at;t({token:n,expires_at:r})})).catch((function(e){e&&"network_error"===e.error?n("Network error reloading google auth response"):n(new s.a("Failed to reload google auth response"))}))):n(new s.a("User is not signed in with Google"))})).catch((function(e){c.debug("Failed to refresh google token",e),n(new s.a("Failed to refresh google token"))}))})):(c.debug("no gapi auth2 available"),Promise.reject("no gapi auth2 available"))},e}(),d=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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},h=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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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.a("CognitoCredentials"),v=new Promise((function(e,t){return Object(o.b)().isBrowser?window.FB?(p.debug("FB SDK already loaded"),e()):void setTimeout((function(){return e()}),2e3):(p.debug("not in the browser, directly resolved"),e())})),y=function(){function e(){this.initialized=!1,this.refreshFacebookToken=this.refreshFacebookToken.bind(this),this._refreshFacebookTokenImpl=this._refreshFacebookTokenImpl.bind(this)}return e.prototype.refreshFacebookToken=function(){return d(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return this.initialized?[3,2]:(p.debug("need to wait for the Facebook SDK loaded"),[4,v]);case 1:e.sent(),this.initialized=!0,p.debug("finish waiting"),e.label=2;case 2:return[2,this._refreshFacebookTokenImpl()]}}))}))},e.prototype._refreshFacebookTokenImpl=function(){var e=null;if(Object(o.b)().isBrowser&&(e=window.FB),!e){return p.debug("no fb sdk available"),Promise.reject(new s.a("no fb sdk available"))}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){a="the jwtToken is undefined";p.debug(a),n(new s.a(a))}t({token:i,expires_at:o})}else{var a="no response from facebook when refreshing the jwt token";p.debug(a),n(new s.a(a))}}),{scope:"public_profile,email"})}))},e}(),g=new f,m=new y,b=n(33),w=n(38),S=n(0),_=function(e,t){return(_=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function E(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}_(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var A=function(){return(A=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)};function O(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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function I(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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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])}}}Object.create;function T(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}var C,x,P,k,N,M,j,R,D,U,F,L,B,q,z,K,H,V,G,W,Y,J,$,Z,Q,X,ee,te,ne,re,ie,oe,se,ae,ue,ce,le,fe,de,he,pe,ve,ye,ge,me,be,we,Se,_e,Ee,Ae,Oe,Ie,Te,Ce,xe,Pe;Object.create;!function(e){e.AUTHENTICATED_ROLE="AuthenticatedRole",e.DENY="Deny"}(C||(C={})),(x||(x={})).filterSensitiveLog=function(e){return A({},e)},(P||(P={})).filterSensitiveLog=function(e){return A({},e)},(k||(k={})).filterSensitiveLog=function(e){return A({},e)},(N||(N={})).filterSensitiveLog=function(e){return A({},e)},(M||(M={})).filterSensitiveLog=function(e){return A({},e)},(j||(j={})).filterSensitiveLog=function(e){return A({},e)},(R||(R={})).filterSensitiveLog=function(e){return A({},e)},(D||(D={})).filterSensitiveLog=function(e){return A({},e)},(U||(U={})).filterSensitiveLog=function(e){return A({},e)},(F||(F={})).filterSensitiveLog=function(e){return A({},e)},function(e){e.ACCESS_DENIED="AccessDenied",e.INTERNAL_SERVER_ERROR="InternalServerError"}(L||(L={})),(B||(B={})).filterSensitiveLog=function(e){return A({},e)},(q||(q={})).filterSensitiveLog=function(e){return A({},e)},(z||(z={})).filterSensitiveLog=function(e){return A({},e)},(K||(K={})).filterSensitiveLog=function(e){return A({},e)},(H||(H={})).filterSensitiveLog=function(e){return A({},e)},(V||(V={})).filterSensitiveLog=function(e){return A({},e)},(G||(G={})).filterSensitiveLog=function(e){return A({},e)},(W||(W={})).filterSensitiveLog=function(e){return A({},e)},(Y||(Y={})).filterSensitiveLog=function(e){return A({},e)},(J||(J={})).filterSensitiveLog=function(e){return A({},e)},($||($={})).filterSensitiveLog=function(e){return A({},e)},(Z||(Z={})).filterSensitiveLog=function(e){return A({},e)},(Q||(Q={})).filterSensitiveLog=function(e){return A({},e)},(X||(X={})).filterSensitiveLog=function(e){return A({},e)},(ee||(ee={})).filterSensitiveLog=function(e){return A({},e)},function(e){e.CONTAINS="Contains",e.EQUALS="Equals",e.NOT_EQUAL="NotEqual",e.STARTS_WITH="StartsWith"}(te||(te={})),(ne||(ne={})).filterSensitiveLog=function(e){return A({},e)},(re||(re={})).filterSensitiveLog=function(e){return A({},e)},function(e){e.RULES="Rules",e.TOKEN="Token"}(ie||(ie={})),(oe||(oe={})).filterSensitiveLog=function(e){return A({},e)},(se||(se={})).filterSensitiveLog=function(e){return A({},e)},(ae||(ae={})).filterSensitiveLog=function(e){return A({},e)},(ue||(ue={})).filterSensitiveLog=function(e){return A({},e)},(ce||(ce={})).filterSensitiveLog=function(e){return A({},e)},(le||(le={})).filterSensitiveLog=function(e){return A({},e)},(fe||(fe={})).filterSensitiveLog=function(e){return A({},e)},(de||(de={})).filterSensitiveLog=function(e){return A({},e)},(he||(he={})).filterSensitiveLog=function(e){return A({},e)},(pe||(pe={})).filterSensitiveLog=function(e){return A({},e)},(ve||(ve={})).filterSensitiveLog=function(e){return A({},e)},(ye||(ye={})).filterSensitiveLog=function(e){return A({},e)},(ge||(ge={})).filterSensitiveLog=function(e){return A({},e)},(me||(me={})).filterSensitiveLog=function(e){return A({},e)},(be||(be={})).filterSensitiveLog=function(e){return A({},e)},(we||(we={})).filterSensitiveLog=function(e){return A({},e)},(Se||(Se={})).filterSensitiveLog=function(e){return A({},e)},(_e||(_e={})).filterSensitiveLog=function(e){return A({},e)},(Ee||(Ee={})).filterSensitiveLog=function(e){return A({},e)},(Ae||(Ae={})).filterSensitiveLog=function(e){return A({},e)},(Oe||(Oe={})).filterSensitiveLog=function(e){return A({},e)},(Ie||(Ie={})).filterSensitiveLog=function(e){return A({},e)},(Te||(Te={})).filterSensitiveLog=function(e){return A({},e)},(Ce||(Ce={})).filterSensitiveLog=function(e){return A({},e)},(xe||(xe={})).filterSensitiveLog=function(e){return A({},e)},(Pe||(Pe={})).filterSensitiveLog=function(e){return A({},e)};var ke=function(){function e(e){this.statusCode=e.statusCode,this.headers=e.headers||{},this.body=e.body}return e.isInstance=function(e){if(!e)return!1;var t=e;return"number"==typeof t.statusCode&&"object"==typeof t.headers},e}(),Ne=function(){function e(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?":"!==e.protocol.substr(-1)?e.protocol+":":e.protocol:"https:",this.path=e.path?"/"!==e.path.charAt(0)?"/"+e.path:e.path:"/"}return e.isInstance=function(e){if(!e)return!1;var t=e;return"method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&"object"==typeof t.query&&"object"==typeof t.headers},e.prototype.clone=function(){var t,n=new e(Object(S.__assign)(Object(S.__assign)({},this),{headers:Object(S.__assign)({},this.headers)}));return n.query&&(n.query=(t=n.query,Object.keys(t).reduce((function(e,n){var r,i=t[n];return Object(S.__assign)(Object(S.__assign)({},e),((r={})[n]=Array.isArray(i)?Object(S.__spread)(i):i,r))}),{}))),n},e}();var Me=function(e,t){return O(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return I(this,(function(g){switch(g.label){case 0:return r=[A({},e)],y={},[4,ut(e.body,t)];case 1:switch(n=A.apply(void 0,r.concat([(y.body=g.sent(),y)])),o="UnknownError",o=ct(e,n.body),o){case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":return[3,2];case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":return[3,4];case"InvalidIdentityPoolConfigurationException":case"com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException":return[3,6];case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":return[3,8];case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":return[3,10];case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":return[3,12];case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":return[3,14];case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":return[3,16]}return[3,18];case 2:return s=[{}],[4,Re(n,t)];case 3:return i=A.apply(void 0,[A.apply(void 0,s.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 4:return a=[{}],[4,De(n,t)];case 5:return i=A.apply(void 0,[A.apply(void 0,a.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 6:return u=[{}],[4,Ue(n,t)];case 7:return i=A.apply(void 0,[A.apply(void 0,u.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 8:return c=[{}],[4,Fe(n,t)];case 9:return i=A.apply(void 0,[A.apply(void 0,c.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 10:return l=[{}],[4,Be(n,t)];case 11:return i=A.apply(void 0,[A.apply(void 0,l.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 12:return f=[{}],[4,qe(n,t)];case 13:return i=A.apply(void 0,[A.apply(void 0,f.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 14:return d=[{}],[4,ze(n,t)];case 15:return i=A.apply(void 0,[A.apply(void 0,d.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 16:return h=[{}],[4,Ke(n,t)];case 17:return i=A.apply(void 0,[A.apply(void 0,h.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=A(A({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:ot(e)}),g.label=19;case 19:return v=i.message||i.Message||o,i.message=v,delete i.Message,[2,Promise.reject(Object.assign(new Error(v),i))]}}))}))},je=function(e,t){return O(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return I(this,(function(g){switch(g.label){case 0:return r=[A({},e)],y={},[4,ut(e.body,t)];case 1:switch(n=A.apply(void 0,r.concat([(y.body=g.sent(),y)])),o="UnknownError",o=ct(e,n.body),o){case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":return[3,2];case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":return[3,4];case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":return[3,6];case"LimitExceededException":case"com.amazonaws.cognitoidentity#LimitExceededException":return[3,8];case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":return[3,10];case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":return[3,12];case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":return[3,14];case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":return[3,16]}return[3,18];case 2:return s=[{}],[4,Re(n,t)];case 3:return i=A.apply(void 0,[A.apply(void 0,s.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 4:return a=[{}],[4,De(n,t)];case 5:return i=A.apply(void 0,[A.apply(void 0,a.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 6:return u=[{}],[4,Fe(n,t)];case 7:return i=A.apply(void 0,[A.apply(void 0,u.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 8:return c=[{}],[4,Le(n,t)];case 9:return i=A.apply(void 0,[A.apply(void 0,c.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 10:return l=[{}],[4,Be(n,t)];case 11:return i=A.apply(void 0,[A.apply(void 0,l.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 12:return f=[{}],[4,qe(n,t)];case 13:return i=A.apply(void 0,[A.apply(void 0,f.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 14:return d=[{}],[4,ze(n,t)];case 15:return i=A.apply(void 0,[A.apply(void 0,d.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 16:return h=[{}],[4,Ke(n,t)];case 17:return i=A.apply(void 0,[A.apply(void 0,h.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=A(A({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:ot(e)}),g.label=19;case 19:return v=i.message||i.Message||o,i.message=v,delete i.Message,[2,Promise.reject(Object.assign(new Error(v),i))]}}))}))},Re=function(e,t){return O(void 0,void 0,void 0,(function(){var n,r;return I(this,(function(i){return n=e.body,r=Ye(n,t),[2,A({name:"ExternalServiceException",$fault:"client",$metadata:ot(e)},r)]}))}))},De=function(e,t){return O(void 0,void 0,void 0,(function(){var n,r;return I(this,(function(i){return n=e.body,r=Ze(n,t),[2,A({name:"InternalErrorException",$fault:"server",$metadata:ot(e)},r)]}))}))},Ue=function(e,t){return O(void 0,void 0,void 0,(function(){var n,r;return I(this,(function(i){return n=e.body,r=Qe(n,t),[2,A({name:"InvalidIdentityPoolConfigurationException",$fault:"client",$metadata:ot(e)},r)]}))}))},Fe=function(e,t){return O(void 0,void 0,void 0,(function(){var n,r;return I(this,(function(i){return n=e.body,r=Xe(n,t),[2,A({name:"InvalidParameterException",$fault:"client",$metadata:ot(e)},r)]}))}))},Le=function(e,t){return O(void 0,void 0,void 0,(function(){var n,r;return I(this,(function(i){return n=e.body,r=et(n,t),[2,A({name:"LimitExceededException",$fault:"client",$metadata:ot(e)},r)]}))}))},Be=function(e,t){return O(void 0,void 0,void 0,(function(){var n,r;return I(this,(function(i){return n=e.body,r=tt(n,t),[2,A({name:"NotAuthorizedException",$fault:"client",$metadata:ot(e)},r)]}))}))},qe=function(e,t){return O(void 0,void 0,void 0,(function(){var n,r;return I(this,(function(i){return n=e.body,r=nt(n,t),[2,A({name:"ResourceConflictException",$fault:"client",$metadata:ot(e)},r)]}))}))},ze=function(e,t){return O(void 0,void 0,void 0,(function(){var n,r;return I(this,(function(i){return n=e.body,r=rt(n,t),[2,A({name:"ResourceNotFoundException",$fault:"client",$metadata:ot(e)},r)]}))}))},Ke=function(e,t){return O(void 0,void 0,void 0,(function(){var n,r;return I(this,(function(i){return n=e.body,r=it(n,t),[2,A({name:"TooManyRequestsException",$fault:"client",$metadata:ot(e)},r)]}))}))},He=function(e,t){return A(A(A({},void 0!==e.CustomRoleArn&&null!==e.CustomRoleArn&&{CustomRoleArn:e.CustomRoleArn}),void 0!==e.IdentityId&&null!==e.IdentityId&&{IdentityId:e.IdentityId}),void 0!==e.Logins&&null!==e.Logins&&{Logins:Ge(e.Logins,t)})},Ve=function(e,t){return A(A(A({},void 0!==e.AccountId&&null!==e.AccountId&&{AccountId:e.AccountId}),void 0!==e.IdentityPoolId&&null!==e.IdentityPoolId&&{IdentityPoolId:e.IdentityPoolId}),void 0!==e.Logins&&null!==e.Logins&&{Logins:Ge(e.Logins,t)})},Ge=function(e,t){return Object.entries(e).reduce((function(e,t){var n,r=T(t,2),i=r[0],o=r[1];return null===o?e:A(A({},e),((n={})[i]=o,n))}),{})},We=function(e,t){return{AccessKeyId:void 0!==e.AccessKeyId&&null!==e.AccessKeyId?e.AccessKeyId:void 0,Expiration:void 0!==e.Expiration&&null!==e.Expiration?new Date(Math.round(1e3*e.Expiration)):void 0,SecretKey:void 0!==e.SecretKey&&null!==e.SecretKey?e.SecretKey:void 0,SessionToken:void 0!==e.SessionToken&&null!==e.SessionToken?e.SessionToken:void 0}},Ye=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Je=function(e,t){return{Credentials:void 0!==e.Credentials&&null!==e.Credentials?We(e.Credentials):void 0,IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},$e=function(e,t){return{IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},Ze=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Qe=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Xe=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},et=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},tt=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},nt=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},rt=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},it=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},ot=function(e){var t;return{httpStatusCode:e.statusCode,requestId:null!==(t=e.headers["x-amzn-requestid"])&&void 0!==t?t:e.headers["x-amzn-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}},st=function(e,t){return void 0===e&&(e=new Uint8Array),e instanceof Uint8Array?Promise.resolve(e):t.streamCollector(e)||Promise.resolve(new Uint8Array)},at=function(e,t,n,r,i){return O(void 0,void 0,void 0,(function(){var o,s,a,u,c,l;return I(this,(function(f){switch(f.label){case 0:return[4,e.endpoint()];case 1:return o=f.sent(),s=o.hostname,a=o.protocol,u=void 0===a?"https":a,c=o.port,l={protocol:u,hostname:s,port:c,method:"POST",path:n,headers:t},void 0!==r&&(l.hostname=r),void 0!==i&&(l.body=i),[2,new Ne(l)]}}))}))},ut=function(e,t){return function(e,t){return st(e,t).then((function(e){return t.utf8Encoder(e)}))}(e,t).then((function(e){return e.length?JSON.parse(e):{}}))},ct=function(e,t){var n,r,i=function(e){var t=e;return t.indexOf(":")>=0&&(t=t.split(":")[0]),t.indexOf("#")>=0&&(t=t.split("#")[1]),t},o=(n=e.headers,r="x-amzn-errortype",Object.keys(n).find((function(e){return e.toLowerCase()===r.toLowerCase()})));return void 0!==o?i(e.headers[o]):void 0!==t.code?i(t.code):void 0!==t.__type?i(t.__type):""},lt={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},ft={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function dt(e,t,n){return{applyToStack:function(r){r.add(function(e,t){return function(n,r){return function(r){return Object(S.__awaiter)(void 0,void 0,void 0,(function(){var i,o;return Object(S.__generator)(this,(function(s){switch(s.label){case 0:return[4,n(r)];case 1:return i=s.sent().response,[4,t(i,e)];case 2:return o=s.sent(),[2,{response:i,output:o}]}}))}))}}}(e,n),lt),r.add(function(e,t){return function(n,r){return function(r){return Object(S.__awaiter)(void 0,void 0,void 0,(function(){var i;return Object(S.__generator)(this,(function(o){switch(o.label){case 0:return[4,t(r.input,e)];case 1:return i=o.sent(),[2,n(Object(S.__assign)(Object(S.__assign)({},r),{request:i}))]}}))}))}}}(e,t),ft)}}}var ht=function(){var e=[],t=[],n=new Set,r=function(n){return e.forEach((function(e){n.add(e.middleware,Object(S.__assign)({},e))})),t.forEach((function(e){n.addRelativeTo(e.middleware,Object(S.__assign)({},e))})),n},i=function(e){var t=[];return e.before.forEach((function(e){0===e.before.length&&0===e.after.length?t.push(e):t.push.apply(t,Object(S.__spread)(i(e)))})),t.push(e),e.after.reverse().forEach((function(e){0===e.before.length&&0===e.after.length?t.push(e):t.push.apply(t,Object(S.__spread)(i(e)))})),t},o=function(){var n,r=[],o=[],s={};return e.forEach((function(e){var t=Object(S.__assign)(Object(S.__assign)({},e),{before:[],after:[]});t.name&&(s[t.name]=t),r.push(t)})),t.forEach((function(e){var t=Object(S.__assign)(Object(S.__assign)({},e),{before:[],after:[]});t.name&&(s[t.name]=t),o.push(t)})),o.forEach((function(e){if(e.toMiddleware){var t=s[e.toMiddleware];if(void 0===t)throw new Error(e.toMiddleware+" is not found when adding "+(e.name||"anonymous")+" middleware "+e.relation+" "+e.toMiddleware);"after"===e.relation&&t.after.push(e),"before"===e.relation&&t.before.push(e)}})),(n=r,n.sort((function(e,t){return pt[t.step]-pt[e.step]||vt[t.priority||"normal"]-vt[e.priority||"normal"]}))).map(i).reduce((function(e,t){return e.push.apply(e,Object(S.__spread)(t)),e}),[]).map((function(e){return e.middleware}))},s={add:function(t,r){void 0===r&&(r={});var i=r.name,o=r.override,s=Object(S.__assign)({step:"initialize",priority:"normal",middleware:t},r);if(i){if(n.has(i)){if(!o)throw new Error("Duplicate middleware name '"+i+"'");var a=e.findIndex((function(e){return e.name===i})),u=e[a];if(u.step!==s.step||u.priority!==s.priority)throw new Error('"'+i+'" middleware with '+u.priority+" priority in "+u.step+" step cannot be overridden by same-name middleware with "+s.priority+" priority in "+s.step+" step.");e.splice(a,1)}n.add(i)}e.push(s)},addRelativeTo:function(e,r){var i=r.name,o=r.override,s=Object(S.__assign)({middleware:e},r);if(i){if(n.has(i)){if(!o)throw new Error("Duplicate middleware name '"+i+"'");var a=t.findIndex((function(e){return e.name===i})),u=t[a];if(u.toMiddleware!==s.toMiddleware||u.relation!==s.relation)throw new Error('"'+i+'" middleware '+u.relation+' "'+u.toMiddleware+'" middleware cannot be overridden by same-name middleware '+s.relation+' "'+s.toMiddleware+'" middleware.');t.splice(a,1)}n.add(i)}t.push(s)},clone:function(){return r(ht())},use:function(e){e.applyToStack(s)},remove:function(r){return"string"==typeof r?function(r){var i=!1,o=function(e){return!e.name||e.name!==r||(i=!0,n.delete(r),!1)};return e=e.filter(o),t=t.filter(o),i}(r):function(r){var i=!1,o=function(e){return e.middleware!==r||(i=!0,e.name&&n.delete(e.name),!1)};return e=e.filter(o),t=t.filter(o),i}(r)},removeByTag:function(r){var i=!1,o=function(e){var t=e.tags,o=e.name;return!t||!t.includes(r)||(o&&n.delete(o),i=!0,!1)};return e=e.filter(o),t=t.filter(o),i},concat:function(e){var t=r(ht());return t.use(e),t},applyToStack:r,resolve:function(e,t){var n,r;try{for(var i=Object(S.__values)(o().reverse()),s=i.next();!s.done;s=i.next()){e=(0,s.value)(e,t)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e}};return s},pt={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},vt={high:3,normal:2,low:1},yt=function(){function e(e){this.middlewareStack=ht(),this.config=e}return e.prototype.send=function(e,t,n){var r="function"!=typeof t?t:void 0,i="function"==typeof t?t:n,o=e.resolveMiddleware(this.middlewareStack,this.config,r);if(!i)return o(e).then((function(e){return e.output}));o(e).then((function(e){return i(null,e.output)}),(function(e){return i(e)})).catch((function(){}))},e.prototype.destroy=function(){this.config.requestHandler.destroy&&this.config.requestHandler.destroy()},e}(),gt=function(){this.middlewareStack=ht()};var mt=function(){var e=Object.getPrototypeOf(this).constructor,t=Function.bind.apply(String,Object(S.__spread)([null],arguments)),n=new t;return Object.setPrototypeOf(n,e.prototype),n};mt.prototype=Object.create(String.prototype,{constructor:{value:mt,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf(mt,String);!function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Object(S.__extends)(t,e),t.prototype.deserializeJSON=function(){return JSON.parse(e.prototype.toString.call(this))},t.prototype.toJSON=function(){return e.prototype.toString.call(this)},t.fromObject=function(e){return e instanceof t?e:new t(e instanceof String||"string"==typeof e?e:JSON.stringify(e))}}(mt);var bt=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return E(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(dt(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetCredentialsForIdentityCommand",inputFilterSensitiveLog:Y.filterSensitiveLog,outputFilterSensitiveLog:$.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return O(void 0,void 0,void 0,(function(){var n,r;return I(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetCredentialsForIdentity"},r=JSON.stringify(He(e,t)),[2,at(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return O(void 0,void 0,void 0,(function(){var n,r,i;return I(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,Me(e,t)]:[4,ut(e.body,t)];case 1:return n=o.sent(),{},r=Je(n,t),i=A({$metadata:ot(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(gt),wt=function(e){function t(t,n){void 0===n&&(n=!0);var r=e.call(this,t)||this;return r.tryNextLink=n,r}return Object(S.__extends)(t,e),t}(Error);function St(e){return Promise.all(Object.keys(e).reduce((function(t,n){var r=e[n];return"string"==typeof r?t.push([n,r]):t.push(r().then((function(e){return[n,e]}))),t}),[])).then((function(e){return e.reduce((function(e,t){var n=Object(S.__read)(t,2),r=n[0],i=n[1];return e[r]=i,e}),{})}))}function _t(e){var t=this;return function(){return Object(S.__awaiter)(t,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,f,d,h;return Object(S.__generator)(this,(function(p){switch(p.label){case 0:return l=(c=e.client).send,f=bt.bind,h={CustomRoleArn:e.customRoleArn,IdentityId:e.identityId},e.logins?[4,St(e.logins)]:[3,2];case 1:return d=p.sent(),[3,3];case 2:d=void 0,p.label=3;case 3:return[4,l.apply(c,[new(f.apply(bt,[void 0,(h.Logins=d,h)]))])];case 4:return t=p.sent().Credentials,n=void 0===t?function(){throw new wt("Response from Amazon Cognito contained no credentials")}():t,r=n.AccessKeyId,i=void 0===r?function(){throw new wt("Response from Amazon Cognito contained no access key ID")}():r,o=n.Expiration,s=n.SecretKey,a=void 0===s?function(){throw new wt("Response from Amazon Cognito contained no secret key")}():s,u=n.SessionToken,[2,{identityId:e.identityId,accessKeyId:i,secretAccessKey:a,sessionToken:u,expiration:o}]}}))}))}}var Et=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return E(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(dt(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetIdCommand",inputFilterSensitiveLog:Q.filterSensitiveLog,outputFilterSensitiveLog:X.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return O(void 0,void 0,void 0,(function(){var n,r;return I(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetId"},r=JSON.stringify(Ve(e,t)),[2,at(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return O(void 0,void 0,void 0,(function(){var n,r,i;return I(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,je(e,t)]:[4,ut(e.body,t)];case 1:return n=o.sent(),{},r=$e(n,t),i=A({$metadata:ot(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(gt),At=function(){function e(e){void 0===e&&(e="aws:cognito-identity-ids"),this.dbName=e}return e.prototype.getItem=function(e){return this.withObjectStore("readonly",(function(t){var n=t.get(e);return new Promise((function(e){n.onerror=function(){return e(null)},n.onsuccess=function(){return e(n.result?n.result.value:null)}}))})).catch((function(){return null}))},e.prototype.removeItem=function(e){return this.withObjectStore("readwrite",(function(t){var n=t.delete(e);return new Promise((function(e,t){n.onerror=function(){return t(n.error)},n.onsuccess=function(){return e()}}))}))},e.prototype.setItem=function(e,t){return this.withObjectStore("readwrite",(function(n){var r=n.put({id:e,value:t});return new Promise((function(e,t){r.onerror=function(){return t(r.error)},r.onsuccess=function(){return e()}}))}))},e.prototype.getDb=function(){var e=self.indexedDB.open(this.dbName,1);return new Promise((function(t,n){e.onsuccess=function(){t(e.result)},e.onerror=function(){n(e.error)},e.onblocked=function(){n(new Error("Unable to access DB"))},e.onupgradeneeded=function(){var t=e.result;t.onerror=function(){n(new Error("Failed to create object store"))},t.createObjectStore("IdentityIds",{keyPath:"id"})}}))},e.prototype.withObjectStore=function(e,t){return this.getDb().then((function(n){var r=n.transaction("IdentityIds",e);return r.oncomplete=function(){return n.close()},new Promise((function(e,n){r.onerror=function(){return n(r.error)},e(t(r.objectStore("IdentityIds")))})).catch((function(e){throw n.close(),e}))}))},e}(),Ot=new(function(){function e(e){void 0===e&&(e={}),this.store=e}return e.prototype.getItem=function(e){return e in this.store?this.store[e]:null},e.prototype.removeItem=function(e){delete this.store[e]},e.prototype.setItem=function(e,t){this.store[e]=t},e}());function It(e){var t=this,n=e.accountId,r=e.cache,i=void 0===r?"object"==typeof self&&self.indexedDB?new At:"object"==typeof window&&window.localStorage?window.localStorage:Ot:r,o=e.client,s=e.customRoleArn,a=e.identityPoolId,u=e.logins,c=e.userIdentifier,l=void 0===c?u&&0!==Object.keys(u).length?void 0:"ANONYMOUS":c,f=l?"aws:cognito-identity-credentials:"+a+":"+l:void 0,d=function(){return Object(S.__awaiter)(t,void 0,void 0,(function(){var e,t,r,c,l,h,p,v,y;return Object(S.__generator)(this,(function(g){switch(g.label){case 0:return(t=f)?[4,i.getItem(f)]:[3,2];case 1:t=g.sent(),g.label=2;case 2:return(e=t)?[3,7]:(h=(l=o).send,p=Et.bind,y={AccountId:n,IdentityPoolId:a},u?[4,St(u)]:[3,4]);case 3:return v=g.sent(),[3,5];case 4:v=void 0,g.label=5;case 5:return[4,h.apply(l,[new(p.apply(Et,[void 0,(y.Logins=v,y)]))])];case 6:r=g.sent().IdentityId,c=void 0===r?function(){throw new wt("Response from Amazon Cognito contained no identity ID")}():r,e=c,f&&Promise.resolve(i.setItem(f,e)).catch((function(){})),g.label=7;case 7:return[2,(d=_t({client:o,customRoleArn:s,logins:u,identityId:e}))()]}}))}))};return function(){return d().catch((function(e){return Object(S.__awaiter)(t,void 0,void 0,(function(){return Object(S.__generator)(this,(function(t){throw f&&Promise.resolve(i.removeItem(f)).catch((function(){})),e}))}))}))}}var Tt=function(e,t){return(Tt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function Ct(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Tt(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var xt=function(){return(xt=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)};function Pt(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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function kt(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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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])}}}Object.create;function Nt(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}Object.create;var Mt=n(72),jt=n(70),Rt=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,Dt)},Dt=function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()};for(var Ut=function(){function e(e){var t=(void 0===e?{}:e).requestTimeout;this.requestTimeout=t}return e.prototype.destroy=function(){},e.prototype.handle=function(e,t){var n=(void 0===t?{}:t).abortSignal,r=this.requestTimeout;if(null==n?void 0:n.aborted){var i=new Error("Request aborted");return i.name="AbortError",Promise.reject(i)}var o=e.path;if(e.query){var s=function(e){var t,n,r=[];try{for(var i=Object(S.__values)(Object.keys(e).sort()),o=i.next();!o.done;o=i.next()){var s=o.value,a=e[s];if(s=Rt(s),Array.isArray(a))for(var u=0,c=a.length;u<c;u++)r.push(s+"="+Rt(a[u]));else{var l=s;(a||"string"==typeof a)&&(l+="="+Rt(a)),r.push(l)}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r.join("&")}(e.query);s&&(o+="?"+s)}var a=e.port,u=e.method,c=e.protocol+"//"+e.hostname+(a?":"+a:"")+o,l={body:"GET"===u||"HEAD"===u?void 0:e.body,headers:new Headers(e.headers),method:u};"undefined"!=typeof AbortController&&(l.signal=n);var f,d=new Request(c,l),h=[fetch(d).then((function(e){var t,n,r=e.headers,i={};try{for(var o=Object(S.__values)(r.entries()),s=o.next();!s.done;s=o.next()){var a=s.value;i[a[0]]=a[1]}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return void 0!==e.body?{response:new ke({headers:i,statusCode:e.status,body:e.body})}:e.blob().then((function(t){return{response:new ke({headers:i,statusCode:e.status,body:t})}}))})),(f=r,void 0===f&&(f=0),new Promise((function(e,t){f&&setTimeout((function(){var e=new Error("Request did not complete within "+f+" ms");e.name="TimeoutError",t(e)}),f)})))];return n&&h.push(new Promise((function(e,t){n.onabort=function(){var e=new Error("Request aborted");e.name="AbortError",t(e)}}))),Promise.race(h)},e}(),Ft={},Lt=new Array(64),Bt=0,qt="A".charCodeAt(0),zt="Z".charCodeAt(0);Bt+qt<=zt;Bt++){var Kt=String.fromCharCode(Bt+qt);Ft[Kt]=Bt,Lt[Bt]=Kt}for(Bt=0,qt="a".charCodeAt(0),zt="z".charCodeAt(0);Bt+qt<=zt;Bt++){Kt=String.fromCharCode(Bt+qt);var Ht=Bt+26;Ft[Kt]=Ht,Lt[Ht]=Kt}for(Bt=0;Bt<10;Bt++){Ft[Bt.toString(10)]=Bt+52;Kt=Bt.toString(10),Ht=Bt+52;Ft[Kt]=Ht,Lt[Ht]=Kt}Ft["+"]=62,Lt[62]="+",Ft["/"]=63,Lt[63]="/";function Vt(e){var t=e.length/4*3;"=="===e.substr(-2)?t-=2:"="===e.substr(-1)&&t--;for(var n=new ArrayBuffer(t),r=new DataView(n),i=0;i<e.length;i+=4){for(var o=0,s=0,a=i,u=i+3;a<=u;a++)"="!==e[a]?(o|=Ft[e[a]]<<6*(u-a),s+=6):o>>=6;var c=i/4*3;o>>=s%8;for(var l=Math.floor(s/8),f=0;f<l;f++){var d=8*(l-f-1);r.setUint8(c+f,(o&255<<d)>>d)}}return new Uint8Array(n)}function Gt(e){return new Promise((function(t,n){var r=new FileReader;r.onloadend=function(){var e;if(2!==r.readyState)return n(new Error("Reader aborted too early"));var i=null!==(e=r.result)&&void 0!==e?e:"",o=i.indexOf(","),s=o>-1?o+1:i.length;t(i.substring(s))},r.onabort=function(){return n(new Error("Read aborted"))},r.onerror=function(){return n(r.error)},r.readAsDataURL(e)}))}var Wt={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Yt=function(e){return{applyToStack:function(t){t.add(function(e){return function(t,n){return function(r){return Object(S.__awaiter)(void 0,void 0,void 0,(function(){var i;return Object(S.__generator)(this,(function(o){return(null===(i=null==e?void 0:e.retryStrategy)||void 0===i?void 0:i.mode)&&(n.userAgent=Object(S.__spread)(n.userAgent||[],[["cfg/retry-mode",e.retryStrategy.mode]])),[2,e.retryStrategy.retry(t,r)]}))}))}}}(e),Wt)}}},Jt=["AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch"],$t=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],Zt=["AbortError","TimeoutError","RequestTimeout","RequestTimeoutException"],Qt=[500,502,503,504],Xt=function(e){var t,n;return 429===(null===(t=e.$metadata)||void 0===t?void 0:t.httpStatusCode)||$t.includes(e.name)||1==(null===(n=e.$retryable)||void 0===n?void 0:n.throttling)},en=n(69),tn=function(e,t){return Math.floor(Math.min(2e4,Math.random()*Math.pow(2,t)*e))},nn=function(e){return!!e&&(function(e){return void 0!==e.$retryable}(e)||function(e){return Jt.includes(e.name)}(e)||Xt(e)||function(e){var t;return Zt.includes(e.name)||Qt.includes((null===(t=e.$metadata)||void 0===t?void 0:t.httpStatusCode)||0)}(e))},rn=function(){function e(e,t){var n,r,i,o,s,a,u,c;this.maxAttemptsProvider=e,this.mode="standard",this.retryDecider=null!==(n=null==t?void 0:t.retryDecider)&&void 0!==n?n:nn,this.delayDecider=null!==(r=null==t?void 0:t.delayDecider)&&void 0!==r?r:tn,this.retryQuota=null!==(i=null==t?void 0:t.retryQuota)&&void 0!==i?i:(s=o=500,a=o,u=function(e){return"TimeoutError"===e.name?10:5},c=function(e){return u(e)<=a},Object.freeze({hasRetryTokens:c,retrieveRetryTokens:function(e){if(!c(e))throw new Error("No retry token available");var t=u(e);return a-=t,t},releaseRetryTokens:function(e){a+=null!=e?e:1,a=Math.min(a,s)}}))}return e.prototype.shouldRetry=function(e,t,n){return t<n&&this.retryDecider(e)&&this.retryQuota.hasRetryTokens(e)},e.prototype.getMaxAttempts=function(){return Object(S.__awaiter)(this,void 0,void 0,(function(){var e;return Object(S.__generator)(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.maxAttemptsProvider()];case 1:return e=t.sent(),[3,3];case 2:return t.sent(),e=3,[3,3];case 3:return[2,e]}}))}))},e.prototype.retry=function(e,t){return Object(S.__awaiter)(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c;return Object(S.__generator)(this,(function(l){switch(l.label){case 0:return r=0,i=0,[4,this.getMaxAttempts()];case 1:o=l.sent(),s=t.request,Ne.isInstance(s)&&(s.headers["amz-sdk-invocation-id"]=Object(en.v4)()),a=function(){var a,c,l,f,d;return Object(S.__generator)(this,(function(h){switch(h.label){case 0:return h.trys.push([0,2,,5]),Ne.isInstance(s)&&(s.headers["amz-sdk-request"]="attempt="+(r+1)+"; max="+o),[4,e(t)];case 1:return a=h.sent(),c=a.response,l=a.output,u.retryQuota.releaseRetryTokens(n),l.$metadata.attempts=r+1,l.$metadata.totalRetryDelay=i,[2,{value:{response:c,output:l}}];case 2:return f=h.sent(),r++,u.shouldRetry(f,r,o)?(n=u.retryQuota.retrieveRetryTokens(f),d=u.delayDecider(Xt(f)?500:100,r),i+=d,[4,new Promise((function(e){return setTimeout(e,d)}))]):[3,4];case 3:return h.sent(),[2,"continue"];case 4:throw f.$metadata||(f.$metadata={}),f.$metadata.attempts=r,f.$metadata.totalRetryDelay=i,f;case 5:return[2]}}))},u=this,l.label=2;case 2:return[5,a()];case 3:return"object"==typeof(c=l.sent())?[2,c.value]:[3,2];case 4:return[2]}}))}))},e}(),on=function(e){if(void 0===e&&(e=3),"number"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};var sn=n(71),an=n.n(sn);var un="cognito-identity.{region}.amazonaws.com",cn=new Set(["af-south-1","ap-east-1","ap-northeast-1","ap-northeast-2","ap-south-1","ap-southeast-1","ap-southeast-2","ca-central-1","eu-central-1","eu-north-1","eu-south-1","eu-west-1","eu-west-2","eu-west-3","me-south-1","sa-east-1","us-east-1","us-east-2","us-west-1","us-west-2"]),ln=new Set(["cn-north-1","cn-northwest-1"]),fn=new Set(["us-iso-east-1"]),dn=new Set(["us-isob-east-1"]),hn=new Set(["us-gov-east-1","us-gov-west-1"]);var pn,vn,yn,gn,mn={apiVersion:"2014-06-30",disableHostPrefix:!1,logger:{},regionInfoProvider:function(e,t){var n=void 0;switch(e){case"ap-northeast-1":n={hostname:"cognito-identity.ap-northeast-1.amazonaws.com",partition:"aws"};break;case"ap-northeast-2":n={hostname:"cognito-identity.ap-northeast-2.amazonaws.com",partition:"aws"};break;case"ap-south-1":n={hostname:"cognito-identity.ap-south-1.amazonaws.com",partition:"aws"};break;case"ap-southeast-1":n={hostname:"cognito-identity.ap-southeast-1.amazonaws.com",partition:"aws"};break;case"ap-southeast-2":n={hostname:"cognito-identity.ap-southeast-2.amazonaws.com",partition:"aws"};break;case"ca-central-1":n={hostname:"cognito-identity.ca-central-1.amazonaws.com",partition:"aws"};break;case"cn-north-1":n={hostname:"cognito-identity.cn-north-1.amazonaws.com.cn",partition:"aws-cn"};break;case"eu-central-1":n={hostname:"cognito-identity.eu-central-1.amazonaws.com",partition:"aws"};break;case"eu-north-1":n={hostname:"cognito-identity.eu-north-1.amazonaws.com",partition:"aws"};break;case"eu-west-1":n={hostname:"cognito-identity.eu-west-1.amazonaws.com",partition:"aws"};break;case"eu-west-2":n={hostname:"cognito-identity.eu-west-2.amazonaws.com",partition:"aws"};break;case"eu-west-3":n={hostname:"cognito-identity.eu-west-3.amazonaws.com",partition:"aws"};break;case"fips-us-east-1":n={hostname:"cognito-identity-fips.us-east-1.amazonaws.com",partition:"aws",signingRegion:"us-east-1"};break;case"fips-us-east-2":n={hostname:"cognito-identity-fips.us-east-2.amazonaws.com",partition:"aws",signingRegion:"us-east-2"};break;case"fips-us-gov-west-1":n={hostname:"cognito-identity-fips.us-gov-west-1.amazonaws.com",partition:"aws-us-gov",signingRegion:"us-gov-west-1"};break;case"fips-us-west-2":n={hostname:"cognito-identity-fips.us-west-2.amazonaws.com",partition:"aws",signingRegion:"us-west-2"};break;case"sa-east-1":n={hostname:"cognito-identity.sa-east-1.amazonaws.com",partition:"aws"};break;case"us-east-1":n={hostname:"cognito-identity.us-east-1.amazonaws.com",partition:"aws"};break;case"us-east-2":n={hostname:"cognito-identity.us-east-2.amazonaws.com",partition:"aws"};break;case"us-gov-west-1":n={hostname:"cognito-identity.us-gov-west-1.amazonaws.com",partition:"aws-us-gov"};break;case"us-west-1":n={hostname:"cognito-identity.us-west-1.amazonaws.com",partition:"aws"};break;case"us-west-2":n={hostname:"cognito-identity.us-west-2.amazonaws.com",partition:"aws"};break;default:cn.has(e)&&(n={hostname:un.replace("{region}",e),partition:"aws"}),ln.has(e)&&(n={hostname:"cognito-identity.{region}.amazonaws.com.cn".replace("{region}",e),partition:"aws-cn"}),fn.has(e)&&(n={hostname:"cognito-identity.{region}.c2s.ic.gov".replace("{region}",e),partition:"aws-iso"}),dn.has(e)&&(n={hostname:"cognito-identity.{region}.sc2s.sgov.gov".replace("{region}",e),partition:"aws-iso-b"}),hn.has(e)&&(n={hostname:"cognito-identity.{region}.amazonaws.com".replace("{region}",e),partition:"aws-us-gov"}),void 0===n&&(n={hostname:un.replace("{region}",e),partition:"aws"})}return Promise.resolve(xt({signingService:"cognito-identity"},n))},serviceId:"Cognito Identity",urlParser:function(e){var t,n=new URL(e),r=n.hostname,i=n.pathname,o=n.port,s=n.protocol,a=n.search;return a&&(t=function(e){var t,n,r={};if(e=e.replace(/^\?/,""))try{for(var i=Object(S.__values)(e.split("&")),o=i.next();!o.done;o=i.next()){var s=o.value,a=Object(S.__read)(s.split("="),2),u=a[0],c=a[1],l=void 0===c?null:c;u=decodeURIComponent(u),l&&(l=decodeURIComponent(l)),u in r?Array.isArray(r[u])?r[u].push(l):r[u]=[r[u],l]:r[u]=l}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}(a)),{hostname:r,port:o?parseInt(o):void 0,protocol:s,path:i,query:t}}},bn=xt(xt({},mn),{runtime:"browser",base64Decoder:Vt,base64Encoder:function(e){for(var t="",n=0;n<e.length;n+=3){for(var r=0,i=0,o=n,s=Math.min(n+3,e.length);o<s;o++)r|=e[o]<<8*(s-o-1),i+=8;var a=Math.ceil(i/6);r<<=6*a-i;for(var u=1;u<=a;u++){var c=6*(a-u);t+=Lt[(r&63<<c)>>c]}t+="==".slice(0,4-a)}return t},bodyLengthChecker:function(e){if("string"==typeof e){for(var t=e.length,n=t-1;n>=0;n--){var r=e.charCodeAt(n);r>127&&r<=2047?t++:r>2047&&r<=65535&&(t+=2)}return t}return"number"==typeof e.byteLength?e.byteLength:"number"==typeof e.size?e.size:void 0},credentialDefaultProvider:function(e){return function(){return Promise.reject(new Error("Credential is missing"))}},defaultUserAgentProvider:(vn={serviceId:mn.serviceId,clientVersion:Mt.version},yn=vn.serviceId,gn=vn.clientVersion,function(){return Object(S.__awaiter)(void 0,void 0,void 0,(function(){var e,t,n,r,i,o,s,a,u;return Object(S.__generator)(this,(function(c){return e=(null===(n=null===window||void 0===window?void 0:window.navigator)||void 0===n?void 0:n.userAgent)?an.a.parse(window.navigator.userAgent):void 0,t=[["aws-sdk-js",gn],["os/"+((null===(r=null==e?void 0:e.os)||void 0===r?void 0:r.name)||"other"),null===(i=null==e?void 0:e.os)||void 0===i?void 0:i.version],["lang/js"],["md/browser",(null!==(s=null===(o=null==e?void 0:e.browser)||void 0===o?void 0:o.name)&&void 0!==s?s:"unknown")+"_"+(null!==(u=null===(a=null==e?void 0:e.browser)||void 0===a?void 0:a.version)&&void 0!==u?u:"unknown")]],yn&&t.push(["api/"+yn,gn]),[2,t]}))}))}),maxAttempts:3,region:(pn="Region is missing",function(){return Promise.reject(pn)}),requestHandler:new Ut,sha256:jt.Sha256,streamCollector:function(e){return"function"==typeof Blob&&e instanceof Blob?function(e){return Object(S.__awaiter)(this,void 0,void 0,(function(){var t,n;return Object(S.__generator)(this,(function(r){switch(r.label){case 0:return[4,Gt(e)];case 1:return t=r.sent(),n=Vt(t),[2,new Uint8Array(n)]}}))}))}(e):function(e){return Object(S.__awaiter)(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return Object(S.__generator)(this,(function(u){switch(u.label){case 0:t=new Uint8Array(0),n=e.getReader(),r=!1,u.label=1;case 1:return r?[3,3]:[4,n.read()];case 2:return i=u.sent(),o=i.done,(s=i.value)&&(a=t,(t=new Uint8Array(a.length+s.length)).set(a),t.set(s,a.length)),r=o,[3,1];case 3:return[2,t]}}))}))}(e)},utf8Decoder:function(e){return"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e.charCodeAt(n);if(i<128)t.push(i);else if(i<2048)t.push(i>>6|192,63&i|128);else if(n+1<e.length&&55296==(64512&i)&&56320==(64512&e.charCodeAt(n+1))){var o=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n));t.push(o>>18|240,o>>12&63|128,o>>6&63|128,63&o|128)}else t.push(i>>12|224,i>>6&63|128,63&i|128)}return Uint8Array.from(t)}(e)},utf8Encoder:function(e){return"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):function(e){for(var t="",n=0,r=e.length;n<r;n++){var i=e[n];if(i<128)t+=String.fromCharCode(i);else if(192<=i&&i<224){var o=e[++n];t+=String.fromCharCode((31&i)<<6|63&o)}else if(240<=i&&i<365){var s="%"+[i,e[++n],e[++n],e[++n]].map((function(e){return e.toString(16)})).join("%");t+=decodeURIComponent(s)}else t+=String.fromCharCode((15&i)<<12|(63&e[++n])<<6|63&e[++n])}return t}(e)}}),wn=function(e){var t=e.endpoint,n=e.urlParser;if("string"==typeof t){var r=Promise.resolve(n(t));return function(){return r}}if("object"==typeof t){var i=Promise.resolve(t);return function(){return i}}return t},Sn=function(e){return Object(S.__awaiter)(void 0,void 0,void 0,(function(){var t,n,r,i,o;return Object(S.__generator)(this,(function(s){switch(s.label){case 0:return t=e.tls,n=void 0===t||t,[4,e.region()];case 1:if(r=s.sent(),!new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/).test(r))throw new Error("Invalid region in client config");return[4,e.regionInfoProvider(r)];case 2:if(!(i=(null!==(o=s.sent())&&void 0!==o?o:{}).hostname))throw new Error("Cannot resolve hostname from client config");return[2,e.urlParser((n?"https:":"http:")+"//"+i)]}}))}))},_n=function(e){if("string"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};var En={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},An=function(e){return{applyToStack:function(t){t.add(function(e){var t=this;return function(n){return function(r){return Object(S.__awaiter)(t,void 0,void 0,(function(){var t,i,o,s,a;return Object(S.__generator)(this,(function(u){return t=r.request,Ne.isInstance(t)&&(i=t.body,o=t.headers,i&&-1===Object.keys(o).map((function(e){return e.toLowerCase()})).indexOf("content-length")&&void 0!==(s=e(i))&&(t.headers=Object(S.__assign)(Object(S.__assign)({},t.headers),((a={})["content-length"]=String(s),a)))),[2,n(Object(S.__assign)(Object(S.__assign)({},r),{request:t}))]}))}))}}}(e.bodyLengthChecker),En)}}};for(var On={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},In=function(e){return{applyToStack:function(t){t.add(function(e){return function(t){return function(n){return Object(S.__awaiter)(void 0,void 0,void 0,(function(){var r,i;return Object(S.__generator)(this,(function(o){return Ne.isInstance(n.request)?(r=n.request,i=(e.requestHandler.metadata||{}).handlerProtocol,(void 0===i?"":i).indexOf("h2")>=0&&!r.headers[":authority"]?(delete r.headers.host,r.headers[":authority"]=""):r.headers.host||(r.headers.host=r.hostname),[2,t(n)]):[2,t(n)]}))}))}}}(e),On)}}},Tn={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},Cn=function(e){return{applyToStack:function(e){e.add((function(e,t){return function(n){return Object(S.__awaiter)(void 0,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,f;return Object(S.__generator)(this,(function(d){switch(d.label){case 0:return r=t.clientName,i=t.commandName,o=t.inputFilterSensitiveLog,s=t.logger,a=t.outputFilterSensitiveLog,[4,e(n)];case 1:return u=d.sent(),s?("function"==typeof s.info&&(c=u.output,l=c.$metadata,f=Object(S.__rest)(c,["$metadata"]),s.info({clientName:r,commandName:i,input:o(n.input),output:a(f),metadata:l})),[2,u]):[2,u]}}))}))}}),Tn)}}},xn={},Pn={},kn=0;kn<256;kn++){var Nn=kn.toString(16).toLowerCase();1===Nn.length&&(Nn="0"+Nn),xn[kn]=Nn,Pn[Nn]=kn}function Mn(e){for(var t="",n=0;n<e.byteLength;n++)t+=xn[e[n]];return t}var jn="X-Amz-Date".toLowerCase(),Rn=["authorization",jn,"date"],Dn="X-Amz-Signature".toLowerCase(),Un="X-Amz-Security-Token".toLowerCase(),Fn={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},Ln=/^proxy-/,Bn=/^sec-/,qn="AWS4-HMAC-SHA256-PAYLOAD",zn={},Kn=[];function Hn(e,t,n){return e+"/"+t+"/"+n+"/aws4_request"}function Vn(e,t,n){var r=new e(t);return r.update(n),r.digest()}function Gn(e,t,n){var r,i,o=e.headers,s={};try{for(var a=Object(S.__values)(Object.keys(o).sort()),u=a.next();!u.done;u=a.next()){var c=u.value,l=c.toLowerCase();(l in Fn||(null==t?void 0:t.has(l))||Ln.test(l)||Bn.test(l))&&(!n||n&&!n.has(l))||(s[l]=o[c].trim().replace(/\s+/g," "))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return s}var Wn=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,Yn)},Yn=function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()};function Jn(e,t){var n=e.headers,r=e.body;return Object(S.__awaiter)(this,void 0,void 0,(function(){var e,i,o,s,a,u,c;return Object(S.__generator)(this,(function(l){switch(l.label){case 0:try{for(e=Object(S.__values)(Object.keys(n)),i=e.next();!i.done;i=e.next())if("x-amz-content-sha256"===(o=i.value).toLowerCase())return[2,n[o]]}catch(e){u={error:e}}finally{try{i&&!i.done&&(c=e.return)&&c.call(e)}finally{if(u)throw u.error}}return null!=r?[3,1]:[2,"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"];case 1:return"string"==typeof r||ArrayBuffer.isView(r)||(f=r,"function"==typeof ArrayBuffer&&f instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(f))?((s=new t).update(r),a=Mn,[4,s.digest()]):[3,3];case 2:return[2,a.apply(void 0,[l.sent()])];case 3:return[2,"UNSIGNED-PAYLOAD"]}var f}))}))}function $n(e){var t=e.headers,n=e.query,r=Object(S.__rest)(e,["headers","query"]);return Object(S.__assign)(Object(S.__assign)({},r),{headers:Object(S.__assign)({},t),query:n?Zn(n):void 0})}function Zn(e){return Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object(S.__assign)(Object(S.__assign)({},t),((r={})[n]=Array.isArray(i)?Object(S.__spread)(i):i,r))}),{})}function Qn(e){var t,n;e="function"==typeof e.clone?e.clone():$n(e);try{for(var r=Object(S.__values)(Object.keys(e.headers)),i=r.next();!i.done;i=r.next()){var o=i.value;Rn.indexOf(o.toLowerCase())>-1&&delete e.headers[o]}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return e}function Xn(e){return function(e){if("number"==typeof e)return new Date(1e3*e);if("string"==typeof e)return Number(e)?new Date(1e3*Number(e)):new Date(e);return e}(e).toISOString().replace(/\.\d{3}Z$/,"Z")}var er=function(){function e(e){var t=e.applyChecksum,n=e.credentials,r=e.region,i=e.service,o=e.sha256,s=e.uriEscapePath,a=void 0===s||s;this.service=i,this.sha256=o,this.uriEscapePath=a,this.applyChecksum="boolean"!=typeof t||t,this.regionProvider=rr(r),this.credentialProvider=ir(n)}return e.prototype.presign=function(e,t){return void 0===t&&(t={}),Object(S.__awaiter)(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b,w,_,E,A,O,I;return Object(S.__generator)(this,(function(T){switch(T.label){case 0:return n=t.signingDate,r=void 0===n?new Date:n,i=t.expiresIn,o=void 0===i?3600:i,s=t.unsignableHeaders,a=t.unhoistableHeaders,u=t.signableHeaders,c=t.signingRegion,l=t.signingService,[4,this.credentialProvider()];case 1:return f=T.sent(),null==c?[3,2]:(h=c,[3,4]);case 2:return[4,this.regionProvider()];case 3:h=T.sent(),T.label=4;case 4:return d=h,p=tr(r),v=p.longDate,y=p.shortDate,o>604800?[2,Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future")]:(g=Hn(y,d,null!=l?l:this.service),m=function(e,t){var n,r,i;void 0===t&&(t={});var o="function"==typeof e.clone?e.clone():$n(e),s=o.headers,a=o.query,u=void 0===a?{}:a;try{for(var c=Object(S.__values)(Object.keys(s)),l=c.next();!l.done;l=c.next()){var f=l.value,d=f.toLowerCase();"x-amz-"!==d.substr(0,6)||(null===(i=t.unhoistableHeaders)||void 0===i?void 0:i.has(d))||(u[f]=s[f],delete s[f])}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}return Object(S.__assign)(Object(S.__assign)({},e),{headers:s,query:u})}(Qn(e),{unhoistableHeaders:a}),f.sessionToken&&(m.query["X-Amz-Security-Token"]=f.sessionToken),m.query["X-Amz-Algorithm"]="AWS4-HMAC-SHA256",m.query["X-Amz-Credential"]=f.accessKeyId+"/"+g,m.query["X-Amz-Date"]=v,m.query["X-Amz-Expires"]=o.toString(10),b=Gn(m,s,u),m.query["X-Amz-SignedHeaders"]=nr(b),w=m.query,_="X-Amz-Signature",E=this.getSignature,A=[v,g,this.getSigningKey(f,d,y,l)],O=this.createCanonicalRequest,I=[m,b],[4,Jn(e,this.sha256)]);case 5:return[4,E.apply(this,A.concat([O.apply(this,I.concat([T.sent()]))]))];case 6:return w[_]=T.sent(),[2,m]}}))}))},e.prototype.sign=function(e,t){return Object(S.__awaiter)(this,void 0,void 0,(function(){return Object(S.__generator)(this,(function(n){return"string"==typeof e?[2,this.signString(e,t)]:e.headers&&e.payload?[2,this.signEvent(e,t)]:[2,this.signRequest(e,t)]}))}))},e.prototype.signEvent=function(e,t){var n=e.headers,r=e.payload,i=t.signingDate,o=void 0===i?new Date:i,s=t.priorSignature,a=t.signingRegion,u=t.signingService;return Object(S.__awaiter)(this,void 0,void 0,(function(){var e,t,i,c,l,f,d,h,p,v,y;return Object(S.__generator)(this,(function(g){switch(g.label){case 0:return null==a?[3,1]:(t=a,[3,3]);case 1:return[4,this.regionProvider()];case 2:t=g.sent(),g.label=3;case 3:return e=t,i=tr(o),c=i.shortDate,l=i.longDate,f=Hn(c,e,null!=u?u:this.service),[4,Jn({headers:{},body:r},this.sha256)];case 4:return d=g.sent(),(h=new this.sha256).update(n),v=Mn,[4,h.digest()];case 5:return p=v.apply(void 0,[g.sent()]),y=[qn,l,f,s,p,d].join("\n"),[2,this.signString(y,{signingDate:o,signingRegion:e,signingService:u})]}}))}))},e.prototype.signString=function(e,t){var n=void 0===t?{}:t,r=n.signingDate,i=void 0===r?new Date:r,o=n.signingRegion,s=n.signingService;return Object(S.__awaiter)(this,void 0,void 0,(function(){var t,n,r,a,u,c,l,f;return Object(S.__generator)(this,(function(d){switch(d.label){case 0:return[4,this.credentialProvider()];case 1:return t=d.sent(),null==o?[3,2]:(r=o,[3,4]);case 2:return[4,this.regionProvider()];case 3:r=d.sent(),d.label=4;case 4:return n=r,a=tr(i).shortDate,l=(c=this.sha256).bind,[4,this.getSigningKey(t,n,a,s)];case 5:return(u=new(l.apply(c,[void 0,d.sent()]))).update(e),f=Mn,[4,u.digest()];case 6:return[2,f.apply(void 0,[d.sent()])]}}))}))},e.prototype.signRequest=function(e,t){var n=void 0===t?{}:t,r=n.signingDate,i=void 0===r?new Date:r,o=n.signableHeaders,s=n.unsignableHeaders,a=n.signingRegion,u=n.signingService;return Object(S.__awaiter)(this,void 0,void 0,(function(){var t,n,r,c,l,f,d,h,p,v,y;return Object(S.__generator)(this,(function(g){switch(g.label){case 0:return[4,this.credentialProvider()];case 1:return t=g.sent(),null==a?[3,2]:(r=a,[3,4]);case 2:return[4,this.regionProvider()];case 3:r=g.sent(),g.label=4;case 4:return n=r,c=Qn(e),l=tr(i),f=l.longDate,d=l.shortDate,h=Hn(d,n,null!=u?u:this.service),c.headers[jn]=f,t.sessionToken&&(c.headers[Un]=t.sessionToken),[4,Jn(c,this.sha256)];case 5:return p=g.sent(),!function(e,t){var n,r;e=e.toLowerCase();try{for(var i=Object(S.__values)(Object.keys(t)),o=i.next();!o.done;o=i.next()){if(e===o.value.toLowerCase())return!0}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1}("x-amz-content-sha256",c.headers)&&this.applyChecksum&&(c.headers["x-amz-content-sha256"]=p),v=Gn(c,s,o),[4,this.getSignature(f,h,this.getSigningKey(t,n,d,u),this.createCanonicalRequest(c,v,p))];case 6:return y=g.sent(),c.headers.authorization="AWS4-HMAC-SHA256 Credential="+t.accessKeyId+"/"+h+", SignedHeaders="+nr(v)+", Signature="+y,[2,c]}}))}))},e.prototype.createCanonicalRequest=function(e,t,n){var r=Object.keys(t).sort();return e.method+"\n"+this.getCanonicalPath(e)+"\n"+function(e){var t,n,r=e.query,i=void 0===r?{}:r,o=[],s={},a=function(e){if(e.toLowerCase()===Dn)return"continue";o.push(e);var t=i[e];"string"==typeof t?s[e]=Wn(e)+"="+Wn(t):Array.isArray(t)&&(s[e]=t.slice(0).sort().reduce((function(t,n){return t.concat([Wn(e)+"="+Wn(n)])}),[]).join("&"))};try{for(var u=Object(S.__values)(Object.keys(i).sort()),c=u.next();!c.done;c=u.next()){a(c.value)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}return o.map((function(e){return s[e]})).filter((function(e){return e})).join("&")}(e)+"\n"+r.map((function(e){return e+":"+t[e]})).join("\n")+"\n\n"+r.join(";")+"\n"+n},e.prototype.createStringToSign=function(e,t,n){return Object(S.__awaiter)(this,void 0,void 0,(function(){var r,i;return Object(S.__generator)(this,(function(o){switch(o.label){case 0:return(r=new this.sha256).update(n),[4,r.digest()];case 1:return i=o.sent(),[2,"AWS4-HMAC-SHA256\n"+e+"\n"+t+"\n"+Mn(i)]}}))}))},e.prototype.getCanonicalPath=function(e){var t=e.path;return this.uriEscapePath?"/"+encodeURIComponent(t.replace(/^\//,"")).replace(/%2F/g,"/"):t},e.prototype.getSignature=function(e,t,n,r){return Object(S.__awaiter)(this,void 0,void 0,(function(){var i,o,s,a,u;return Object(S.__generator)(this,(function(c){switch(c.label){case 0:return[4,this.createStringToSign(e,t,r)];case 1:return i=c.sent(),a=(s=this.sha256).bind,[4,n];case 2:return(o=new(a.apply(s,[void 0,c.sent()]))).update(i),u=Mn,[4,o.digest()];case 3:return[2,u.apply(void 0,[c.sent()])]}}))}))},e.prototype.getSigningKey=function(e,t,n,r){return function(e,t,n,r,i){return Object(S.__awaiter)(void 0,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h;return Object(S.__generator)(this,(function(p){switch(p.label){case 0:return[4,Vn(e,t.secretAccessKey,t.accessKeyId)];case 1:if(o=p.sent(),(s=n+":"+r+":"+i+":"+Mn(o)+":"+t.sessionToken)in zn)return[2,zn[s]];for(Kn.push(s);Kn.length>50;)delete zn[Kn.shift()];a="AWS4"+t.secretAccessKey,p.label=2;case 2:p.trys.push([2,7,8,9]),u=Object(S.__values)([n,r,i,"aws4_request"]),c=u.next(),p.label=3;case 3:return c.done?[3,6]:(l=c.value,[4,Vn(e,a,l)]);case 4:a=p.sent(),p.label=5;case 5:return c=u.next(),[3,3];case 6:return[3,9];case 7:return f=p.sent(),d={error:f},[3,9];case 8:try{c&&!c.done&&(h=u.return)&&h.call(u)}finally{if(d)throw d.error}return[7];case 9:return[2,zn[s]=a]}}))}))}(this.sha256,e,n,t,r||this.service)},e}(),tr=function(e){var t=Xn(e).replace(/[\-:]/g,"");return{longDate:t,shortDate:t.substr(0,8)}},nr=function(e){return Object.keys(e).sort().join(";")},rr=function(e){if("string"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e},ir=function(e){if("object"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};function or(e){if("object"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e}var sr,ar,ur,cr,lr,fr,dr,hr,pr,vr,yr,gr,mr,br,wr,Sr,_r,Er,Ar,Or,Ir,Tr,Cr,xr,Pr,kr,Nr,Mr,jr,Rr,Dr,Ur,Fr,Lr,Br,qr,zr,Kr,Hr,Vr,Gr,Wr,Yr,Jr,$r,Zr,Qr,Xr,ei,ti,ni,ri,ii,oi,si,ai,ui,ci=/[^\!\#\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,li=function(e){var t=Object(S.__read)(e,2),n=t[0],r=t[1],i=n.indexOf("/"),o=n.substring(0,i),s=n.substring(i+1);return"api"===o&&(s=s.toLowerCase()),[o,s,r].filter((function(e){return e&&e.length>0})).map((function(e){return null==e?void 0:e.replace(ci,"_")})).join("/")},fi={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},di=function(e){return{applyToStack:function(t){var n;t.add((n=e,function(e,t){return function(r){return Object(S.__awaiter)(void 0,void 0,void 0,(function(){var i,o,s,a,u,c,l,f;return Object(S.__generator)(this,(function(d){switch(d.label){case 0:return i=r.request,Ne.isInstance(i)?(o=i.headers,s=(null===(l=null==t?void 0:t.userAgent)||void 0===l?void 0:l.map(li))||[],[4,n.defaultUserAgentProvider()]):[2,e(r)];case 1:return a=d.sent().map(li),u=(null===(f=null==n?void 0:n.customUserAgent)||void 0===f?void 0:f.map(li))||[],o["x-amz-user-agent"]=Object(S.__spread)(a,s,u).join(" "),c=Object(S.__spread)(a.filter((function(e){return e.startsWith("aws-sdk-")})),u).join(" "),"browser"!==n.runtime&&c&&(o["user-agent"]=o["user-agent"]?o["user-agent"]+" "+c:c),[2,e(Object(S.__assign)(Object(S.__assign)({},r),{request:i}))]}}))}))}}),fi)}}},hi=function(e){function t(t){var n,r,i=this,o=function(e){var t,n=this,r=or(e.credentials||e.credentialDefaultProvider(e)),i=e.signingEscapePath,o=void 0===i||i,s=e.systemClockOffset,a=void 0===s?e.systemClockOffset||0:s,u=e.sha256;return t=e.signer?or(e.signer):function(){return or(e.region)().then((function(t){return Object(S.__awaiter)(n,void 0,void 0,(function(){return Object(S.__generator)(this,(function(n){switch(n.label){case 0:return[4,e.regionInfoProvider(t)];case 1:return[2,[n.sent()||{},t]]}}))}))})).then((function(t){var n=Object(S.__read)(t,2),i=n[0],s=n[1],a=i.signingRegion,c=i.signingService;return e.signingRegion=e.signingRegion||a||s,e.signingName=e.signingName||c||e.serviceId,new er({credentials:r,region:e.signingRegion,service:e.signingName,sha256:u,uriEscapePath:o})}))},Object(S.__assign)(Object(S.__assign)({},e),{systemClockOffset:a,signingEscapePath:o,credentials:r,signer:t})}(function(e){var t;return Object(S.__assign)(Object(S.__assign)({},e),{tls:null===(t=e.tls)||void 0===t||t,endpoint:e.endpoint?wn(e):function(){return Sn(e)},isCustomEndpoint:!!e.endpoint})}(function(e){if(!e.region)throw new Error("Region is missing");return Object(S.__assign)(Object(S.__assign)({},e),{region:_n(e.region)})}(xt(xt({},bn),t)))),s=function(e){return Object(S.__assign)(Object(S.__assign)({},e),{customUserAgent:"string"==typeof e.customUserAgent?[[e.customUserAgent]]:e.customUserAgent})}((r=on((n=o).maxAttempts),Object(S.__assign)(Object(S.__assign)({},n),{maxAttempts:r,retryStrategy:n.retryStrategy||new rn(r)})));return(i=e.call(this,s)||this).config=s,i.middlewareStack.use(Yt(i.config)),i.middlewareStack.use(An(i.config)),i.middlewareStack.use(In(i.config)),i.middlewareStack.use(Cn(i.config)),i.middlewareStack.use(di(i.config)),i}return Ct(t,e),t.prototype.destroy=function(){e.prototype.destroy.call(this)},t}(yt);!function(e){e.AUTHENTICATED_ROLE="AuthenticatedRole",e.DENY="Deny"}(sr||(sr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(ar||(ar={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(ur||(ur={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(cr||(cr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(lr||(lr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(fr||(fr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(dr||(dr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(hr||(hr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(pr||(pr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(vr||(vr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(yr||(yr={})),function(e){e.ACCESS_DENIED="AccessDenied",e.INTERNAL_SERVER_ERROR="InternalServerError"}(gr||(gr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(mr||(mr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(br||(br={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(wr||(wr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Sr||(Sr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(_r||(_r={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Er||(Er={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Ar||(Ar={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Or||(Or={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Ir||(Ir={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Tr||(Tr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Cr||(Cr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(xr||(xr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Pr||(Pr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(kr||(kr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Nr||(Nr={})),function(e){e.CONTAINS="Contains",e.EQUALS="Equals",e.NOT_EQUAL="NotEqual",e.STARTS_WITH="StartsWith"}(Mr||(Mr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(jr||(jr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Rr||(Rr={})),function(e){e.RULES="Rules",e.TOKEN="Token"}(Dr||(Dr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Ur||(Ur={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Fr||(Fr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Lr||(Lr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Br||(Br={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(qr||(qr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(zr||(zr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Kr||(Kr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Hr||(Hr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Vr||(Vr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Gr||(Gr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Wr||(Wr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Yr||(Yr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Jr||(Jr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}($r||($r={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Zr||(Zr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Qr||(Qr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Xr||(Xr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(ei||(ei={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(ti||(ti={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(ni||(ni={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(ri||(ri={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(ii||(ii={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(oi||(oi={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(si||(si={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(ai||(ai={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(ui||(ui={}));var pi=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return kt(this,(function(g){switch(g.label){case 0:return r=[xt({},e)],y={},[4,Ki(e.body,t)];case 1:switch(n=xt.apply(void 0,r.concat([(y.body=g.sent(),y)])),o="UnknownError",o=Hi(e,n.body),o){case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":return[3,2];case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":return[3,4];case"InvalidIdentityPoolConfigurationException":case"com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException":return[3,6];case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":return[3,8];case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":return[3,10];case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":return[3,12];case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":return[3,14];case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":return[3,16]}return[3,18];case 2:return s=[{}],[4,yi(n,t)];case 3:return i=xt.apply(void 0,[xt.apply(void 0,s.concat([g.sent()])),{name:o,$metadata:Bi(e)}]),[3,19];case 4:return a=[{}],[4,gi(n,t)];case 5:return i=xt.apply(void 0,[xt.apply(void 0,a.concat([g.sent()])),{name:o,$metadata:Bi(e)}]),[3,19];case 6:return u=[{}],[4,mi(n,t)];case 7:return i=xt.apply(void 0,[xt.apply(void 0,u.concat([g.sent()])),{name:o,$metadata:Bi(e)}]),[3,19];case 8:return c=[{}],[4,bi(n,t)];case 9:return i=xt.apply(void 0,[xt.apply(void 0,c.concat([g.sent()])),{name:o,$metadata:Bi(e)}]),[3,19];case 10:return l=[{}],[4,Si(n,t)];case 11:return i=xt.apply(void 0,[xt.apply(void 0,l.concat([g.sent()])),{name:o,$metadata:Bi(e)}]),[3,19];case 12:return f=[{}],[4,_i(n,t)];case 13:return i=xt.apply(void 0,[xt.apply(void 0,f.concat([g.sent()])),{name:o,$metadata:Bi(e)}]),[3,19];case 14:return d=[{}],[4,Ei(n,t)];case 15:return i=xt.apply(void 0,[xt.apply(void 0,d.concat([g.sent()])),{name:o,$metadata:Bi(e)}]),[3,19];case 16:return h=[{}],[4,Ai(n,t)];case 17:return i=xt.apply(void 0,[xt.apply(void 0,h.concat([g.sent()])),{name:o,$metadata:Bi(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=xt(xt({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:Bi(e)}),g.label=19;case 19:return v=i.message||i.Message||o,i.message=v,delete i.Message,[2,Promise.reject(Object.assign(new Error(v),i))]}}))}))},vi=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return kt(this,(function(g){switch(g.label){case 0:return r=[xt({},e)],y={},[4,Ki(e.body,t)];case 1:switch(n=xt.apply(void 0,r.concat([(y.body=g.sent(),y)])),o="UnknownError",o=Hi(e,n.body),o){case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":return[3,2];case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":return[3,4];case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":return[3,6];case"LimitExceededException":case"com.amazonaws.cognitoidentity#LimitExceededException":return[3,8];case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":return[3,10];case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":return[3,12];case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":return[3,14];case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":return[3,16]}return[3,18];case 2:return s=[{}],[4,yi(n,t)];case 3:return i=xt.apply(void 0,[xt.apply(void 0,s.concat([g.sent()])),{name:o,$metadata:Bi(e)}]),[3,19];case 4:return a=[{}],[4,gi(n,t)];case 5:return i=xt.apply(void 0,[xt.apply(void 0,a.concat([g.sent()])),{name:o,$metadata:Bi(e)}]),[3,19];case 6:return u=[{}],[4,bi(n,t)];case 7:return i=xt.apply(void 0,[xt.apply(void 0,u.concat([g.sent()])),{name:o,$metadata:Bi(e)}]),[3,19];case 8:return c=[{}],[4,wi(n,t)];case 9:return i=xt.apply(void 0,[xt.apply(void 0,c.concat([g.sent()])),{name:o,$metadata:Bi(e)}]),[3,19];case 10:return l=[{}],[4,Si(n,t)];case 11:return i=xt.apply(void 0,[xt.apply(void 0,l.concat([g.sent()])),{name:o,$metadata:Bi(e)}]),[3,19];case 12:return f=[{}],[4,_i(n,t)];case 13:return i=xt.apply(void 0,[xt.apply(void 0,f.concat([g.sent()])),{name:o,$metadata:Bi(e)}]),[3,19];case 14:return d=[{}],[4,Ei(n,t)];case 15:return i=xt.apply(void 0,[xt.apply(void 0,d.concat([g.sent()])),{name:o,$metadata:Bi(e)}]),[3,19];case 16:return h=[{}],[4,Ai(n,t)];case 17:return i=xt.apply(void 0,[xt.apply(void 0,h.concat([g.sent()])),{name:o,$metadata:Bi(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=xt(xt({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:Bi(e)}),g.label=19;case 19:return v=i.message||i.Message||o,i.message=v,delete i.Message,[2,Promise.reject(Object.assign(new Error(v),i))]}}))}))},yi=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return kt(this,(function(i){return n=e.body,r=xi(n,t),[2,xt({name:"ExternalServiceException",$fault:"client",$metadata:Bi(e)},r)]}))}))},gi=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return kt(this,(function(i){return n=e.body,r=Ni(n,t),[2,xt({name:"InternalErrorException",$fault:"server",$metadata:Bi(e)},r)]}))}))},mi=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return kt(this,(function(i){return n=e.body,r=Mi(n,t),[2,xt({name:"InvalidIdentityPoolConfigurationException",$fault:"client",$metadata:Bi(e)},r)]}))}))},bi=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return kt(this,(function(i){return n=e.body,r=ji(n,t),[2,xt({name:"InvalidParameterException",$fault:"client",$metadata:Bi(e)},r)]}))}))},wi=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return kt(this,(function(i){return n=e.body,r=Ri(n,t),[2,xt({name:"LimitExceededException",$fault:"client",$metadata:Bi(e)},r)]}))}))},Si=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return kt(this,(function(i){return n=e.body,r=Di(n,t),[2,xt({name:"NotAuthorizedException",$fault:"client",$metadata:Bi(e)},r)]}))}))},_i=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return kt(this,(function(i){return n=e.body,r=Ui(n,t),[2,xt({name:"ResourceConflictException",$fault:"client",$metadata:Bi(e)},r)]}))}))},Ei=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return kt(this,(function(i){return n=e.body,r=Fi(n,t),[2,xt({name:"ResourceNotFoundException",$fault:"client",$metadata:Bi(e)},r)]}))}))},Ai=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return kt(this,(function(i){return n=e.body,r=Li(n,t),[2,xt({name:"TooManyRequestsException",$fault:"client",$metadata:Bi(e)},r)]}))}))},Oi=function(e,t){return xt(xt(xt({},void 0!==e.CustomRoleArn&&null!==e.CustomRoleArn&&{CustomRoleArn:e.CustomRoleArn}),void 0!==e.IdentityId&&null!==e.IdentityId&&{IdentityId:e.IdentityId}),void 0!==e.Logins&&null!==e.Logins&&{Logins:Ti(e.Logins,t)})},Ii=function(e,t){return xt(xt(xt({},void 0!==e.AccountId&&null!==e.AccountId&&{AccountId:e.AccountId}),void 0!==e.IdentityPoolId&&null!==e.IdentityPoolId&&{IdentityPoolId:e.IdentityPoolId}),void 0!==e.Logins&&null!==e.Logins&&{Logins:Ti(e.Logins,t)})},Ti=function(e,t){return Object.entries(e).reduce((function(e,t){var n,r=Nt(t,2),i=r[0],o=r[1];return null===o?e:xt(xt({},e),((n={})[i]=o,n))}),{})},Ci=function(e,t){return{AccessKeyId:void 0!==e.AccessKeyId&&null!==e.AccessKeyId?e.AccessKeyId:void 0,Expiration:void 0!==e.Expiration&&null!==e.Expiration?new Date(Math.round(1e3*e.Expiration)):void 0,SecretKey:void 0!==e.SecretKey&&null!==e.SecretKey?e.SecretKey:void 0,SessionToken:void 0!==e.SessionToken&&null!==e.SessionToken?e.SessionToken:void 0}},xi=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Pi=function(e,t){return{Credentials:void 0!==e.Credentials&&null!==e.Credentials?Ci(e.Credentials):void 0,IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},ki=function(e,t){return{IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},Ni=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Mi=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},ji=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ri=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Di=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ui=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Fi=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Li=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Bi=function(e){var t;return{httpStatusCode:e.statusCode,requestId:null!==(t=e.headers["x-amzn-requestid"])&&void 0!==t?t:e.headers["x-amzn-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}},qi=function(e,t){return void 0===e&&(e=new Uint8Array),e instanceof Uint8Array?Promise.resolve(e):t.streamCollector(e)||Promise.resolve(new Uint8Array)},zi=function(e,t,n,r,i){return Pt(void 0,void 0,void 0,(function(){var o,s,a,u,c,l;return kt(this,(function(f){switch(f.label){case 0:return[4,e.endpoint()];case 1:return o=f.sent(),s=o.hostname,a=o.protocol,u=void 0===a?"https":a,c=o.port,l={protocol:u,hostname:s,port:c,method:"POST",path:n,headers:t},void 0!==r&&(l.hostname=r),void 0!==i&&(l.body=i),[2,new Ne(l)]}}))}))},Ki=function(e,t){return function(e,t){return qi(e,t).then((function(e){return t.utf8Encoder(e)}))}(e,t).then((function(e){return e.length?JSON.parse(e):{}}))},Hi=function(e,t){var n,r,i=function(e){var t=e;return t.indexOf(":")>=0&&(t=t.split(":")[0]),t.indexOf("#")>=0&&(t=t.split("#")[1]),t},o=(n=e.headers,r="x-amzn-errortype",Object.keys(n).find((function(e){return e.toLowerCase()===r.toLowerCase()})));return void 0!==o?i(e.headers[o]):void 0!==t.code?i(t.code):void 0!==t.__type?i(t.__type):""},Vi=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return Ct(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(dt(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetIdCommand",inputFilterSensitiveLog:Pr.filterSensitiveLog,outputFilterSensitiveLog:kr.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return kt(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetId"},r=JSON.stringify(Ii(e,t)),[2,zi(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r,i;return kt(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,vi(e,t)]:[4,Ki(e.body,t)];case 1:return n=o.sent(),{},r=ki(n,t),i=xt({$metadata:Bi(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(gt),Gi=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return Ct(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(dt(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetCredentialsForIdentityCommand",inputFilterSensitiveLog:Ir.filterSensitiveLog,outputFilterSensitiveLog:Cr.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return kt(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetCredentialsForIdentity"},r=JSON.stringify(Oi(e,t)),[2,zi(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r,i;return kt(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,pi(e,t)]:[4,Ki(e.body,t)];case 1:return n=o.sent(),{},r=Pi(n,t),i=xt({$metadata:Bi(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(gt),Wi=function(){return(Wi=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)},Yi=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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Ji=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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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=new r.a("Credentials"),Zi=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=m.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=Wi(Wi({},this._refreshHandlers),t)),this._storage=this._config.storage,this._storage||(this._storage=(new i.a).getStorage()),this._storageSync=Promise.resolve(),"function"==typeof this._storage.sync&&(this._storageSync=this._storage.sync()),this._config},e.prototype.get=function(){return $i.debug("getting credentials"),this._pickupCredentials()},e.prototype._getCognitoIdentityIdStorageKey=function(e){return"CognitoIdentityId-"+e},e.prototype._pickupCredentials=function(){return $i.debug("picking up credentials"),this._gettingCredPromise&&this._gettingCredPromise.isPending()?$i.debug("getting old cred promise"):($i.debug("getting new cred promise"),this._gettingCredPromise=Object(o.d)(this._keepAlive())),this._gettingCredPromise},e.prototype._keepAlive=function(){return Yi(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return Ji(this,(function(a){switch(a.label){case 0:if($i.debug("checking if credentials exists and not expired"),(e=this._credentials)&&!this._isExpired(e)&&!this._isPastTTL())return $i.debug("credentials not changed and not expired, directly return"),[2,Promise.resolve(e)];if($i.debug("need to get a new credential or refresh the existing one"),t=this.Auth,!(n=void 0===t?w.a.Auth:t)||"function"!=typeof n.currentUserCredentials)return[2,Promise.reject("No Auth module registered in Amplify")];if(this._isExpired(e)||!this._isPastTTL())return[3,6];$i.debug("ttl has passed but token is not yet expired"),a.label=1;case 1:return a.trys.push([1,5,,6]),[4,n.currentUserPoolUser()];case 2:return r=a.sent(),[4,n.currentSession()];case 3:return i=a.sent(),o=i.refreshToken,[4,new Promise((function(e,t){r.refreshSession(o,(function(n,r){return n?t(n):e(r)}))}))];case 4:return a.sent(),[3,6];case 5:return s=a.sent(),$i.debug("Error attempting to refreshing the session",s),[3,6];case 6:return[2,n.currentUserCredentials()]}}))}))},e.prototype.refreshFederatedToken=function(e){$i.debug("Getting federated credentials");var t=e.provider,n=e.user,r=e.token,i=e.identity_id,o=e.expires_at;o=1970===new Date(o).getFullYear()?1e3*o:o;return $i.debug("checking if federated jwt token expired"),o>(new Date).getTime()?($i.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]?($i.debug("getting refreshed jwt token from federation provider"),this._providerRefreshWithRetry({refreshHandler:this._refreshHandlers[t],provider:t,user:n})):($i.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 Object(s.c)(n,[],1e4).then((function(e){return $i.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(),$i.debug("refresh federated token failed",e),Promise.reject("refreshing federation token failed: "+e)}))},e.prototype._isExpired=function(e){if(!e)return $i.debug("no credentials for expiration check"),!0;$i.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 Yi(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a=this;return Ji(this,(function(u){switch(u.label){case 0:return $i.debug("setting credentials for guest"),e=this._config,t=e.identityPoolId,n=e.region,e.mandatorySignIn?[2,Promise.reject("cannot get guest credentials when mandatory signin enabled")]:t?n?(i=this,[4,this._getGuestIdentityId()]):($i.debug("region is not configured for getting the credentials"),[2,Promise.reject("region is not configured for getting the credentials")]):($i.debug("No Cognito Identity pool provided for unauthenticated access"),[2,Promise.reject("No Cognito Identity pool provided for unauthenticated access")]);case 1:return r=i._identityId=u.sent(),o=new hi({region:n,customUserAgent:Object(b.b)()}),s=void 0,s=r?_t({identityId:r,client:o})():function(){return Yi(a,void 0,void 0,(function(){var e;return Ji(this,(function(n){switch(n.label){case 0:return[4,o.send(new Vi({IdentityPoolId:t}))];case 1:return e=n.sent().IdentityId,this._identityId=e,[2,_t({client:o,identityId:e})()]}}))}))}().catch((function(e){return Yi(a,void 0,void 0,(function(){return Ji(this,(function(t){throw e}))}))})),[2,this._loadCredentials(s,"guest",!1,null).then((function(e){return e})).catch((function(e){return Yi(a,void 0,void 0,(function(){var n=this;return Ji(this,(function(i){switch(i.label){case 0:return"ResourceNotFoundException"!==e.name||e.message!=="Identity '"+r+"' not found."?[3,2]:($i.debug("Failed to load guest credentials"),[4,this._removeGuestIdentityId()]);case 1:return i.sent(),s=function(){return Yi(n,void 0,void 0,(function(){var e;return Ji(this,(function(n){switch(n.label){case 0:return[4,o.send(new Vi({IdentityPoolId:t}))];case 1:return e=n.sent().IdentityId,this._identityId=e,[2,_t({client:o,identityId:e})()]}}))}))}().catch((function(e){return Yi(n,void 0,void 0,(function(){return Ji(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 $i.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");if(!u)return $i.debug("region is not configured for getting the credentials"),Promise.reject("region is not configured for getting the credentials");var c=new hi({region:u,customUserAgent:Object(b.b)()}),l=void 0;r?l=_t({identityId:r,logins:o,client:c})():l=It({logins:o,identityPoolId:a,client:c})();return this._loadCredentials(l,"federated",!0,e)},e.prototype._setCredentialsFromSession=function(e){var t=this;$i.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 $i.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");if(!i)return $i.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 hi({region:i,customUserAgent:Object(b.b)()}),c=Yi(t,void 0,void 0,(function(){var e,t,n,r,i,o,c,l,f,d;return Ji(this,(function(h){switch(h.label){case 0:return[4,this._getGuestIdentityId()];case 1:return(e=h.sent())?[3,3]:[4,u.send(new Vi({IdentityPoolId:s,Logins:a}))];case 2:n=h.sent().IdentityId,t=n,h.label=3;case 3:return[4,u.send(new Gi({IdentityId:e||t,Logins:a}))];case 4:return r=h.sent(),i=r.Credentials,o=i.AccessKeyId,c=i.Expiration,l=i.SecretKey,f=i.SessionToken,d=r.IdentityId,this._identityId=d,e?($i.debug("The guest identity "+e+" has been successfully linked to the logins"),e===d&&$i.debug("The guest identity "+e+" has become the primary identity"),[4,this._removeGuestIdentityId()]):[3,6];case 5:h.sent(),h.label=6;case 6:return[2,{accessKeyId:o,secretAccessKey:l,sessionToken:f,expiration:c,identityId:d}]}}))})).catch((function(e){return Yi(t,void 0,void 0,(function(){return Ji(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 Yi(i,void 0,void 0,(function(){var i,a,u,c,l;return Ji(this,(function(f){switch(f.label){case 0:if($i.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){$i.debug("Failed to put federated info into auth storage",e)}}return"guest"!==t?[3,2]:[4,this._setGuestIdentityId(e.identityId)];case 1:f.sent(),f.label=2;case 2:return s(o._credentials),[2]}}))}))})).catch((function(t){if(t)return $i.debug("Failed to load credentials",e),$i.debug("Error loading credentials",t),void a(t)}))}))},e.prototype.set=function(e,t){return"session"===t?this._setCredentialsFromSession(e):"federation"===t?this._setCredentialsFromFederation(e):"guest"===t?this._setCredentialsForGuest():($i.debug("no source specified for setting credentials"),Promise.reject("invalid source"))},e.prototype.clear=function(){return Yi(this,void 0,void 0,(function(){return Ji(this,(function(e){return this._credentials=null,this._credentials_source=null,$i.debug("removing aws-amplify-federatedInfo from storage"),this._storage.removeItem("aws-amplify-federatedInfo"),[2]}))}))},e.prototype._getGuestIdentityId=function(){return Yi(this,void 0,void 0,(function(){var e,t;return Ji(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(),$i.debug("Failed to get the cached guest identityId",t),[3,4];case 4:return[2]}}))}))},e.prototype._setGuestIdentityId=function(e){return Yi(this,void 0,void 0,(function(){var t,n;return Ji(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(),$i.debug("Failed to cache guest identityId",n),[3,4];case 4:return[2]}}))}))},e.prototype._removeGuestIdentityId=function(){return Yi(this,void 0,void 0,(function(){var e;return Ji(this,(function(t){return e=this._config.identityPoolId,$i.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);w.a.register(Zi)}])}));
95
+ t.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,l=-7,f=n?i-1:0,d=n?-1:1,h=e[t+f];for(f+=d,o=h&(1<<-l)-1,h>>=-l,l+=a;l>0;o=256*o+e[t+f],f+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+e[t+f],f+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,r),o-=c}return(h?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,u,c=8*o-i-1,l=(1<<c)-1,f=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,p=r?1:-1,v=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+f>=1?d/u:d*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*u-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[n+h]=255&a,h+=p,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[n+h]=255&s,h+=p,s/=256,c-=8);e[n+h-p]|=128*v}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t){},function(e,t){},function(e,t,n){var r,i,o,s;e.exports=(r=n(12),o=(i=r).lib.Base,s=i.enc.Utf8,void(i.algo.HMAC=o.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var n=e.blockSize,r=4*n;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),o=this._iKey=t.clone(),a=i.words,u=o.words,c=0;c<n;c++)a[c]^=1549556828,u[c]^=909522486;i.sigBytes=o.sigBytes=r,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(n))}})))},function(e,t){},function(e,t,n){e.exports=self.fetch||(self.fetch=n(47).default||n(47))},function(e,t,n){e.exports=n(93).Observable},function(e,t,n){"use strict";(function(e){!function(e,t){function n(e){return"function"==typeof Symbol&&Boolean(Symbol[e])}function r(e){return n(e)?Symbol[e]:"@@"+e}function i(e){setTimeout((function(){throw e}))}function o(e,t){var n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function s(e){var t=e.constructor;return void 0!==t&&null===(t=t[r("species")])&&(t=void 0),void 0!==t?t:d}function a(e,t){Object.keys(t).forEach((function(n){var r=Object.getOwnPropertyDescriptor(t,n);r.enumerable=!1,Object.defineProperty(e,n,r)}))}function u(e){var t=e._cleanup;if(t){e._cleanup=void 0;try{t()}catch(e){i(e)}}}function c(e){return void 0===e._observer}function l(e,t){if(Object(e)!==e)throw new TypeError("Observer must be an object");this._cleanup=void 0,this._observer=e;try{var n=o(e,"start");n&&n.call(e,this)}catch(e){i(e)}if(!c(this)){e=new f(this);try{var r=t.call(void 0,e);if(null!=r){if("function"==typeof r.unsubscribe)s=r,r=function(){s.unsubscribe()};else if("function"!=typeof r)throw new TypeError(r+" is not a function");this._cleanup=r}}catch(t){return void e.error(t)}var s;c(this)&&u(this)}}function f(e){this._subscription=e}function d(e){if(!(this instanceof d))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}"function"!=typeof Symbol||Symbol.observable||(Symbol.observable=Symbol("observable")),a(l.prototype={},{get closed(){return c(this)},unsubscribe:function(){var e;c(e=this)||(e._observer=void 0,u(e))}}),a(f.prototype={},{get closed(){return c(this._subscription)},next:function(e){var t=this._subscription;if(!c(t)){var n=t._observer;try{var r=o(n,"next");r&&r.call(n,e)}catch(e){i(e)}}},error:function(e){var t=this._subscription;if(c(t))i(e);else{var n=t._observer;t._observer=void 0;try{var r=o(n,"error");if(!r)throw e;r.call(n,e)}catch(e){i(e)}u(t)}},complete:function(){var e=this._subscription;if(!c(e)){var t=e._observer;e._observer=void 0;try{var n=o(t,"complete");n&&n.call(t)}catch(e){i(e)}u(e)}}}),a(d.prototype,{subscribe:function(e){for(var t=[],n=1;n<arguments.length;++n)t.push(arguments[n]);return"function"==typeof e?e={next:e,error:t[0],complete:t[1]}:"object"==typeof e&&null!==e||(e={}),new l(e,this._subscriber)},forEach:function(e){var t=this;return new Promise((function(n,r){if("function"!=typeof e)return Promise.reject(new TypeError(e+" is not a function"));t.subscribe({_subscription:null,start:function(e){if(Object(e)!==e)throw new TypeError(e+" is not an object");this._subscription=e},next:function(t){var n=this._subscription;if(!n.closed)try{e(t)}catch(e){r(e),n.unsubscribe()}},error:r,complete:n})}))},map:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(s(this))((function(n){return t.subscribe({next:function(t){if(!n.closed){try{t=e(t)}catch(e){return n.error(e)}n.next(t)}},error:function(e){n.error(e)},complete:function(){n.complete()}})}))},filter:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(s(this))((function(n){return t.subscribe({next:function(t){if(!n.closed){try{if(!e(t))return}catch(e){return n.error(e)}n.next(t)}},error:function(e){n.error(e)},complete:function(){n.complete()}})}))},reduce:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=s(this),r=arguments.length>1,i=!1,o=arguments[1],a=o;return new n((function(n){return t.subscribe({next:function(t){if(!n.closed){var o=!i;if(i=!0,!o||r)try{a=e(a,t)}catch(e){return n.error(e)}else a=t}},error:function(e){n.error(e)},complete:function(){if(!i&&!r)return n.error(new TypeError("Cannot reduce an empty sequence"));n.next(a),n.complete()}})}))}}),Object.defineProperty(d.prototype,r("observable"),{value:function(){return this},writable:!0,configurable:!0}),a(d,{from:function(e){var t="function"==typeof this?this:d;if(null==e)throw new TypeError(e+" is not an object");var i=o(e,r("observable"));if(i){var s=i.call(e);if(Object(s)!==s)throw new TypeError(s+" is not an object");return s.constructor===t?s:new t((function(e){return s.subscribe(e)}))}if(n("iterator")&&(i=o(e,r("iterator"))))return new t((function(t){for(var n,r=i.call(e)[Symbol.iterator]();!(n=r.next()).done;){var o=n.value;if(t.next(o),t.closed)return}t.complete()}));if(Array.isArray(e))return new t((function(t){for(var n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}));throw new TypeError(e+" is not observable")},of:function(){for(var e=[],t=0;t<arguments.length;++t)e.push(arguments[t]);var n="function"==typeof this?this:d;return new n((function(t){for(var n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}))}}),Object.defineProperty(d,r("species"),{get:function(){return this},configurable:!0}),Object.defineProperty(d,"extensions",{value:{observableSymbol:r("observable"),setHostReportError:function(e){i=e}}}),e.Observable=d}(t)}).call(this,n(49)(e))},function(e,t,n){(function(e,r){var i;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(o){t&&t.nodeType,e&&e.nodeType;var s="object"==typeof r&&r;s.global!==s&&s.window!==s&&s.self;var a,u=2147483647,c=/^xn--/,l=/[^\x20-\x7E]/,f=/[\x2E\u3002\uFF0E\uFF61]/g,d={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},h=Math.floor,p=String.fromCharCode;function v(e){throw new RangeError(d[e])}function y(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function g(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+y((e=e.replace(f,".")).split("."),t).join(".")}function m(e){for(var t,n,r=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(n=e.charCodeAt(i++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),i--):r.push(t);return r}function b(e){return y(e,(function(e){var t="";return e>65535&&(t+=p((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=p(e)})).join("")}function w(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function S(e,t,n){var r=0;for(e=n?h(e/700):e>>1,e+=h(e/t);e>455;r+=36)e=h(e/35);return h(r+36*e/(e+38))}function O(e){var t,n,r,i,o,s,a,c,l,f,d,p=[],y=e.length,g=0,m=128,w=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&v("not-basic"),p.push(e.charCodeAt(r));for(i=n>0?n+1:0;i<y;){for(o=g,s=1,a=36;i>=y&&v("invalid-input"),((c=(d=e.charCodeAt(i++))-48<10?d-22:d-65<26?d-65:d-97<26?d-97:36)>=36||c>h((u-g)/s))&&v("overflow"),g+=c*s,!(c<(l=a<=w?1:a>=w+26?26:a-w));a+=36)s>h(u/(f=36-l))&&v("overflow"),s*=f;w=S(g-o,t=p.length+1,0==o),h(g/t)>u-m&&v("overflow"),m+=h(g/t),g%=t,p.splice(g++,0,m)}return b(p)}function _(e){var t,n,r,i,o,s,a,c,l,f,d,y,g,b,O,_=[];for(y=(e=m(e)).length,t=128,n=0,o=72,s=0;s<y;++s)(d=e[s])<128&&_.push(p(d));for(r=i=_.length,i&&_.push("-");r<y;){for(a=u,s=0;s<y;++s)(d=e[s])>=t&&d<a&&(a=d);for(a-t>h((u-n)/(g=r+1))&&v("overflow"),n+=(a-t)*g,t=a,s=0;s<y;++s)if((d=e[s])<t&&++n>u&&v("overflow"),d==t){for(c=n,l=36;!(c<(f=l<=o?1:l>=o+26?26:l-o));l+=36)O=c-f,b=36-f,_.push(p(w(f+O%b,0))),c=h(O/b);_.push(p(w(c,0))),o=S(n,g,r==i),n=0,++r}++n,++t}return _.join("")}a={version:"1.4.1",ucs2:{decode:m,encode:b},decode:O,encode:_,toASCII:function(e){return g(e,(function(e){return l.test(e)?"xn--"+_(e):e}))},toUnicode:function(e){return g(e,(function(e){return c.test(e)?O(e.slice(4).toLowerCase()):e}))}},void 0===(i=function(){return a}.call(t,n,t,e))||(e.exports=i)}()}).call(this,n(49)(e),n(31))},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";t.decode=t.parse=n(97),t.encode=t.stringify=n(98)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,o){t=t||"&",n=n||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var l=0;l<c;++l){var f,d,h,p,v=e[l].replace(a,"%20"),y=v.indexOf(n);y>=0?(f=v.substr(0,y),d=v.substr(y+1)):(f=v,d=""),h=decodeURIComponent(f),p=decodeURIComponent(d),r(s,h)?i(s[h])?s[h].push(p):s[h]=[s[h],p]:s[h]=p}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,a){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),(function(s){var a=encodeURIComponent(r(s))+n;return i(e[s])?o(e[s],(function(e){return a+encodeURIComponent(r(e))})).join(t):a+encodeURIComponent(r(e[s]))})).join(t):a?encodeURIComponent(r(a))+n+encodeURIComponent(r(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var s=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}},function(e,t,n){var r,i,o=n(51),s=n(52),a=0,u=0;e.exports=function(e,t,n){var c=t&&n||0,l=t||[],f=(e=e||{}).node||r,d=void 0!==e.clockseq?e.clockseq:i;if(null==f||null==d){var h=o();null==f&&(f=r=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==d&&(d=i=16383&(h[6]<<8|h[7]))}var p=void 0!==e.msecs?e.msecs:(new Date).getTime(),v=void 0!==e.nsecs?e.nsecs:u+1,y=p-a+(v-u)/1e4;if(y<0&&void 0===e.clockseq&&(d=d+1&16383),(y<0||p>a)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=p,u=v,i=d;var g=(1e4*(268435455&(p+=122192928e5))+v)%4294967296;l[c++]=g>>>24&255,l[c++]=g>>>16&255,l[c++]=g>>>8&255,l[c++]=255&g;var m=p/4294967296*1e4&268435455;l[c++]=m>>>8&255,l[c++]=255&m,l[c++]=m>>>24&15|16,l[c++]=m>>>16&255,l[c++]=d>>>8|128,l[c++]=255&d;for(var b=0;b<6;++b)l[c+b]=f[b];return t||s(l)}},function(e,t,n){var r=n(51),i=n(52);e.exports=function(e,t,n){var o=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[o+a]=s[a];return t||i(s)}},function(e,t,n){"use strict";n.r(t),n.d(t,"__extends",(function(){return i})),n.d(t,"__assign",(function(){return o})),n.d(t,"__rest",(function(){return s})),n.d(t,"__decorate",(function(){return a})),n.d(t,"__param",(function(){return u})),n.d(t,"__metadata",(function(){return c})),n.d(t,"__awaiter",(function(){return l})),n.d(t,"__generator",(function(){return f})),n.d(t,"__createBinding",(function(){return d})),n.d(t,"__exportStar",(function(){return h})),n.d(t,"__values",(function(){return p})),n.d(t,"__read",(function(){return v})),n.d(t,"__spread",(function(){return y})),n.d(t,"__spreadArrays",(function(){return g})),n.d(t,"__await",(function(){return m})),n.d(t,"__asyncGenerator",(function(){return b})),n.d(t,"__asyncDelegator",(function(){return w})),n.d(t,"__asyncValues",(function(){return S})),n.d(t,"__makeTemplateObject",(function(){return O})),n.d(t,"__importStar",(function(){return _})),n.d(t,"__importDefault",(function(){return E})),n.d(t,"__classPrivateFieldGet",(function(){return A})),n.d(t,"__classPrivateFieldSet",(function(){return I}));
96
+ /*! *****************************************************************************
97
+ Copyright (c) Microsoft Corporation.
98
+
99
+ Permission to use, copy, modify, and/or distribute this software for any
100
+ purpose with or without fee is hereby granted.
101
+
102
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
103
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
104
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
105
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
106
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
107
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
108
+ PERFORMANCE OF THIS SOFTWARE.
109
+ ***************************************************************************** */
110
+ var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function i(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function s(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function a(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function u(e,t){return function(n,r){t(n,r,e)}}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function f(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next: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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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 d(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}function h(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||(t[n]=e[n])}function p(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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(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 y(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(v(arguments[t]));return e}function g(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}function m(e){return this instanceof m?(this.v=e,this):new m(e)}function b(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{(n=i[e](t)).value instanceof m?Promise.resolve(n.value.v).then(u,c):l(o[0][2],n)}catch(e){l(o[0][3],e)}var n}function u(e){a("next",e)}function c(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function w(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:m(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function S(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=p(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}function O(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function _(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function E(e){return e&&e.__esModule?e:{default:e}}function A(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function I(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(53),i=n(55),o=n(109),s=n(117),a=n(119),u=n(39),c=function(){function e(e){(0,s.supportsWebCrypto)((0,u.locateWindow)())?this.hash=new i.Sha256(e):(0,a.isMsWindow)((0,u.locateWindow)())?this.hash=new r.Sha256(e):this.hash=new o.Sha256(e)}return e.prototype.update=function(e,t){this.hash.update(e,t)},e.prototype.digest=function(){return this.hash.digest()},e}();t.Sha256=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyData=void 0,t.isEmptyData=function(e){return"string"==typeof e?0===e.length:0===e.byteLength}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=t.numToUint8=t.isEmptyData=t.convertToBuffer=void 0;var r=n(105);Object.defineProperty(t,"convertToBuffer",{enumerable:!0,get:function(){return r.convertToBuffer}});var i=n(106);Object.defineProperty(t,"isEmptyData",{enumerable:!0,get:function(){return i.isEmptyData}});var o=n(107);Object.defineProperty(t,"numToUint8",{enumerable:!0,get:function(){return o.numToUint8}});var s=n(108);Object.defineProperty(t,"uint32ArrayFrom",{enumerable:!0,get:function(){return s.uint32ArrayFrom}})},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var r=n(69),i=void 0!==e&&e.from?function(t){return e.from(t,"utf8")}:r.fromUtf8;t.convertToBuffer=function(e){return e instanceof Uint8Array?e:"string"==typeof e?i(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}}).call(this,n(6).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyData=void 0,t.isEmptyData=function(e){return"string"==typeof e?0===e.length:0===e.byteLength}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.numToUint8=void 0,t.numToUint8=function(e){return new Uint8Array([(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=void 0,t.uint32ArrayFrom=function(e){if(!Array.from){for(var t=new Uint32Array(e.length);0<e.length;)t[0]=e[0];return t}return Uint32Array.from(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),(0,n(56).__exportStar)(n(110),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(56),i=n(57),o=n(111),s=n(112),a=function(){function e(e){if(this.hash=new o.RawSha256,e){this.outer=new o.RawSha256;var t=function(e){var t=(0,s.convertToBuffer)(e);if(t.byteLength>i.BLOCK_SIZE){var n=new o.RawSha256;n.update(t),t=n.digest()}var r=new Uint8Array(i.BLOCK_SIZE);return r.set(t),r}(e),n=new Uint8Array(i.BLOCK_SIZE);n.set(t);for(var r=0;r<i.BLOCK_SIZE;r++)t[r]^=54,n[r]^=92;this.hash.update(t),this.outer.update(n);for(r=0;r<t.byteLength;r++)t[r]=0}}return e.prototype.update=function(e){if(!(0,s.isEmptyData)(e)&&!this.error)try{this.hash.update((0,s.convertToBuffer)(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return(0,r.__awaiter)(this,void 0,void 0,(function(){return(0,r.__generator)(this,(function(e){return[2,this.digestSync()]}))}))},e}();t.Sha256=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RawSha256=void 0;var r=n(57),i=function(){function e(){this.state=Int32Array.from(r.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,n=e.byteLength;if(this.bytesHashed+=n,8*this.bytesHashed>r.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[t++],n--,this.bufferLength===r.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(t.setUint8(this.bufferLength++,128),n%r.BLOCK_SIZE>=r.BLOCK_SIZE-8){for(var i=this.bufferLength;i<r.BLOCK_SIZE;i++)t.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(i=this.bufferLength;i<r.BLOCK_SIZE-8;i++)t.setUint8(i,0);t.setUint32(r.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),t.setUint32(r.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}var o=new Uint8Array(r.DIGEST_LENGTH);for(i=0;i<8;i++)o[4*i]=this.state[i]>>>24&255,o[4*i+1]=this.state[i]>>>16&255,o[4*i+2]=this.state[i]>>>8&255,o[4*i+3]=this.state[i]>>>0&255;return o},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],u=t[5],c=t[6],l=t[7],f=0;f<r.BLOCK_SIZE;f++){if(f<16)this.temp[f]=(255&e[4*f])<<24|(255&e[4*f+1])<<16|(255&e[4*f+2])<<8|255&e[4*f+3];else{var d=this.temp[f-2],h=(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,p=((d=this.temp[f-15])>>>7|d<<25)^(d>>>18|d<<14)^d>>>3;this.temp[f]=(h+this.temp[f-7]|0)+(p+this.temp[f-16]|0)}var v=(((a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7))+(a&u^~a&c)|0)+(l+(r.KEY[f]+this.temp[f]|0)|0)|0,y=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&i^n&o^i&o)|0;l=c,c=u,u=a,a=s+v|0,s=o,o=i,i=n,n=v+y|0}t[0]+=n,t[1]+=i,t[2]+=o,t[3]+=s,t[4]+=a,t[5]+=u,t[6]+=c,t[7]+=l},e}();t.RawSha256=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=t.numToUint8=t.isEmptyData=t.convertToBuffer=void 0;var r=n(113);Object.defineProperty(t,"convertToBuffer",{enumerable:!0,get:function(){return r.convertToBuffer}});var i=n(114);Object.defineProperty(t,"isEmptyData",{enumerable:!0,get:function(){return i.isEmptyData}});var o=n(115);Object.defineProperty(t,"numToUint8",{enumerable:!0,get:function(){return o.numToUint8}});var s=n(116);Object.defineProperty(t,"uint32ArrayFrom",{enumerable:!0,get:function(){return s.uint32ArrayFrom}})},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var r=n(148),i=void 0!==e&&e.from?function(t){return e.from(t,"utf8")}:r.fromUtf8;t.convertToBuffer=function(e){return e instanceof Uint8Array?e:"string"==typeof e?i(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}}).call(this,n(6).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyData=void 0,t.isEmptyData=function(e){return"string"==typeof e?0===e.length:0===e.byteLength}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.numToUint8=void 0,t.numToUint8=function(e){return new Uint8Array([(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=void 0,t.uint32ArrayFrom=function(e){if(!Array.from){for(var t=new Uint32Array(e.length);0<e.length;)t[0]=e[0];return t}return Uint32Array.from(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(58).__exportStar(n(118),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.supportsZeroByteGCM=t.supportsSubtleCrypto=t.supportsSecureRandom=t.supportsWebCrypto=void 0;var r=n(58),i=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function o(e){return"object"==typeof e&&"object"==typeof e.crypto&&"function"==typeof e.crypto.getRandomValues}function s(e){return e&&i.every((function(t){return"function"==typeof e[t]}))}t.supportsWebCrypto=function(e){return!(!o(e)||"object"!=typeof e.crypto.subtle)&&s(e.crypto.subtle)},t.supportsSecureRandom=o,t.supportsSubtleCrypto=s,t.supportsZeroByteGCM=function(e){return r.__awaiter(this,void 0,void 0,(function(){var t;return r.__generator(this,(function(n){switch(n.label){case 0:if(!s(e))return[2,!1];n.label=1;case 1:return n.trys.push([1,4,,5]),[4,e.generateKey({name:"AES-GCM",length:128},!1,["encrypt"])];case 2:return t=n.sent(),[4,e.encrypt({name:"AES-GCM",iv:new Uint8Array(Array(12)),additionalData:new Uint8Array(Array(16)),tagLength:128},t,new Uint8Array(0))];case 3:return[2,16===n.sent().byteLength];case 4:return n.sent(),[2,!1];case 5:return[2]}}))}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(120);r.__exportStar(n(121),t),r.__exportStar(n(122),t),r.__exportStar(n(123),t),r.__exportStar(n(124),t),r.__exportStar(n(125),t)},function(e,t,n){"use strict";n.r(t),n.d(t,"__extends",(function(){return i})),n.d(t,"__assign",(function(){return o})),n.d(t,"__rest",(function(){return s})),n.d(t,"__decorate",(function(){return a})),n.d(t,"__param",(function(){return u})),n.d(t,"__metadata",(function(){return c})),n.d(t,"__awaiter",(function(){return l})),n.d(t,"__generator",(function(){return f})),n.d(t,"__createBinding",(function(){return d})),n.d(t,"__exportStar",(function(){return h})),n.d(t,"__values",(function(){return p})),n.d(t,"__read",(function(){return v})),n.d(t,"__spread",(function(){return y})),n.d(t,"__spreadArrays",(function(){return g})),n.d(t,"__await",(function(){return m})),n.d(t,"__asyncGenerator",(function(){return b})),n.d(t,"__asyncDelegator",(function(){return w})),n.d(t,"__asyncValues",(function(){return S})),n.d(t,"__makeTemplateObject",(function(){return O})),n.d(t,"__importStar",(function(){return _})),n.d(t,"__importDefault",(function(){return E})),n.d(t,"__classPrivateFieldGet",(function(){return A})),n.d(t,"__classPrivateFieldSet",(function(){return I}));
111
+ /*! *****************************************************************************
112
+ Copyright (c) Microsoft Corporation.
113
+
114
+ Permission to use, copy, modify, and/or distribute this software for any
115
+ purpose with or without fee is hereby granted.
116
+
117
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
118
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
119
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
120
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
121
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
122
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
123
+ PERFORMANCE OF THIS SOFTWARE.
124
+ ***************************************************************************** */
125
+ var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function i(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function s(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function a(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function u(e,t){return function(n,r){t(n,r,e)}}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function f(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next: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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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 d(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}function h(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||(t[n]=e[n])}function p(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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(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 y(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(v(arguments[t]));return e}function g(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}function m(e){return this instanceof m?(this.v=e,this):new m(e)}function b(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{(n=i[e](t)).value instanceof m?Promise.resolve(n.value.v).then(u,c):l(o[0][2],n)}catch(e){l(o[0][3],e)}var n}function u(e){a("next",e)}function c(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function w(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:m(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function S(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=p(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}function O(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function _(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function E(e){return e&&e.__esModule?e:{default:e}}function A(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function I(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isMsWindow=void 0;var r=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];t.isMsWindow=function(e){if(function(e){return"MSInputMethodContext"in e&&"msCrypto"in e}(e)&&void 0!==e.msCrypto.subtle){var t=e.msCrypto,n=t.getRandomValues,i=t.subtle;return r.map((function(e){return i[e]})).concat(n).every((function(e){return"function"==typeof e}))}return!1}},function(e,t,n){"use strict";var r=n(13),i=n(59),o=n(127),s=n(65);var a=function e(t){var n=new o(t),a=i(o.prototype.request,n);return r.extend(a,o.prototype,n),r.extend(a,n),a.create=function(n){return e(s(t,n))},a}(n(32));a.Axios=o,a.Cancel=n(33),a.CancelToken=n(140),a.isCancel=n(64),a.VERSION=n(66).version,a.all=function(e){return Promise.all(e)},a.spread=n(141),a.isAxiosError=n(142),e.exports=a,e.exports.default=a},function(e,t,n){"use strict";var r=n(13),i=n(60),o=n(128),s=n(129),a=n(65),u=n(139),c=u.validators;function l(e){this.defaults=e,this.interceptors={request:new o,response:new o}}l.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var n=t.transitional;void 0!==n&&u.assertOptions(n,{silentJSONParsing:c.transitional(c.boolean),forcedJSONParsing:c.transitional(c.boolean),clarifyTimeoutError:c.transitional(c.boolean)},!1);var r=[],i=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(i=i&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var o,l=[];if(this.interceptors.response.forEach((function(e){l.push(e.fulfilled,e.rejected)})),!i){var f=[s,void 0];for(Array.prototype.unshift.apply(f,r),f=f.concat(l),o=Promise.resolve(t);f.length;)o=o.then(f.shift(),f.shift());return o}for(var d=t;r.length;){var h=r.shift(),p=r.shift();try{d=h(d)}catch(e){p(e);break}}try{o=s(d)}catch(e){return Promise.reject(e)}for(;l.length;)o=o.then(l.shift(),l.shift());return o},l.prototype.getUri=function(e){return e=a(this.defaults,e),i(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function(e){l.prototype[e]=function(t,n){return this.request(a(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(e){l.prototype[e]=function(t,n,r){return this.request(a(r||{},{method:e,url:t,data:n}))}})),e.exports=l},function(e,t,n){"use strict";var r=n(13);function i(){this.handlers=[]}i.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){r.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=i},function(e,t,n){"use strict";var r=n(13),i=n(130),o=n(64),s=n(32),a=n(33);function u(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new a("canceled")}e.exports=function(e){return u(e),e.headers=e.headers||{},e.data=i.call(e,e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||s.adapter)(e).then((function(t){return u(e),t.data=i.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(u(e),t&&t.response&&(t.response.data=i.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,n){"use strict";var r=n(13),i=n(32);e.exports=function(e,t,n){var o=this||i;return r.forEach(n,(function(n){e=n.call(o,e,t)})),e}},function(e,t,n){"use strict";var r=n(13);e.exports=function(e,t){r.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))}},function(e,t,n){"use strict";var r=n(63);e.exports=function(e,t,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},function(e,t,n){"use strict";var r=n(13);e.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,i,o,s){var a=[];a.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(i)&&a.push("path="+i),r.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,n){"use strict";var r=n(135),i=n(136);e.exports=function(e,t){return e&&!r(t)?i(e,t):t}},function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var r=n(13),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,o,s={};return e?(r.forEach(e.split("\n"),(function(e){if(o=e.indexOf(":"),t=r.trim(e.substr(0,o)).toLowerCase(),n=r.trim(e.substr(o+1)),t){if(s[t]&&i.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([n]):s[t]?s[t]+", "+n:n}})),s):s}},function(e,t,n){"use strict";var r=n(13);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=i(window.location.href),function(t){var n=r.isString(t)?i(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},function(e,t,n){"use strict";var r=n(66).version,i={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){i[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var o={};i.transitional=function(e,t,n){function i(e,t){return"[Axios v"+r+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,r,s){if(!1===e)throw new Error(i(r," has been removed"+(t?" in "+t:"")));return t&&!o[r]&&(o[r]=!0,console.warn(i(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,s)}},e.exports={assertOptions:function(e,t,n){if("object"!=typeof e)throw new TypeError("options must be an object");for(var r=Object.keys(e),i=r.length;i-- >0;){var o=r[i],s=t[o];if(s){var a=e[o],u=void 0===a||s(a,o,e);if(!0!==u)throw new TypeError("option "+o+" must be "+u)}else if(!0!==n)throw Error("Unknown option "+o)}},validators:i}},function(e,t,n){"use strict";var r=n(33);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;this.promise.then((function(e){if(n._listeners){var t,r=n._listeners.length;for(t=0;t<r;t++)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},i.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){"use strict";var r=n(13);e.exports=function(e){return r.isObject(e)&&!0===e.isAxiosError}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(67),i=n(68),o=n(144),s=n(147),a=function(){function e(e){if(this.hash=new o.RawSha256,e){this.outer=new o.RawSha256;var t=function(e){var t=u(e);if(t.byteLength>i.BLOCK_SIZE){var n=new o.RawSha256;n.update(t),t=n.digest()}var r=new Uint8Array(i.BLOCK_SIZE);return r.set(t),r}(e),n=new Uint8Array(i.BLOCK_SIZE);n.set(t);for(var r=0;r<i.BLOCK_SIZE;r++)t[r]^=54,n[r]^=92;this.hash.update(t),this.outer.update(n);for(r=0;r<t.byteLength;r++)t[r]=0}}return e.prototype.update=function(e){if(!function(e){if("string"==typeof e)return 0===e.length;return 0===e.byteLength}(e)&&!this.error)try{this.hash.update(u(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.digestSync()]}))}))},e}();function u(e){return"string"==typeof e?s.fromUtf8(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.Sha256=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(68),i=function(){function e(){this.state=Int32Array.from(r.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,n=e.byteLength;if(this.bytesHashed+=n,8*this.bytesHashed>r.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[t++],n--,this.bufferLength===r.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(t.setUint8(this.bufferLength++,128),n%r.BLOCK_SIZE>=r.BLOCK_SIZE-8){for(var i=this.bufferLength;i<r.BLOCK_SIZE;i++)t.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(i=this.bufferLength;i<r.BLOCK_SIZE-8;i++)t.setUint8(i,0);t.setUint32(r.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),t.setUint32(r.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}var o=new Uint8Array(r.DIGEST_LENGTH);for(i=0;i<8;i++)o[4*i]=this.state[i]>>>24&255,o[4*i+1]=this.state[i]>>>16&255,o[4*i+2]=this.state[i]>>>8&255,o[4*i+3]=this.state[i]>>>0&255;return o},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],u=t[5],c=t[6],l=t[7],f=0;f<r.BLOCK_SIZE;f++){if(f<16)this.temp[f]=(255&e[4*f])<<24|(255&e[4*f+1])<<16|(255&e[4*f+2])<<8|255&e[4*f+3];else{var d=this.temp[f-2],h=(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,p=((d=this.temp[f-15])>>>7|d<<25)^(d>>>18|d<<14)^d>>>3;this.temp[f]=(h+this.temp[f-7]|0)+(p+this.temp[f-16]|0)}var v=(((a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7))+(a&u^~a&c)|0)+(l+(r.KEY[f]+this.temp[f]|0)|0)|0,y=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&i^n&o^i&o)|0;l=c,c=u,u=a,a=s+v|0,s=o,o=i,i=n,n=v+y|0}t[0]+=n,t[1]+=i,t[2]+=o,t[3]+=s,t[4]+=a,t[5]+=u,t[6]+=c,t[7]+=l},e}();t.RawSha256=i},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}Object.defineProperty(t,"__esModule",{value:!0}),t.Observable=void 0;var s=function(){return"function"==typeof Symbol},a=function(e){return s()&&Boolean(Symbol[e])},u=function(e){return a(e)?Symbol[e]:"@@"+e};s()&&!a("observable")&&(Symbol.observable=Symbol("observable"));var c=u("iterator"),l=u("observable"),f=u("species");function d(e,t){var n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function h(e){var t=e.constructor;return void 0!==t&&null===(t=t[f])&&(t=void 0),void 0!==t?t:_}function p(e){return e instanceof _}function v(e){v.log?v.log(e):setTimeout((function(){throw e}))}function y(e){Promise.resolve().then((function(){try{e()}catch(e){v(e)}}))}function g(e){var t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{var n=d(t,"unsubscribe");n&&n.call(t)}}catch(e){v(e)}}function m(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function b(e,t,n){e._state="running";var r=e._observer;try{var i=d(r,t);switch(t){case"next":i&&i.call(r,n);break;case"error":if(m(e),!i)throw n;i.call(r,n);break;case"complete":m(e),i&&i.call(r)}}catch(e){v(e)}"closed"===e._state?g(e):"running"===e._state&&(e._state="ready")}function w(e,t,n){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:n}],void y((function(){return function(e){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var n=0;n<t.length&&(b(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e)}))):void b(e,t,n);e._queue.push({type:t,value:n})}}var S=function(){function e(t,n){r(this,e),this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var i=new O(this);try{this._cleanup=n.call(void 0,i)}catch(e){i.error(e)}"initializing"===this._state&&(this._state="ready")}return o(e,[{key:"unsubscribe",value:function(){"closed"!==this._state&&(m(this),g(this))}},{key:"closed",get:function(){return"closed"===this._state}}]),e}(),O=function(){function e(t){r(this,e),this._subscription=t}return o(e,[{key:"next",value:function(e){w(this._subscription,"next",e)}},{key:"error",value:function(e){w(this._subscription,"error",e)}},{key:"complete",value:function(){w(this._subscription,"complete")}},{key:"closed",get:function(){return"closed"===this._subscription._state}}]),e}(),_=function(){function e(t){if(r(this,e),!(this instanceof e))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof t)throw new TypeError("Observable initializer must be a function");this._subscriber=t}return o(e,[{key:"subscribe",value:function(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new S(e,this._subscriber)}},{key:"forEach",value:function(e){var t=this;return new Promise((function(n,r){if("function"==typeof e)var i=t.subscribe({next:function(t){try{e(t,o)}catch(e){r(e),i.unsubscribe()}},error:r,complete:n});else r(new TypeError(e+" is not a function"));function o(){i.unsubscribe(),n()}}))}},{key:"map",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(h(this))((function(n){return t.subscribe({next:function(t){try{t=e(t)}catch(e){return n.error(e)}n.next(t)},error:function(e){n.error(e)},complete:function(){n.complete()}})}))}},{key:"filter",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(h(this))((function(n){return t.subscribe({next:function(t){try{if(!e(t))return}catch(e){return n.error(e)}n.next(t)},error:function(e){n.error(e)},complete:function(){n.complete()}})}))}},{key:"reduce",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=h(this),r=arguments.length>1,i=!1,o=arguments[1],s=o;return new n((function(n){return t.subscribe({next:function(t){var o=!i;if(i=!0,!o||r)try{s=e(s,t)}catch(e){return n.error(e)}else s=t},error:function(e){n.error(e)},complete:function(){if(!i&&!r)return n.error(new TypeError("Cannot reduce an empty sequence"));n.next(s),n.complete()}})}))}},{key:"concat",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=h(this);return new i((function(t){var r,o=0;return function e(s){r=s.subscribe({next:function(e){t.next(e)},error:function(e){t.error(e)},complete:function(){o===n.length?(r=void 0,t.complete()):e(i.from(n[o++]))}})}(e),function(){r&&(r.unsubscribe(),r=void 0)}}))}},{key:"flatMap",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=h(this);return new n((function(r){var i=[],o=t.subscribe({next:function(t){if(e)try{t=e(t)}catch(e){return r.error(e)}var o=n.from(t).subscribe({next:function(e){r.next(e)},error:function(e){r.error(e)},complete:function(){var e=i.indexOf(o);e>=0&&i.splice(e,1),s()}});i.push(o)},error:function(e){r.error(e)},complete:function(){s()}});function s(){o.closed&&0===i.length&&r.complete()}return function(){i.forEach((function(e){return e.unsubscribe()})),o.unsubscribe()}}))}},{key:l,value:function(){return this}}],[{key:"from",value:function(t){var n="function"==typeof this?this:e;if(null==t)throw new TypeError(t+" is not an object");var r=d(t,l);if(r){var i=r.call(t);if(Object(i)!==i)throw new TypeError(i+" is not an object");return p(i)&&i.constructor===n?i:new n((function(e){return i.subscribe(e)}))}if(a("iterator")&&(r=d(t,c)))return new n((function(e){y((function(){if(!e.closed){var n=!0,i=!1,o=void 0;try{for(var s,a=r.call(t)[Symbol.iterator]();!(n=(s=a.next()).done);n=!0){var u=s.value;if(e.next(u),e.closed)return}}catch(e){i=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}e.complete()}}))}));if(Array.isArray(t))return new n((function(e){y((function(){if(!e.closed){for(var n=0;n<t.length;++n)if(e.next(t[n]),e.closed)return;e.complete()}}))}));throw new TypeError(t+" is not observable")}},{key:"of",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i="function"==typeof this?this:e;return new i((function(e){y((function(){if(!e.closed){for(var t=0;t<n.length;++t)if(e.next(n[t]),e.closed)return;e.complete()}}))}))}},{key:f,get:function(){return this}}]),e}();t.Observable=_,s()&&Object.defineProperty(_,Symbol("extensions"),{value:{symbol:l,hostReportError:v},configurable:!0})},function(e,t,n){"use strict";n.r(t),n.d(t,"DataStore",(function(){return it})),n.d(t,"DataStoreClass",(function(){return rt})),n.d(t,"initSchema",(function(){return Le})),n.d(t,"Predicates",(function(){return S.b})),n.d(t,"ModelPredicateCreator",(function(){return S.a})),n.d(t,"ModelSortPredicateCreator",(function(){return O.a})),n.d(t,"utils",(function(){return ot})),n.d(t,"isSchemaModel",(function(){return y.w})),n.d(t,"isAssociatedWith",(function(){return y.l})),n.d(t,"isTargetNameAssociation",(function(){return y.x})),n.d(t,"isModelAttributeAuth",(function(){return y.o})),n.d(t,"isModelAttributeKey",(function(){return y.q})),n.d(t,"isModelAttributePrimaryKey",(function(){return y.r})),n.d(t,"isModelAttributeCompositeKey",(function(){return y.p})),n.d(t,"ModelAttributeAuthAllow",(function(){return y.e})),n.d(t,"ModelAttributeAuthProvider",(function(){return y.f})),n.d(t,"GraphQLScalarType",(function(){return y.c})),n.d(t,"isGraphQLScalarType",(function(){return y.n})),n.d(t,"isModelFieldType",(function(){return y.s})),n.d(t,"isNonModelFieldType",(function(){return y.t})),n.d(t,"isEnumFieldType",(function(){return y.m})),n.d(t,"OpType",(function(){return y.h})),n.d(t,"isPredicateObj",(function(){return y.v})),n.d(t,"isPredicateGroup",(function(){return y.u})),n.d(t,"QueryOne",(function(){return y.j})),n.d(t,"SortDirection",(function(){return y.k})),n.d(t,"AuthModeStrategyType",(function(){return y.a})),n.d(t,"ModelOperation",(function(){return y.g})),n.d(t,"syncExpression",(function(){return y.y})),n.d(t,"ProcessName",(function(){return y.i})),n.d(t,"DISCARD",(function(){return y.b})),n.d(t,"LimitTimerRaceResolvedValues",(function(){return y.d}));var r=n(0),i=n(19),o=n(22),s=n(17),a=n(78),u=n(40),c=n(35),l=n(20),f=n(16),d=n(34),h=n(10),p=n(18),v=n(3),y=n(1);function g(e){return"private"!==e.allow||e.provider?"public"!==e.allow||e.provider?e.provider:y.f.API_KEY:y.f.USER_POOLS}function m(e){var t=e.rules,n=e.currentUser,r=new Set;return t.forEach((function(e){switch(e.allow){case y.e.CUSTOM:e.provider&&e.provider!==y.f.FUNCTION||r.add(v.c.AWS_LAMBDA);break;case y.e.GROUPS:case y.e.OWNER:n&&(e.provider===y.f.USER_POOLS?r.add(v.c.AMAZON_COGNITO_USER_POOLS):e.provider===y.f.OIDC&&r.add(v.c.OPENID_CONNECT));break;case y.e.PRIVATE:n&&(e.provider&&e.provider!==y.f.USER_POOLS?e.provider===y.f.IAM&&r.add(v.c.AWS_IAM):r.add(v.c.AMAZON_COGNITO_USER_POOLS));break;case y.e.PUBLIC:e.provider===y.f.IAM?r.add(v.c.AWS_IAM):e.provider&&e.provider!==y.f.API_KEY||r.add(v.c.API_KEY)}})),Array.from(r)}var b=function(e){return function(t){var n=t.schema,i=t.modelName;return Object(r.c)(void 0,void 0,void 0,(function(){var t,o,s,a,u;return Object(r.e)(this,(function(c){switch(c.label){case 0:e.Auth=e.Auth||p.a,c.label=1;case 1:return c.trys.push([1,3,,4]),[4,e.Auth.currentAuthenticatedUser()];case 2:return t=c.sent(),[3,4];case 3:return c.sent(),[3,4];case 4:return(o=n.namespaces.user.models[i].attributes)&&(s=o.find((function(e){return"auth"===e.type})),null===(u=null==s?void 0:s.properties)||void 0===u?void 0:u.rules)?(l=s.properties.rules,f=[y.e.CUSTOM,y.e.OWNER,y.e.GROUPS,y.e.PRIVATE,y.e.PUBLIC],d=[y.f.FUNCTION,y.f.USER_POOLS,y.f.OIDC,y.f.IAM,y.f.API_KEY],a=Object(r.h)(l).sort((function(e,t){return e.allow===t.allow?d.indexOf(g(e))-d.indexOf(g(t)):f.indexOf(e.allow)-f.indexOf(t.allow)})),[2,m({currentUser:t,rules:a})]):[2,[]]}var l,f,d}))}))}},w=function(){return[]},S=n(5),O=n(50),_=function(){function e(){this._queue=[],this._pending=!1}return e.prototype.isLocked=function(){return this._pending},e.prototype.acquire=function(){var e=this,t=new Promise((function(t){return e._queue.push(t)}));return this._pending||this._dispatchNext(),t},e.prototype.runExclusive=function(e){return this.acquire().then((function(t){var n;try{n=e()}catch(e){throw t(),e}return Promise.resolve(n).then((function(e){return t(),e}),(function(e){throw t(),e}))}))},e.prototype._dispatchNext=function(){this._queue.length>0?(this._pending=!0,this._queue.shift()(this._dispatchNext.bind(this))):this._pending=!1},e}(),E=n(72),A=n.n(E),I=n(2);let T,j;const C=new WeakMap,P=new WeakMap,x=new WeakMap,k=new WeakMap,N=new WeakMap;let M={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return P.get(e);if("objectStoreNames"===t)return e.objectStoreNames||x.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return U(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function D(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(j||(j=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(F(this),t),U(C.get(this))}:function(...t){return U(e.apply(F(this),t))}:function(t,...n){const r=e.call(F(this),t,...n);return x.set(r,t.sort?t.sort():[t]),U(r)}}function R(e){return"function"==typeof e?D(e):(e instanceof IDBTransaction&&function(e){if(P.has(e))return;const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",o),e.removeEventListener("abort",o)},i=()=>{t(),r()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",o),e.addEventListener("abort",o)});P.set(e,t)}(e),t=e,(T||(T=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,M):e);var t}function U(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t(U(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",o)});return t.then(t=>{t instanceof IDBCursor&&C.set(t,e)}).catch(()=>{}),N.set(t,e),t}(e);if(k.has(e))return k.get(e);const t=R(e);return t!==e&&(k.set(e,t),N.set(t,e)),t}const F=e=>N.get(e);function L(e,t,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const s=indexedDB.open(e,t),a=U(s);return r&&s.addEventListener("upgradeneeded",e=>{r(U(s.result),e.oldVersion,e.newVersion,U(s.transaction))}),n&&s.addEventListener("blocked",()=>n()),a.then(e=>{o&&e.addEventListener("close",()=>o()),i&&e.addEventListener("versionchange",()=>i())}).catch(()=>{}),a}function B(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",()=>t()),U(n).then(()=>{})}const q=["get","getKey","getAll","getAllKeys","count"],z=["put","add","delete","clear"],K=new Map;function V(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(K.get(t))return K.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=z.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!q.includes(n))return;const o=async function(e,...t){const o=this.transaction(e,i?"readwrite":"readonly");let s=o.store;r&&(s=s.index(t.shift()));const a=await s[n](...t);return i&&await o.done,a};return K.set(t,o),o}function G(e){return(G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}M=(e=>({...e,get:(t,n,r)=>V(t,n)||e.get(t,n,r),has:(t,n)=>!!V(t,n)||e.has(t,n)}))(M);var H=new o.a("DataStore"),W=new(function(){function e(){this.dbName="amplify-datastore"}return e.prototype.checkPrivate=function(){return Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(this,(function(e){switch(e.label){case 0:return[4,Object(I.x)().then((function(e){return e}))];case 1:return e.sent()?(H.error("IndexedDB not supported in this browser's private mode"),[2,Promise.reject("IndexedDB not supported in this browser's private mode")]):[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,i,o){return Object(r.c)(this,void 0,void 0,(function(){var s,a,u=this;return Object(r.e)(this,(function(c){switch(c.label){case 0:return[4,this.checkPrivate()];case 1:return c.sent(),this.initPromise?[3,2]:(this.initPromise=new Promise((function(e,t){u.resolve=e,u.reject=t})),[3,4]);case 2:return[4,this.initPromise];case 3:c.sent(),c.label=4;case 4:o&&(this.dbName="amplify-datastore-"+o),this.schema=e,this.namespaceResolver=t,this.modelInstanceCreator=n,this.getModelConstructorByModelName=i,c.label=5;case 5:return c.trys.push([5,8,,9]),this.db?[3,7]:(2,s=this,[4,L(this.dbName,2,{upgrade:function(t,n,i,o){return Object(r.c)(u,void 0,void 0,(function(){var s,a,u,c,l,f,d,h,p,v,y,g,m=this;return Object(r.e)(this,(function(b){switch(b.label){case 0:if(0===n)return Object.keys(e.namespaces).forEach((function(n){var r=e.namespaces[n];Object.keys(r.models).forEach((function(e){var r=m.getStorename(n,e);m.createObjectStoreForModel(t,n,r,e)}))})),[2];if(1!==n||2!==i)return[3,16];b.label=1;case 1:b.trys.push([1,14,,15]),b.label=2;case 2:b.trys.push([2,11,12,13]),s=Object(r.i)(o.objectStoreNames),a=s.next(),b.label=3;case 3:return a.done?[3,10]:(u=a.value,c=o.objectStore(u),l="tmp_"+u,c.name=l,(f=t.createObjectStore(u,{keyPath:void 0,autoIncrement:!0})).createIndex("byId","id",{unique:!0}),[4,c.openCursor()]);case 4:d=b.sent(),h=0,b.label=5;case 5:return d&&d.value?[4,f.put(d.value)]:[3,8];case 6:return b.sent(),[4,d.continue()];case 7:return d=b.sent(),h++,[3,5];case 8:t.deleteObjectStore(l),H.debug(h+" "+u+" records migrated"),b.label=9;case 9:return a=s.next(),[3,3];case 10:return[3,13];case 11:return p=b.sent(),y={error:p},[3,13];case 12:try{a&&!a.done&&(g=s.return)&&g.call(s)}finally{if(y)throw y.error}return[7];case 13:return Object.keys(e.namespaces).forEach((function(n){var i=e.namespaces[n],s=new Set(o.objectStoreNames);Object.keys(i.models).map((function(e){return[e,m.getStorename(n,e)]})).filter((function(e){var t=Object(r.f)(e,2)[1];return!s.has(t)})).forEach((function(e){var i=Object(r.f)(e,2),o=i[0],s=i[1];m.createObjectStoreForModel(t,n,s,o)}))})),[3,15];case 14:throw v=b.sent(),H.error("Error migrating IndexedDB data",v),o.abort(),v;case 15:case 16:return[2]}}))}))}})]);case 6:s.db=c.sent(),this.resolve(),c.label=7;case 7:return[3,9];case 8:return a=c.sent(),this.reject(a),[3,9];case 9:return[2]}}))}))},e.prototype._get=function(e,t){return Object(r.c)(this,void 0,void 0,(function(){var n,i;return Object(r.e)(this,(function(r){switch(r.label){case 0:return"string"==typeof e?(i=e,n=this.db.transaction(i,"readonly").store.index("byId")):n=e.index("byId"),[4,n.get(t)];case 1:return[2,r.sent()]}}))}))},e.prototype.save=function(e,t){var n,i;return Object(r.c)(this,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h,p,v,g,m,b,w,O,_,E,A,T,j,C,P,x,k,N,M=this;return Object(r.e)(this,(function(D){switch(D.label){case 0:return[4,this.checkPrivate()];case 1:return D.sent(),o=Object.getPrototypeOf(e).constructor,s=this.getStorenameForModel(o),a=Object(I.C)(o.name,e,this.schema.namespaces[this.namespaceResolver(o)],this.modelInstanceCreator,this.getModelConstructorByModelName),u=this.namespaceResolver(o),c=new Set,l=Object.values(a).map((function(e){var t=e.modelName,n=e.item,r=e.instance,i=M.getStorename(u,t);return c.add(i),{storeName:i,item:n,instance:r}})),f=this.db.transaction(Object(r.h)([s],Array.from(c.values())),"readwrite"),d=f.objectStore(s),[4,this._get(d,e.id)];case 2:if(h=D.sent(),t&&h&&(p=S.a.getPredicates(t),v=p.predicates,g=p.type,!Object(I.D)(h,g,v)))throw m="Conditional update failed",H.error(m,{model:h,condition:v}),new Error(m);b=[],D.label=3;case 3:D.trys.push([3,11,12,17]),w=Object(r.b)(l),D.label=4;case 4:return[4,w.next()];case 5:return(O=D.sent()).done?[3,10]:(_=O.value,E=_.storeName,A=_.item,T=_.instance,j=f.objectStore(E),C=A.id,[4,this._get(j,C)]);case 6:return P=D.sent(),x=void 0===P?y.h.INSERT:y.h.UPDATE,C!==e.id&&x!==y.h.INSERT?[3,9]:[4,j.index("byId").getKey(A.id)];case 7:return k=D.sent(),[4,j.put(A,k)];case 8:D.sent(),b.push([T,x]),D.label=9;case 9:return[3,4];case 10:return[3,17];case 11:return N=D.sent(),n={error:N},[3,17];case 12:return D.trys.push([12,,15,16]),O&&!O.done&&(i=w.return)?[4,i.call(w)]:[3,14];case 13:D.sent(),D.label=14;case 14:return[3,16];case 15:if(n)throw n.error;return[7];case 16:return[7];case 17:return[4,f.done];case 18:return D.sent(),[2,b]}}))}))},e.prototype.load=function(e,t,n){var i,o,s,a,u,c,l,f,d,h;return Object(r.c)(this,void 0,void 0,(function(){var p,v,y,g,m,b,w,S,O,_,E,A,T,j,C,P,x,k,N,M,D=this;return Object(r.e)(this,(function(R){switch(R.label){case 0:if(p=this.schema.namespaces[e],v=p.relationships[t].relationTypes,y=v.map((function(t){var n=t.modelName;return D.getStorename(e,n)})),g=this.getModelConstructorByModelName(e,t),0===y.length)return[2,n.map((function(e){return D.modelInstanceCreator(g,e)}))];m=this.db.transaction(Object(r.h)(y),"readonly"),R.label=1;case 1:R.trys.push([1,34,35,40]),b=Object(r.b)(v),R.label=2;case 2:return[4,b.next()];case 3:if((w=R.sent()).done)return[3,33];switch(S=w.value,O=S.fieldName,_=S.modelName,E=S.targetName,A=this.getStorename(e,_),T=m.objectStore(A),j=this.getModelConstructorByModelName(e,_),S.relationType){case"HAS_ONE":return[3,4];case"BELONGS_TO":return[3,17];case"HAS_MANY":return[3,30]}return[3,31];case 4:R.trys.push([4,10,11,16]),i=Object(r.b)(n),R.label=5;case 5:return[4,i.next()];case 6:return(o=R.sent()).done?[3,9]:(x=o.value,C=x[E]?E:O,x[C]?[4,this._get(T,x[C])]:[3,9]);case 7:k=R.sent(),x[O]=k&&this.modelInstanceCreator(j,k),R.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return P=R.sent(),l={error:P},[3,16];case 11:return R.trys.push([11,,14,15]),o&&!o.done&&(f=i.return)?[4,f.call(i)]:[3,13];case 12:R.sent(),R.label=13;case 13:return[3,15];case 14:if(l)throw l.error;return[7];case 15:return[7];case 16:return[3,32];case 17:R.trys.push([17,23,24,29]),s=Object(r.b)(n),R.label=18;case 18:return[4,s.next()];case 19:return(a=R.sent()).done?[3,22]:(x=a.value)[E]?[4,this._get(T,x[E])]:[3,21];case 20:k=R.sent(),x[O]=k&&this.modelInstanceCreator(j,k),delete x[E],R.label=21;case 21:return[3,18];case 22:return[3,29];case 23:return N=R.sent(),d={error:N},[3,29];case 24:return R.trys.push([24,,27,28]),a&&!a.done&&(h=s.return)?[4,h.call(s)]:[3,26];case 25:R.sent(),R.label=26;case 26:return[3,28];case 27:if(d)throw d.error;return[7];case 28:return[7];case 29:case 30:return[3,32];case 31:return Object(I.h)(S.relationType),[3,32];case 32:return[3,2];case 33:return[3,40];case 34:return M=R.sent(),u={error:M},[3,40];case 35:return R.trys.push([35,,38,39]),w&&!w.done&&(c=b.return)?[4,c.call(b)]:[3,37];case 36:R.sent(),R.label=37;case 37:return[3,39];case 38:if(u)throw u.error;return[7];case 39:return[7];case 40:return[2,n.map((function(e){return D.modelInstanceCreator(g,e)}))]}}))}))},e.prototype.query=function(e,t,n){return Object(r.c)(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f=this;return Object(r.e)(this,(function(d){switch(d.label){case 0:return[4,this.checkPrivate()];case 1:return d.sent(),i=this.getStorenameForModel(e),o=this.namespaceResolver(e),s=t&&S.a.getPredicates(t),a=s&&this.idFromPredicate(s),u=n&&n.sort,c=n&&n.limit,[4,Object(r.c)(f,void 0,void 0,(function(){var e,t,o;return Object(r.e)(this,(function(r){switch(r.label){case 0:return a?[4,this.getById(i,a)]:[3,2];case 1:return[2,(e=r.sent())?[e]:[]];case 2:return s?[4,this.filterOnPredicate(i,s)]:[3,4];case 3:return t=r.sent(),[2,this.inMemoryPagination(t,n)];case 4:return u?[4,this.getAll(i)]:[3,6];case 5:return o=r.sent(),[2,this.inMemoryPagination(o,n)];case 6:return c?[2,this.enginePagination(i,n)]:[2,this.getAll(i)]}}))}))];case 2:return l=d.sent(),[4,this.load(o,e.name,l)];case 3:return[2,d.sent()]}}))}))},e.prototype.getById=function(e,t){return Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(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 Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(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 Object(y.v)(e)&&"id"===e.field&&"eq"===e.operator}));return n&&n.operand},e.prototype.filterOnPredicate=function(e,t){return Object(r.c)(this,void 0,void 0,(function(){var n,i,o;return Object(r.e)(this,(function(r){switch(r.label){case 0:return n=t.predicates,i=t.type,[4,this.getAll(e)];case 1:return o=r.sent(),[2,n?o.filter((function(e){return Object(I.D)(e,i,n)})):o]}}))}))},e.prototype.inMemoryPagination=function(e,t){if(t&&e.length>1){if(t.sort){var n=O.a.getPredicates(t.sort);if(n.length){var r=Object(I.B)(n);e.sort(r)}}var i=t.page,o=void 0===i?0:i,s=t.limit,a=void 0===s?0:s,u=Math.max(0,o*a)||0,c=a>0?u+a:e.length;return e.slice(u,c)}return e},e.prototype.enginePagination=function(e,t){return Object(r.c)(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,f;return Object(r.e)(this,(function(r){switch(r.label){case 0:return t?(i=t.page,o=void 0===i?0:i,s=t.limit,a=void 0===s?0:s,u=Math.max(0,o*a)||0,[4,this.db.transaction(e).objectStore(e).openCursor()]):[3,7];case 1:return(c=r.sent())&&u>0?[4,c.advance(u)]:[3,3];case 2:r.sent(),r.label=3;case 3:l=[],f="number"==typeof a&&a>0,r.label=4;case 4:return c&&c.value?(l.push(c.value),f&&l.length===a?[3,6]:[4,c.continue()]):[3,6];case 5:return c=r.sent(),[3,4];case 6:return n=l,[3,9];case 7:return[4,this.db.getAll(e)];case 8:n=r.sent(),r.label=9;case 9:return[2,n]}}))}))},e.prototype.queryOne=function(e,t){return void 0===t&&(t=y.j.FIRST),Object(r.c)(this,void 0,void 0,(function(){var n,i,o;return Object(r.e)(this,(function(r){switch(r.label){case 0:return[4,this.checkPrivate()];case 1:return r.sent(),n=this.getStorenameForModel(e),[4,this.db.transaction([n],"readonly").objectStore(n).openCursor(void 0,t===y.j.FIRST?"next":"prev")];case 2:return i=r.sent(),[2,(o=i?i.value:void 0)&&this.modelInstanceCreator(e,o)]}}))}))},e.prototype.delete=function(e,t){return Object(r.c)(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,f,d,h,p,v,y,g;return Object(r.e)(this,(function(r){switch(r.label){case 0:return[4,this.checkPrivate()];case 1:return r.sent(),n=[],Object(I.u)(e)?(s=e,a=this.namespaceResolver(s),u=this.getStorenameForModel(s),[4,this.query(s,t)]):[3,9];case 2:return i=r.sent(),y=this.schema.namespaces[a].relationships[s.name].relationTypes,void 0===t?[3,5]:[4,this.deleteTraverse(y,i,s.name,a,n)];case 3:return r.sent(),[4,this.deleteItem(n)];case 4:return r.sent(),g=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[i,g]];case 5:return[4,this.deleteTraverse(y,i,s.name,a,n)];case 6:return r.sent(),[4,this.db.transaction([u],"readwrite").objectStore(u).clear()];case 7:return r.sent(),g=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[i,g]];case 8:return[3,17];case 9:return o=e,s=Object.getPrototypeOf(o).constructor,a=this.namespaceResolver(s),u=this.getStorenameForModel(s),t?(c=this.db.transaction([u],"readwrite"),l=c.objectStore(u),[4,this._get(l,o.id)]):[3,13];case 10:if(void 0===(f=r.sent()))return v="Model instance not found in storage",H.warn(v,{model:o}),[2,[[o],[]]];if(d=S.a.getPredicates(t),h=d.predicates,p=d.type,!Object(I.D)(f,p,h))throw v="Conditional update failed",H.error(v,{model:f,condition:h}),new Error(v);return[4,c.done];case 11:return r.sent(),y=this.schema.namespaces[a].relationships[s.name].relationTypes,[4,this.deleteTraverse(y,[o],s.name,a,n)];case 12:return r.sent(),[3,15];case 13:return y=this.schema.namespaces[a].relationships[s.name].relationTypes,[4,this.deleteTraverse(y,[o],s.name,a,n)];case 14:r.sent(),r.label=15;case 15:return[4,this.deleteItem(n)];case 16:return r.sent(),g=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[[o],g]];case 17:return[2]}}))}))},e.prototype.deleteItem=function(e){var t,n,i,o,s,a;return Object(r.c)(this,void 0,void 0,(function(){var u,c,l,f,d,h,p,v,y,g,m,b;return Object(r.e)(this,(function(w){switch(w.label){case 0:u=e.map((function(e){return e.storeName})),c=this.db.transaction(Object(r.h)(u),"readwrite"),w.label=1;case 1:w.trys.push([1,22,23,28]),t=Object(r.b)(e),w.label=2;case 2:return[4,t.next()];case 3:if((n=w.sent()).done)return[3,21];l=n.value,f=l.storeName,d=l.items,h=c.objectStore(f),w.label=4;case 4:w.trys.push([4,14,15,20]),p=Object(r.b)(d),w.label=5;case 5:return[4,p.next()];case 6:return(v=w.sent()).done?[3,13]:(y=v.value)?(g=void 0,"object"!==G(y)?[3,8]:[4,h.index("byId").getKey(y.id)]):[3,12];case 7:return g=w.sent(),[3,10];case 8:return[4,h.index("byId").getKey(y.toString())];case 9:g=w.sent(),w.label=10;case 10:return void 0===g?[3,12]:[4,h.delete(g)];case 11:w.sent(),w.label=12;case 12:return[3,5];case 13:return[3,20];case 14:return m=w.sent(),s={error:m},[3,20];case 15:return w.trys.push([15,,18,19]),v&&!v.done&&(a=p.return)?[4,a.call(p)]:[3,17];case 16:w.sent(),w.label=17;case 17:return[3,19];case 18:if(s)throw s.error;return[7];case 19:return[7];case 20:return[3,2];case 21:return[3,28];case 22:return b=w.sent(),i={error:b},[3,28];case 23:return w.trys.push([23,,26,27]),n&&!n.done&&(o=t.return)?[4,o.call(t)]:[3,25];case 24:w.sent(),w.label=25;case 25:return[3,27];case 26:if(i)throw i.error;return[7];case 27:return[7];case 28:return[2]}}))}))},e.prototype.deleteTraverse=function(e,t,n,i,o){var s,a,u,c,l,f,d,h,p,v,y,g;return Object(r.c)(this,void 0,void 0,(function(){var m,b,w,S,O,_,E,A,T,j,C,P,x,k,N=this;return Object(r.e)(this,(function(M){switch(M.label){case 0:M.trys.push([0,35,36,41]),s=Object(r.b)(e),M.label=1;case 1:return[4,s.next()];case 2:if((a=M.sent()).done)return[3,34];switch(m=a.value,b=m.relationType,m.fieldName,w=m.modelName,S=m.targetName,O=this.getStorename(i,w),_=Object(I.i)(this.schema.namespaces[i].relationships[w].relationTypes,n)||Object(I.j)(this.schema.namespaces[i].relationships[w].indexes,m.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:M.trys.push([3,10,11,16]),u=Object(r.b)(t),M.label=4;case 4:return[4,u.next()];case 5:return(c=M.sent()).done?[3,9]:(C=c.value,E=_||"byId",(A=S in C?C[S]:C.id)?[4,this.db.transaction(O,"readwrite").objectStore(O).index(E).get(A)]:[3,9]);case 6:return T=M.sent(),[4,this.deleteTraverse(this.schema.namespaces[i].relationships[w].relationTypes,T?[T]:[],w,i,o)];case 7:M.sent(),M.label=8;case 8:return[3,4];case 9:return[3,16];case 10:return j=M.sent(),p={error:j},[3,16];case 11:return M.trys.push([11,,14,15]),c&&!c.done&&(v=u.return)?[4,v.call(u)]:[3,13];case 12:M.sent(),M.label=13;case 13:return[3,15];case 14:if(p)throw p.error;return[7];case 15:return[7];case 16:return[3,33];case 17:M.trys.push([17,24,25,30]),l=Object(r.b)(t),M.label=18;case 18:return[4,l.next()];case 19:return(f=M.sent()).done?[3,23]:(C=f.value,[4,this.db.transaction(O,"readwrite").objectStore(O).index(_).getAll(C.id)]);case 20:return P=M.sent(),[4,this.deleteTraverse(this.schema.namespaces[i].relationships[w].relationTypes,P,w,i,o)];case 21:M.sent(),M.label=22;case 22:return[3,18];case 23:return[3,30];case 24:return x=M.sent(),y={error:x},[3,30];case 25:return M.trys.push([25,,28,29]),f&&!f.done&&(g=l.return)?[4,g.call(l)]:[3,27];case 26:M.sent(),M.label=27;case 27:return[3,29];case 28:if(y)throw y.error;return[7];case 29:return[7];case 30:case 31:return[3,33];case 32:return Object(I.h)(b),[3,33];case 33:return[3,1];case 34:return[3,41];case 35:return k=M.sent(),d={error:k},[3,41];case 36:return M.trys.push([36,,39,40]),a&&!a.done&&(h=s.return)?[4,h.call(s)]:[3,38];case 37:M.sent(),M.label=38;case 38:return[3,40];case 39:if(d)throw d.error;return[7];case 40:return[7];case 41:return o.push({storeName:this.getStorename(i,n),items:t.map((function(e){return N.modelInstanceCreator(N.getModelConstructorByModelName(i,n),e)}))}),[2]}}))}))},e.prototype.clear=function(){var e;return Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(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,B(this.dbName)];case 2:return t.sent(),this.db=void 0,this.initPromise=void 0,[2]}}))}))},e.prototype.batchSave=function(e,t){return Object(r.c)(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,f,d,h,p;return Object(r.e)(this,(function(v){switch(v.label){case 0:return 0===t.length?[2,[]]:[4,this.checkPrivate()];case 1:v.sent(),n=[],i=this.getStorenameForModel(e),o=this.db.transaction(i,"readwrite"),s=o.store,a=function(t){var i,o,a,c,l;return Object(r.e)(this,(function(r){switch(r.label){case 0:return i=Object(I.C)(e.name,u.modelInstanceCreator(e,t),u.schema.namespaces[u.namespaceResolver(e)],u.modelInstanceCreator,u.getModelConstructorByModelName),o=t.id,a=t._deleted,[4,s.index("byId").getKey(o)];case 1:return c=r.sent(),a?[3,3]:(l=i.find((function(e){return e.instance.id===o})).instance,n.push([l,c?y.h.UPDATE:y.h.INSERT]),[4,s.put(l,c)]);case 2:return r.sent(),[3,5];case 3:return n.push([t,y.h.DELETE]),c?[4,s.delete(c)]:[3,5];case 4:r.sent(),r.label=5;case 5:return[2]}}))},u=this,v.label=2;case 2:v.trys.push([2,7,8,9]),c=Object(r.i)(t),l=c.next(),v.label=3;case 3:return l.done?[3,6]:(f=l.value,[5,a(f)]);case 4:v.sent(),v.label=5;case 5:return l=c.next(),[3,3];case 6:return[3,9];case 7:return d=v.sent(),h={error:d},[3,9];case 8:try{l&&!l.done&&(p=c.return)&&p.call(c)}finally{if(h)throw h.error}return[7];case 9:return[4,o.done];case 10:return v.sent(),[2,n]}}))}))},e.prototype.createObjectStoreForModel=function(e,t,n,i){return Object(r.c)(this,void 0,void 0,(function(){var o;return Object(r.e)(this,(function(r){return o=e.createObjectStore(n,{autoIncrement:!0}),this.schema.namespaces[t].relationships[i].indexes.forEach((function(e){return o.createIndex(e,e)})),o.createIndex("byId","id",{unique:!0}),[2]}))}))},e}()),Y=function(){var e=this;this.db=new Map,this.getAllKeys=function(){return Object(r.c)(e,void 0,void 0,(function(){return Object(r.e)(this,(function(e){return[2,Array.from(this.db.keys())]}))}))},this.multiGet=function(t){return Object(r.c)(e,void 0,void 0,(function(){var e=this;return Object(r.e)(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 Object(r.c)(e,void 0,void 0,(function(){var e=this;return Object(r.e)(this,(function(r){return t.forEach((function(t){return e.db.delete(t)})),"function"==typeof n&&n(),[2]}))}))},this.multiSet=function(t,n){return Object(r.c)(e,void 0,void 0,(function(){var e=this;return Object(r.e)(this,(function(i){return t.forEach((function(t){var n=Object(r.f)(t,2),i=n[0],o=n[1];e.setItem(i,o)})),"function"==typeof n&&n(),[2]}))}))},this.setItem=function(t,n){return Object(r.c)(e,void 0,void 0,(function(){return Object(r.e)(this,(function(e){return[2,this.db.set(t,n)]}))}))},this.removeItem=function(t){return Object(r.c)(e,void 0,void 0,(function(){return Object(r.e)(this,(function(e){return[2,this.db.delete(t)]}))}))},this.getItem=function(t){return Object(r.c)(e,void 0,void 0,(function(){return Object(r.e)(this,(function(e){return[2,this.db.get(t)]}))}))}};var J=new Map,$=function(){function e(){this._collectionInMemoryIndex=new Map,this.storage=new Y}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 J.has(e)||J.set(e,Object(I.z)()),J.get(e)},e.prototype.init=function(){return Object(r.c)(this,void 0,void 0,(function(){var e,t,n,i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b,w;return Object(r.e)(this,(function(S){switch(S.label){case 0:return this._collectionInMemoryIndex.clear(),[4,this.storage.getAllKeys()];case 1:e=S.sent(),t=[],S.label=2;case 2:S.trys.push([2,12,13,14]),n=Object(r.i)(e),i=n.next(),S.label=3;case 3:return i.done?[3,11]:(o=i.value,s=Object(r.f)(o.split("::"),5),a=s[0],u=s[1],c=s[2],l=s[3],f=s[4],"@AmplifyDatastore"!==a?[3,10]:"Data"!==c?[3,9]:(d=void 0,void 0!==f?[3,7]:(h=l,p=this.getMonotonicFactory(u)(),v=this.getLegacyKeyForItem(u,h),y=this.getKeyForItem(u,h,p),[4,this.storage.getItem(v)])));case 4:return g=S.sent(),[4,this.storage.setItem(y,g)];case 5:return S.sent(),[4,this.storage.removeItem(v)];case 6:return S.sent(),d=p,[3,8];case 7:d=l,S.label=8;case 8:return this.getCollectionIndex(u).set(f,d),[3,10];case 9:"Collection"===c&&t.push(o),S.label=10;case 10:return i=n.next(),[3,3];case 11:return[3,14];case 12:return m=S.sent(),b={error:m},[3,14];case 13:try{i&&!i.done&&(w=n.return)&&w.call(n)}finally{if(b)throw b.error}return[7];case 14:return t.length>0?[4,this.storage.multiRemove(t)]:[3,16];case 15:S.sent(),S.label=16;case 16:return[2]}}))}))},e.prototype.save=function(e,t){return Object(r.c)(this,void 0,void 0,(function(){var n,i;return Object(r.e)(this,(function(r){switch(r.label){case 0:return n=this.getCollectionIndex(t).get(e.id)||this.getMonotonicFactory(t)(),i=this.getKeyForItem(t,e.id,n),this.getCollectionIndex(t).set(e.id,n),[4,this.storage.setItem(i,JSON.stringify(e))];case 1:return r.sent(),[2]}}))}))},e.prototype.batchSave=function(e,t){return Object(r.c)(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,f,d,h,p,v,g,m,b,w,S,O,_,E,A=this;return Object(r.e)(this,(function(I){switch(I.label){case 0:if(0===t.length)return[2,[]];n=[],i=this.getCollectionIndex(e),o=new Set,s=new Set,a=[],u={};try{for(c=Object(r.i)(t),l=c.next();!l.done;l=c.next())f=l.value,d=f.id,h=f._deleted,p=i.get(d)||this.getMonotonicFactory(e)(),w=this.getKeyForItem(e,d,p),a.push(w),u[w]={ulid:p,model:f},h?o.add(w):s.add(w)}catch(e){S={error:e}}finally{try{l&&!l.done&&(O=c.return)&&O.call(c)}finally{if(S)throw S.error}}return[4,this.storage.multiGet(a)];case 1:return v=I.sent(),g=v.filter((function(e){return!!Object(r.f)(e,2)[1]})).reduce((function(e,t){var n=Object(r.f)(t,1)[0];return e.add(n)}),new Set),[4,new Promise((function(e,t){if(0!==o.size){var n=Array.from(o);n.forEach((function(e){return i.delete(u[e].model.id)})),A.storage.multiRemove(n,(function(n){n&&n.length>0?t(n):e()}))}else e()}))];case 2:return I.sent(),[4,new Promise((function(e,t){if(0!==s.size){var n=Array.from(s).map((function(e){return[e,JSON.stringify(u[e].model)]}));s.forEach((function(e){var t=u[e],n=t.model.id,r=t.ulid;i.set(n,r)})),A.storage.multiSet(n,(function(n){n&&n.length>0?t(n):e()}))}else e()}))];case 3:I.sent();try{for(m=Object(r.i)(a),b=m.next();!b.done;b=m.next())w=b.value,o.has(w)&&g.has(w)?n.push([u[w].model,y.h.DELETE]):s.has(w)&&n.push([u[w].model,g.has(w)?y.h.UPDATE:y.h.INSERT])}catch(e){_={error:e}}finally{try{b&&!b.done&&(E=m.return)&&E.call(m)}finally{if(_)throw _.error}}return[2,n]}}))}))},e.prototype.get=function(e,t){return Object(r.c)(this,void 0,void 0,(function(){var n,i,o;return Object(r.e)(this,(function(r){switch(r.label){case 0:return n=this.getCollectionIndex(t).get(e),i=this.getKeyForItem(t,e,n),[4,this.storage.getItem(i)];case 1:return o=r.sent(),[2,o&&JSON.parse(o)]}}))}))},e.prototype.getOne=function(e,t){return Object(r.c)(this,void 0,void 0,(function(){var n,i,o,s,a,u,c;return Object(r.e)(this,(function(l){switch(l.label){case 0:return n=this.getCollectionIndex(t),i=Object(r.f)(e===y.j.FIRST?function(){var e,t,i,o,s;try{for(var a=Object(r.i)(n),u=a.next();!u.done;u=a.next()){o=(i=Object(r.f)(u.value,2))[0],s=i[1];break}}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return[o,s]}():function(){var e,t,i,o,s;try{for(var a=Object(r.i)(n),u=a.next();!u.done;u=a.next())o=(i=Object(r.f)(u.value,2))[0],s=i[1]}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return[o,s]}(),2),o=i[0],s=i[1],a=this.getKeyForItem(t,o,s),(c=a)?[4,this.storage.getItem(a)]:[3,2];case 1:c=l.sent(),l.label=2;case 2:return[2,(u=c)&&JSON.parse(u)||void 0]}}))}))},e.prototype.getAll=function(e,t){return Object(r.c)(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b,w;return Object(r.e)(this,(function(S){switch(S.label){case 0:n=this.getCollectionIndex(e),o=(i=t||{}).page,s=void 0===o?0:o,a=i.limit,u=void 0===a?0:a,c=Math.max(0,s*u)||0,l=u>0?c+u:void 0,f=[],d=0;try{for(h=Object(r.i)(n),p=h.next();!p.done&&(v=Object(r.f)(p.value,2),y=v[0],g=v[1],++d<=c||(f.push(this.getKeyForItem(e,y,g)),d!==l));p=h.next());}catch(e){b={error:e}}finally{try{p&&!p.done&&(w=h.return)&&w.call(h)}finally{if(b)throw b.error}}return[4,this.storage.multiGet(f)];case 1:return m=S.sent(),[2,m.filter((function(e){return Object(r.f)(e,2)[1]})).map((function(e){var t=Object(r.f)(e,2)[1];return JSON.parse(t)}))]}}))}))},e.prototype.delete=function(e,t){return Object(r.c)(this,void 0,void 0,(function(){var n,i;return Object(r.e)(this,(function(r){switch(r.label){case 0:return n=this.getCollectionIndex(t).get(e),i=this.getKeyForItem(t,e,n),this.getCollectionIndex(t).delete(e),[4,this.storage.removeItem(i)];case 1:return r.sent(),[2]}}))}))},e.prototype.clear=function(){return Object(r.c)(this,void 0,void 0,(function(){var e,t;return Object(r.e)(this,(function(n){switch(n.label){case 0:return[4,this.storage.getAllKeys()];case 1:return e=n.sent(),t=e.filter((function(e){return e.startsWith("@AmplifyDatastore")})),[4,this.storage.multiRemove(t)];case 2:return n.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"@AmplifyDatastore::"+e+"::Data"},e}();function Z(e){return(Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var Q,X=new o.a("DataStore"),ee=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,i){return Object(r.c)(this,void 0,void 0,(function(){var o,s=this;return Object(r.e)(this,(function(r){switch(r.label){case 0:return this.initPromise?[3,1]:(this.initPromise=new Promise((function(e,t){s.resolve=e,s.reject=t})),[3,3]);case 1:return[4,this.initPromise];case 2:return r.sent(),[2];case 3:this.schema=e,this.namespaceResolver=t,this.modelInstanceCreator=n,this.getModelConstructorByModelName=i,r.label=4;case 4:return r.trys.push([4,7,,8]),this.db?[3,6]:(this.db=new $,[4,this.db.init()]);case 5:r.sent(),this.resolve(),r.label=6;case 6:return[3,8];case 7:return o=r.sent(),this.reject(o),[3,8];case 8:return[2]}}))}))},e.prototype.save=function(e,t){var n,i;return Object(r.c)(this,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h,p,v,g,m,b,w,O,_,E,A,T,j,C,P=this;return Object(r.e)(this,(function(x){switch(x.label){case 0:return o=Object.getPrototypeOf(e).constructor,s=this.getStorenameForModel(o),a=Object(I.C)(o.name,e,this.schema.namespaces[this.namespaceResolver(o)],this.modelInstanceCreator,this.getModelConstructorByModelName),u=this.namespaceResolver(o),c=new Set,l=Object.values(a).map((function(e){var t=e.modelName,n=e.item,r=e.instance,i=P.getStorename(u,t);return c.add(i),{storeName:i,item:n,instance:r}})),[4,this.db.get(e.id,s)];case 1:if(f=x.sent(),t&&f&&(d=S.a.getPredicates(t),h=d.predicates,p=d.type,!Object(I.D)(f,p,h)))throw v="Conditional update failed",X.error(v,{model:f,condition:h}),new Error(v);g=[],x.label=2;case 2:x.trys.push([2,9,10,15]),m=Object(r.b)(l),x.label=3;case 3:return[4,m.next()];case 4:return(b=x.sent()).done?[3,8]:(w=b.value,O=w.storeName,_=w.item,E=w.instance,A=_.id,[4,this.db.get(A,O)]);case 5:return T=x.sent(),j=T?y.h.UPDATE:y.h.INSERT,A!==e.id&&j!==y.h.INSERT?[3,7]:[4,this.db.save(_,O)];case 6:x.sent(),g.push([E,j]),x.label=7;case 7:return[3,3];case 8:return[3,15];case 9:return C=x.sent(),n={error:C},[3,15];case 10:return x.trys.push([10,,13,14]),b&&!b.done&&(i=m.return)?[4,i.call(m)]:[3,12];case 11:x.sent(),x.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 i,o,s,a,u,c,l,f,d,h;return Object(r.c)(this,void 0,void 0,(function(){var p,v,y,g,m,b,w,S,O,_,E,A,T,j,C,P,x,k,N,M=this;return Object(r.e)(this,(function(D){switch(D.label){case 0:if(p=this.schema.namespaces[e],v=p.relationships[t].relationTypes,y=v.map((function(t){var n=t.modelName;return M.getStorename(e,n)})),g=this.getModelConstructorByModelName(e,t),0===y.length)return[2,n.map((function(e){return M.modelInstanceCreator(g,e)}))];D.label=1;case 1:D.trys.push([1,34,35,40]),m=Object(r.b)(v),D.label=2;case 2:return[4,m.next()];case 3:if((b=D.sent()).done)return[3,33];switch(w=b.value,S=w.fieldName,O=w.modelName,_=w.targetName,E=w.relationType,A=this.getStorename(e,O),T=this.getModelConstructorByModelName(e,O),E){case"HAS_ONE":return[3,4];case"BELONGS_TO":return[3,17];case"HAS_MANY":return[3,30]}return[3,31];case 4:D.trys.push([4,10,11,16]),i=Object(r.b)(n),D.label=5;case 5:return[4,i.next()];case 6:return(o=D.sent()).done?[3,9]:(P=o.value,j=P[_]?_:S,P[j]?[4,this.db.get(P[j],A)]:[3,9]);case 7:x=D.sent(),P[S]=x&&this.modelInstanceCreator(T,x),D.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return C=D.sent(),l={error:C},[3,16];case 11:return D.trys.push([11,,14,15]),o&&!o.done&&(f=i.return)?[4,f.call(i)]:[3,13];case 12:D.sent(),D.label=13;case 13:return[3,15];case 14:if(l)throw l.error;return[7];case 15:return[7];case 16:return[3,32];case 17:D.trys.push([17,23,24,29]),s=Object(r.b)(n),D.label=18;case 18:return[4,s.next()];case 19:return(a=D.sent()).done?[3,22]:(P=a.value)[_]?[4,this.db.get(P[_],A)]:[3,21];case 20:x=D.sent(),P[S]=x&&this.modelInstanceCreator(T,x),delete P[_],D.label=21;case 21:return[3,18];case 22:return[3,29];case 23:return k=D.sent(),d={error:k},[3,29];case 24:return D.trys.push([24,,27,28]),a&&!a.done&&(h=s.return)?[4,h.call(s)]:[3,26];case 25:D.sent(),D.label=26;case 26:return[3,28];case 27:if(d)throw d.error;return[7];case 28:return[7];case 29:case 30:return[3,32];case 31:return Object(I.h)(E),[3,32];case 32:return[3,2];case 33:return[3,40];case 34:return N=D.sent(),u={error:N},[3,40];case 35:return D.trys.push([35,,38,39]),b&&!b.done&&(c=m.return)?[4,c.call(m)]:[3,37];case 36:D.sent(),D.label=37;case 37:return[3,39];case 38:if(u)throw u.error;return[7];case 39:return[7];case 40:return[2,n.map((function(e){return M.modelInstanceCreator(g,e)}))]}}))}))},e.prototype.query=function(e,t,n){return Object(r.c)(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f=this;return Object(r.e)(this,(function(d){switch(d.label){case 0:return i=this.getStorenameForModel(e),o=this.namespaceResolver(e),s=t&&S.a.getPredicates(t),a=s&&this.idFromPredicate(s),u=n&&n.sort,c=n&&n.limit,[4,Object(r.c)(f,void 0,void 0,(function(){var e,t,o;return Object(r.e)(this,(function(r){switch(r.label){case 0:return a?[4,this.getById(i,a)]:[3,2];case 1:return[2,(e=r.sent())?[e]:[]];case 2:return s?[4,this.filterOnPredicate(i,s)]:[3,4];case 3:return t=r.sent(),[2,this.inMemoryPagination(t,n)];case 4:return u||c?[4,this.getAll(i)]:[3,6];case 5:return o=r.sent(),[2,this.inMemoryPagination(o,n)];case 6:return[2,this.getAll(i)]}}))}))];case 1:return l=d.sent(),[4,this.load(o,e.name,l)];case 2:return[2,d.sent()]}}))}))},e.prototype.getById=function(e,t){return Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(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 Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(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 Object(y.v)(e)&&"id"===e.field&&"eq"===e.operator}));return n&&n.operand},e.prototype.filterOnPredicate=function(e,t){return Object(r.c)(this,void 0,void 0,(function(){var n,i,o;return Object(r.e)(this,(function(r){switch(r.label){case 0:return n=t.predicates,i=t.type,[4,this.getAll(e)];case 1:return o=r.sent(),[2,n?o.filter((function(e){return Object(I.D)(e,i,n)})):o]}}))}))},e.prototype.inMemoryPagination=function(e,t){if(t&&e.length>1){if(t.sort){var n=O.a.getPredicates(t.sort);if(n.length){var r=Object(I.B)(n);e.sort(r)}}var i=t.page,o=void 0===i?0:i,s=t.limit,a=void 0===s?0:s,u=Math.max(0,o*a)||0,c=a>0?u+a:e.length;return e.slice(u,c)}return e},e.prototype.queryOne=function(e,t){return void 0===t&&(t=y.j.FIRST),Object(r.c)(this,void 0,void 0,(function(){var n,i;return Object(r.e)(this,(function(r){switch(r.label){case 0:return n=this.getStorenameForModel(e),[4,this.db.getOne(t,n)];case 1:return[2,(i=r.sent())&&this.modelInstanceCreator(e,i)]}}))}))},e.prototype.delete=function(e,t){return Object(r.c)(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,f,d,h,p,v;return Object(r.e)(this,(function(r){switch(r.label){case 0:return n=[],Object(I.u)(e)?(s=e,a=this.namespaceResolver(s),[4,this.query(s,t)]):[3,8];case 1:return i=r.sent(),p=this.schema.namespaces[a].relationships[s.name].relationTypes,void 0===t?[3,4]:[4,this.deleteTraverse(p,i,s.name,a,n)];case 2:return r.sent(),[4,this.deleteItem(n)];case 3:return r.sent(),v=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[i,v]];case 4:return[4,this.deleteTraverse(p,i,s.name,a,n)];case 5:return r.sent(),[4,this.deleteItem(n)];case 6:return r.sent(),v=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[i,v]];case 7:return[3,15];case 8:return o=e,s=Object.getPrototypeOf(o).constructor,a=this.namespaceResolver(s),u=this.getStorenameForModel(s),t?[4,this.db.get(o.id,u)]:[3,11];case 9:if(void 0===(c=r.sent()))return h="Model instance not found in storage",X.warn(h,{model:o}),[2,[[o],[]]];if(l=S.a.getPredicates(t),f=l.predicates,d=l.type,!Object(I.D)(c,d,f))throw h="Conditional update failed",X.error(h,{model:c,condition:f}),new Error(h);return p=this.schema.namespaces[a].relationships[s.name].relationTypes,[4,this.deleteTraverse(p,[o],s.name,a,n)];case 10:return r.sent(),[3,13];case 11:return p=this.schema.namespaces[a].relationships[s.name].relationTypes,[4,this.deleteTraverse(p,[o],s.name,a,n)];case 12:r.sent(),r.label=13;case 13:return[4,this.deleteItem(n)];case 14:return r.sent(),v=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[[o],v]];case 15:return[2]}}))}))},e.prototype.deleteItem=function(e){var t,n,i,o,s,a;return Object(r.c)(this,void 0,void 0,(function(){var u,c,l,f,d,h,p,v,y;return Object(r.e)(this,(function(g){switch(g.label){case 0:g.trys.push([0,17,18,23]),t=Object(r.b)(e),g.label=1;case 1:return[4,t.next()];case 2:if((n=g.sent()).done)return[3,16];u=n.value,c=u.storeName,l=u.items,g.label=3;case 3:g.trys.push([3,9,10,15]),f=Object(r.b)(l),g.label=4;case 4:return[4,f.next()];case 5:return(d=g.sent()).done?[3,8]:(h=d.value)?"object"!==Z(h)?[3,7]:(p=h.id,[4,this.db.delete(p,c)]):[3,7];case 6:g.sent(),g.label=7;case 7:return[3,4];case 8:return[3,15];case 9:return v=g.sent(),s={error:v},[3,15];case 10:return g.trys.push([10,,13,14]),d&&!d.done&&(a=f.return)?[4,a.call(f)]:[3,12];case 11:g.sent(),g.label=12;case 12:return[3,14];case 13:if(s)throw s.error;return[7];case 14:return[7];case 15:return[3,1];case 16:return[3,23];case 17:return y=g.sent(),i={error:y},[3,23];case 18:return g.trys.push([18,,21,22]),n&&!n.done&&(o=t.return)?[4,o.call(t)]:[3,20];case 19:g.sent(),g.label=20;case 20:return[3,22];case 21:if(i)throw i.error;return[7];case 22:return[7];case 23:return[2]}}))}))},e.prototype.deleteTraverse=function(e,t,n,i,o){var s,a,u,c,l,f,d,h,p,v,y,g;return Object(r.c)(this,void 0,void 0,(function(){var m,b,w,S,O,_,E,A,T,j,C,P,x,k,N,M=this;return Object(r.e)(this,(function(D){switch(D.label){case 0:D.trys.push([0,35,36,41]),s=Object(r.b)(e),D.label=1;case 1:return[4,s.next()];case 2:if((a=D.sent()).done)return[3,34];switch(m=a.value,b=m.relationType,w=m.modelName,S=m.targetName,O=this.getStorename(i,w),_=Object(I.i)(this.schema.namespaces[i].relationships[w].relationTypes,n)||Object(I.j)(this.schema.namespaces[i].relationships[w].indexes,m.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:D.trys.push([3,10,11,16]),u=Object(r.b)(t),D.label=4;case 4:return[4,u.next()];case 5:return(c=D.sent()).done?[3,9]:(C=c.value,E=_||"byId",(A=S in C?C[S]:C.id)?[4,this.db.getAll(O)]:[3,9]);case 6:return P=D.sent(),T=P.filter((function(e){return e[E]===A})),[4,this.deleteTraverse(this.schema.namespaces[i].relationships[w].relationTypes,T,w,i,o)];case 7:D.sent(),D.label=8;case 8:return[3,4];case 9:return[3,16];case 10:return j=D.sent(),p={error:j},[3,16];case 11:return D.trys.push([11,,14,15]),c&&!c.done&&(v=u.return)?[4,v.call(u)]:[3,13];case 12:D.sent(),D.label=13;case 13:return[3,15];case 14:if(p)throw p.error;return[7];case 15:return[7];case 16:return[3,33];case 17:D.trys.push([17,24,25,30]),l=Object(r.b)(t),D.label=18;case 18:return[4,l.next()];case 19:return(f=D.sent()).done?[3,23]:(C=f.value,[4,this.db.getAll(O)]);case 20:return P=D.sent(),x=P.filter((function(e){return e[_]===C.id})),[4,this.deleteTraverse(this.schema.namespaces[i].relationships[w].relationTypes,x,w,i,o)];case 21:D.sent(),D.label=22;case 22:return[3,18];case 23:return[3,30];case 24:return k=D.sent(),y={error:k},[3,30];case 25:return D.trys.push([25,,28,29]),f&&!f.done&&(g=l.return)?[4,g.call(l)]:[3,27];case 26:D.sent(),D.label=27;case 27:return[3,29];case 28:if(y)throw y.error;return[7];case 29:return[7];case 30:case 31:return[3,33];case 32:return Object(I.h)(b),[3,33];case 33:return[3,1];case 34:return[3,41];case 35:return N=D.sent(),d={error:N},[3,41];case 36:return D.trys.push([36,,39,40]),a&&!a.done&&(h=s.return)?[4,h.call(s)]:[3,38];case 37:D.sent(),D.label=38;case 38:return[3,40];case 39:if(d)throw d.error;return[7];case 40:return[7];case 41:return o.push({storeName:this.getStorename(i,n),items:t.map((function(e){return M.modelInstanceCreator(M.getModelConstructorByModelName(i,n),e)}))}),[2]}}))}))},e.prototype.clear=function(){return Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(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 Object(r.c)(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,f,d,h;return Object(r.e)(this,(function(p){switch(p.label){case 0:n=e.name,i=this.namespaceResolver(e),o=this.getStorename(i,n),s=[],a=function(t){var n=t.id,r=Object(I.C)(e.name,u.modelInstanceCreator(e,t),u.schema.namespaces[u.namespaceResolver(e)],u.modelInstanceCreator,u.getModelConstructorByModelName).find((function(e){return e.instance.id===n})).instance;s.push(r)},u=this;try{for(c=Object(r.i)(t),l=c.next();!l.done;l=c.next())f=l.value,a(f)}catch(e){d={error:e}}finally{try{l&&!l.done&&(h=c.return)&&h.call(c)}finally{if(d)throw d.error}}return[4,this.db.batchSave(o,s)];case 1:return[2,p.sent()]}}))}))},e}()),te=function(){return Object(s.b)().isBrowser&&window.indexedDB||Object(s.c)()&&self.indexedDB?W:ee},ne=new o.a("DataStore"),re=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||te(),this.pushStream=new A.a}return e.getNamespace=function(){return{name:I.c,relationships:{},enums:{},models:{},nonModels:{}}},e.prototype.init=function(){return Object(r.c)(this,void 0,void 0,(function(){var e,t;return Object(r.e)(this,(function(n){switch(n.label){case 0:return void 0===this.initialized?[3,2]:[4,this.initialized];case 1:return n.sent(),[2];case 2:return ne.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];case 3:return n.sent(),[2]}}))}))},e.prototype.save=function(e,t,n,i){return Object(r.c)(this,void 0,void 0,(function(){var o,s=this;return Object(r.e)(this,(function(a){switch(a.label){case 0:return[4,this.init()];case 1:return a.sent(),[4,this.adapter.save(e,t)];case 2:return(o=a.sent()).forEach((function(a){var u,c=Object(r.f)(a,2),l=c[0],f=c[1],d=!!n;if(f===y.h.UPDATE&&!d&&null===(u=s.getUpdateMutationInput(e,l,i)))return o;var h=u||l,p=Object.getPrototypeOf(l).constructor;s.pushStream.next({model:p,opType:f,element:h,mutator:n,condition:S.a.getPredicates(t,!1),savedElement:l})})),[2,o]}}))}))},e.prototype.delete=function(e,t,n){return Object(r.c)(this,void 0,void 0,(function(){var i,o,s,a,u=this;return Object(r.e)(this,(function(c){switch(c.label){case 0:return[4,this.init()];case 1:return c.sent(),[4,this.adapter.delete(e,t)];case 2:return a=r.f.apply(void 0,[c.sent(),2]),o=a[0],i=a[1],s=new Set(o.map((function(e){return e.id}))),Object(I.u)(e)||Array.isArray(i)||(i=[i]),i.forEach((function(r){var i,o=Object.getPrototypeOf(r).constructor;Object(I.u)(e)||(i=s.has(r.id)?S.a.getPredicates(t,!1):void 0),u.pushStream.next({model:o,opType:y.h.DELETE,element:r,mutator:n,condition:i})})),[2,[o,i]]}}))}))},e.prototype.query=function(e,t,n){return Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(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=y.j.FIRST),Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(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 i=!e,o=S.a.getPredicates(t,!1)||{},s=o.predicates,a=o.type,u=!!s,c=this.pushStream.observable.filter((function(e){var t=e.mutator;return!n||t!==n})).map((function(e){e.mutator;return Object(r.g)(e,["mutator"])}));return i||(c=c.filter((function(t){var n=t.model,r=t.element;return e===n&&(!u||Object(I.D)(r,a,s))}))),c},e.prototype.clear=function(e){return void 0===e&&(e=!0),Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(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 Object(r.c)(this,void 0,void 0,(function(){var i,o=this;return Object(r.e)(this,(function(s){switch(s.label){case 0:return[4,this.init()];case 1:return s.sent(),[4,this.adapter.batchSave(e,t)];case 2:return(i=s.sent()).forEach((function(t){var i=Object(r.f)(t,2),s=i[0],a=i[1];o.pushStream.next({model:e,opType:a,element:s,mutator:n,condition:void 0})})),[2,i]}}))}))},e.prototype.getUpdateMutationInput=function(e,t,n){var i,o;if(!(n&&n.length))return null;var s=Object(r.f)(n,2),a=s[0],u=s[1],c={},l=a.map((function(e){return e.path&&e.path[0]})),f=Object.getPrototypeOf(e).constructor,d=this.namespaceResolver(f),h=this.schema.namespaces[d].models[f.name].fields,p=this.schema.namespaces[d].keys[f.name],v=p.primaryKey,g=p.compositeKeys,m=void 0===g?[]:g;if(l.forEach((function(e){var n,i,o,s,a,l=Object(y.x)(null===(a=h[e])||void 0===a?void 0:a.association)||e;if(!Object(I.E)(u[l],t[l])){c[l]=void 0===t[l]?null:t[l];try{for(var f=Object(r.i)(m),d=f.next();!d.done;d=f.next()){var p=d.value;if(p.has(l))try{for(var v=(o=void 0,Object(r.i)(p)),g=v.next();!g.done;g=v.next()){var b=g.value;c[b]=t[b]}}catch(e){o={error:e}}finally{try{g&&!g.done&&(s=v.return)&&s.call(v)}finally{if(o)throw o.error}}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}}})),v&&v.length)try{for(var b=Object(r.i)(v),w=b.next();!w.done;w=b.next()){var S=w.value;c[S]=t[S]}}catch(e){i={error:e}}finally{try{w&&!w.done&&(o=b.return)&&o.call(b)}finally{if(i)throw i.error}}if(0===Object.keys(c).length)return null;var O=t.id,_=t._version,E=t._lastChangedAt,A=t._deleted;return Object(r.a)(Object(r.a)({},c),{id:O,_version:_,_lastChangedAt:E,_deleted:A})},e}(),ie=function(){function e(e,t,n,r,i,o){this.mutex=new _,this.storage=new re(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,i){return Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(this,(function(r){return[2,this.runExclusive((function(r){return r.save(e,t,n,i)}))]}))}))},e.prototype.delete=function(e,t,n){return Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(this,(function(r){return[2,this.runExclusive((function(r){if(Object(I.u)(e)){var i=e;return r.delete(i,t,n)}var o=e;return r.delete(o,t,n)}))]}))}))},e.prototype.query=function(e,t,n){return Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(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=y.j.FIRST),Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(this,(function(n){return[2,this.runExclusive((function(n){return n.queryOne(e,t)}))]}))}))},e.getNamespace=function(){return re.getNamespace()},e.prototype.observe=function(e,t,n){return this.storage.observe(e,t,n)},e.prototype.clear=function(){return Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(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 Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(this,(function(e){return[2,this.storage.init()]}))}))},e}(),oe=n(15),se=(new(function(){function e(){}return e.prototype.networkMonitor=function(t){if(Object(s.b)().isNode)return h.a.from([{online:!0}]);var n=Object(s.c)()?self:window;return new h.a((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,i,o=function(n){if(n.closed)return e._observers=e._observers.filter((function(e){return e!==n})),"continue";n.next(t)};try{for(var s=Object(r.i)(e._observers),a=s.next();!a.done;a=s.next()){o(a.value)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}},e._observers=[],e}())).networkMonitor(),ae=(new o.a("DataStore"),function(){function e(){this.connectionStatus={online:!1}}return e.prototype.status=function(){var e=this;if(this.observer)throw new Error("Subscriber already exists");return new h.a((function(t){return e.observer=t,e.subscription=se.subscribe((function(n){var i=n.online;e.connectionStatus.online=i;var o=Object(r.a)({},e.connectionStatus);t.next(o)})),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=Object(r.a)({},e.connectionStatus);e.observer.next(t)}),5e3))},e}()),ue=function(){function e(e,t){this.outbox=e,this.ownSymbol=t}return e.prototype.merge=function(e,t){return Object(r.c)(this,void 0,void 0,(function(){var n,i,o,s,a;return Object(r.e)(this,(function(u){switch(u.label){case 0:return[4,this.outbox.getForModel(e,t)];case 1:return i=u.sent(),o=t._deleted,0!==i.length?[3,5]:o?(n=y.h.DELETE,[4,e.delete(t,void 0,this.ownSymbol)]):[3,3];case 2:return u.sent(),[3,5];case 3:return[4,e.save(t,void 0,this.ownSymbol)];case 4:s=r.f.apply(void 0,[u.sent(),1]),a=Object(r.f)(s[0],2),n=a[1],u.label=5;case 5:return[2,n]}}))}))},e.prototype.mergePage=function(e,t,n){return Object(r.c)(this,void 0,void 0,(function(){var i,o,s,a,u,c,l;return Object(r.e)(this,(function(f){switch(f.label){case 0:i=new Map;try{for(o=Object(r.i)(n),s=o.next();!s.done;s=o.next())a=s.value,i.set(a.id,a)}catch(e){c={error:e}}finally{try{s&&!s.done&&(l=o.return)&&l.call(o)}finally{if(c)throw c.error}}return u=Object(r.h)(i.values()),[4,e.batchSave(t,u,this.ownSymbol)];case 1:return[2,f.sent()]}}))}))},e}(),ce=n(4),le=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 Object(r.c)(this,void 0,void 0,(function(){var n=this;return Object(r.e)(this,(function(i){return e.runExclusive((function(e){return Object(r.c)(n,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,f,d=this;return Object(r.e)(this,(function(h){switch(h.label){case 0:return n=this.schema.namespaces[I.d].models.MutationEvent,i=S.a.createFromExisting(n,(function(e){return e.modelId("eq",t.modelId).id("ne",d.inProgressMutationEventId)})),[4,e.query(this.MutationEvent,i)];case 1:return o=r.f.apply(void 0,[h.sent(),1]),void 0!==(s=o[0])?[3,3]:[4,e.save(t,void 0,this.ownSymbol)];case 2:return h.sent(),[2];case 3:return a=t.operation,s.operation!==ce.a.CREATE?[3,8]:a!==ce.a.DELETE?[3,5]:[4,e.delete(this.MutationEvent,i)];case 4:return h.sent(),[3,7];case 5:return u=this.mergeUserFields(s,t),[4,e.save(this.MutationEvent.copyOf(s,(function(e){e.data=u.data})),void 0,this.ownSymbol)];case 6:h.sent(),h.label=7;case 7:return[3,12];case 8:return c=t.condition,l=JSON.parse(c),f=void 0,0!==Object.keys(l).length?[3,10]:(f=this.mergeUserFields(s,t),[4,e.delete(this.MutationEvent,i)]);case 9:h.sent(),h.label=10;case 10:return f=f||t,[4,e.save(f,void 0,this.ownSymbol)];case 11:h.sent(),h.label=12;case 12:return[2]}}))}))})),[2]}))}))},e.prototype.dequeue=function(e,t,n){return Object(r.c)(this,void 0,void 0,(function(){var i;return Object(r.e)(this,(function(r){switch(r.label){case 0:return[4,this.peek(e)];case 1:return i=r.sent(),t?[4,this.syncOutboxVersionsOnDequeue(e,t,i,n)]:[3,3];case 2:r.sent(),r.label=3;case 3:return[4,e.delete(i)];case 4:return r.sent(),this.inProgressMutationEventId=void 0,[2,i]}}))}))},e.prototype.peek=function(e){return Object(r.c)(this,void 0,void 0,(function(){var t;return Object(r.e)(this,(function(n){switch(n.label){case 0:return[4,e.queryOne(this.MutationEvent,y.j.FIRST)];case 1:return t=n.sent(),this.inProgressMutationEventId=t?t.id:void 0,[2,t]}}))}))},e.prototype.getForModel=function(e,t){return Object(r.c)(this,void 0,void 0,(function(){var n;return Object(r.e)(this,(function(r){switch(r.label){case 0:return n=this.schema.namespaces[I.d].models.MutationEvent,[4,e.query(this.MutationEvent,S.a.createFromExisting(n,(function(e){return e.modelId("eq",t.id)})))];case 1:return[2,r.sent()]}}))}))},e.prototype.getModelIds=function(e){return Object(r.c)(this,void 0,void 0,(function(){var t,n;return Object(r.e)(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,i){return Object(r.c)(this,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h,p,v,y=this;return Object(r.e)(this,(function(g){switch(g.label){case 0:return n.operation!==i?[2]:(o=t._version,s=t._lastChangedAt,t._deleted,a=Object(r.g)(t,["_version","_lastChangedAt","_deleted"]),u=this.removeTimestampFields(n.model,a),(c=JSON.parse(n.data))?(c._version,c._lastChangedAt,c._deleted,l=Object(r.g)(c,["_version","_lastChangedAt","_deleted"]),f=this.removeTimestampFields(n.model,l),Object(I.E)(u,f,!0)?(d=this.schema.namespaces[I.d].models.MutationEvent,h=S.a.createFromExisting(d,(function(e){return e.modelId("eq",t.id).id("ne",y.inProgressMutationEventId)})),[4,e.query(this.MutationEvent,h)]):[2]):[2]);case 1:return(p=g.sent()).length?(v=p.map((function(e){var t=JSON.parse(e.data),n=Object(r.a)(Object(r.a)({},t),{_version:o,_lastChangedAt:s});return y.MutationEvent.copyOf(e,(function(e){e.data=JSON.stringify(n)}))})),[4,e.delete(this.MutationEvent,h)]):[2];case 2:return g.sent(),[4,Promise.all(v.map((function(t){return Object(r.c)(y,void 0,void 0,(function(){return Object(r.e)(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 g.sent(),[2]}}))}))},e.prototype.mergeUserFields=function(e,t){var n=JSON.parse(e.data),i=n._version,o=n.id,s=n._lastChangedAt,a=n._deleted,u=Object(r.g)(n,["_version","id","_lastChangedAt","_deleted"]),c=JSON.parse(t.data),l=(c.id,c._version,c._lastChangedAt,c._deleted,Object(r.g)(c,["id","_version","_lastChangedAt","_deleted"])),f=JSON.stringify(Object(r.a)(Object(r.a)({id:o,_version:i,_lastChangedAt:s,_deleted:a},u),l));return this.modelInstanceCreator(this.MutationEvent,Object(r.a)(Object(r.a)({},t),{data:f}))},e.prototype.removeTimestampFields=function(e,t){var n,r,i="createdAt",o="updatedAt",s=null===(n=this.schema.namespaces[I.e].models[e].attributes)||void 0===n?void 0:n.find((function(e){return"model"===e.type})),a=null===(r=null==s?void 0:s.properties)||void 0===r?void 0:r.timestamps;return a&&(i=a.createdAt,o=a.updatedAt),delete t[i],delete t[o],t},e}(),fe=n(153),de=n(24),he=new o.a("DataStore"),pe=function(){function e(e,t,n,r,o,s,a,u,c,l,f){void 0===a&&(a={}),this.schema=e,this.storage=t,this.userClasses=n,this.outbox=r,this.modelInstanceCreator=o,this.MutationEvent=s,this.amplifyConfig=a,this.authModeStrategy=u,this.errorHandler=c,this.conflictHandler=l,this.amplifyContext=f,this.typeQuery=new WeakMap,this.processing=!1,this.amplifyContext.API=this.amplifyContext.API||i.a,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})).forEach((function(n){var i=Object(r.f)(Object(ce.b)(t,n,"CREATE"),1)[0],o=Object(r.f)(Object(ce.b)(t,n,"UPDATE"),1)[0],s=Object(r.f)(Object(ce.b)(t,n,"DELETE"),1)[0];e.typeQuery.set(n,[i,o,s])}))}))},e.prototype.isReady=function(){return void 0!==this.observer},e.prototype.start=function(){var e=this;return new h.a((function(t){return e.observer=t,e.resume(),function(){e.pause()}}))},e.prototype.resume=function(){return Object(r.c)(this,void 0,void 0,(function(){var e,t,n,i,o,s=this;return Object(r.e)(this,(function(a){switch(a.label){case 0:if(this.processing||!this.isReady())return[2];this.processing=!0,t=I.e,n=function(){var n,o,a,u,c,l,f,d,h,p,v,y,g,m,b,w;return Object(r.e)(this,(function(S){switch(S.label){case 0:n=e.model,o=e.operation,a=e.data,u=e.condition,c=i.userClasses[n],l=void 0,f=void 0,d=void 0,S.label=1;case 1:return S.trys.push([1,4,,5]),[4,Object(ce.h)({authModeStrategy:i.authModeStrategy,defaultAuthMode:i.amplifyConfig.aws_appsync_authenticationType,modelName:n,schema:i.schema})];case 2:return h=S.sent(),p=h[o.toUpperCase()],v=0,[4,(y=function(){return Object(r.c)(s,void 0,void 0,(function(){var i,s;return Object(r.e)(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,4]),he.debug("Attempting mutation with authMode: "+p[v]),[4,this.jitteredRetry(t,n,o,a,u,c,this.MutationEvent,e,p[v])];case 1:return i=r.sent(),he.debug("Mutation sent successfully with authMode: "+p[v]),[2,i];case 2:if(s=r.sent(),++v>=p.length)throw he.debug("Mutation failed with authMode: "+p[v-1]),s;return he.debug("Mutation failed with authMode: "+p[v-1]+". Retrying with authMode: "+p[v]),[4,y()];case 3:return[2,r.sent()];case 4:return[2]}}))}))})()];case 3:return w=r.f.apply(void 0,[S.sent(),3]),l=w[0],f=w[1],d=w[2],[3,5];case 4:return"Offline"===(g=S.sent()).message||"RetryMutation"===g.message?[2,"continue"]:[3,5];case 5:return void 0!==l?[3,7]:(he.debug("done retrying"),[4,i.storage.runExclusive((function(e){return Object(r.c)(s,void 0,void 0,(function(){return Object(r.e)(this,(function(t){switch(t.label){case 0:return[4,this.outbox.dequeue(e)];case 1:return t.sent(),[2]}}))}))}))]);case 6:return S.sent(),[2,"continue"];case 7:return m=l.data[f],b=!1,[4,i.storage.runExclusive((function(e){return Object(r.c)(s,void 0,void 0,(function(){return Object(r.e)(this,(function(t){switch(t.label){case 0:return[4,this.outbox.dequeue(e,m,o)];case 1:return t.sent(),[4,this.outbox.peek(e)];case 2:return b=void 0!==t.sent(),[2]}}))}))}))];case 8:return S.sent(),i.observer.next({operation:o,modelDefinition:d,model:m,hasMore:b}),[2]}}))},i=this,a.label=1;case 1:return(o=this.processing)?[4,this.outbox.peek(this.storage)]:[3,3];case 2:o=void 0!==(e=a.sent()),a.label=3;case 3:return o?[5,n()]:[3,5];case 4:return a.sent(),[3,1];case 5:return this.pause(),[2]}}))}))},e.prototype.jitteredRetry=function(e,t,n,i,o,s,a,u,c){return Object(r.c)(this,void 0,void 0,(function(){var l=this;return Object(r.e)(this,(function(f){switch(f.label){case 0:return[4,Object(fe.d)((function(t,n,i,o,s,a,u){return Object(r.c)(l,void 0,void 0,(function(){var l,f,d,h,p,v,g,m,b,w,S,O,_,E,A,T,j,C,P,x,k,N,M,D,R,U,F;return Object(r.e)(this,(function(L){switch(L.label){case 0:return l=Object(r.f)(this.createQueryVariables(e,t,n,i,o),5),f=l[0],d=l[1],h=l[2],p=l[3],v=l[4],[4,Object(ce.i)(c,this.amplifyConfig)];case 1:g=L.sent(),m={query:f,variables:d,authMode:c,authToken:g,userAgentSuffix:I.f},b=0,w=this.opTypeFromTransformerOperation(n),L.label=2;case 2:return L.trys.push([2,4,,20]),[4,this.amplifyContext.API.graphql(m)];case 3:return[2,[L.sent(),p,v]];case 4:if(!((S=L.sent()).errors&&S.errors.length>0))return[3,18];if(O=Object(r.f)(S.errors,1),_=O[0],E=_.originalError,A=(void 0===E?{}:E).code,T=void 0===A?null:A,"Unauthorized"===_.errorType)throw new fe.a("Unauthorized");if("Network Error"===_.message||"ECONNABORTED"===T){if(!this.processing)throw new fe.a("Offline");throw new Error("Network Error")}return"ConflictUnhandled"!==_.errorType?[3,13]:(b++,j=void 0,b>10?(j=y.b,[3,8]):[3,5]);case 5:return L.trys.push([5,7,,8]),[4,this.conflictHandler({modelConstructor:s,localModel:this.modelInstanceCreator(s,d.input),remoteModel:this.modelInstanceCreator(s,_.data),operation:w,attempts:b})];case 6:return j=L.sent(),[3,8];case 7:return C=L.sent(),he.warn("conflict trycatch",C),[3,20];case 8:return j!==y.b?[3,11]:(P=Object(r.f)(Object(ce.b)(this.schema.namespaces[e],v,"GET"),1),x=Object(r.f)(P[0],3),k=x[1],N=x[2],[4,Object(ce.i)(c,this.amplifyConfig)]);case 9:return M=L.sent(),[4,this.amplifyContext.API.graphql({query:N,variables:{id:d.input.id},authMode:c,authToken:M,userAgentSuffix:I.f})];case 10:return[2,[L.sent(),k,v]];case 11:return D=this.schema.namespaces[e],R=Object(ce.d)(D.relationships,v,w,s,j,h,a,this.modelInstanceCreator,u.id),[4,this.storage.save(R)];case 12:throw L.sent(),new fe.a("RetryMutation");case 13:return L.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:d.input,message:_.message,operation:n,errorType:Object(de.a)(_),errorInfo:_.errorInfo,process:y.i.mutate,cause:_,remoteModel:_.data?this.modelInstanceCreator(s,_.data):null})];case 14:return L.sent(),[3,17];case 15:return U=L.sent(),he.warn("Mutation error handler failed with:",U),[3,17];case 16:return[2,_.data?[{data:(F={},F[p]=_.data,F)},p,v]:[]];case 17:return[3,19];case 18:throw new fe.a(S);case 19:return[3,20];case 20:if(m)return[3,2];L.label=21;case 21:return[2]}}))}))}),[t,n,i,o,s,a,u],ye)];case 1:return[2,f.sent()]}}))}))},e.prototype.createQueryVariables=function(e,t,n,i,o){var s,a,u=this.schema.namespaces[e].models[t],c=this.schema.namespaces[e].keys[t].primaryKey,l=this.typeQuery.get(u),f=Object(r.f)(l.find((function(e){return Object(r.f)(e,1)[0]===n})),3),d=f[1],h=f[2],p=JSON.parse(i),v=p._version,g=Object(r.g)(p,["_version"]),m={};if(c&&c.length)try{for(var b=Object(r.i)(c),w=b.next();!w.done;w=b.next()){var S=w.value;m[S]=g[S]}}catch(e){s={error:e}}finally{try{w&&!w.done&&(a=b.return)&&a.call(b)}finally{if(s)throw s.error}}else m.id=g.id;var O=n===ce.a.DELETE?m:Object.values(u.fields).filter((function(e){var t=e.name,r=e.type,i=e.association;return Object(y.s)(r)?!(!Object(y.x)(i)||"BELONGS_TO"!==i.connectionType):n!==ce.a.UPDATE||g.hasOwnProperty(t)})).map((function(e){var t=e.name,n=e.type,r=e.association,i=t,o=g[t];return Object(y.s)(n)&&Object(y.x)(r)&&(i=r.targetName,o=g[i]),[i,o]})).reduce((function(e,t){var n=Object(r.f)(t,2),i=n[0],o=n[1];return e[i]=o,e}),{}),_=Object(r.a)(Object(r.a)({},O),{_version:v}),E=JSON.parse(o);return[h,Object(r.a)({input:_},n===ce.a.CREATE?{}:{condition:Object.keys(E).length>0?E:null}),E,d,u]},e.prototype.opTypeFromTransformerOperation=function(e){switch(e){case ce.a.CREATE:return y.h.INSERT;case ce.a.DELETE:return y.h.DELETE;case ce.a.UPDATE:return y.h.UPDATE;case ce.a.GET:break;default:Object(I.h)(e)}},e.prototype.pause=function(){this.processing=!1},e}(),ve=Object(fe.b)(3e5),ye=function(e,t,n){var r=ve(e);return!1===r&&"Network Error"===(null==n?void 0:n.message)?3e5:r},ge=n(42),me={items:[],nextToken:null,startedAt:null},be=new o.a("DataStore"),we=function(){function e(e,t,n,r,o,s){void 0===n&&(n={}),this.schema=e,this.syncPredicates=t,this.amplifyConfig=n,this.authModeStrategy=r,this.errorHandler=o,this.amplifyContext=s,this.typeQuery=new WeakMap,s.API=s.API||i.a,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})).forEach((function(n){var i=Object(r.f)(Object(ce.b)(t,n,"LIST"),1),o=Object(r.f)(i[0]).slice(1);e.typeQuery.set(n,o)}))}))},e.prototype.graphqlFilterFromPredicate=function(e){if(!this.syncPredicates)return null;var t=S.a.getPredicates(this.syncPredicates.get(e),!1);return t?Object(ce.l)(t):null},e.prototype.retrievePage=function(e,t,n,i,o){return void 0===i&&(i=null),Object(r.c)(this,void 0,void 0,(function(){var s,a,u,c,l,f,d,h,p,v,y,g,m,b=this;return Object(r.e)(this,(function(w){switch(w.label){case 0:return s=Object(r.f)(this.typeQuery.get(e),2),a=s[0],u=s[1],c={limit:i,nextToken:n,lastSync:t,filter:o},[4,Object(ce.h)({authModeStrategy:this.authModeStrategy,defaultAuthMode:this.amplifyConfig.aws_appsync_authenticationType,modelName:e.name,schema:this.schema})];case 1:return l=w.sent(),f=l.READ,d=0,[4,(h=function(){return Object(r.c)(b,void 0,void 0,(function(){var t,n,i,o;return Object(r.e)(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,4]),be.debug("Attempting sync with authMode: "+f[d]),[4,this.jitteredRetry({query:u,variables:c,opName:a,modelDefinition:e,authMode:f[d]})];case 1:return t=r.sent(),be.debug("Sync successful with authMode: "+f[d]),[2,t];case 2:if(n=r.sent(),++d>=f.length){if(i=f[d-1],be.debug("Sync failed with authMode: "+i,n),Object(ce.f)(n)||Object(ce.g)(n))return be.warn("User is unauthorized to query "+a+" with auth mode "+i+". No data could be returned."),[2,{data:(o={},o[a]=me,o)}];throw n}return be.debug("Sync failed with authMode: "+f[d-1]+". Retrying with authMode: "+f[d]),[4,h()];case 3:return[2,r.sent()];case 4:return[2]}}))}))})()];case 2:return p=w.sent().data,v=p[a],y=v.items,g=v.nextToken,m=v.startedAt,[2,{nextToken:g,startedAt:m,items:y}]}}))}))},e.prototype.partialDataFeatureFlagEnabled=function(){try{var e=sessionStorage.getItem("datastorePartialData");return Boolean(e)}catch(e){return!1}},e.prototype.jitteredRetry=function(e){var t=e.query,n=e.variables,i=e.opName,o=e.modelDefinition,s=e.authMode;return Object(r.c)(this,void 0,void 0,(function(){var e=this;return Object(r.e)(this,(function(u){switch(u.label){case 0:return[4,Object(fe.c)((function(t,n){return Object(r.c)(e,void 0,void 0,(function(){var e,u,c,l,f,d=this;return Object(r.e)(this,(function(h){switch(h.label){case 0:return h.trys.push([0,3,,8]),[4,Object(ce.i)(s,this.amplifyConfig)];case 1:return e=h.sent(),[4,this.amplifyContext.API.graphql({query:t,variables:n,authMode:s,authToken:e,userAgentSuffix:I.f})];case 2:return[2,h.sent()];case 3:if(u=h.sent(),c=Object(ce.f)(u)||Object(ce.g)(u))throw new fe.a(c);return l=Boolean(u&&u.data&&u.data[i]&&u.data[i].items),this.partialDataFeatureFlagEnabled()?l?((f=u).data[i].items=f.data[i].items.filter((function(e){return null!==e})),u.errors?[4,Promise.all(u.errors.map((function(e){return Object(r.c)(d,void 0,void 0,(function(){var t;return Object(r.e)(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:o.name,operation:i,errorType:Object(de.c)(e),process:y.i.sync,remoteModel:null,cause:e})];case 1:return n.sent(),[3,3];case 2:return t=n.sent(),be.error("Sync error handler failed with:",t),[3,3];case 3:return[2]}}))}))})))]:[3,5]):[3,6]:[3,7];case 4:h.sent(),a.a.dispatch("datastore",{event:"syncQueriesPartialSyncError",data:{errors:u.errors,modelName:o.name}}),h.label=5;case 5:return[2,f];case 6:throw u;case 7:if(u&&u.errors&&u.errors.some((function(e){return"Unauthorized"===e.errorType})))return f=u,l?f.data[i].items=f.data[i].items.filter((function(e){return null!==e})):f.data[i]=Object(r.a)(Object(r.a)({},me),f.data[i]),be.warn("queryError","User is unauthorized to query "+i+", some items could not be returned."),[2,f];throw u;case 8:return[2]}}))}))}),[t,n])];case 1:return[2,u.sent()]}}))}))},e.prototype.start=function(e){var t=this,n=!0,i=this.amplifyConfig,o=i.maxRecordsToSync,s=i.syncPageSize,a=new Map;return new h.a((function(i){var u=Object.values(t.schema.namespaces).reduce((function(t,n){var i,o;try{for(var s=Object(r.i)(Array.from(n.modelTopologicalOrdering.keys())),a=s.next();!a.done;a=s.next()){var u=a.value,c=e.get(n.models[u]);t.set(n.models[u],c)}}catch(e){i={error:e}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}return t}),new Map),c=Array.from(u.entries()).filter((function(e){return Object(r.f)(e,1)[0].syncable})).map((function(e){var u=Object(r.f)(e,2),c=u[0],l=Object(r.f)(u[1],2),f=l[0],d=l[1];return Object(r.c)(t,void 0,void 0,(function(){var e,t,u,l,h,p,v,y,g,m=this;return Object(r.e)(this,(function(b){switch(b.label){case 0:return e=!1,t=null,u=null,l=null,h=0,p=this.graphqlFilterFromPredicate(c),v=this.schema.namespaces[f].modelTopologicalOrdering.get(c.name),y=v.map((function(e){return a.get(f+"_"+e)})),g=new Promise((function(a){return Object(r.c)(m,void 0,void 0,(function(){var v,g;return Object(r.e)(this,(function(r){switch(r.label){case 0:return[4,Promise.all(y)];case 1:r.sent(),r.label=2;case 2:return n?(v=Math.min(o-h,s),[4,this.retrievePage(c,d,t,v,p)]):[2];case 3:g=r.sent(),l=g.items,t=g.nextToken,u=g.startedAt,h+=l.length,e=null===t||h>=o,i.next({namespace:f,modelDefinition:c,items:l,done:e,startedAt:u,isFullSync:!d}),r.label=4;case 4:if(!e)return[3,2];r.label=5;case 5:return a(),[2]}}))}))})),a.set(f+"_"+c.name,g),[4,g];case 1:return b.sent(),[2]}}))}))}));return Promise.all(c).then((function(){i.complete()})),function(){n=!1}}))},e}(),Se=Object(s.b)().isNode,Oe=new o.a("DataStore"),_e=Symbol("sync");!function(e){e.SYNC_ENGINE_STORAGE_SUBSCRIBED="storageSubscribed",e.SYNC_ENGINE_SUBSCRIPTIONS_ESTABLISHED="subscriptionsEstablished",e.SYNC_ENGINE_SYNC_QUERIES_STARTED="syncQueriesStarted",e.SYNC_ENGINE_SYNC_QUERIES_READY="syncQueriesReady",e.SYNC_ENGINE_MODEL_SYNCED="modelSynced",e.SYNC_ENGINE_OUTBOX_MUTATION_ENQUEUED="outboxMutationEnqueued",e.SYNC_ENGINE_OUTBOX_MUTATION_PROCESSED="outboxMutationProcessed",e.SYNC_ENGINE_OUTBOX_STATUS="outboxStatus",e.SYNC_ENGINE_NETWORK_STATUS="networkStatus",e.SYNC_ENGINE_READY="ready"}(Q||(Q={}));var Ee=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 le(this.schema,d,o,_e),this.modelMerger=new ue(this.outbox,_e),this.syncQueriesProcessor=new we(this.schema,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,a,this.amplifyContext),this.subscriptionsProcessor=new ge.b(this.schema,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,a,this.amplifyContext),this.mutationsProcessor=new pe(this.schema,this.storage,this.userModelClasses,this.outbox,this.modelInstanceCreator,d,this.amplifyConfig,this.authModeStrategy,a,s,this.amplifyContext),this.datastoreConnectivity=new ae}return e.prototype.getModelSyncedStatus=function(e){return this.modelSyncedStatus.get(e)},e.prototype.start=function(e){var t=this;return new h.a((function(n){Oe.log("starting sync engine...");var i=[];return Object(r.c)(t,void 0,void 0,(function(){var t,o,s,a=this;return Object(r.e)(this,(function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),[4,this.setupModels(e)];case 1:return u.sent(),[3,3];case 2:return t=u.sent(),n.error(t),[2];case 3:return o=new Promise((function(e){a.datastoreConnectivity.status().subscribe((function(t){var o=t.online;return Object(r.c)(a,void 0,void 0,(function(){var t,s,a,u,c,l=this;return Object(r.e)(this,(function(f){switch(f.label){case 0:return!o||this.online?[3,10]:(this.online=o,n.next({type:Q.SYNC_ENGINE_NETWORK_STATUS,data:{active:this.online}}),s=void 0,Se?(Oe.warn("Realtime disabled when in a server-side environment"),[3,6]):[3,1]);case 1:c=Object(r.f)(this.subscriptionsProcessor.start(),2),t=c[0],s=c[1],f.label=2;case 2:return f.trys.push([2,4,,5]),[4,new Promise((function(e,n){var r=t.subscribe({next:function(t){t===ge.a.CONNECTED&&e()},error:function(e){n(e),l.disconnectionHandler()(e)}});i.push(r)}))];case 3:return f.sent(),[3,5];case 4:return a=f.sent(),n.error(a),[2];case 5:Oe.log("Realtime ready"),n.next({type:Q.SYNC_ENGINE_SUBSCRIPTIONS_ESTABLISHED}),f.label=6;case 6:return f.trys.push([6,8,,9]),[4,new Promise((function(e,t){var r=l.syncQueriesObservable().subscribe({next:function(t){t.type===Q.SYNC_ENGINE_SYNC_QUERIES_READY&&e(),n.next(t)},complete:function(){e()},error:function(e){t(e)}});r&&i.push(r)}))];case 7:return f.sent(),[3,9];case 8:return u=f.sent(),n.error(u),[2];case 9:return i.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:Q.SYNC_ENGINE_OUTBOX_MUTATION_PROCESSED,data:{model:o,element:s}}),n.next({type:Q.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:!i}})}))),Se||i.push(s.subscribe((function(e){var t=Object(r.f)(e,3),n=(t[0],t[1]),i=t[2],o=l.userModelClasses[n.name],s=l.modelInstanceCreator(o,i);l.storage.runExclusive((function(e){return l.modelMerger.merge(e,s)}))}))),[3,11];case 10:o||(this.online=o,n.next({type:Q.SYNC_ENGINE_NETWORK_STATUS,data:{active:this.online}}),i.forEach((function(e){return e.unsubscribe()})),i=[]),f.label=11;case 11:return e(),[2]}}))}))}))})),this.storage.observe(null,null,_e).filter((function(e){var t=e.model;return!0===a.getModelDefinition(t).syncable})).subscribe({next:function(e){var t=e.opType,i=e.model,s=e.element,u=e.condition;return Object(r.c)(a,void 0,void 0,(function(){var e,a,c,l;return Object(r.e)(this,(function(r){switch(r.label){case 0:return e=this.schema.namespaces[this.namespaceResolver(i)],a=this.modelClasses.MutationEvent,c=Object(ce.k)(u),l=Object(ce.d)(e.relationships,this.getModelDefinition(i),t,i,s,c,a,this.modelInstanceCreator),[4,this.outbox.enqueue(this.storage,l)];case 1:return r.sent(),n.next({type:Q.SYNC_ENGINE_OUTBOX_MUTATION_ENQUEUED,data:{model:i,element:s}}),n.next({type:Q.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:!1}}),[4,o];case 2:return r.sent(),this.online&&this.mutationsProcessor.resume(),[2]}}))}))}}),n.next({type:Q.SYNC_ENGINE_STORAGE_SUBSCRIBED}),[4,this.outbox.peek(this.storage)];case 4:return s=void 0===u.sent(),n.next({type:Q.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:s}}),[4,o];case 5:return u.sent(),n.next({type:Q.SYNC_ENGINE_READY}),[2]}}))})),function(){i.forEach((function(e){return e.unsubscribe()}))}}))},e.prototype.getModelsMetadataWithNextFullSync=function(e){return Object(r.c)(this,void 0,void 0,(function(){var t,n=this;return Object(r.e)(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,u=(t.lastSyncPredicate,!s||s+a<e?0:o);return[n.schema.namespaces[r].models[i],[r,u]]}))]))]}}))}))},e.prototype.syncQueriesObservable=function(){var e=this;return this.online?new h.a((function(t){var n,i;return Object(r.c)(e,void 0,void 0,(function(){var e,o,s=this;return Object(r.e)(this,(function(a){switch(a.label){case 0:e=function(){var e,a,u,c,l,f,d,h,p;return Object(r.e)(this,(function(v){switch(v.label){case 0:return e=new WeakMap,[4,o.getModelsMetadataWithNextFullSync(Date.now())];case 1:return a=v.sent(),u=new Set(a.keys()),[4,new Promise((function(i){n=s.syncQueriesProcessor.start(a).subscribe({next:function(o){var a=o.namespace,p=o.modelDefinition,v=o.items,g=o.done,m=o.startedAt,b=o.isFullSync;return Object(r.c)(s,void 0,void 0,(function(){var o,s,w,S,O,_,E=this;return Object(r.e)(this,(function(A){switch(A.label){case 0:return o=this.userModelClasses[p.name],e.has(o)||(e.set(o,{new:0,updated:0,deleted:0}),f=Object(I.k)(),h=void 0===h?m:Math.max(h,m)),[4,this.storage.runExclusive((function(t){return Object(r.c)(E,void 0,void 0,(function(){var n,i,s,a,u,c,l,f,d,h,p,g,m,b,w;return Object(r.e)(this,(function(S){switch(S.label){case 0:return[4,this.outbox.getModelIds(t)];case 1:n=S.sent(),i=[],s=v.filter((function(e){return!n.has(e.id)||(i.push(e),!1)})),a=[],S.label=2;case 2:S.trys.push([2,7,8,9]),u=Object(r.i)(i),c=u.next(),S.label=3;case 3:return c.done?[3,6]:(l=c.value,[4,this.modelMerger.merge(t,l)]);case 4:void 0!==(f=S.sent())&&a.push([l,f]),S.label=5;case 5:return c=u.next(),[3,3];case 6:return[3,9];case 7:return d=S.sent(),b={error:d},[3,9];case 8:try{c&&!c.done&&(w=u.return)&&w.call(u)}finally{if(b)throw b.error}return[7];case 9:return p=(h=a.push).apply,g=[a],[4,this.modelMerger.mergePage(t,o,s)];case 10:return p.apply(h,g.concat([r.h.apply(void 0,[S.sent()])])),m=e.get(o),a.forEach((function(e){var t=Object(r.f)(e,2)[1];switch(t){case y.h.INSERT:m.new++;break;case y.h.UPDATE:m.updated++;break;case y.h.DELETE:m.deleted++;break;default:Object(I.h)(t)}})),[2]}}))}))}))];case 1:return A.sent(),g?(s=p.name,[4,this.getModelMetadata(a,s)]):[3,4];case 2:return w=A.sent(),S=w.lastFullSync,O=w.fullSyncInterval,l=O,c=void 0===c?S:Math.max(c,b?m:S),w=this.modelClasses.ModelMetadata.copyOf(w,(function(e){e.lastSync=m,e.lastFullSync=b?m:w.lastFullSync})),[4,this.storage.save(w,void 0,_e)];case 3:A.sent(),_=e.get(o),this.modelSyncedStatus.set(o,!0),t.next({type:Q.SYNC_ENGINE_MODEL_SYNCED,data:{model:o,isFullSync:b,isDeltaSync:!b,counts:_}}),u.delete(p),0===u.size&&(d=Object(I.k)()-f,i(),t.next({type:Q.SYNC_ENGINE_SYNC_QUERIES_READY}),n.unsubscribe()),A.label=4;case 4:return[2]}}))}))},error:function(e){t.error(e)}}),t.next({type:Q.SYNC_ENGINE_SYNC_QUERIES_STARTED,data:{models:Array.from(u).map((function(e){return e.name}))}})}))];case 2:return v.sent(),p=c+l-(h+d),Oe.debug("Next fullSync in "+p/1e3+" seconds. ("+new Date(Date.now()+p)+")"),[4,new Promise((function(e){i=setTimeout(e,p)}))];case 3:return v.sent(),[2]}}))},o=this,a.label=1;case 1:return t.closed?[3,3]:[5,e()];case 2:return a.sent(),[3,1];case 3:return[2]}}))})),function(){n&&n.unsubscribe(),i&&clearTimeout(i)}})):h.a.of()},e.prototype.disconnectionHandler=function(){var e=this;return function(t){oe.CONTROL_MSG.CONNECTION_CLOSED!==t&&oe.CONTROL_MSG.TIMEOUT_DISCONNECT!==t||e.datastoreConnectivity.socketDisconnected()}},e.prototype.unsubscribeConnectivity=function(){this.datastoreConnectivity.unsubscribe()},e.prototype.setupModels=function(e){return Object(r.c)(this,void 0,void 0,(function(){var t,n,i,o,s,a,u,c,l,f,d,h,p,v=this;return Object(r.e)(this,(function(y){switch(y.label){case 0:t=e.fullSyncInterval,n=this.modelClasses.ModelMetadata,i=[],Object.values(this.schema.namespaces).forEach((function(e){Object.values(e.models).filter((function(e){return e.syncable})).forEach((function(t){if(i.push([e.name,t]),e.name===I.e){var n=v.userModelClasses[t.name];v.modelSyncedStatus.set(n,!1)}}))})),s=i.map((function(e){var i=Object(r.f)(e,2),s=i[0],a=i[1];return Object(r.c)(v,void 0,void 0,(function(){var e,i,u,c,l,f,d,h,p;return Object(r.e)(this,(function(v){switch(v.label){case 0:return[4,this.getModelMetadata(s,a.name)];case 1:return e=v.sent(),i=S.a.getPredicates(this.syncPredicates.get(a),!1),u=i?JSON.stringify(i):null,void 0!==e?[3,3]:[4,this.storage.save(this.modelInstanceCreator(n,{model:a.name,namespace:s,lastSync:null,fullSyncInterval:t,lastFullSync:null,lastSyncPredicate:u}),void 0,_e)];case 2:return f=r.f.apply(void 0,[v.sent(),1]),d=Object(r.f)(f[0],1),o=d[0],[3,5];case 3:return c=e.lastSyncPredicate?e.lastSyncPredicate:null,l=c!==u,[4,this.storage.save(this.modelClasses.ModelMetadata.copyOf(e,(function(e){e.fullSyncInterval=t,l&&(e.lastSync=null,e.lastFullSync=null,e.lastSyncPredicate=u)})))];case 4:h=r.f.apply(void 0,[v.sent(),1]),p=Object(r.f)(h[0],1),o=p[0],v.label=5;case 5:return[2,o]}}))}))})),a={},y.label=1;case 1:return y.trys.push([1,6,7,8]),[4,Promise.all(s)];case 2:u=r.i.apply(void 0,[y.sent()]),c=u.next(),y.label=3;case 3:if(c.done)return[3,5];l=c.value,f=l.model,a[f]=l,y.label=4;case 4:return c=u.next(),[3,3];case 5:return[3,8];case 6:return d=y.sent(),h={error:d},[3,8];case 7:try{c&&!c.done&&(p=u.return)&&p.call(u)}finally{if(h)throw h.error}return[7];case 8:return[2,a]}}))}))},e.prototype.getModelsMetadata=function(){return Object(r.c)(this,void 0,void 0,(function(){var e;return Object(r.e)(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 Object(r.c)(this,void 0,void 0,(function(){var n,i,o;return Object(r.e)(this,(function(s){switch(s.label){case 0:return n=this.modelClasses.ModelMetadata,i=S.a.createFromExisting(this.schema.namespaces[I.d].models[n.name],(function(n){return n.namespace("eq",e).model("eq",t)})),[4,this.storage.query(n,i,{page:0,limit:1})];case 1:return o=r.f.apply(void 0,[s.sent(),1]),[2,o[0]]}}))}))},e.prototype.getModelDefinition=function(e){var t=this.namespaceResolver(e);return this.schema.namespaces[t].models[e.name]},e.getNamespace=function(){return{name:I.d,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}();function Ae(e){return(Ae="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object(f.e)(!0),Object(f.b)();var Ie,Te,je,Ce,Pe,xe=new o.a("DataStore"),ke=Object(I.z)(Date.now()),Ne=s.a.browserOrNode().isNode,Me=new WeakMap,De=new WeakMap,Re=function(e){var t=Me.get(e);return Ie.namespaces[t].models[e.name]},Ue=function(e){return Object(I.u)(e)&&Me.has(e)},Fe=function(e){return Me.get(e)},Le=function(e){var t;if(void 0!==Ie)return console.warn("The schema has already been initialized"),je;xe.log("validating schema",{schema:e});var n=Object(r.a)({name:I.e},e);xe.log("DataStore","Init models"),je=qe(n),xe.log("DataStore","Models initialized");var i={name:I.a,relationships:{},enums:{},nonModels:{},models:{Setting:{name:"Setting",pluralName:"Settings",syncable:!1,fields:{id:{name:"id",type:"ID",isRequired:!0,isArray:!1},key:{name:"key",type:"String",isRequired:!0,isArray:!1},value:{name:"value",type:"String",isRequired:!0,isArray:!1}}}}},o=ie.getNamespace(),s=Ee.getNamespace();return Ce=qe(i),Pe=qe(o),Te=qe(s),Ie={namespaces:(t={},t[i.name]=i,t[n.name]=n,t[o.name]=o,t[s.name]=s,t),version:e.version},Object.keys(Ie.namespaces).forEach((function(e){var t,n,i=Object(r.f)(Object(I.g)(Ie.namespaces[e]),2),o=i[0],s=i[1];Ie.namespaces[e].relationships=o,Ie.namespaces[e].keys=s;var a=new Map;Object.values(Ie.namespaces[e].models).forEach((function(e){var t=[];Object.values(e.fields).filter((function(t){return t.association&&"BELONGS_TO"===t.association.connectionType&&t.type.model!==e.name})).forEach((function(e){return t.push(e.type.model)})),a.set(e.name,t)}));for(var u=new Map,c=1e3;c>0&&0!==a.size;){if(0===--c)throw new Error("Models are not topologically sortable. Please verify your schema.");try{for(var l=(t=void 0,Object(r.i)(Array.from(a.keys()))),f=l.next();!f.done;f=l.next()){var d=f.value,h=a.get(d);h.every((function(e){return u.has(e)}))&&u.set(d,h)}}catch(e){t={error:e}}finally{try{f&&!f.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}Array.from(u.keys()).forEach((function(e){return a.delete(e)}))}Ie.namespaces[e].modelTopologicalOrdering=u})),je},Be=function(){if(void 0===Ie){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 xe.error(e),new Error(e)}},qe=function(e){var t={};return Object.entries(e.models).forEach((function(n){var i=Object(r.f)(n,2),o=i[0],s=i[1],a=Ye(s);t[o]=a,Me.set(a,e.name)})),Object.entries(e.nonModels||{}).forEach((function(e){var n=Object(r.f)(e,2),i=n[0],o=n[1],s=Ze(o);t[i]=s})),t},ze=new WeakSet;function Ke(e,t){return ze.add(t),new e(t)}var Ve,Ge=function(e){return function(t,n){var r=e.fields[t];if(void 0!==r){var i=r.type,o=r.isRequired,s=r.isArrayNullable,a=r.name,u=r.isArray;if((!u&&o||u&&!s)&&null==n)throw new Error("Field "+a+" is required");if(Object(y.n)(i)){var c=y.c.getJSType(i),l=y.c.getValidationFunction(i);if("AWSJSON"===i){if(Ae(n)===c)return;if("string"==typeof n)try{return void JSON.parse(n)}catch(e){throw new Error("Field "+a+" is an invalid JSON object. "+n)}}if(u){var f=c;if(o||(f=c+" | null | undefined"),!Array.isArray(n)&&!s)throw new Error("Field "+a+" should be of type ["+f+"], "+Ae(n)+" received. "+n);if(!Object(I.w)(n)&&n.some((function(e){return Object(I.w)(e)?o:Ae(e)!==c}))){var d=n.map((function(e){return null===e?"null":Ae(e)})).join(",");throw new Error("All elements in the "+a+" array should be of type "+f+", ["+d+"] received. "+n)}if(l&&!Object(I.w)(n))if(!n.map((function(e){return Object(I.w)(e)?!(!Object(I.w)(e)||o):l(e)})).every((function(e){return e})))throw new Error("All elements in the "+a+" array should be of type "+i+", validation failed for one or more elements. "+n)}else{if(!o&&void 0===n)return;if(Ae(n)!==c&&null!==n)throw new Error("Field "+a+" should be of type "+c+", "+Ae(n)+" received. "+n);if(!Object(I.w)(n)&&l&&!l(n))throw new Error("Field "+a+" should be of type "+i+", validation failed. "+n)}}}}},He=function(e,t,n){var r=e.fields[t]||{},i=r.isArray,o=r.type;if("string"==typeof n&&(i||"AWSJSON"===o||Object(y.t)(o)||Object(y.s)(o)))try{return JSON.parse(n)}catch(e){}return"number"==typeof n&&"Boolean"===o?Boolean(n):n},We=function(e,t,n){var i=Ge(t);Object.entries(e).forEach((function(e){var o=Object(r.f)(e,2),s=o[0],a=o[1],u=He(t,s,a);i(s,u),n[s]=u}))},Ye=function(e){var t=function(){function n(t){return Object(f.d)(this,(function(n){We(t,e,n);var r=ze.has(t)?t:{},i=r.id,o=r._version,s=r._lastChangedAt,a=r._deleted,u=null!=i,c=u?i:e.syncable?Object(d.v4)():ke();u||Je(n,e),n.id=c,e.syncable&&(n._version=o,n._lastChangedAt=s,n._deleted=a)}))}return n.copyOf=function(t,n){var i,o=Object.getPrototypeOf(t||{}).constructor;if(!Ue(o)){var s="The source object is not a valid model";throw xe.error(s,{source:t}),new Error(s)}var a=Object(f.d)(t,(function(i){n(i),i.id=t.id;var o=Ge(e);Object.entries(i).forEach((function(t){var n=Object(r.f)(t,2),i=n[0],s=n[1],a=He(e,i,s);o(i,a)}))}),(function(e){return i=e})),u=De.has(t);if(i.length||u)if(u){var c=Object(r.f)(De.get(t),2),l=c[0],d=c[1],h=Object(I.y)(d,l,i);De.set(a,[h,d]),$e(h,e)}else De.set(a,[i,t]),$e(i,e);return a},n.fromJSON=function(n){var i=this;if(Array.isArray(n))return n.map((function(e){return i.fromJSON(e)}));var o=Ke(t,n),s=Ge(e);return Object.entries(o).forEach((function(e){var t=Object(r.f)(e,2),n=t[0],i=t[1];s(n,i)})),o},n}();return t[f.c]=!0,Object.defineProperty(t,"name",{value:e.name}),t},Je=function(e,t){var n=Object.keys(e),r=t.fields;n.forEach((function(e){if(r[e]&&r[e].isReadOnly)throw new Error(e+" is read-only.")}))},$e=function(e,t){var n=e.map((function(e){return[e.path[0],e.value]})),i=t.fields;n.forEach((function(e){var t=Object(r.f)(e,2),n=t[0];if(t[1]&&i[n]&&i[n].isReadOnly)throw new Error(n+" is read-only.")}))},Ze=function(e){var t=function(t){return Object(f.d)(this,(function(n){We(t,e,n)}))};return t[f.c]=!0,Object.defineProperty(t,"name",{value:e.name}),Object(I.A)(t),t};function Qe(e){return"string"==typeof e}function Xe(e){var t=e.localModel,n=e.modelConstructor,i=e.remoteModel._version;return Ke(n,Object(r.a)(Object(r.a)({},t),{_version:i}))}function et(e){xe.warn(e)}function tt(e,t){var n;switch(e){case I.a:n=Ce[t];break;case I.e:n=je[t];break;case I.d:n=Te[t];break;case I.c:n=Pe[t];break;default:Object(I.h)(e)}if(Ue(n))return n;var r="Model name is not valid for namespace. modelName: "+t+", namespace: "+e;throw xe.error(r),new Error(r)}function nt(e,t){return Object(r.c)(this,void 0,void 0,(function(){var n,i,o=this;return Object(r.e)(this,(function(s){switch(s.label){case 0:return n=Ce.Setting,i=Ie.namespaces[I.a].models.Setting,[4,e.runExclusive((function(e){return Object(r.c)(o,void 0,void 0,(function(){var o,s;return Object(r.e)(this,(function(a){switch(a.label){case 0:return[4,e.query(n,S.a.createFromExisting(i,(function(e){return e.key("eq","schemaVersion")})),{page:0,limit:1})];case 1:return o=r.f.apply(void 0,[a.sent(),1]),void 0===(s=o[0])||void 0===s.value?[3,4]:JSON.parse(s.value)===t?[3,3]:[4,e.clear(!1)];case 2:a.sent(),a.label=3;case 3:return[3,6];case 4:return[4,e.save(Ke(n,{key:"schemaVersion",value:JSON.stringify(t)}))];case 5:a.sent(),a.label=6;case 6:return[2]}}))}))}))];case 1:return s.sent(),[2]}}))}))}var rt=function(){function e(){var e=this;this.Auth=c.a,this.API=i.a,this.Cache=l.a,this.amplifyConfig={},this.syncPredicates=new WeakMap,this.amplifyContext={Auth:this.Auth,API:this.API,Cache:this.Cache},this.start=function(){return Object(r.c)(e,void 0,void 0,(function(){var e,t,n,i=this;return Object(r.e)(this,(function(r){switch(r.label){case 0:return void 0!==this.initialized?[3,1]:(xe.debug("Starting DataStore"),this.initialized=new Promise((function(e,t){i.initResolve=e,i.initReject=t})),[3,3]);case 1:return[4,this.initialized];case 2:return r.sent(),[2];case 3:return this.storage=new ie(Ie,Fe,tt,Ke,this.storageAdapter,this.sessionId),[4,this.storage.init()];case 4:return r.sent(),Be(),[4,nt(this.storage,Ie.version)];case 5:return r.sent(),(e=this.amplifyConfig.aws_appsync_graphqlEndpoint)?(xe.debug("GraphQL endpoint available",e),t=this,[4,this.processSyncExpressions()]):[3,7];case 6:return t.syncPredicates=r.sent(),this.sync=new Ee(Ie,Fe,Te,je,this.storage,Ke,this.conflictHandler,this.errorHandler,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,this.amplifyContext),n=1e3*this.fullSyncInterval*60,Ve=this.sync.start({fullSyncInterval:n}).subscribe({next:function(e){var t=e.type,n=e.data;t===(Ne?Q.SYNC_ENGINE_SYNC_QUERIES_READY:Q.SYNC_ENGINE_STORAGE_SUBSCRIBED)&&i.initResolve(),a.a.dispatch("datastore",{event:t,data:n})},error:function(e){xe.warn("Sync error",e),i.initReject()}}),[3,8];case 7:xe.warn("Data won't be synchronized. No GraphQL endpoint configured. Did you forget `Amplify.configure(awsconfig)`?",{config:this.amplifyConfig}),this.initResolve(),r.label=8;case 8:return[4,this.initialized];case 9:return r.sent(),[2]}}))}))},this.query=function(t,n,i){return Object(r.c)(e,void 0,void 0,(function(){var e,o,s,a,u;return Object(r.e)(this,(function(c){switch(c.label){case 0:return[4,this.start()];case 1:if(c.sent(),!Ue(t))throw e="Constructor is not for a valid model",xe.error(e,{modelConstructor:t}),new Error(e);return"string"==typeof n&&void 0!==i&&xe.warn("Pagination is ignored when querying by id"),o=Re(t),s=Qe(n)?S.a.createForId(o,n):Object(S.c)(n)?void 0:S.a.createFromExisting(o,n),a=this.processPagination(o,i),xe.debug("params ready",{modelConstructor:t,predicate:S.a.getPredicates(s,!1),pagination:Object(r.a)(Object(r.a)({},a),{sort:O.a.getPredicates(a&&a.sort,!1)})}),[4,this.storage.query(t,s,a)];case 2:return u=c.sent(),[2,Qe(n)?u[0]:u]}}))}))},this.save=function(t,n){return Object(r.c)(e,void 0,void 0,(function(){var e,i,o,s,a,u,c=this;return Object(r.e)(this,(function(l){switch(l.label){case 0:return[4,this.start()];case 1:if(l.sent(),e=De.get(t),i=t?t.constructor:void 0,!Ue(i))throw o="Object is not an instance of a valid model",xe.error(o,{model:t}),new Error(o);return s=Re(i),a=S.a.createFromExisting(s,n),[4,this.storage.runExclusive((function(n){return Object(r.c)(c,void 0,void 0,(function(){return Object(r.e)(this,(function(r){switch(r.label){case 0:return[4,n.save(t,a,void 0,e)];case 1:return r.sent(),[2,n.query(i,S.a.createForId(s,t.id))]}}))}))}))];case 2:return u=r.f.apply(void 0,[l.sent(),1]),[2,u[0]]}}))}))},this.setConflictHandler=function(t){var n=t.DataStore;return n&&n.conflictHandler?n.conflictHandler:e.conflictHandler===Xe&&t.conflictHandler?t.conflictHandler:e.conflictHandler||Xe},this.setErrorHandler=function(t){var n=t.DataStore;return n&&n.errorHandler?n.errorHandler:e.errorHandler===et&&t.errorHandler?t.errorHandler:e.errorHandler||et},this.delete=function(t,n){return Object(r.c)(e,void 0,void 0,(function(){var e,i,o,s,a,u,c,l,f;return Object(r.e)(this,(function(d){switch(d.label){case 0:return[4,this.start()];case 1:if(d.sent(),!t)throw c="Model or Model Constructor required",xe.error(c,{modelOrConstructor:t}),new Error(c);if(!Ue(t))return[3,3];if(s=t,!n)throw c="Id to delete or criteria required. Do you want to delete all? Pass Predicates.ALL",xe.error(c,{idOrCriteria:n}),new Error(c);if("string"==typeof n)e=S.a.createForId(Re(s),n);else if(!(e=S.a.createFromExisting(Re(s),n))||!S.a.isValidPredicate(e))throw c="Criteria required. Do you want to delete all? Pass Predicates.ALL",xe.error(c,{condition:e}),new Error(c);return[4,this.storage.delete(s,e)];case 2:return i=r.f.apply(void 0,[d.sent(),1]),[2,i[0]];case 3:if(o=t,s=Object.getPrototypeOf(o||{}).constructor,!Ue(s))throw c="Object is not an instance of a valid model",xe.error(c,{model:o}),new Error(c);if(a=Re(s),u=S.a.createForId(a,o.id),n){if("function"!=typeof n)throw c="Invalid criteria",xe.error(c,{idOrCriteria:n}),new Error(c);e=n(u)}else e=u;return[4,this.storage.delete(o,e)];case 4:return l=r.f.apply(void 0,[d.sent(),1]),f=Object(r.f)(l[0],1),[2,f[0]]}}))}))},this.observe=function(t,n){var i,o=t&&Ue(t)?t:void 0;if(t&&void 0===o){var s=t,a=s&&Object.getPrototypeOf(s).constructor;if(Ue(a))return n&&xe.warn("idOrCriteria is ignored when using a model instance",{model:s,idOrCriteria:n}),e.observe(a,s.id);var u="The model is not an instance of a PersistentModelConstructor";throw xe.error(u,{model:s}),new Error(u)}if(void 0!==n&&void 0===o){u="Cannot provide criteria without a modelConstructor";throw xe.error(u,n),new Error(u)}if(o&&!Ue(o)){u="Constructor is not for a valid model";throw xe.error(u,{modelConstructor:o}),new Error(u)}return i="string"==typeof n?S.a.createForId(Re(o),n):o&&S.a.createFromExisting(Re(o),n),new h.a((function(t){var n;return Object(r.c)(e,void 0,void 0,(function(){var e=this;return Object(r.e)(this,(function(s){switch(s.label){case 0:return[4,this.start()];case 1:return s.sent(),n=this.storage.observe(o,i).filter((function(e){var t=e.model;return Fe(t)===I.e})).subscribe({next:function(n){return Object(r.c)(e,void 0,void 0,(function(){var e,i;return Object(r.e)(this,(function(o){switch(o.label){case 0:return e=n,"DELETE"===n.opType?[3,2]:[4,this.query(n.model,n.element.id)];case 1:i=o.sent(),e=Object(r.a)(Object(r.a)({},e),{element:i}),o.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,i){return new h.a((function(o){var s,u,c=new Map,l=new Map,f=[],d=function(){var e=_();E(e)},h=new I.b({callback:d,errorHandler:o.error,maxInterval:2e3}),p=(i||{}).sort,v=p?{sort:p}:void 0,y=Re(t);u=Qe(n)?S.a.createForId(y,n):Object(S.c)(n)?void 0:S.a.createFromExisting(y,n);var g=S.a.getPredicates(u,!1)||{},m=g.predicates,b=g.type,w=!!m;Object(r.c)(e,void 0,void 0,(function(){var e,i=this;return Object(r.e)(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.query(t,n,v)];case 1:return r.sent().forEach((function(e){return c.set(e.id,e)})),s=this.observe(t).subscribe((function(e){var t,n,r=e.element,o=e.model,s=e.opType;if(w&&!Object(I.D)(r,b,m)){if("UPDATE"!==s||!c.has(r.id)&&!l.has(r.id))return;f.push(r.id)}"DELETE"===s?f.push(r.id):l.set(r.id,r);var a=null!==(n=null===(t=i.sync)||void 0===t?void 0:t.getModelSyncedStatus(o))&&void 0!==n&&n;(l.size-f.length>=i.syncPageSize||a)&&h.resolve(),h.start()})),d(),[3,3];case 2:return e=r.sent(),o.error(e),[3,3];case 3:return[2]}}))}));var _=function(){var n,o,s=null!==(o=null===(n=e.sync)||void 0===n?void 0:n.getModelSyncedStatus(t))&&void 0!==o&&o,a=Object(r.h)(Array.from(c.values()),Array.from(l.values()));return(null==i?void 0:i.sort)&&A(a),c.clear(),a.forEach((function(e){return c.set(e.id,e)})),f.forEach((function(e){return c.delete(e)})),{items:Array.from(c.values()),isSynced:s}},E=function(e){o.next(e),l.clear(),f=[]},A=function(n){var r=Re(t),o=e.processPagination(r,i),s=O.a.getPredicates(o.sort);if(s.length){var a=Object(I.B)(s);n.sort(a)}};return a.a.listen("datastore",(function e(n){var r,i=n.payload,o=i.event,s=i.data;o===Q.SYNC_ENGINE_MODEL_SYNCED&&(null===(r=null==s?void 0:s.model)||void 0===r?void 0:r.name)===t.name&&(d(),a.a.remove("api",e))})),function(){s&&s.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=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=Object(r.g)(t,["DataStore","authModeStrategyType","conflictHandler","errorHandler","maxRecordsToSync","syncPageSize","fullSyncInterval","syncExpressions","authProviders","storageAdapter"]);switch(e.amplifyConfig=Object(r.a)(Object(r.a)({},f),e.amplifyConfig),e.conflictHandler=e.setConflictHandler(t),e.errorHandler=e.setErrorHandler(t),n&&n.authModeStrategyType||i||y.a.DEFAULT){case y.a.MULTI_AUTH:e.authModeStrategy=b(e.amplifyContext);break;case y.a.DEFAULT:default:e.authModeStrategy=w}e.amplifyConfig.authProviders=n&&n.authProviders||c,e.syncExpressions=n&&n.syncExpressions||u||e.syncExpressions,e.maxRecordsToSync=n&&n.maxRecordsToSync||o||e.maxRecordsToSync||1e4,e.amplifyConfig.maxRecordsToSync=e.maxRecordsToSync,e.syncPageSize=n&&n.syncPageSize||s||e.syncPageSize||1e3,e.amplifyConfig.syncPageSize=e.syncPageSize,e.fullSyncInterval=n&&n.fullSyncInterval||a||e.fullSyncInterval||1440,e.storageAdapter=n&&n.storageAdapter||l||e.storageAdapter||void 0,e.sessionId=e.retrieveSessionId()},this.clear=function(){return Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(this,(function(e){switch(e.label){case 0:return Be(),void 0!==this.storage?[3,2]:(this.storage=new ie(Ie,Fe,tt,Ke,this.storageAdapter,this.sessionId),[4,this.storage.init()]);case 1:e.sent(),e.label=2;case 2:return Ve&&!Ve.closed&&Ve.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 Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(this,(function(e){switch(e.label){case 0:return void 0===this.initialized?[3,2]:[4,this.start()];case 1:e.sent(),e.label=2;case 2:return Ve&&!Ve.closed&&Ve.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 new Error("Limit is required when requesting a page");if(void 0!==o){if("number"!=typeof o)throw new Error("Page should be a number");if(o<0)throw new Error("Page can't be negative")}if(void 0!==i){if("number"!=typeof i)throw new Error("Limit should be a number");if(i<0)throw new Error("Limit can't be negative")}return s&&(n=O.a.createFromExisting(e,t.sort)),{limit:i,page:o,sort:n}}},e.prototype.processSyncExpressions=function(){return Object(r.c)(this,void 0,void 0,(function(){var e,t=this;return Object(r.e)(this,(function(n){switch(n.label){case 0:return this.syncExpressions&&this.syncExpressions.length?[4,Promise.all(this.syncExpressions.map((function(e){return Object(r.c)(t,void 0,void 0,(function(){var t,n,i,o,s,a;return Object(r.e)(this,(function(r){switch(r.label){case 0:return[4,e];case 1:return t=r.sent(),n=t.modelConstructor,i=t.conditionProducer,o=Re(n),[4,this.unwrapPromise(i)];case 2:return s=r.sent(),Object(S.c)(s)?[2,[o,null]]:(a=this.createFromCondition(o,s),[2,[o,a]])}}))}))})))]:[2,new WeakMap];case 1:return e=n.sent(),[2,this.weakMapFromEntries(e)]}}))}))},e.prototype.createFromCondition=function(e,t){try{return S.a.createFromExisting(e,t)}catch(e){throw xe.error("Error creating Sync Predicate"),e}},e.prototype.unwrapPromise=function(e){return Object(r.c)(this,void 0,void 0,(function(){var t;return Object(r.e)(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=Object(r.f)(t,2),i=n[0],o=n[1];if(e.has(i)){var s=i.name;return xe.warn("You can only utilize one Sync Expression per model.\n Subsequent sync expressions for the "+s+" model will be ignored."),e}return o&&e.set(i,o),e}),new WeakMap)},e.prototype.retrieveSessionId=function(){try{var e=sessionStorage.getItem("datastoreSessionId");if(e){var t=this.amplifyConfig.aws_appsync_graphqlEndpoint.split("/")[2];return e+"-"+Object(r.f)(t.split("."),1)[0]}}catch(e){return}},e}(),it=new rt;u.a.register(it);var ot={USER:I.e,traverseModel:I.C,validatePredicate:I.D,isNonModelConstructor:I.v,isModelConstructor:I.u}},function(e,t,n){"use strict";n.r(t),n.d(t,"fromUtf8",(function(){return r})),n.d(t,"toUtf8",(function(){return i}));var r=function(e){return"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e.charCodeAt(n);if(i<128)t.push(i);else if(i<2048)t.push(i>>6|192,63&i|128);else if(n+1<e.length&&55296==(64512&i)&&56320==(64512&e.charCodeAt(n+1))){var o=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n));t.push(o>>18|240,o>>12&63|128,o>>6&63|128,63&o|128)}else t.push(i>>12|224,i>>6&63|128,63&i|128)}return Uint8Array.from(t)}(e)},i=function(e){return"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):function(e){for(var t="",n=0,r=e.length;n<r;n++){var i=e[n];if(i<128)t+=String.fromCharCode(i);else if(192<=i&&i<224){var o=e[++n];t+=String.fromCharCode((31&i)<<6|63&o)}else if(240<=i&&i<365){var s="%"+[i,e[++n],e[++n],e[++n]].map((function(e){return e.toString(16)})).join("%");t+=decodeURIComponent(s)}else t+=String.fromCharCode((15&i)<<12|(63&e[++n])<<6|63&e[++n])}return t}(e)}},function(e,t,n){"use strict";n.r(t),n.d(t,"fromUtf8",(function(){return r})),n.d(t,"toUtf8",(function(){return i}));var r=function(e){return"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e.charCodeAt(n);if(i<128)t.push(i);else if(i<2048)t.push(i>>6|192,63&i|128);else if(n+1<e.length&&55296==(64512&i)&&56320==(64512&e.charCodeAt(n+1))){var o=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n));t.push(o>>18|240,o>>12&63|128,o>>6&63|128,63&o|128)}else t.push(i>>12|224,i>>6&63|128,63&i|128)}return Uint8Array.from(t)}(e)},i=function(e){return"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):function(e){for(var t="",n=0,r=e.length;n<r;n++){var i=e[n];if(i<128)t+=String.fromCharCode(i);else if(192<=i&&i<224){var o=e[++n];t+=String.fromCharCode((31&i)<<6|63&o)}else if(240<=i&&i<365){var s="%"+[i,e[++n],e[++n],e[++n]].map((function(e){return e.toString(16)})).join("%");t+=decodeURIComponent(s)}else t+=String.fromCharCode((15&i)<<12|(63&e[++n])<<6|63&e[++n])}return t}(e)}},,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"d",(function(){return s})),n.d(t,"b",(function(){return a})),n.d(t,"c",(function(){return u}));var r=n(0),i=new(n(22).a)("Util"),o=function(e){function t(t){var n=e.call(this,t)||this;return n.nonRetryable=!0,n}return Object(r.d)(t,e),t}(Error);function s(e,t,n,o){return void 0===o&&(o=1),Object(r.c)(this,void 0,void 0,(function(){var a,u;return Object(r.e)(this,(function(c){switch(c.label){case 0:if("function"!=typeof e)throw Error("functionToRetry must be a function");i.debug(e.name+" attempt #"+o+" with this vars: "+JSON.stringify(t)),c.label=1;case 1:return c.trys.push([1,3,,8]),[4,e.apply(void 0,Object(r.h)(t))];case 2:return[2,c.sent()];case 3:if(a=c.sent(),i.debug("error on "+e.name,a),(l=a)&&l.nonRetryable)throw i.debug(e.name+" non retryable error",a),a;return u=n(o,t,a),i.debug(e.name+" retrying in "+u+" ms"),!1===u?[3,6]:[4,new Promise((function(e){return setTimeout(e,u)}))];case 4:return c.sent(),[4,s(e,t,n,o+1)];case 5:return[2,c.sent()];case 6:throw a;case 7:return[3,8];case 8:return[2]}var l}))}))}function a(e){void 0===e&&(e=3e5);return function(t){var n=100*Math.pow(2,t)+100*Math.random();return!(n>e)&&n}}var u=function(e,t,n){return void 0===n&&(n=3e5),s(e,t,a(n))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return Br}));var r=n(0),i=n(22),o=n(70),s=n(17),a=n(153),u=new i.a("CognitoCredentials"),c=new Promise((function(e,t){return Object(s.b)().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(){return Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(this,(function(e){switch(e.label){case 0:return this.initialized?[3,2]:(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()]}}))}))},e.prototype._refreshGoogleTokenImpl=function(){var e=null;return Object(s.b)().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 a.a("google Auth undefined")));var r=e.currentUser.get();r.isSignedIn()?(u.debug("refreshing the google access token"),r.reloadAuthResponse().then((function(e){var n=e.id_token,r=e.expires_at;t({token:n,expires_at:r})})).catch((function(e){e&&"network_error"===e.error?n("Network error reloading google auth response"):n(new a.a("Failed to reload google auth response"))}))):n(new a.a("User is not signed in with Google"))})).catch((function(e){u.debug("Failed to refresh google token",e),n(new a.a("Failed to refresh google token"))}))})):(u.debug("no gapi auth2 available"),Promise.reject("no gapi auth2 available"))},e}(),f=new i.a("CognitoCredentials"),d=new Promise((function(e,t){return Object(s.b)().isBrowser?window.FB?(f.debug("FB SDK already loaded"),e()):void setTimeout((function(){return e()}),2e3):(f.debug("not in the browser, directly resolved"),e())})),h=function(){function e(){this.initialized=!1,this.refreshFacebookToken=this.refreshFacebookToken.bind(this),this._refreshFacebookTokenImpl=this._refreshFacebookTokenImpl.bind(this)}return e.prototype.refreshFacebookToken=function(){return Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(this,(function(e){switch(e.label){case 0:return this.initialized?[3,2]:(f.debug("need to wait for the Facebook SDK loaded"),[4,d]);case 1:e.sent(),this.initialized=!0,f.debug("finish waiting"),e.label=2;case 2:return[2,this._refreshFacebookTokenImpl()]}}))}))},e.prototype._refreshFacebookTokenImpl=function(){var e=null;if(Object(s.b)().isBrowser&&(e=window.FB),!e){return f.debug("no fb sdk available"),Promise.reject(new a.a("no fb sdk available"))}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){s="the jwtToken is undefined";f.debug(s),n(new a.a(s))}t({token:i,expires_at:o})}else{var s="no response from facebook when refreshing the jwt token";f.debug(s),n(new a.a(s))}}),{scope:"public_profile,email"})}))},e}(),p=new l,v=new h,y=n(36),g=n(40),m=function(e,t){return(m=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)};var b,w,S,O,_,E,A,I,T,j,C,P,x,k,N,M,D,R,U,F,L,B,q,z,K,V,G,H,W,Y,J,$,Z,Q,X,ee,te,ne,re,ie,oe,se,ae,ue,ce,le,fe,de,he,pe,ve,ye,ge,me,be,we,Se;function Oe(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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function _e(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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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 Ee(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(e){e.AUTHENTICATED_ROLE="AuthenticatedRole",e.DENY="Deny"}(b||(b={})),(w||(w={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(S||(S={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(O||(O={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(_||(_={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(E||(E={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(A||(A={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(I||(I={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(T||(T={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(j||(j={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(C||(C={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},function(e){e.ACCESS_DENIED="AccessDenied",e.INTERNAL_SERVER_ERROR="InternalServerError"}(P||(P={})),(x||(x={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(k||(k={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(N||(N={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(M||(M={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(D||(D={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(R||(R={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(U||(U={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(F||(F={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(L||(L={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(B||(B={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(q||(q={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(z||(z={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(K||(K={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(V||(V={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(G||(G={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},function(e){e.CONTAINS="Contains",e.EQUALS="Equals",e.NOT_EQUAL="NotEqual",e.STARTS_WITH="StartsWith"}(H||(H={})),(W||(W={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(Y||(Y={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},function(e){e.RULES="Rules",e.TOKEN="Token"}(J||(J={})),($||($={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(Z||(Z={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(Q||(Q={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(X||(X={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(ee||(ee={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(te||(te={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(ne||(ne={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(re||(re={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(ie||(ie={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(oe||(oe={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(se||(se={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(ae||(ae={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(ue||(ue={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(ce||(ce={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(le||(le={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(fe||(fe={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(de||(de={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(he||(he={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(pe||(pe={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(ve||(ve={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(ye||(ye={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(ge||(ge={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(me||(me={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(be||(be={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(we||(we={})).filterSensitiveLog=function(e){return Object(r.a)({},e)},(Se||(Se={})).filterSensitiveLog=function(e){return Object(r.a)({},e)};var Ae=function(){function e(e){this.statusCode=e.statusCode,this.headers=e.headers||{},this.body=e.body}return e.isInstance=function(e){if(!e)return!1;var t=e;return"number"==typeof t.statusCode&&"object"==typeof t.headers},e}();
126
+ /*! *****************************************************************************
127
+ Copyright (c) Microsoft Corporation.
128
+
129
+ Permission to use, copy, modify, and/or distribute this software for any
130
+ purpose with or without fee is hereby granted.
131
+
132
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
133
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
134
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
135
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
136
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
137
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
138
+ PERFORMANCE OF THIS SOFTWARE.
139
+ ***************************************************************************** */var Ie=function(){return(Ie=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)};function Te(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}var je=function(){function e(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?":"!==e.protocol.substr(-1)?e.protocol+":":e.protocol:"https:",this.path=e.path?"/"!==e.path.charAt(0)?"/"+e.path:e.path:"/"}return e.isInstance=function(e){if(!e)return!1;var t=e;return"method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&"object"==typeof t.query&&"object"==typeof t.headers},e.prototype.clone=function(){var t,n=new e(Ie(Ie({},this),{headers:Ie({},this.headers)}));return n.query&&(n.query=(t=n.query,Object.keys(t).reduce((function(e,n){var r,i=t[n];return Ie(Ie({},e),((r={})[n]=Array.isArray(i)?function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Te(arguments[t]));return e}(i):i,r))}),{}))),n},e}();var Ce=function(e,t){return Object(r.c)(void 0,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,f,d,h,p,v,y,g;return Object(r.e)(this,(function(m){switch(m.label){case 0:return i=[Object(r.a)({},e)],g={},[4,it(e.body,t)];case 1:switch(n=r.a.apply(void 0,i.concat([(g.body=m.sent(),g)])),s="UnknownError",s=ot(e,n.body),s){case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":return[3,2];case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":return[3,4];case"InvalidIdentityPoolConfigurationException":case"com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException":return[3,6];case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":return[3,8];case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":return[3,10];case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":return[3,12];case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":return[3,14];case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":return[3,16]}return[3,18];case 2:return a=[{}],[4,xe(n,t)];case 3:return o=r.a.apply(void 0,[r.a.apply(void 0,a.concat([m.sent()])),{name:s,$metadata:tt(e)}]),[3,19];case 4:return u=[{}],[4,ke(n,t)];case 5:return o=r.a.apply(void 0,[r.a.apply(void 0,u.concat([m.sent()])),{name:s,$metadata:tt(e)}]),[3,19];case 6:return c=[{}],[4,Ne(n,t)];case 7:return o=r.a.apply(void 0,[r.a.apply(void 0,c.concat([m.sent()])),{name:s,$metadata:tt(e)}]),[3,19];case 8:return l=[{}],[4,Me(n,t)];case 9:return o=r.a.apply(void 0,[r.a.apply(void 0,l.concat([m.sent()])),{name:s,$metadata:tt(e)}]),[3,19];case 10:return f=[{}],[4,Re(n,t)];case 11:return o=r.a.apply(void 0,[r.a.apply(void 0,f.concat([m.sent()])),{name:s,$metadata:tt(e)}]),[3,19];case 12:return d=[{}],[4,Ue(n,t)];case 13:return o=r.a.apply(void 0,[r.a.apply(void 0,d.concat([m.sent()])),{name:s,$metadata:tt(e)}]),[3,19];case 14:return h=[{}],[4,Fe(n,t)];case 15:return o=r.a.apply(void 0,[r.a.apply(void 0,h.concat([m.sent()])),{name:s,$metadata:tt(e)}]),[3,19];case 16:return p=[{}],[4,Le(n,t)];case 17:return o=r.a.apply(void 0,[r.a.apply(void 0,p.concat([m.sent()])),{name:s,$metadata:tt(e)}]),[3,19];case 18:v=n.body,s=v.code||v.Code||s,o=Object(r.a)(Object(r.a)({},v),{name:""+s,message:v.message||v.Message||s,$fault:"client",$metadata:tt(e)}),m.label=19;case 19:return y=o.message||o.Message||s,o.message=y,delete o.Message,[2,Promise.reject(Object.assign(new Error(y),o))]}}))}))},Pe=function(e,t){return Object(r.c)(void 0,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,f,d,h,p,v,y,g;return Object(r.e)(this,(function(m){switch(m.label){case 0:return i=[Object(r.a)({},e)],g={},[4,it(e.body,t)];case 1:switch(n=r.a.apply(void 0,i.concat([(g.body=m.sent(),g)])),s="UnknownError",s=ot(e,n.body),s){case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":return[3,2];case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":return[3,4];case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":return[3,6];case"LimitExceededException":case"com.amazonaws.cognitoidentity#LimitExceededException":return[3,8];case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":return[3,10];case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":return[3,12];case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":return[3,14];case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":return[3,16]}return[3,18];case 2:return a=[{}],[4,xe(n,t)];case 3:return o=r.a.apply(void 0,[r.a.apply(void 0,a.concat([m.sent()])),{name:s,$metadata:tt(e)}]),[3,19];case 4:return u=[{}],[4,ke(n,t)];case 5:return o=r.a.apply(void 0,[r.a.apply(void 0,u.concat([m.sent()])),{name:s,$metadata:tt(e)}]),[3,19];case 6:return c=[{}],[4,Me(n,t)];case 7:return o=r.a.apply(void 0,[r.a.apply(void 0,c.concat([m.sent()])),{name:s,$metadata:tt(e)}]),[3,19];case 8:return l=[{}],[4,De(n,t)];case 9:return o=r.a.apply(void 0,[r.a.apply(void 0,l.concat([m.sent()])),{name:s,$metadata:tt(e)}]),[3,19];case 10:return f=[{}],[4,Re(n,t)];case 11:return o=r.a.apply(void 0,[r.a.apply(void 0,f.concat([m.sent()])),{name:s,$metadata:tt(e)}]),[3,19];case 12:return d=[{}],[4,Ue(n,t)];case 13:return o=r.a.apply(void 0,[r.a.apply(void 0,d.concat([m.sent()])),{name:s,$metadata:tt(e)}]),[3,19];case 14:return h=[{}],[4,Fe(n,t)];case 15:return o=r.a.apply(void 0,[r.a.apply(void 0,h.concat([m.sent()])),{name:s,$metadata:tt(e)}]),[3,19];case 16:return p=[{}],[4,Le(n,t)];case 17:return o=r.a.apply(void 0,[r.a.apply(void 0,p.concat([m.sent()])),{name:s,$metadata:tt(e)}]),[3,19];case 18:v=n.body,s=v.code||v.Code||s,o=Object(r.a)(Object(r.a)({},v),{name:""+s,message:v.message||v.Message||s,$fault:"client",$metadata:tt(e)}),m.label=19;case 19:return y=o.message||o.Message||s,o.message=y,delete o.Message,[2,Promise.reject(Object.assign(new Error(y),o))]}}))}))},xe=function(e,t){return Object(r.c)(void 0,void 0,void 0,(function(){var n,i;return Object(r.e)(this,(function(o){return n=e.body,i=Ve(n,t),[2,Object(r.a)({name:"ExternalServiceException",$fault:"client",$metadata:tt(e)},i)]}))}))},ke=function(e,t){return Object(r.c)(void 0,void 0,void 0,(function(){var n,i;return Object(r.e)(this,(function(o){return n=e.body,i=We(n,t),[2,Object(r.a)({name:"InternalErrorException",$fault:"server",$metadata:tt(e)},i)]}))}))},Ne=function(e,t){return Object(r.c)(void 0,void 0,void 0,(function(){var n,i;return Object(r.e)(this,(function(o){return n=e.body,i=Ye(n,t),[2,Object(r.a)({name:"InvalidIdentityPoolConfigurationException",$fault:"client",$metadata:tt(e)},i)]}))}))},Me=function(e,t){return Object(r.c)(void 0,void 0,void 0,(function(){var n,i;return Object(r.e)(this,(function(o){return n=e.body,i=Je(n,t),[2,Object(r.a)({name:"InvalidParameterException",$fault:"client",$metadata:tt(e)},i)]}))}))},De=function(e,t){return Object(r.c)(void 0,void 0,void 0,(function(){var n,i;return Object(r.e)(this,(function(o){return n=e.body,i=$e(n,t),[2,Object(r.a)({name:"LimitExceededException",$fault:"client",$metadata:tt(e)},i)]}))}))},Re=function(e,t){return Object(r.c)(void 0,void 0,void 0,(function(){var n,i;return Object(r.e)(this,(function(o){return n=e.body,i=Ze(n,t),[2,Object(r.a)({name:"NotAuthorizedException",$fault:"client",$metadata:tt(e)},i)]}))}))},Ue=function(e,t){return Object(r.c)(void 0,void 0,void 0,(function(){var n,i;return Object(r.e)(this,(function(o){return n=e.body,i=Qe(n,t),[2,Object(r.a)({name:"ResourceConflictException",$fault:"client",$metadata:tt(e)},i)]}))}))},Fe=function(e,t){return Object(r.c)(void 0,void 0,void 0,(function(){var n,i;return Object(r.e)(this,(function(o){return n=e.body,i=Xe(n,t),[2,Object(r.a)({name:"ResourceNotFoundException",$fault:"client",$metadata:tt(e)},i)]}))}))},Le=function(e,t){return Object(r.c)(void 0,void 0,void 0,(function(){var n,i;return Object(r.e)(this,(function(o){return n=e.body,i=et(n,t),[2,Object(r.a)({name:"TooManyRequestsException",$fault:"client",$metadata:tt(e)},i)]}))}))},Be=function(e,t){return Object(r.a)(Object(r.a)(Object(r.a)({},void 0!==e.CustomRoleArn&&null!==e.CustomRoleArn&&{CustomRoleArn:e.CustomRoleArn}),void 0!==e.IdentityId&&null!==e.IdentityId&&{IdentityId:e.IdentityId}),void 0!==e.Logins&&null!==e.Logins&&{Logins:ze(e.Logins,t)})},qe=function(e,t){return Object(r.a)(Object(r.a)(Object(r.a)({},void 0!==e.AccountId&&null!==e.AccountId&&{AccountId:e.AccountId}),void 0!==e.IdentityPoolId&&null!==e.IdentityPoolId&&{IdentityPoolId:e.IdentityPoolId}),void 0!==e.Logins&&null!==e.Logins&&{Logins:ze(e.Logins,t)})},ze=function(e,t){return Object.entries(e).reduce((function(e,t){var n,i=Object(r.f)(t,2),o=i[0],s=i[1];return null===s?e:Object(r.a)(Object(r.a)({},e),((n={})[o]=s,n))}),{})},Ke=function(e,t){return{AccessKeyId:void 0!==e.AccessKeyId&&null!==e.AccessKeyId?e.AccessKeyId:void 0,Expiration:void 0!==e.Expiration&&null!==e.Expiration?new Date(Math.round(1e3*e.Expiration)):void 0,SecretKey:void 0!==e.SecretKey&&null!==e.SecretKey?e.SecretKey:void 0,SessionToken:void 0!==e.SessionToken&&null!==e.SessionToken?e.SessionToken:void 0}},Ve=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ge=function(e,t){return{Credentials:void 0!==e.Credentials&&null!==e.Credentials?Ke(e.Credentials):void 0,IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},He=function(e,t){return{IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},We=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ye=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Je=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},$e=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ze=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Qe=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Xe=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},et=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},tt=function(e){var t;return{httpStatusCode:e.statusCode,requestId:null!==(t=e.headers["x-amzn-requestid"])&&void 0!==t?t:e.headers["x-amzn-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}},nt=function(e,t){return void 0===e&&(e=new Uint8Array),e instanceof Uint8Array?Promise.resolve(e):t.streamCollector(e)||Promise.resolve(new Uint8Array)},rt=function(e,t,n,i,o){return Object(r.c)(void 0,void 0,void 0,(function(){var s,a,u,c,l,f;return Object(r.e)(this,(function(r){switch(r.label){case 0:return[4,e.endpoint()];case 1:return s=r.sent(),a=s.hostname,u=s.protocol,c=void 0===u?"https":u,l=s.port,f={protocol:c,hostname:a,port:l,method:"POST",path:n,headers:t},void 0!==i&&(f.hostname=i),void 0!==o&&(f.body=o),[2,new je(f)]}}))}))},it=function(e,t){return function(e,t){return nt(e,t).then((function(e){return t.utf8Encoder(e)}))}(e,t).then((function(e){return e.length?JSON.parse(e):{}}))},ot=function(e,t){var n,r,i=function(e){var t=e;return t.indexOf(":")>=0&&(t=t.split(":")[0]),t.indexOf("#")>=0&&(t=t.split("#")[1]),t},o=(n=e.headers,r="x-amzn-errortype",Object.keys(n).find((function(e){return e.toLowerCase()===r.toLowerCase()})));return void 0!==o?i(e.headers[o]):void 0!==t.code?i(t.code):void 0!==t.__type?i(t.__type):""};var st=function(){return(st=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)};function at(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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function ut(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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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])}}}var ct={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},lt={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function ft(e,t,n){return{applyToStack:function(r){r.add(function(e,t){return function(n,r){return function(r){return at(void 0,void 0,void 0,(function(){var i,o;return ut(this,(function(s){switch(s.label){case 0:return[4,n(r)];case 1:return i=s.sent().response,[4,t(i,e)];case 2:return o=s.sent(),[2,{response:i,output:o}]}}))}))}}}(e,n),ct),r.add(function(e,t){return function(n,r){return function(r){return at(void 0,void 0,void 0,(function(){var i;return ut(this,(function(o){switch(o.label){case 0:return[4,t(r.input,e)];case 1:return i=o.sent(),[2,n(st(st({},r),{request:i}))]}}))}))}}}(e,t),lt)}}}
140
+ /*! *****************************************************************************
141
+ Copyright (c) Microsoft Corporation.
142
+
143
+ Permission to use, copy, modify, and/or distribute this software for any
144
+ purpose with or without fee is hereby granted.
145
+
146
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
147
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
148
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
149
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
150
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
151
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
152
+ PERFORMANCE OF THIS SOFTWARE.
153
+ ***************************************************************************** */var dt=function(){return(dt=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)};function ht(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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function pt(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 vt(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(pt(arguments[t]));return e}var yt=function(){var e=[],t=[],n=new Set,r=function(n){return e.forEach((function(e){n.add(e.middleware,dt({},e))})),t.forEach((function(e){n.addRelativeTo(e.middleware,dt({},e))})),n},i=function(e){var t=[];return e.before.forEach((function(e){0===e.before.length&&0===e.after.length?t.push(e):t.push.apply(t,vt(i(e)))})),t.push(e),e.after.reverse().forEach((function(e){0===e.before.length&&0===e.after.length?t.push(e):t.push.apply(t,vt(i(e)))})),t},o=function(){var n,r=[],o=[],s={};return e.forEach((function(e){var t=dt(dt({},e),{before:[],after:[]});t.name&&(s[t.name]=t),r.push(t)})),t.forEach((function(e){var t=dt(dt({},e),{before:[],after:[]});t.name&&(s[t.name]=t),o.push(t)})),o.forEach((function(e){if(e.toMiddleware){var t=s[e.toMiddleware];if(void 0===t)throw new Error(e.toMiddleware+" is not found when adding "+(e.name||"anonymous")+" middleware "+e.relation+" "+e.toMiddleware);"after"===e.relation&&t.after.push(e),"before"===e.relation&&t.before.push(e)}})),(n=r,n.sort((function(e,t){return gt[t.step]-gt[e.step]||mt[t.priority||"normal"]-mt[e.priority||"normal"]}))).map(i).reduce((function(e,t){return e.push.apply(e,vt(t)),e}),[]).map((function(e){return e.middleware}))},s={add:function(t,r){void 0===r&&(r={});var i=r.name,o=r.override,s=dt({step:"initialize",priority:"normal",middleware:t},r);if(i){if(n.has(i)){if(!o)throw new Error("Duplicate middleware name '"+i+"'");var a=e.findIndex((function(e){return e.name===i})),u=e[a];if(u.step!==s.step||u.priority!==s.priority)throw new Error('"'+i+'" middleware with '+u.priority+" priority in "+u.step+" step cannot be overridden by same-name middleware with "+s.priority+" priority in "+s.step+" step.");e.splice(a,1)}n.add(i)}e.push(s)},addRelativeTo:function(e,r){var i=r.name,o=r.override,s=dt({middleware:e},r);if(i){if(n.has(i)){if(!o)throw new Error("Duplicate middleware name '"+i+"'");var a=t.findIndex((function(e){return e.name===i})),u=t[a];if(u.toMiddleware!==s.toMiddleware||u.relation!==s.relation)throw new Error('"'+i+'" middleware '+u.relation+' "'+u.toMiddleware+'" middleware cannot be overridden by same-name middleware '+s.relation+' "'+s.toMiddleware+'" middleware.');t.splice(a,1)}n.add(i)}t.push(s)},clone:function(){return r(yt())},use:function(e){e.applyToStack(s)},remove:function(r){return"string"==typeof r?function(r){var i=!1,o=function(e){return!e.name||e.name!==r||(i=!0,n.delete(r),!1)};return e=e.filter(o),t=t.filter(o),i}(r):function(r){var i=!1,o=function(e){return e.middleware!==r||(i=!0,e.name&&n.delete(e.name),!1)};return e=e.filter(o),t=t.filter(o),i}(r)},removeByTag:function(r){var i=!1,o=function(e){var t=e.tags,o=e.name;return!t||!t.includes(r)||(o&&n.delete(o),i=!0,!1)};return e=e.filter(o),t=t.filter(o),i},concat:function(e){var t=r(yt());return t.use(e),t},applyToStack:r,resolve:function(e,t){var n,r;try{for(var i=ht(o().reverse()),s=i.next();!s.done;s=i.next()){e=(0,s.value)(e,t)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e}};return s},gt={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},mt={high:3,normal:2,low:1},bt=function(){function e(e){this.middlewareStack=yt(),this.config=e}return e.prototype.send=function(e,t,n){var r="function"!=typeof t?t:void 0,i="function"==typeof t?t:n,o=e.resolveMiddleware(this.middlewareStack,this.config,r);if(!i)return o(e).then((function(e){return e.output}));o(e).then((function(e){return i(null,e.output)}),(function(e){return i(e)})).catch((function(){}))},e.prototype.destroy=function(){this.config.requestHandler.destroy&&this.config.requestHandler.destroy()},e}(),wt=function(){this.middlewareStack=yt()};var St=function(e,t){return(St=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 Ot(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 _t(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Ot(arguments[t]));return e}var Et=function(){var e=Object.getPrototypeOf(this).constructor,t=Function.bind.apply(String,_t([null],arguments)),n=new t;return Object.setPrototypeOf(n,e.prototype),n};Et.prototype=Object.create(String.prototype,{constructor:{value:Et,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf(Et,String);!function(e){function t(){return null!==e&&e.apply(this,arguments)||this}(function(e,t){function n(){this.constructor=e}St(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)})(t,e),t.prototype.deserializeJSON=function(){return JSON.parse(e.prototype.toString.call(this))},t.prototype.toJSON=function(){return e.prototype.toString.call(this)},t.fromObject=function(e){return e instanceof t?e:new t(e instanceof String||"string"==typeof e?e:JSON.stringify(e))}}(Et);var At=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return Object(r.d)(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(ft(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetCredentialsForIdentityCommand",inputFilterSensitiveLog:L.filterSensitiveLog,outputFilterSensitiveLog:q.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return Object(r.c)(void 0,void 0,void 0,(function(){var n,i;return Object(r.e)(this,(function(r){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetCredentialsForIdentity"},i=JSON.stringify(Be(e,t)),[2,rt(t,n,"/",void 0,i)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return Object(r.c)(void 0,void 0,void 0,(function(){var n,i,o;return Object(r.e)(this,(function(s){switch(s.label){case 0:return e.statusCode>=300?[2,Ce(e,t)]:[4,it(e.body,t)];case 1:return n=s.sent(),{},i=Ge(n,t),o=Object(r.a)({$metadata:tt(e)},i),[2,Promise.resolve(o)]}}))}))}(e,t)},t}(wt),It=function(e){function t(t,n){void 0===n&&(n=!0);var r=e.call(this,t)||this;return r.tryNextLink=n,r}return function(e,t){function n(){this.constructor=e}m(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t}(Error);function Tt(e){return Promise.all(Object.keys(e).reduce((function(t,n){var r=e[n];return"string"==typeof r?t.push([n,r]):t.push(r().then((function(e){return[n,e]}))),t}),[])).then((function(e){return e.reduce((function(e,t){var n=Ee(t,2),r=n[0],i=n[1];return e[r]=i,e}),{})}))}function jt(e){var t=this;return function(){return Oe(t,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,f,d,h;return _e(this,(function(p){switch(p.label){case 0:return l=(c=e.client).send,f=At.bind,h={CustomRoleArn:e.customRoleArn,IdentityId:e.identityId},e.logins?[4,Tt(e.logins)]:[3,2];case 1:return d=p.sent(),[3,3];case 2:d=void 0,p.label=3;case 3:return[4,l.apply(c,[new(f.apply(At,[void 0,(h.Logins=d,h)]))])];case 4:return t=p.sent().Credentials,n=void 0===t?function(){throw new It("Response from Amazon Cognito contained no credentials")}():t,r=n.AccessKeyId,i=void 0===r?function(){throw new It("Response from Amazon Cognito contained no access key ID")}():r,o=n.Expiration,s=n.SecretKey,a=void 0===s?function(){throw new It("Response from Amazon Cognito contained no secret key")}():s,u=n.SessionToken,[2,{identityId:e.identityId,accessKeyId:i,secretAccessKey:a,sessionToken:u,expiration:o}]}}))}))}}var Ct=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return Object(r.d)(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(ft(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetIdCommand",inputFilterSensitiveLog:K.filterSensitiveLog,outputFilterSensitiveLog:V.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return Object(r.c)(void 0,void 0,void 0,(function(){var n,i;return Object(r.e)(this,(function(r){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetId"},i=JSON.stringify(qe(e,t)),[2,rt(t,n,"/",void 0,i)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return Object(r.c)(void 0,void 0,void 0,(function(){var n,i,o;return Object(r.e)(this,(function(s){switch(s.label){case 0:return e.statusCode>=300?[2,Pe(e,t)]:[4,it(e.body,t)];case 1:return n=s.sent(),{},i=He(n,t),o=Object(r.a)({$metadata:tt(e)},i),[2,Promise.resolve(o)]}}))}))}(e,t)},t}(wt),Pt=function(){function e(e){void 0===e&&(e="aws:cognito-identity-ids"),this.dbName=e}return e.prototype.getItem=function(e){return this.withObjectStore("readonly",(function(t){var n=t.get(e);return new Promise((function(e){n.onerror=function(){return e(null)},n.onsuccess=function(){return e(n.result?n.result.value:null)}}))})).catch((function(){return null}))},e.prototype.removeItem=function(e){return this.withObjectStore("readwrite",(function(t){var n=t.delete(e);return new Promise((function(e,t){n.onerror=function(){return t(n.error)},n.onsuccess=function(){return e()}}))}))},e.prototype.setItem=function(e,t){return this.withObjectStore("readwrite",(function(n){var r=n.put({id:e,value:t});return new Promise((function(e,t){r.onerror=function(){return t(r.error)},r.onsuccess=function(){return e()}}))}))},e.prototype.getDb=function(){var e=self.indexedDB.open(this.dbName,1);return new Promise((function(t,n){e.onsuccess=function(){t(e.result)},e.onerror=function(){n(e.error)},e.onblocked=function(){n(new Error("Unable to access DB"))},e.onupgradeneeded=function(){var t=e.result;t.onerror=function(){n(new Error("Failed to create object store"))},t.createObjectStore("IdentityIds",{keyPath:"id"})}}))},e.prototype.withObjectStore=function(e,t){return this.getDb().then((function(n){var r=n.transaction("IdentityIds",e);return r.oncomplete=function(){return n.close()},new Promise((function(e,n){r.onerror=function(){return n(r.error)},e(t(r.objectStore("IdentityIds")))})).catch((function(e){throw n.close(),e}))}))},e}(),xt=new(function(){function e(e){void 0===e&&(e={}),this.store=e}return e.prototype.getItem=function(e){return e in this.store?this.store[e]:null},e.prototype.removeItem=function(e){delete this.store[e]},e.prototype.setItem=function(e,t){this.store[e]=t},e}());function kt(e){var t=this,n=e.accountId,r=e.cache,i=void 0===r?"object"==typeof self&&self.indexedDB?new Pt:"object"==typeof window&&window.localStorage?window.localStorage:xt:r,o=e.client,s=e.customRoleArn,a=e.identityPoolId,u=e.logins,c=e.userIdentifier,l=void 0===c?u&&0!==Object.keys(u).length?void 0:"ANONYMOUS":c,f=l?"aws:cognito-identity-credentials:"+a+":"+l:void 0,d=function(){return Oe(t,void 0,void 0,(function(){var e,t,r,c,l,h,p,v,y;return _e(this,(function(g){switch(g.label){case 0:return(t=f)?[4,i.getItem(f)]:[3,2];case 1:t=g.sent(),g.label=2;case 2:return(e=t)?[3,7]:(h=(l=o).send,p=Ct.bind,y={AccountId:n,IdentityPoolId:a},u?[4,Tt(u)]:[3,4]);case 3:return v=g.sent(),[3,5];case 4:v=void 0,g.label=5;case 5:return[4,h.apply(l,[new(p.apply(Ct,[void 0,(y.Logins=v,y)]))])];case 6:r=g.sent().IdentityId,c=void 0===r?function(){throw new It("Response from Amazon Cognito contained no identity ID")}():r,e=c,f&&Promise.resolve(i.setItem(f,e)).catch((function(){})),g.label=7;case 7:return[2,(d=jt({client:o,customRoleArn:s,logins:u,identityId:e}))()]}}))}))};return function(){return d().catch((function(e){return Oe(t,void 0,void 0,(function(){return _e(this,(function(t){throw f&&Promise.resolve(i.removeItem(f)).catch((function(){})),e}))}))}))}}var Nt=n(76),Mt=n(74);function Dt(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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function Rt(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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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 Ut(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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ft(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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}var Lt=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,Bt)},Bt=function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()};for(var qt=function(){function e(e){var t=(void 0===e?{}:e).requestTimeout;this.requestTimeout=t}return e.prototype.destroy=function(){},e.prototype.handle=function(e,t){var n=(void 0===t?{}:t).abortSignal,r=this.requestTimeout;if(null==n?void 0:n.aborted){var i=new Error("Request aborted");return i.name="AbortError",Promise.reject(i)}var o=e.path;if(e.query){var s=function(e){var t,n,r=[];try{for(var i=Ft(Object.keys(e).sort()),o=i.next();!o.done;o=i.next()){var s=o.value,a=e[s];if(s=Lt(s),Array.isArray(a))for(var u=0,c=a.length;u<c;u++)r.push(s+"="+Lt(a[u]));else{var l=s;(a||"string"==typeof a)&&(l+="="+Lt(a)),r.push(l)}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r.join("&")}(e.query);s&&(o+="?"+s)}var a=e.port,u=e.method,c=e.protocol+"//"+e.hostname+(a?":"+a:"")+o,l={body:"GET"===u||"HEAD"===u?void 0:e.body,headers:new Headers(e.headers),method:u};"undefined"!=typeof AbortController&&(l.signal=n);var f,d=new Request(c,l),h=[fetch(d).then((function(e){var t,n,r=e.headers,i={};try{for(var o=Ut(r.entries()),s=o.next();!s.done;s=o.next()){var a=s.value;i[a[0]]=a[1]}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return void 0!==e.body?{response:new Ae({headers:i,statusCode:e.status,body:e.body})}:e.blob().then((function(t){return{response:new Ae({headers:i,statusCode:e.status,body:t})}}))})),(f=r,void 0===f&&(f=0),new Promise((function(e,t){f&&setTimeout((function(){var e=new Error("Request did not complete within "+f+" ms");e.name="TimeoutError",t(e)}),f)})))];return n&&h.push(new Promise((function(e,t){n.onabort=function(){var e=new Error("Request aborted");e.name="AbortError",t(e)}}))),Promise.race(h)},e}(),zt={},Kt=new Array(64),Vt=0,Gt="A".charCodeAt(0),Ht="Z".charCodeAt(0);Vt+Gt<=Ht;Vt++){var Wt=String.fromCharCode(Vt+Gt);zt[Wt]=Vt,Kt[Vt]=Wt}for(Vt=0,Gt="a".charCodeAt(0),Ht="z".charCodeAt(0);Vt+Gt<=Ht;Vt++){Wt=String.fromCharCode(Vt+Gt);var Yt=Vt+26;zt[Wt]=Yt,Kt[Yt]=Wt}for(Vt=0;Vt<10;Vt++){zt[Vt.toString(10)]=Vt+52;Wt=Vt.toString(10),Yt=Vt+52;zt[Wt]=Yt,Kt[Yt]=Wt}zt["+"]=62,Kt[62]="+",zt["/"]=63,Kt[63]="/";function Jt(e){var t=e.length/4*3;"=="===e.substr(-2)?t-=2:"="===e.substr(-1)&&t--;for(var n=new ArrayBuffer(t),r=new DataView(n),i=0;i<e.length;i+=4){for(var o=0,s=0,a=i,u=i+3;a<=u;a++)"="!==e[a]?(o|=zt[e[a]]<<6*(u-a),s+=6):o>>=6;var c=i/4*3;o>>=s%8;for(var l=Math.floor(s/8),f=0;f<l;f++){var d=8*(l-f-1);r.setUint8(c+f,(o&255<<d)>>d)}}return new Uint8Array(n)}function $t(e){return new Promise((function(t,n){var r=new FileReader;r.onloadend=function(){var e;if(2!==r.readyState)return n(new Error("Reader aborted too early"));var i=null!==(e=r.result)&&void 0!==e?e:"",o=i.indexOf(","),s=o>-1?o+1:i.length;t(i.substring(s))},r.onabort=function(){return n(new Error("Read aborted"))},r.onerror=function(){return n(r.error)},r.readAsDataURL(e)}))}var Zt=function(){return(Zt=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)};function Qt(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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function Xt(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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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 en(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}var tn=function(e){return function(t,n){return function(r){return Qt(void 0,void 0,void 0,(function(){var i;return Xt(this,(function(o){return(null===(i=null==e?void 0:e.retryStrategy)||void 0===i?void 0:i.mode)&&(n.userAgent=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(en(arguments[t]));return e}(n.userAgent||[],[["cfg/retry-mode",e.retryStrategy.mode]])),[2,e.retryStrategy.retry(t,r)]}))}))}}},nn={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},rn=["AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch"],on=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],sn=["AbortError","TimeoutError","RequestTimeout","RequestTimeoutException"],an=[500,502,503,504],un=function(e){var t,n;return 429===(null===(t=e.$metadata)||void 0===t?void 0:t.httpStatusCode)||on.includes(e.name)||1==(null===(n=e.$retryable)||void 0===n?void 0:n.throttling)},cn=n(73),ln=function(e,t){return Math.floor(Math.min(2e4,Math.random()*Math.pow(2,t)*e))},fn=function(e){return!!e&&(function(e){return void 0!==e.$retryable}(e)||function(e){return rn.includes(e.name)}(e)||un(e)||function(e){var t;return sn.includes(e.name)||an.includes((null===(t=e.$metadata)||void 0===t?void 0:t.httpStatusCode)||0)}(e))},dn=function(){function e(e,t){var n,r,i,o,s,a,u,c;this.maxAttemptsProvider=e,this.mode="standard",this.retryDecider=null!==(n=null==t?void 0:t.retryDecider)&&void 0!==n?n:fn,this.delayDecider=null!==(r=null==t?void 0:t.delayDecider)&&void 0!==r?r:ln,this.retryQuota=null!==(i=null==t?void 0:t.retryQuota)&&void 0!==i?i:(s=o=500,a=o,u=function(e){return"TimeoutError"===e.name?10:5},c=function(e){return u(e)<=a},Object.freeze({hasRetryTokens:c,retrieveRetryTokens:function(e){if(!c(e))throw new Error("No retry token available");var t=u(e);return a-=t,t},releaseRetryTokens:function(e){a+=null!=e?e:1,a=Math.min(a,s)}}))}return e.prototype.shouldRetry=function(e,t,n){return t<n&&this.retryDecider(e)&&this.retryQuota.hasRetryTokens(e)},e.prototype.getMaxAttempts=function(){return Qt(this,void 0,void 0,(function(){var e;return Xt(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.maxAttemptsProvider()];case 1:return e=t.sent(),[3,3];case 2:return t.sent(),e=3,[3,3];case 3:return[2,e]}}))}))},e.prototype.retry=function(e,t){return Qt(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c;return Xt(this,(function(l){switch(l.label){case 0:return r=0,i=0,[4,this.getMaxAttempts()];case 1:o=l.sent(),s=t.request,je.isInstance(s)&&(s.headers["amz-sdk-invocation-id"]=Object(cn.v4)()),a=function(){var a,c,l,f,d;return Xt(this,(function(h){switch(h.label){case 0:return h.trys.push([0,2,,5]),je.isInstance(s)&&(s.headers["amz-sdk-request"]="attempt="+(r+1)+"; max="+o),[4,e(t)];case 1:return a=h.sent(),c=a.response,l=a.output,u.retryQuota.releaseRetryTokens(n),l.$metadata.attempts=r+1,l.$metadata.totalRetryDelay=i,[2,{value:{response:c,output:l}}];case 2:return f=h.sent(),r++,u.shouldRetry(f,r,o)?(n=u.retryQuota.retrieveRetryTokens(f),d=u.delayDecider(un(f)?500:100,r),i+=d,[4,new Promise((function(e){return setTimeout(e,d)}))]):[3,4];case 3:return h.sent(),[2,"continue"];case 4:throw f.$metadata||(f.$metadata={}),f.$metadata.attempts=r,f.$metadata.totalRetryDelay=i,f;case 5:return[2]}}))},u=this,l.label=2;case 2:return[5,a()];case 3:return"object"==typeof(c=l.sent())?[2,c.value]:[3,2];case 4:return[2]}}))}))},e}(),hn=function(e){if(void 0===e&&(e=3),"number"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};function pn(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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function vn(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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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])}}}var yn=n(75),gn=n.n(yn);var mn="cognito-identity.{region}.amazonaws.com",bn=new Set(["af-south-1","ap-east-1","ap-northeast-1","ap-northeast-2","ap-south-1","ap-southeast-1","ap-southeast-2","ca-central-1","eu-central-1","eu-north-1","eu-south-1","eu-west-1","eu-west-2","eu-west-3","me-south-1","sa-east-1","us-east-1","us-east-2","us-west-1","us-west-2"]),wn=new Set(["cn-north-1","cn-northwest-1"]),Sn=new Set(["us-iso-east-1"]),On=new Set(["us-isob-east-1"]),_n=new Set(["us-gov-east-1","us-gov-west-1"]);function En(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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function An(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}var In,Tn,jn,Cn,Pn={apiVersion:"2014-06-30",disableHostPrefix:!1,logger:{},regionInfoProvider:function(e,t){var n=void 0;switch(e){case"ap-northeast-1":n={hostname:"cognito-identity.ap-northeast-1.amazonaws.com",partition:"aws"};break;case"ap-northeast-2":n={hostname:"cognito-identity.ap-northeast-2.amazonaws.com",partition:"aws"};break;case"ap-south-1":n={hostname:"cognito-identity.ap-south-1.amazonaws.com",partition:"aws"};break;case"ap-southeast-1":n={hostname:"cognito-identity.ap-southeast-1.amazonaws.com",partition:"aws"};break;case"ap-southeast-2":n={hostname:"cognito-identity.ap-southeast-2.amazonaws.com",partition:"aws"};break;case"ca-central-1":n={hostname:"cognito-identity.ca-central-1.amazonaws.com",partition:"aws"};break;case"cn-north-1":n={hostname:"cognito-identity.cn-north-1.amazonaws.com.cn",partition:"aws-cn"};break;case"eu-central-1":n={hostname:"cognito-identity.eu-central-1.amazonaws.com",partition:"aws"};break;case"eu-north-1":n={hostname:"cognito-identity.eu-north-1.amazonaws.com",partition:"aws"};break;case"eu-west-1":n={hostname:"cognito-identity.eu-west-1.amazonaws.com",partition:"aws"};break;case"eu-west-2":n={hostname:"cognito-identity.eu-west-2.amazonaws.com",partition:"aws"};break;case"eu-west-3":n={hostname:"cognito-identity.eu-west-3.amazonaws.com",partition:"aws"};break;case"fips-us-east-1":n={hostname:"cognito-identity-fips.us-east-1.amazonaws.com",partition:"aws",signingRegion:"us-east-1"};break;case"fips-us-east-2":n={hostname:"cognito-identity-fips.us-east-2.amazonaws.com",partition:"aws",signingRegion:"us-east-2"};break;case"fips-us-gov-west-1":n={hostname:"cognito-identity-fips.us-gov-west-1.amazonaws.com",partition:"aws-us-gov",signingRegion:"us-gov-west-1"};break;case"fips-us-west-2":n={hostname:"cognito-identity-fips.us-west-2.amazonaws.com",partition:"aws",signingRegion:"us-west-2"};break;case"sa-east-1":n={hostname:"cognito-identity.sa-east-1.amazonaws.com",partition:"aws"};break;case"us-east-1":n={hostname:"cognito-identity.us-east-1.amazonaws.com",partition:"aws"};break;case"us-east-2":n={hostname:"cognito-identity.us-east-2.amazonaws.com",partition:"aws"};break;case"us-gov-west-1":n={hostname:"cognito-identity.us-gov-west-1.amazonaws.com",partition:"aws-us-gov"};break;case"us-west-1":n={hostname:"cognito-identity.us-west-1.amazonaws.com",partition:"aws"};break;case"us-west-2":n={hostname:"cognito-identity.us-west-2.amazonaws.com",partition:"aws"};break;default:bn.has(e)&&(n={hostname:mn.replace("{region}",e),partition:"aws"}),wn.has(e)&&(n={hostname:"cognito-identity.{region}.amazonaws.com.cn".replace("{region}",e),partition:"aws-cn"}),Sn.has(e)&&(n={hostname:"cognito-identity.{region}.c2s.ic.gov".replace("{region}",e),partition:"aws-iso"}),On.has(e)&&(n={hostname:"cognito-identity.{region}.sc2s.sgov.gov".replace("{region}",e),partition:"aws-iso-b"}),_n.has(e)&&(n={hostname:"cognito-identity.{region}.amazonaws.com".replace("{region}",e),partition:"aws-us-gov"}),void 0===n&&(n={hostname:mn.replace("{region}",e),partition:"aws"})}return Promise.resolve(Object(r.a)({signingService:"cognito-identity"},n))},serviceId:"Cognito Identity",urlParser:function(e){var t,n=new URL(e),r=n.hostname,i=n.pathname,o=n.port,s=n.protocol,a=n.search;return a&&(t=function(e){var t,n,r={};if(e=e.replace(/^\?/,""))try{for(var i=En(e.split("&")),o=i.next();!o.done;o=i.next()){var s=An(o.value.split("="),2),a=s[0],u=s[1],c=void 0===u?null:u;a=decodeURIComponent(a),c&&(c=decodeURIComponent(c)),a in r?Array.isArray(r[a])?r[a].push(c):r[a]=[r[a],c]:r[a]=c}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}(a)),{hostname:r,port:o?parseInt(o):void 0,protocol:s,path:i,query:t}}},xn=Object(r.a)(Object(r.a)({},Pn),{runtime:"browser",base64Decoder:Jt,base64Encoder:function(e){for(var t="",n=0;n<e.length;n+=3){for(var r=0,i=0,o=n,s=Math.min(n+3,e.length);o<s;o++)r|=e[o]<<8*(s-o-1),i+=8;var a=Math.ceil(i/6);r<<=6*a-i;for(var u=1;u<=a;u++){var c=6*(a-u);t+=Kt[(r&63<<c)>>c]}t+="==".slice(0,4-a)}return t},bodyLengthChecker:function(e){if("string"==typeof e){for(var t=e.length,n=t-1;n>=0;n--){var r=e.charCodeAt(n);r>127&&r<=2047?t++:r>2047&&r<=65535&&(t+=2)}return t}return"number"==typeof e.byteLength?e.byteLength:"number"==typeof e.size?e.size:void 0}
154
+ /*! *****************************************************************************
155
+ Copyright (c) Microsoft Corporation.
156
+
157
+ Permission to use, copy, modify, and/or distribute this software for any
158
+ purpose with or without fee is hereby granted.
159
+
160
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
161
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
162
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
163
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
164
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
165
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
166
+ PERFORMANCE OF THIS SOFTWARE.
167
+ ***************************************************************************** */,credentialDefaultProvider:function(e){return function(){return Promise.reject(new Error("Credential is missing"))}},defaultUserAgentProvider:(Tn={serviceId:Pn.serviceId,clientVersion:Nt.version},jn=Tn.serviceId,Cn=Tn.clientVersion,function(){return pn(void 0,void 0,void 0,(function(){var e,t,n,r,i,o,s,a,u;return vn(this,(function(c){return e=(null===(n=null===window||void 0===window?void 0:window.navigator)||void 0===n?void 0:n.userAgent)?gn.a.parse(window.navigator.userAgent):void 0,t=[["aws-sdk-js",Cn],["os/"+((null===(r=null==e?void 0:e.os)||void 0===r?void 0:r.name)||"other"),null===(i=null==e?void 0:e.os)||void 0===i?void 0:i.version],["lang/js"],["md/browser",(null!==(s=null===(o=null==e?void 0:e.browser)||void 0===o?void 0:o.name)&&void 0!==s?s:"unknown")+"_"+(null!==(u=null===(a=null==e?void 0:e.browser)||void 0===a?void 0:a.version)&&void 0!==u?u:"unknown")]],jn&&t.push(["api/"+jn,Cn]),[2,t]}))}))}),maxAttempts:3,region:(In="Region is missing",function(){return Promise.reject(In)}),requestHandler:new qt,sha256:Mt.Sha256,streamCollector:function(e){return"function"==typeof Blob&&e instanceof Blob?function(e){return Dt(this,void 0,void 0,(function(){var t,n;return Rt(this,(function(r){switch(r.label){case 0:return[4,$t(e)];case 1:return t=r.sent(),n=Jt(t),[2,new Uint8Array(n)]}}))}))}(e):function(e){return Dt(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return Rt(this,(function(u){switch(u.label){case 0:t=new Uint8Array(0),n=e.getReader(),r=!1,u.label=1;case 1:return r?[3,3]:[4,n.read()];case 2:return i=u.sent(),o=i.done,(s=i.value)&&(a=t,(t=new Uint8Array(a.length+s.length)).set(a),t.set(s,a.length)),r=o,[3,1];case 3:return[2,t]}}))}))}(e)},utf8Decoder:function(e){return"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e.charCodeAt(n);if(i<128)t.push(i);else if(i<2048)t.push(i>>6|192,63&i|128);else if(n+1<e.length&&55296==(64512&i)&&56320==(64512&e.charCodeAt(n+1))){var o=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n));t.push(o>>18|240,o>>12&63|128,o>>6&63|128,63&o|128)}else t.push(i>>12|224,i>>6&63|128,63&i|128)}return Uint8Array.from(t)}(e)},utf8Encoder:function(e){return"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):function(e){for(var t="",n=0,r=e.length;n<r;n++){var i=e[n];if(i<128)t+=String.fromCharCode(i);else if(192<=i&&i<224){var o=e[++n];t+=String.fromCharCode((31&i)<<6|63&o)}else if(240<=i&&i<365){var s="%"+[i,e[++n],e[++n],e[++n]].map((function(e){return e.toString(16)})).join("%");t+=decodeURIComponent(s)}else t+=String.fromCharCode((15&i)<<12|(63&e[++n])<<6|63&e[++n])}return t}(e)}});var kn=function(){return(kn=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)};function Nn(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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function Mn(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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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])}}}var Dn=function(e){var t=e.endpoint,n=e.urlParser;if("string"==typeof t){var r=Promise.resolve(n(t));return function(){return r}}if("object"==typeof t){var i=Promise.resolve(t);return function(){return i}}return t},Rn=function(e){return Nn(void 0,void 0,void 0,(function(){var t,n,r,i,o;return Mn(this,(function(s){switch(s.label){case 0:return t=e.tls,n=void 0===t||t,[4,e.region()];case 1:if(r=s.sent(),!new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/).test(r))throw new Error("Invalid region in client config");return[4,e.regionInfoProvider(r)];case 2:if(!(i=(null!==(o=s.sent())&&void 0!==o?o:{}).hostname))throw new Error("Cannot resolve hostname from client config");return[2,e.urlParser((n?"https:":"http:")+"//"+i)]}}))}))},Un=function(e){if("string"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};var Fn=function(){return(Fn=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)};function Ln(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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function Bn(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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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])}}}var qn={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},zn=function(e){return{applyToStack:function(t){t.add(function(e){var t=this;return function(n){return function(r){return Ln(t,void 0,void 0,(function(){var t,i,o,s,a;return Bn(this,(function(u){return t=r.request,je.isInstance(t)&&(i=t.body,o=t.headers,i&&-1===Object.keys(o).map((function(e){return e.toLowerCase()})).indexOf("content-length")&&void 0!==(s=e(i))&&(t.headers=Fn(Fn({},t.headers),((a={})["content-length"]=String(s),a)))),[2,n(Fn(Fn({},r),{request:t}))]}))}))}}}(e.bodyLengthChecker),qn)}}};function Kn(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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function Vn(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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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])}}}var Gn={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},Hn=function(e){return{applyToStack:function(t){t.add(function(e){return function(t){return function(n){return Kn(void 0,void 0,void 0,(function(){var r,i;return Vn(this,(function(o){return je.isInstance(n.request)?(r=n.request,i=(e.requestHandler.metadata||{}).handlerProtocol,(void 0===i?"":i).indexOf("h2")>=0&&!r.headers[":authority"]?(delete r.headers.host,r.headers[":authority"]=""):r.headers.host||(r.headers.host=r.hostname),[2,t(n)]):[2,t(n)]}))}))}}}(e),Gn)}}};function Wn(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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function Yn(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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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])}}}var Jn=function(){return function(e,t){return function(n){return Wn(void 0,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,f;return Yn(this,(function(d){switch(d.label){case 0:return r=t.clientName,i=t.commandName,o=t.inputFilterSensitiveLog,s=t.logger,a=t.outputFilterSensitiveLog,[4,e(n)];case 1:return u=d.sent(),s?("function"==typeof s.info&&(c=u.output,l=c.$metadata,f=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(c,["$metadata"]),s.info({clientName:r,commandName:i,input:o(n.input),output:a(f),metadata:l})),[2,u]):[2,u]}}))}))}}},$n={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0};var Zn=function(){return(Zn=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)};function Qn(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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function Xn(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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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 er(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 new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function tr(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}var nr=n(14),rr="X-Amz-Date".toLowerCase(),ir=["authorization",rr,"date"],or="X-Amz-Signature".toLowerCase(),sr="X-Amz-Security-Token".toLowerCase(),ar={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},ur=/^proxy-/,cr=/^sec-/,lr="AWS4-HMAC-SHA256-PAYLOAD",fr={},dr=[];function hr(e,t,n){return e+"/"+t+"/"+n+"/aws4_request"}function pr(e,t,n){var r=new e(t);return r.update(n),r.digest()}function vr(e,t,n){var r,i,o=e.headers,s={};try{for(var a=er(Object.keys(o).sort()),u=a.next();!u.done;u=a.next()){var c=u.value,l=c.toLowerCase();(l in ar||(null==t?void 0:t.has(l))||ur.test(l)||cr.test(l))&&(!n||n&&!n.has(l))||(s[l]=o[c].trim().replace(/\s+/g," "))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return s}var yr=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,gr)},gr=function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()};function mr(e,t){var n=e.headers,r=e.body;return Qn(this,void 0,void 0,(function(){var e,i,o,s,a,u,c;return Xn(this,(function(l){switch(l.label){case 0:try{for(e=er(Object.keys(n)),i=e.next();!i.done;i=e.next())if("x-amz-content-sha256"===(o=i.value).toLowerCase())return[2,n[o]]}catch(e){u={error:e}}finally{try{i&&!i.done&&(c=e.return)&&c.call(e)}finally{if(u)throw u.error}}return null!=r?[3,1]:[2,"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"];case 1:return"string"==typeof r||ArrayBuffer.isView(r)||(f=r,"function"==typeof ArrayBuffer&&f instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(f))?((s=new t).update(r),a=nr.a,[4,s.digest()]):[3,3];case 2:return[2,a.apply(void 0,[l.sent()])];case 3:return[2,"UNSIGNED-PAYLOAD"]}var f}))}))}function br(e){var t=e.headers,n=e.query,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["headers","query"]);return Zn(Zn({},r),{headers:Zn({},t),query:n?wr(n):void 0})}function wr(e){return Object.keys(e).reduce((function(t,n){var r,i=e[n];return Zn(Zn({},t),((r={})[n]=Array.isArray(i)?function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(tr(arguments[t]));return e}(i):i,r))}),{})}function Sr(e){var t,n;e="function"==typeof e.clone?e.clone():br(e);try{for(var r=er(Object.keys(e.headers)),i=r.next();!i.done;i=r.next()){var o=i.value;ir.indexOf(o.toLowerCase())>-1&&delete e.headers[o]}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return e}function Or(e){return function(e){if("number"==typeof e)return new Date(1e3*e);if("string"==typeof e)return Number(e)?new Date(1e3*Number(e)):new Date(e);return e}(e).toISOString().replace(/\.\d{3}Z$/,"Z")}var _r=function(){function e(e){var t=e.applyChecksum,n=e.credentials,r=e.region,i=e.service,o=e.sha256,s=e.uriEscapePath,a=void 0===s||s;this.service=i,this.sha256=o,this.uriEscapePath=a,this.applyChecksum="boolean"!=typeof t||t,this.regionProvider=Ir(r),this.credentialProvider=Tr(n)}return e.prototype.presign=function(e,t){return void 0===t&&(t={}),Qn(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b,w,S,O,_,E,A;return Xn(this,(function(I){switch(I.label){case 0:return n=t.signingDate,r=void 0===n?new Date:n,i=t.expiresIn,o=void 0===i?3600:i,s=t.unsignableHeaders,a=t.unhoistableHeaders,u=t.signableHeaders,c=t.signingRegion,l=t.signingService,[4,this.credentialProvider()];case 1:return f=I.sent(),null==c?[3,2]:(h=c,[3,4]);case 2:return[4,this.regionProvider()];case 3:h=I.sent(),I.label=4;case 4:return d=h,p=Er(r),v=p.longDate,y=p.shortDate,o>604800?[2,Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future")]:(g=hr(y,d,null!=l?l:this.service),m=function(e,t){var n,r,i;void 0===t&&(t={});var o="function"==typeof e.clone?e.clone():br(e),s=o.headers,a=o.query,u=void 0===a?{}:a;try{for(var c=er(Object.keys(s)),l=c.next();!l.done;l=c.next()){var f=l.value,d=f.toLowerCase();"x-amz-"!==d.substr(0,6)||(null===(i=t.unhoistableHeaders)||void 0===i?void 0:i.has(d))||(u[f]=s[f],delete s[f])}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}return Zn(Zn({},e),{headers:s,query:u})}(Sr(e),{unhoistableHeaders:a}),f.sessionToken&&(m.query["X-Amz-Security-Token"]=f.sessionToken),m.query["X-Amz-Algorithm"]="AWS4-HMAC-SHA256",m.query["X-Amz-Credential"]=f.accessKeyId+"/"+g,m.query["X-Amz-Date"]=v,m.query["X-Amz-Expires"]=o.toString(10),b=vr(m,s,u),m.query["X-Amz-SignedHeaders"]=Ar(b),w=m.query,S="X-Amz-Signature",O=this.getSignature,_=[v,g,this.getSigningKey(f,d,y,l)],E=this.createCanonicalRequest,A=[m,b],[4,mr(e,this.sha256)]);case 5:return[4,O.apply(this,_.concat([E.apply(this,A.concat([I.sent()]))]))];case 6:return w[S]=I.sent(),[2,m]}}))}))},e.prototype.sign=function(e,t){return Qn(this,void 0,void 0,(function(){return Xn(this,(function(n){return"string"==typeof e?[2,this.signString(e,t)]:e.headers&&e.payload?[2,this.signEvent(e,t)]:[2,this.signRequest(e,t)]}))}))},e.prototype.signEvent=function(e,t){var n=e.headers,r=e.payload,i=t.signingDate,o=void 0===i?new Date:i,s=t.priorSignature,a=t.signingRegion,u=t.signingService;return Qn(this,void 0,void 0,(function(){var e,t,i,c,l,f,d,h,p,v,y;return Xn(this,(function(g){switch(g.label){case 0:return null==a?[3,1]:(t=a,[3,3]);case 1:return[4,this.regionProvider()];case 2:t=g.sent(),g.label=3;case 3:return e=t,i=Er(o),c=i.shortDate,l=i.longDate,f=hr(c,e,null!=u?u:this.service),[4,mr({headers:{},body:r},this.sha256)];case 4:return d=g.sent(),(h=new this.sha256).update(n),v=nr.a,[4,h.digest()];case 5:return p=v.apply(void 0,[g.sent()]),y=[lr,l,f,s,p,d].join("\n"),[2,this.signString(y,{signingDate:o,signingRegion:e,signingService:u})]}}))}))},e.prototype.signString=function(e,t){var n=void 0===t?{}:t,r=n.signingDate,i=void 0===r?new Date:r,o=n.signingRegion,s=n.signingService;return Qn(this,void 0,void 0,(function(){var t,n,r,a,u,c,l,f;return Xn(this,(function(d){switch(d.label){case 0:return[4,this.credentialProvider()];case 1:return t=d.sent(),null==o?[3,2]:(r=o,[3,4]);case 2:return[4,this.regionProvider()];case 3:r=d.sent(),d.label=4;case 4:return n=r,a=Er(i).shortDate,l=(c=this.sha256).bind,[4,this.getSigningKey(t,n,a,s)];case 5:return(u=new(l.apply(c,[void 0,d.sent()]))).update(e),f=nr.a,[4,u.digest()];case 6:return[2,f.apply(void 0,[d.sent()])]}}))}))},e.prototype.signRequest=function(e,t){var n=void 0===t?{}:t,r=n.signingDate,i=void 0===r?new Date:r,o=n.signableHeaders,s=n.unsignableHeaders,a=n.signingRegion,u=n.signingService;return Qn(this,void 0,void 0,(function(){var t,n,r,c,l,f,d,h,p,v,y;return Xn(this,(function(g){switch(g.label){case 0:return[4,this.credentialProvider()];case 1:return t=g.sent(),null==a?[3,2]:(r=a,[3,4]);case 2:return[4,this.regionProvider()];case 3:r=g.sent(),g.label=4;case 4:return n=r,c=Sr(e),l=Er(i),f=l.longDate,d=l.shortDate,h=hr(d,n,null!=u?u:this.service),c.headers[rr]=f,t.sessionToken&&(c.headers[sr]=t.sessionToken),[4,mr(c,this.sha256)];case 5:return p=g.sent(),!function(e,t){var n,r;e=e.toLowerCase();try{for(var i=er(Object.keys(t)),o=i.next();!o.done;o=i.next()){if(e===o.value.toLowerCase())return!0}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1}("x-amz-content-sha256",c.headers)&&this.applyChecksum&&(c.headers["x-amz-content-sha256"]=p),v=vr(c,s,o),[4,this.getSignature(f,h,this.getSigningKey(t,n,d,u),this.createCanonicalRequest(c,v,p))];case 6:return y=g.sent(),c.headers.authorization="AWS4-HMAC-SHA256 Credential="+t.accessKeyId+"/"+h+", SignedHeaders="+Ar(v)+", Signature="+y,[2,c]}}))}))},e.prototype.createCanonicalRequest=function(e,t,n){var r=Object.keys(t).sort();return e.method+"\n"+this.getCanonicalPath(e)+"\n"+function(e){var t,n,r=e.query,i=void 0===r?{}:r,o=[],s={},a=function(e){if(e.toLowerCase()===or)return"continue";o.push(e);var t=i[e];"string"==typeof t?s[e]=yr(e)+"="+yr(t):Array.isArray(t)&&(s[e]=t.slice(0).sort().reduce((function(t,n){return t.concat([yr(e)+"="+yr(n)])}),[]).join("&"))};try{for(var u=er(Object.keys(i).sort()),c=u.next();!c.done;c=u.next()){a(c.value)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}return o.map((function(e){return s[e]})).filter((function(e){return e})).join("&")}(e)+"\n"+r.map((function(e){return e+":"+t[e]})).join("\n")+"\n\n"+r.join(";")+"\n"+n},e.prototype.createStringToSign=function(e,t,n){return Qn(this,void 0,void 0,(function(){var r,i;return Xn(this,(function(o){switch(o.label){case 0:return(r=new this.sha256).update(n),[4,r.digest()];case 1:return i=o.sent(),[2,"AWS4-HMAC-SHA256\n"+e+"\n"+t+"\n"+Object(nr.a)(i)]}}))}))},e.prototype.getCanonicalPath=function(e){var t=e.path;return this.uriEscapePath?"/"+encodeURIComponent(t.replace(/^\//,"")).replace(/%2F/g,"/"):t},e.prototype.getSignature=function(e,t,n,r){return Qn(this,void 0,void 0,(function(){var i,o,s,a,u;return Xn(this,(function(c){switch(c.label){case 0:return[4,this.createStringToSign(e,t,r)];case 1:return i=c.sent(),a=(s=this.sha256).bind,[4,n];case 2:return(o=new(a.apply(s,[void 0,c.sent()]))).update(i),u=nr.a,[4,o.digest()];case 3:return[2,u.apply(void 0,[c.sent()])]}}))}))},e.prototype.getSigningKey=function(e,t,n,r){return function(e,t,n,r,i){return Qn(void 0,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h;return Xn(this,(function(p){switch(p.label){case 0:return[4,pr(e,t.secretAccessKey,t.accessKeyId)];case 1:if(o=p.sent(),(s=n+":"+r+":"+i+":"+Object(nr.a)(o)+":"+t.sessionToken)in fr)return[2,fr[s]];for(dr.push(s);dr.length>50;)delete fr[dr.shift()];a="AWS4"+t.secretAccessKey,p.label=2;case 2:p.trys.push([2,7,8,9]),u=er([n,r,i,"aws4_request"]),c=u.next(),p.label=3;case 3:return c.done?[3,6]:(l=c.value,[4,pr(e,a,l)]);case 4:a=p.sent(),p.label=5;case 5:return c=u.next(),[3,3];case 6:return[3,9];case 7:return f=p.sent(),d={error:f},[3,9];case 8:try{c&&!c.done&&(h=u.return)&&h.call(u)}finally{if(d)throw d.error}return[7];case 9:return[2,fr[s]=a]}}))}))}(this.sha256,e,n,t,r||this.service)},e}(),Er=function(e){var t=Or(e).replace(/[\-:]/g,"");return{longDate:t,shortDate:t.substr(0,8)}},Ar=function(e){return Object.keys(e).sort().join(";")},Ir=function(e){if("string"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e},Tr=function(e){if("object"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};function jr(e){if("object"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e}var Cr=function(){return(Cr=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)};function Pr(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,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function xr(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 new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.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 kr(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 Nr(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(kr(arguments[t]));return e}var Mr=/[^\!\#\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,Dr=function(e){var t=kr(e,2),n=t[0],r=t[1],i=n.indexOf("/"),o=n.substring(0,i),s=n.substring(i+1);return"api"===o&&(s=s.toLowerCase()),[o,s,r].filter((function(e){return e&&e.length>0})).map((function(e){return null==e?void 0:e.replace(Mr,"_")})).join("/")},Rr={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Ur=function(e){return{applyToStack:function(t){var n;t.add((n=e,function(e,t){return function(r){return Pr(void 0,void 0,void 0,(function(){var i,o,s,a,u,c,l,f;return xr(this,(function(d){switch(d.label){case 0:return i=r.request,je.isInstance(i)?(o=i.headers,s=(null===(l=null==t?void 0:t.userAgent)||void 0===l?void 0:l.map(Dr))||[],[4,n.defaultUserAgentProvider()]):[2,e(r)];case 1:return a=d.sent().map(Dr),u=(null===(f=null==n?void 0:n.customUserAgent)||void 0===f?void 0:f.map(Dr))||[],o["x-amz-user-agent"]=Nr(a,s,u).join(" "),c=Nr(a.filter((function(e){return e.startsWith("aws-sdk-")})),u).join(" "),"browser"!==n.runtime&&c&&(o["user-agent"]=o["user-agent"]?o["user-agent"]+" "+c:c),[2,e(Cr(Cr({},r),{request:i}))]}}))}))}}),Rr)}}},Fr=function(e){function t(t){var n,i,o,s=this,a=function(e){var t,n=this,r=jr(e.credentials||e.credentialDefaultProvider(e)),i=e.signingEscapePath,o=void 0===i||i,s=e.systemClockOffset,a=void 0===s?e.systemClockOffset||0:s,u=e.sha256;return t=e.signer?jr(e.signer):function(){return jr(e.region)().then((function(t){return Qn(n,void 0,void 0,(function(){return Xn(this,(function(n){switch(n.label){case 0:return[4,e.regionInfoProvider(t)];case 1:return[2,[n.sent()||{},t]]}}))}))})).then((function(t){var n=tr(t,2),i=n[0],s=n[1],a=i.signingRegion,c=i.signingService;return e.signingRegion=e.signingRegion||a||s,e.signingName=e.signingName||c||e.serviceId,new _r({credentials:r,region:e.signingRegion,service:e.signingName,sha256:u,uriEscapePath:o})}))},Zn(Zn({},e),{systemClockOffset:a,signingEscapePath:o,credentials:r,signer:t})}(function(e){var t;return kn(kn({},e),{tls:null===(t=e.tls)||void 0===t||t,endpoint:e.endpoint?Dn(e):function(){return Rn(e)},isCustomEndpoint:!!e.endpoint})}(function(e){if(!e.region)throw new Error("Region is missing");return kn(kn({},e),{region:Un(e.region)})}(Object(r.a)(Object(r.a)({},xn),t)))),u=function(e){return Cr(Cr({},e),{customUserAgent:"string"==typeof e.customUserAgent?[[e.customUserAgent]]:e.customUserAgent})}((i=hn((n=a).maxAttempts),Zt(Zt({},n),{maxAttempts:i,retryStrategy:n.retryStrategy||new dn(i)})));return(s=e.call(this,u)||this).config=u,s.middlewareStack.use((o=s.config,{applyToStack:function(e){e.add(tn(o),nn)}})),s.middlewareStack.use(zn(s.config)),s.middlewareStack.use(Hn(s.config)),s.middlewareStack.use((s.config,{applyToStack:function(e){e.add(Jn(),$n)}})),s.middlewareStack.use(Ur(s.config)),s}return Object(r.d)(t,e),t.prototype.destroy=function(){e.prototype.destroy.call(this)},t}(bt),Lr=new i.a("Credentials"),Br=new(function(){function e(e){this._gettingCredPromise=null,this._refreshHandlers={},this.Auth=void 0,this.configure(e),this._refreshHandlers.google=p.refreshGoogleToken,this._refreshHandlers.facebook=v.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=Object(r.a)(Object(r.a)({},this._refreshHandlers),t)),this._storage=this._config.storage,this._storage||(this._storage=(new o.a).getStorage()),this._storageSync=Promise.resolve(),"function"==typeof this._storage.sync&&(this._storageSync=this._storage.sync()),this._config},e.prototype.get=function(){return Lr.debug("getting credentials"),this._pickupCredentials()},e.prototype._getCognitoIdentityIdStorageKey=function(e){return"CognitoIdentityId-"+e},e.prototype._pickupCredentials=function(){return Lr.debug("picking up credentials"),this._gettingCredPromise&&this._gettingCredPromise.isPending()?Lr.debug("getting old cred promise"):(Lr.debug("getting new cred promise"),this._gettingCredPromise=Object(s.d)(this._keepAlive())),this._gettingCredPromise},e.prototype._keepAlive=function(){return Object(r.c)(this,void 0,void 0,(function(){var e,t,n,i,o,s,a;return Object(r.e)(this,(function(r){switch(r.label){case 0:if(Lr.debug("checking if credentials exists and not expired"),(e=this._credentials)&&!this._isExpired(e)&&!this._isPastTTL())return Lr.debug("credentials not changed and not expired, directly return"),[2,Promise.resolve(e)];if(Lr.debug("need to get a new credential or refresh the existing one"),t=this.Auth,!(n=void 0===t?g.a.Auth:t)||"function"!=typeof n.currentUserCredentials)return[2,Promise.reject("No Auth module registered in Amplify")];if(this._isExpired(e)||!this._isPastTTL())return[3,6];Lr.debug("ttl has passed but token is not yet expired"),r.label=1;case 1:return r.trys.push([1,5,,6]),[4,n.currentUserPoolUser()];case 2:return i=r.sent(),[4,n.currentSession()];case 3:return o=r.sent(),s=o.refreshToken,[4,new Promise((function(e,t){i.refreshSession(s,(function(n,r){return n?t(n):e(r)}))}))];case 4:return r.sent(),[3,6];case 5:return a=r.sent(),Lr.debug("Error attempting to refreshing the session",a),[3,6];case 6:return[2,n.currentUserCredentials()]}}))}))},e.prototype.refreshFederatedToken=function(e){Lr.debug("Getting federated credentials");var t=e.provider,n=e.user,r=e.token,i=e.identity_id,o=e.expires_at;o=1970===new Date(o).getFullYear()?1e3*o:o;return Lr.debug("checking if federated jwt token expired"),o>(new Date).getTime()?(Lr.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]?(Lr.debug("getting refreshed jwt token from federation provider"),this._providerRefreshWithRetry({refreshHandler:this._refreshHandlers[t],provider:t,user:n})):(Lr.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 Object(a.c)(n,[],1e4).then((function(e){return Lr.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(),Lr.debug("refresh federated token failed",e),Promise.reject("refreshing federation token failed: "+e)}))},e.prototype._isExpired=function(e){if(!e)return Lr.debug("no credentials for expiration check"),!0;Lr.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 Object(r.c)(this,void 0,void 0,(function(){var e,t,n,i,o,s,a,u=this;return Object(r.e)(this,(function(c){switch(c.label){case 0:return Lr.debug("setting credentials for guest"),e=this._config,t=e.identityPoolId,n=e.region,e.mandatorySignIn?[2,Promise.reject("cannot get guest credentials when mandatory signin enabled")]:t?n?(o=this,[4,this._getGuestIdentityId()]):(Lr.debug("region is not configured for getting the credentials"),[2,Promise.reject("region is not configured for getting the credentials")]):(Lr.debug("No Cognito Identity pool provided for unauthenticated access"),[2,Promise.reject("No Cognito Identity pool provided for unauthenticated access")]);case 1:return i=o._identityId=c.sent(),s=new Fr({region:n,customUserAgent:Object(y.b)()}),a=void 0,a=i?jt({identityId:i,client:s})():function(){return Object(r.c)(u,void 0,void 0,(function(){var e;return Object(r.e)(this,(function(n){switch(n.label){case 0:return[4,s.send(new Ct({IdentityPoolId:t}))];case 1:return e=n.sent().IdentityId,this._identityId=e,[2,jt({client:s,identityId:e})()]}}))}))}().catch((function(e){return Object(r.c)(u,void 0,void 0,(function(){return Object(r.e)(this,(function(t){throw e}))}))})),[2,this._loadCredentials(a,"guest",!1,null).then((function(e){return e})).catch((function(e){return Object(r.c)(u,void 0,void 0,(function(){var n=this;return Object(r.e)(this,(function(o){switch(o.label){case 0:return"ResourceNotFoundException"!==e.name||e.message!=="Identity '"+i+"' not found."?[3,2]:(Lr.debug("Failed to load guest credentials"),[4,this._removeGuestIdentityId()]);case 1:return o.sent(),a=function(){return Object(r.c)(n,void 0,void 0,(function(){var e;return Object(r.e)(this,(function(n){switch(n.label){case 0:return[4,s.send(new Ct({IdentityPoolId:t}))];case 1:return e=n.sent().IdentityId,this._identityId=e,[2,jt({client:s,identityId:e})()]}}))}))}().catch((function(e){return Object(r.c)(n,void 0,void 0,(function(){return Object(r.e)(this,(function(t){throw e}))}))})),[2,this._loadCredentials(a,"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 Lr.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");if(!u)return Lr.debug("region is not configured for getting the credentials"),Promise.reject("region is not configured for getting the credentials");var c=new Fr({region:u,customUserAgent:Object(y.b)()}),l=void 0;r?l=jt({identityId:r,logins:o,client:c})():l=kt({logins:o,identityPoolId:a,client:c})();return this._loadCredentials(l,"federated",!0,e)},e.prototype._setCredentialsFromSession=function(e){var t=this;Lr.debug("set credentials from session");var n=e.getIdToken().getJwtToken(),i=this._config,o=i.region,s=i.userPoolId,a=i.identityPoolId;if(!a)return Lr.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");if(!o)return Lr.debug("region is not configured for getting the credentials"),Promise.reject("region is not configured for getting the credentials");var u={};u["cognito-idp."+o+".amazonaws.com/"+s]=n;var c=new Fr({region:o,customUserAgent:Object(y.b)()}),l=Object(r.c)(t,void 0,void 0,(function(){var e,t,n,i,o,s,l,f,d,h;return Object(r.e)(this,(function(r){switch(r.label){case 0:return[4,this._getGuestIdentityId()];case 1:return(e=r.sent())?[3,3]:[4,c.send(new Ct({IdentityPoolId:a,Logins:u}))];case 2:n=r.sent().IdentityId,t=n,r.label=3;case 3:return[4,c.send(new At({IdentityId:e||t,Logins:u}))];case 4:return i=r.sent(),o=i.Credentials,s=o.AccessKeyId,l=o.Expiration,f=o.SecretKey,d=o.SessionToken,h=i.IdentityId,this._identityId=h,e?(Lr.debug("The guest identity "+e+" has been successfully linked to the logins"),e===h&&Lr.debug("The guest identity "+e+" has become the primary identity"),[4,this._removeGuestIdentityId()]):[3,6];case 5:r.sent(),r.label=6;case 6:return[2,{accessKeyId:s,secretAccessKey:f,sessionToken:d,expiration:l,identityId:h}]}}))})).catch((function(e){return Object(r.c)(t,void 0,void 0,(function(){return Object(r.e)(this,(function(t){throw e}))}))}));return this._loadCredentials(l,"userPool",!0,null)},e.prototype._loadCredentials=function(e,t,n,i){var o=this,s=this;return new Promise((function(a,u){e.then((function(e){return Object(r.c)(o,void 0,void 0,(function(){var o,u,c,l,f;return Object(r.e)(this,(function(r){switch(r.label){case 0:if(Lr.debug("Load credentials successfully",e),this._identityId&&!e.identityId&&(e.identityId=this._identityId),s._credentials=e,s._credentials.authenticated=n,s._credentials_source=t,s._nextCredentialsRefresh=(new Date).getTime()+3e6,"federated"===t){o=Object.assign({id:this._credentials.identityId},i.user),u=i.provider,c=i.token,l=i.expires_at,f=i.identity_id;try{this._storage.setItem("aws-amplify-federatedInfo",JSON.stringify({provider:u,token:c,user:o,expires_at:l,identity_id:f}))}catch(e){Lr.debug("Failed to put federated info into auth storage",e)}}return"guest"!==t?[3,2]:[4,this._setGuestIdentityId(e.identityId)];case 1:r.sent(),r.label=2;case 2:return a(s._credentials),[2]}}))}))})).catch((function(t){if(t)return Lr.debug("Failed to load credentials",e),Lr.debug("Error loading credentials",t),void u(t)}))}))},e.prototype.set=function(e,t){return"session"===t?this._setCredentialsFromSession(e):"federation"===t?this._setCredentialsFromFederation(e):"guest"===t?this._setCredentialsForGuest():(Lr.debug("no source specified for setting credentials"),Promise.reject("invalid source"))},e.prototype.clear=function(){return Object(r.c)(this,void 0,void 0,(function(){return Object(r.e)(this,(function(e){return this._credentials=null,this._credentials_source=null,Lr.debug("removing aws-amplify-federatedInfo from storage"),this._storage.removeItem("aws-amplify-federatedInfo"),[2]}))}))},e.prototype._getGuestIdentityId=function(){return Object(r.c)(this,void 0,void 0,(function(){var e,t;return Object(r.e)(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(),Lr.debug("Failed to get the cached guest identityId",t),[3,4];case 4:return[2]}}))}))},e.prototype._setGuestIdentityId=function(e){return Object(r.c)(this,void 0,void 0,(function(){var t,n;return Object(r.e)(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(),Lr.debug("Failed to cache guest identityId",n),[3,4];case 4:return[2]}}))}))},e.prototype._removeGuestIdentityId=function(){return Object(r.c)(this,void 0,void 0,(function(){var e;return Object(r.e)(this,(function(t){return e=this._config.identityPoolId,Lr.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);g.a.register(Br)}])}));
66
168
  //# sourceMappingURL=aws-amplify-datastore.min.js.map