From ff02ece0dcb5a373693c4c020270bc1ae6ce2d4a Mon Sep 17 00:00:00 2001 From: Francisco Pessano Date: Tue, 19 Oct 2021 20:30:31 -0300 Subject: [PATCH] Input for mobile users done --- build/asset-manifest.json | 30 + build/css/index.css | 305 + build/css/index.css.map | 1 + build/index.html | 1 + build/manifest.json | 25 + build/robots.txt | 3 + build/sass/_app.scss | 23 + build/sass/_categories.scss | 152 + build/sass/_current-score.scss | 16 + build/sass/_defeat-victory.scss | 32 + build/sass/_hangman.scss | 8 + build/sass/_header.scss | 25 + build/sass/_letters-registered.scss | 17 + build/sass/_loading.scss | 19 + build/sass/_puzzleWord.scss | 33 + build/sass/index.scss | 27 + build/static/js/2.60c5fd81.chunk.js | 3 + .../static/js/2.60c5fd81.chunk.js.LICENSE.txt | 211 + build/static/js/2.60c5fd81.chunk.js.map | 1 + build/static/js/3.5abcd70e.chunk.js | 2 + build/static/js/3.5abcd70e.chunk.js.map | 1 + build/static/js/main.387d7b4b.chunk.js | 2 + build/static/js/main.387d7b4b.chunk.js.map | 1 + build/static/js/runtime-main.9107414c.js | 2 + build/static/js/runtime-main.9107414c.js.map | 1 + build/static/media/00.568d8d0b.svg | 15 + build/static/media/01.6338b5c8.svg | 17 + build/static/media/02.9844dd07.svg | 415 + build/static/media/03.6bbc7f38.svg | 403 + build/static/media/04.47aae56d.svg | 406 + build/static/media/05.2556129c.svg | 426 + build/static/media/06.66808474.svg | 412 + build/static/media/cities.6fc05cbf.png | Bin 0 -> 15699 bytes build/static/media/countries.002d677d.png | Bin 0 -> 21093 bytes .../media/loading-light-theme.cf953a77.png | Bin 0 -> 27042 bytes build/static/media/pokemon.a607811c.png | Bin 0 -> 13963 bytes package-lock.json | 24576 +--------------- package.json | 10 +- src/App.js | 17 + src/Firebase Querys/BringTheWord.js | 10 +- src/Firebase/Firebase_Config.js | 34 + src/General Scripts/getWidthScreenUser.js | 12 + src/components/Header/Header.jsx | 14 +- src/components/Letter Input/LetterInput.jsx | 19 + 44 files changed, 4399 insertions(+), 23328 deletions(-) create mode 100644 build/asset-manifest.json create mode 100644 build/css/index.css create mode 100644 build/css/index.css.map create mode 100644 build/index.html create mode 100644 build/manifest.json create mode 100644 build/robots.txt create mode 100644 build/sass/_app.scss create mode 100644 build/sass/_categories.scss create mode 100644 build/sass/_current-score.scss create mode 100644 build/sass/_defeat-victory.scss create mode 100644 build/sass/_hangman.scss create mode 100644 build/sass/_header.scss create mode 100644 build/sass/_letters-registered.scss create mode 100644 build/sass/_loading.scss create mode 100644 build/sass/_puzzleWord.scss create mode 100644 build/sass/index.scss create mode 100644 build/static/js/2.60c5fd81.chunk.js create mode 100644 build/static/js/2.60c5fd81.chunk.js.LICENSE.txt create mode 100644 build/static/js/2.60c5fd81.chunk.js.map create mode 100644 build/static/js/3.5abcd70e.chunk.js create mode 100644 build/static/js/3.5abcd70e.chunk.js.map create mode 100644 build/static/js/main.387d7b4b.chunk.js create mode 100644 build/static/js/main.387d7b4b.chunk.js.map create mode 100644 build/static/js/runtime-main.9107414c.js create mode 100644 build/static/js/runtime-main.9107414c.js.map create mode 100644 build/static/media/00.568d8d0b.svg create mode 100644 build/static/media/01.6338b5c8.svg create mode 100644 build/static/media/02.9844dd07.svg create mode 100644 build/static/media/03.6bbc7f38.svg create mode 100644 build/static/media/04.47aae56d.svg create mode 100644 build/static/media/05.2556129c.svg create mode 100644 build/static/media/06.66808474.svg create mode 100644 build/static/media/cities.6fc05cbf.png create mode 100644 build/static/media/countries.002d677d.png create mode 100644 build/static/media/loading-light-theme.cf953a77.png create mode 100644 build/static/media/pokemon.a607811c.png create mode 100644 src/Firebase/Firebase_Config.js create mode 100644 src/General Scripts/getWidthScreenUser.js create mode 100644 src/components/Letter Input/LetterInput.jsx diff --git a/build/asset-manifest.json b/build/asset-manifest.json new file mode 100644 index 0000000..0decf8d --- /dev/null +++ b/build/asset-manifest.json @@ -0,0 +1,30 @@ +{ + "files": { + "main.js": "/static/js/main.387d7b4b.chunk.js", + "main.js.map": "/static/js/main.387d7b4b.chunk.js.map", + "runtime-main.js": "/static/js/runtime-main.9107414c.js", + "runtime-main.js.map": "/static/js/runtime-main.9107414c.js.map", + "static/js/2.60c5fd81.chunk.js": "/static/js/2.60c5fd81.chunk.js", + "static/js/2.60c5fd81.chunk.js.map": "/static/js/2.60c5fd81.chunk.js.map", + "static/js/3.5abcd70e.chunk.js": "/static/js/3.5abcd70e.chunk.js", + "static/js/3.5abcd70e.chunk.js.map": "/static/js/3.5abcd70e.chunk.js.map", + "index.html": "/index.html", + "static/js/2.60c5fd81.chunk.js.LICENSE.txt": "/static/js/2.60c5fd81.chunk.js.LICENSE.txt", + "static/media/00.568d8d0b.svg": "/static/media/00.568d8d0b.svg", + "static/media/01.6338b5c8.svg": "/static/media/01.6338b5c8.svg", + "static/media/02.9844dd07.svg": "/static/media/02.9844dd07.svg", + "static/media/03.6bbc7f38.svg": "/static/media/03.6bbc7f38.svg", + "static/media/04.47aae56d.svg": "/static/media/04.47aae56d.svg", + "static/media/05.2556129c.svg": "/static/media/05.2556129c.svg", + "static/media/06.66808474.svg": "/static/media/06.66808474.svg", + "static/media/cities.6fc05cbf.png": "/static/media/cities.6fc05cbf.png", + "static/media/countries.002d677d.png": "/static/media/countries.002d677d.png", + "static/media/loading-light-theme.cf953a77.png": "/static/media/loading-light-theme.cf953a77.png", + "static/media/pokemon.a607811c.png": "/static/media/pokemon.a607811c.png" + }, + "entrypoints": [ + "static/js/runtime-main.9107414c.js", + "static/js/2.60c5fd81.chunk.js", + "static/js/main.387d7b4b.chunk.js" + ] +} \ No newline at end of file diff --git a/build/css/index.css b/build/css/index.css new file mode 100644 index 0000000..6701b6c --- /dev/null +++ b/build/css/index.css @@ -0,0 +1,305 @@ +@charset "UTF-8"; +html, body { + margin: 0; + padding: 0; +} + +header { + border-bottom: 1px solid #c8c8c8; + height: 15vh; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} +header h1 { + font-family: "Raleway", sans-serif; + font-weight: bold; + user-select: none; + margin: 0; +} +header h2 { + font-family: "Raleway", sans-serif; + font-weight: bold; + user-select: none; + margin: 0; + color: #48a6fd; + margin-top: 0.5vh; + cursor: pointer; +} + +.app { + display: flex; + justify-content: space-around; + margin-top: 2vh; +} +.app .column-2 { + display: flex; + flex-direction: column; + justify-content: space-between; +} + +.hangman { + user-select: none; +} +.hangman img { + width: 20vw; +} + +.puzzleWord { + font-family: "Rambla", sans-serif; + font-weight: 400; + font-size: 50pt; + display: flex; + align-items: center; + max-width: 70vw; + display: flex; + flex-wrap: wrap; +} +.puzzleWord .letter { + width: 3vw; + height: 70pt; + margin-left: 2vw; + border-bottom: 5px solid #000; + display: flex; + justify-content: center; + align-items: flex-end; +} +.puzzleWord .counter { + font-size: 40pt; + font-family: Arial, Helvetica, sans-serif; + margin-left: 3vw; +} + +.current-score { + display: flex; + flex-direction: row-reverse; + font-family: "Raleway", sans-serif; + font-weight: bold; + font-size: 18pt; + color: #58ff6b; +} +.current-score .text { + user-select: none; +} + +.categories-container { + overflow-y: hidden; +} +.categories-container .categories { + position: absolute; + top: 15vh; + left: 0; + height: 85vh; + width: 100vw; + background-color: #e1e1e1; + transition: opacity 0.4s ease-in-out; + display: flex; + flex-direction: column; + justify-content: space-around; + align-items: center; + box-sizing: border-box; + padding-top: 10vh; + padding-bottom: 10vh; +} +.categories-container .categories button, .categories-container .categories select { + height: 10vh; + width: 50vw; + font-family: Arial, Helvetica, sans-serif; + font-size: 22pt; + border: none; + border-radius: 10px; + text-align: center; + text-align-last: center; + -moz-text-align-last: center; + display: flex; + justify-content: space-between; + align-items: center; +} +.categories-container .categories button img, .categories-container .categories button .blank-space, .categories-container .categories select img, .categories-container .categories select .blank-space { + height: 4vw; + width: 4vw; +} +.categories-container .categories button.Select, .categories-container .categories select.Select { + color: #000; + background-color: #E96363; + border: #e16363 solid 2px; + cursor: pointer; + transition: 0.4s ease-in-out; +} +.categories-container .categories button.Select:hover, .categories-container .categories select.Select:hover { + background-color: #ef9090; + transition: 0.4s ease-in-out; +} +.categories-container .categories button.Select:hover img, .categories-container .categories select.Select:hover img { + animation: bounce; + animation-duration: 0.5s; +} +.categories-container .categories button.Cities, .categories-container .categories button.Ciudades, .categories-container .categories select.Cities, .categories-container .categories select.Ciudades { + color: #000; + background-color: #5f9ea0; + border: #5f9798 solid 2px; + cursor: pointer; + transition: 0.4s ease-in-out; +} +.categories-container .categories button.Cities:hover, .categories-container .categories button.Ciudades:hover, .categories-container .categories select.Cities:hover, .categories-container .categories select.Ciudades:hover { + background-color: #7fb1b3; + transition: 0.4s ease-in-out; +} +.categories-container .categories button.Cities:hover img, .categories-container .categories button.Ciudades:hover img, .categories-container .categories select.Cities:hover img, .categories-container .categories select.Ciudades:hover img { + animation: bounce; + animation-duration: 0.5s; +} +.categories-container .categories button.Pokemon, .categories-container .categories select.Pokemon { + color: #000; + background-color: #ffcb05; + border: #f7c505 solid 2px; + cursor: pointer; + transition: 0.4s ease-in-out; +} +.categories-container .categories button.Pokemon:hover, .categories-container .categories select.Pokemon:hover { + background-color: #ffd638; + transition: 0.4s ease-in-out; +} +.categories-container .categories button.Pokemon:hover img, .categories-container .categories select.Pokemon:hover img { + animation: bounce; + animation-duration: 0.5s; +} +.categories-container .categories button.Programming.Languages, .categories-container .categories button.Lenguajes.De.Programación, .categories-container .categories select.Programming.Languages, .categories-container .categories select.Lenguajes.De.Programación { + color: #fff; + background-color: #e46f01; + border: #dc6b01 solid 2px; + cursor: pointer; + transition: 0.4s ease-in-out; +} +.categories-container .categories button.Programming.Languages:hover, .categories-container .categories button.Lenguajes.De.Programación:hover, .categories-container .categories select.Programming.Languages:hover, .categories-container .categories select.Lenguajes.De.Programación:hover { + background-color: #fe881a; + transition: 0.4s ease-in-out; +} +.categories-container .categories button.Programming.Languages:hover img, .categories-container .categories button.Lenguajes.De.Programación:hover img, .categories-container .categories select.Programming.Languages:hover img, .categories-container .categories select.Lenguajes.De.Programación:hover img { + animation: bounce; + animation-duration: 0.5s; +} +.categories-container .categories button.Animals, .categories-container .categories button.Animales, .categories-container .categories select.Animals, .categories-container .categories select.Animales { + color: #000; + background-color: #efa482; + border: #e7a282 solid 2px; + cursor: pointer; + transition: 0.4s ease-in-out; +} +.categories-container .categories button.Animals:hover, .categories-container .categories button.Animales:hover, .categories-container .categories select.Animals:hover, .categories-container .categories select.Animales:hover { + background-color: #f5c5af; + transition: 0.4s ease-in-out; +} +.categories-container .categories button.Animals:hover img, .categories-container .categories button.Animales:hover img, .categories-container .categories select.Animals:hover img, .categories-container .categories select.Animales:hover img { + animation: bounce; + animation-duration: 0.5s; +} +.categories-container .categories button.Countries, .categories-container .categories button.Países, .categories-container .categories select.Countries, .categories-container .categories select.Países { + color: #fff; + background-color: #9f0000; + border: #970000 solid 2px; + cursor: pointer; + transition: 0.4s ease-in-out; +} +.categories-container .categories button.Countries:hover, .categories-container .categories button.Países:hover, .categories-container .categories select.Countries:hover, .categories-container .categories select.Países:hover { + background-color: #d20000; + transition: 0.4s ease-in-out; +} +.categories-container .categories button.Countries:hover img, .categories-container .categories button.Países:hover img, .categories-container .categories select.Countries:hover img, .categories-container .categories select.Países:hover img { + animation: bounce; + animation-duration: 0.5s; +} +.categories-container .categories button.Random, .categories-container .categories select.Random { + color: #000; + background-color: #4285f4; + border: #4282ec solid 2px; + cursor: pointer; + transition: 0.4s ease-in-out; +} +.categories-container .categories button.Random:hover, .categories-container .categories select.Random:hover { + background-color: #72a4f7; + transition: 0.4s ease-in-out; +} +.categories-container .categories button.Random:hover img, .categories-container .categories select.Random:hover img { + animation: bounce; + animation-duration: 0.5s; +} +.categories-container .categories.hidden { + opacity: 0%; + top: 0; + height: 85vh; +} +.categories-container .categories.hidden button, .categories-container .categories.hidden select { + height: 5vh; +} +.categories-container .categories.show { + opacity: 100%; +} +.categories-container .categories.stretch { + height: auto; + width: 100%; +} +.categories-container .categories.stretch button, .categories-container .categories.stretch select { + margin-bottom: 5vh; +} +.categories-container .categories.stretch:last-child { + margin-bottom: 0vh !important; +} + +.defeat, .victory { + position: absolute; + left: 0; + top: 0; + height: 100vh; + width: 100vw; + display: flex; + align-items: center; + justify-content: center; + font-size: 80pt; + background-color: rgba(0, 0, 0, 0.775); + user-select: none; +} +.defeat h1, .victory h1 { + padding: 5%; + background-color: rgba(0, 0, 0, 0.775); +} + +.defeat { + color: #ff6363; +} + +.victory { + color: #58ff6b; +} + +.loading { + position: absolute; + left: 0; + top: 0; + width: 100vw; + height: 100vh; + background-color: #fff; + display: flex; + align-items: center; + justify-content: center; +} +.loading img { + width: 50px; + height: 50px; +} + +.letters-registered { + margin: 0px 5vw; + display: flex; + align-items: center; + font-family: "Times New Roman", Times, serif; + color: #918c6c; + font-size: 50pt; + height: 20vh; +} +.letters-registered span { + margin-left: 1vw; +} + +/*# sourceMappingURL=index.css.map */ diff --git a/build/css/index.css.map b/build/css/index.css.map new file mode 100644 index 0000000..73bcbdf --- /dev/null +++ b/build/css/index.css.map @@ -0,0 +1 @@ +{"version":3,"sourceRoot":"","sources":["../sass/index.scss","../sass/_header.scss","../sass/_app.scss","../sass/_hangman.scss","../sass/_puzzleWord.scss","../sass/_current-score.scss","../sass/_categories.scss","../sass/_defeat-victory.scss","../sass/_loading.scss","../sass/_letters-registered.scss"],"names":[],"mappings":";AAAA;EACI;EACA;;;ACFJ;EACI;EAEA;EAEA;EACA;EACA;EACA;;AAEA;EDHA;EACA;EAIA;EACA;;ACGA;EDTA;EACA;EAIA;EACA;ECMI;EACA;EAEA;;;ACtBR;EAEI;EACA;EAEA;;AAMA;EACI;EACA;EAEA;;;ACfR;EAEI;;AAEA;EACI;;;ACLR;EJkBI;EACA;EIhBA;EAEA;EACA;EAEA;EAEA;EACA;;AAEA;EACI;EACA;EACA;EAEA;EAEA;EACA;EACA;;AAGJ;EACI;EAEA;EAEA;;;AC9BR;EAEI;EAEA;ELGA;EACA;EKAA;EAEA;;AAEA;EACI;;;ACbR;EAEI;;AAEA;EAEI;EAEA;EACA;EAEA;EACA;EAEA;EAEA;EAEA;EACA;EACA;EACA;EAEA;EAEA;EACA;;AAEA;EACI;EACA;EAEA;EACA;EAEA;EACA;EAEA;EACA;EACA;EAEA;EACA;EACA;;AAEA;EACI;EACA;;AA0BJ;EArBI,OAFuD;EAIvD,kBAoBc;EAnBd;EAEA;EAEA;;AAEA;EACI;EACA;;AAEA;EACI;EACA;;AAYZ;EA3BI,OAFuD;EAIvD,kBA0Bc;EAzBd;EAEA;EAEA;;AAEA;EACI;EACA;;AAEA;EACI;EACA;;AAkBZ;EAjCI,OAFuD;EAIvD,kBAgCc;EA/Bd;EAEA;EAEA;;AAEA;EACI;EACA;;AAEA;EACI;EACA;;AAwBZ;EAvCI,OAyCY;EAvCZ,kBAsCc;EArCd;EAEA;EAEA;;AAEA;EACI;EACA;;AAEA;EACI;EACA;;AA+BZ;EA9CI,OAFuD;EAIvD,kBA6Cc;EA5Cd;EAEA;EAEA;;AAEA;EACI;EACA;;AAEA;EACI;EACA;;AAqCZ;EApDI,OAsDY;EApDZ,kBAmDc;EAlDd;EAEA;EAEA;;AAEA;EACI;EACA;;AAEA;EACI;EACA;;AA4CZ;EA3DI,OAFuD;EAIvD,kBA0Dc;EAzDd;EAEA;EAEA;;AAEA;EACI;EACA;;AAEA;EACI;EACA;;AAmDhB;EACI;EAEA;EACA;;AAEA;EAEI;;AAIR;EACI;;AAIJ;EACI;EACA;;AAEA;EAEI;;AAGJ;EAEI;;;ACnJhB;EACI;EACA;EACA;EAEA;EACA;EAEA;EAEA;EACA;EAEA;EAEA;EAEA;;AAEA;EACI;EACA;;;AAIR;EACI;;;AAGJ;EACI;;;AC9BJ;EACI;EACA;EACA;EAEA;EACA;EAEA;EAEA;EACA;EACA;;AAEA;EACI;EACA;;;AChBR;EACI;EAEA;EAEA;EAEA;EACA;EACA;EAEA;;AAEA;EACI","file":"index.css"} \ No newline at end of file diff --git a/build/index.html b/build/index.html new file mode 100644 index 0000000..791c6d7 --- /dev/null +++ b/build/index.html @@ -0,0 +1 @@ +Hangman game
\ No newline at end of file diff --git a/build/manifest.json b/build/manifest.json new file mode 100644 index 0000000..080d6c7 --- /dev/null +++ b/build/manifest.json @@ -0,0 +1,25 @@ +{ + "short_name": "React App", + "name": "Create React App Sample", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + }, + { + "src": "logo192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "logo512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/build/robots.txt b/build/robots.txt new file mode 100644 index 0000000..e9e57dc --- /dev/null +++ b/build/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: diff --git a/build/sass/_app.scss b/build/sass/_app.scss new file mode 100644 index 0000000..73c5687 --- /dev/null +++ b/build/sass/_app.scss @@ -0,0 +1,23 @@ +.app { + + display: flex; + justify-content: space-around; + + margin-top: 2vh; + + .column-1 { + + } + + .column-2 { + display: flex; + flex-direction: column; + + justify-content: space-between; + } +} + +@import 'hangman'; +@import 'puzzleWord'; +@import 'current-score'; +@import 'categories'; \ No newline at end of file diff --git a/build/sass/_categories.scss b/build/sass/_categories.scss new file mode 100644 index 0000000..1e09fe3 --- /dev/null +++ b/build/sass/_categories.scss @@ -0,0 +1,152 @@ +.categories-container { + + overflow-y: hidden; + + .categories { + + position: absolute; + + top: 15vh; + left: 0; + + height: 85vh; + width: 100vw; + + background-color: rgb(225, 225, 225); + + transition: opacity 0.4s ease-in-out; + + display: flex; + flex-direction: column; + justify-content: space-around; + align-items: center; + + box-sizing: border-box; + + padding-top: 10vh; + padding-bottom: 10vh; + + button, select { + height: 10vh; + width: 50vw; + + font-family: Arial, Helvetica, sans-serif; + font-size: 22pt; + + border: none; + border-radius: 10px; + + text-align: center; + text-align-last: center; + -moz-text-align-last: center; + + display: flex; + justify-content: space-between; + align-items: center; + + img, .blank-space { + height: 4vw; + width: 4vw; + } + + @mixin backgroundAndHoverDefiner($buttonColor, $textColor: #000) { + + color: $textColor; + + background-color: $buttonColor; + border: adjust-color($color: $buttonColor, $blackness: 3%, $alpha: 1.0) solid 2px; + + cursor: pointer; + + transition: 0.4s ease-in-out; + + &:hover { + background-color: adjust-color($color: $buttonColor, $lightness: 10%, ); + transition: 0.4s ease-in-out; + + & img { + animation: bounce; + animation-duration: 0.5s; + } + } + + } + + &.Select { + $buttonColor: #E96363; + + @include backgroundAndHoverDefiner($buttonColor); + } + + &.Cities, &.Ciudades { + $buttonColor: #5f9ea0; + + @include backgroundAndHoverDefiner($buttonColor); + } + + &.Pokemon { + $buttonColor: #ffcb05; + + @include backgroundAndHoverDefiner($buttonColor); + } + + &.Programming.Languages, &.Lenguajes.De.Programación { + $buttonColor: #e46f01; + $textColor: #fff; + + @include backgroundAndHoverDefiner($buttonColor, $textColor); + } + + &.Animals, &.Animales { + $buttonColor: #efa482; + + @include backgroundAndHoverDefiner($buttonColor) + } + + &.Countries, &.Países { + $buttonColor: #9f0000; + $textColor: #fff; + + @include backgroundAndHoverDefiner($buttonColor, $textColor); + } + + &.Random { + $buttonColor: #4285f4; + + @include backgroundAndHoverDefiner($buttonColor); + } + } + + &.hidden { + opacity: 0%; + + top: 0; + height: 85vh; + + button, select { + + height: 5vh; + } + } + + &.show { + opacity: 100%; + + } + + &.stretch { + height: auto; + width: 100%; + + button, select { + + margin-bottom: 5vh; + } + + &:last-child { + + margin-bottom: 0vh !important; + } + } + } +} \ No newline at end of file diff --git a/build/sass/_current-score.scss b/build/sass/_current-score.scss new file mode 100644 index 0000000..75cbdc6 --- /dev/null +++ b/build/sass/_current-score.scss @@ -0,0 +1,16 @@ +.current-score { + + display: flex; + + flex-direction: row-reverse; + + @include titleFont(); + + font-size: 18pt; + + color: rgb(88, 255, 107); + + .text { + user-select: none; + } +} \ No newline at end of file diff --git a/build/sass/_defeat-victory.scss b/build/sass/_defeat-victory.scss new file mode 100644 index 0000000..900642c --- /dev/null +++ b/build/sass/_defeat-victory.scss @@ -0,0 +1,32 @@ +.defeat, .victory { + position: absolute; + left: 0; + top: 0; + + height: 100vh; + width: 100vw; + + display: flex; + + align-items: center; + justify-content: center; + + font-size: 80pt; + + background-color: rgba(0, 0, 0, 0.775); + + user-select: none; + + h1 { + padding: 5%; + background-color: rgba(0, 0, 0, 0.775); + } +} + +.defeat { + color: rgb(255, 99, 99); +} + +.victory { + color: rgb(88, 255, 107); +} \ No newline at end of file diff --git a/build/sass/_hangman.scss b/build/sass/_hangman.scss new file mode 100644 index 0000000..97d6d5d --- /dev/null +++ b/build/sass/_hangman.scss @@ -0,0 +1,8 @@ +.hangman { + + user-select: none; + + img { + width: 20vw; + } +} \ No newline at end of file diff --git a/build/sass/_header.scss b/build/sass/_header.scss new file mode 100644 index 0000000..ccb957a --- /dev/null +++ b/build/sass/_header.scss @@ -0,0 +1,25 @@ +header { + border-bottom: 1px solid rgb(200, 200, 200); + + height: 15vh; + + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + + h1 { + @include titleFont(); + @include titleNormalize(); + + } + + h2 { + @include titleFont(); + @include titleNormalize(); + color: rgb(72, 166, 253); + margin-top: 0.5vh; + + cursor: pointer; + } +} \ No newline at end of file diff --git a/build/sass/_letters-registered.scss b/build/sass/_letters-registered.scss new file mode 100644 index 0000000..f4125e3 --- /dev/null +++ b/build/sass/_letters-registered.scss @@ -0,0 +1,17 @@ +.letters-registered { + margin: 0px 5vw; + + display: flex; + + align-items: center; + + font-family: 'Times New Roman', Times, serif; + color: rgb(145, 140, 108); + font-size: 50pt; + + height: 20vh; + + span { + margin-left: 1vw; + } +} \ No newline at end of file diff --git a/build/sass/_loading.scss b/build/sass/_loading.scss new file mode 100644 index 0000000..c5a5a66 --- /dev/null +++ b/build/sass/_loading.scss @@ -0,0 +1,19 @@ +.loading { + position: absolute; + left: 0; + top: 0; + + width: 100vw; + height: 100vh; + + background-color: #fff; + + display: flex; + align-items: center; + justify-content: center; + + img { + width: 50px; + height: 50px; + } +} \ No newline at end of file diff --git a/build/sass/_puzzleWord.scss b/build/sass/_puzzleWord.scss new file mode 100644 index 0000000..953f09f --- /dev/null +++ b/build/sass/_puzzleWord.scss @@ -0,0 +1,33 @@ +.puzzleWord { + @include bodyFont(); + + font-size: 50pt; + + display: flex; + align-items: center; + + max-width: 70vw; + + display: flex; + flex-wrap: wrap; + + .letter { + width: 3vw; + height: 70pt; + margin-left: 2vw; + + border-bottom: 5px solid #000; + + display: flex; + justify-content: center; + align-items: flex-end; + } + + .counter { + font-size: 40pt; + + font-family:Arial, Helvetica, sans-serif; + + margin-left: 3vw; + } +} \ No newline at end of file diff --git a/build/sass/index.scss b/build/sass/index.scss new file mode 100644 index 0000000..513dcca --- /dev/null +++ b/build/sass/index.scss @@ -0,0 +1,27 @@ +html, body { + margin: 0; + padding: 0; +} + +@mixin titleFont() { + + font-family: 'Raleway', sans-serif; + font-weight: bold; +} + +@mixin titleNormalize() { + user-select: none; + margin: 0; +} + +@mixin bodyFont() { + + font-family: 'Rambla', sans-serif; + font-weight: 400; +} + +@import 'header'; +@import 'app'; +@import 'defeat-victory'; +@import 'loading'; +@import 'letters-registered'; \ No newline at end of file diff --git a/build/static/js/2.60c5fd81.chunk.js b/build/static/js/2.60c5fd81.chunk.js new file mode 100644 index 0000000..c13ccac --- /dev/null +++ b/build/static/js/2.60c5fd81.chunk.js @@ -0,0 +1,3 @@ +/*! For license information please see 2.60c5fd81.chunk.js.LICENSE.txt */ +(this["webpackJsonphangman-game"]=this["webpackJsonphangman-game"]||[]).push([[2],[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.d(t,"a",(function(){return r}))},function(e,t,n){e.exports=n(37)},function(e,t,n){"use strict";function r(e,t){for(var n=0;n=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return u=e.done,e},e:function(e){s=!0,o=e},f:function(){try{u||null==n.return||n.return()}finally{if(s)throw o}}}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(21);function i(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&&Object(r.a)(e,t)}},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(13),i=n(26);function a(e){return a="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},a(e)}var o=n(25);function u(e,t){return!t||"object"!==a(t)&&"function"!==typeof t?Object(o.a)(e):t}function s(e){var t=Object(i.a)();return function(){var n,i=Object(r.a)(e);if(t){var a=Object(r.a)(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return u(this,n)}}},function(e,t,n){"use strict";e.exports=n(36)},function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return h})),n.d(t,"b",(function(){return S})),n.d(t,"c",(function(){return d})),n.d(t,"d",(function(){return j})),n.d(t,"e",(function(){return x})),n.d(t,"f",(function(){return p})),n.d(t,"g",(function(){return y})),n.d(t,"h",(function(){return m})),n.d(t,"i",(function(){return b})),n.d(t,"j",(function(){return E})),n.d(t,"k",(function(){return v})),n.d(t,"l",(function(){return g})),n.d(t,"m",(function(){return w})),n.d(t,"n",(function(){return k}));n(4),n(11);var r=n(25),i=n(5),a=n(6),o=n(23),u=n(0),s=n(2),l=function(e){for(var t=[],n=0,r=0;r>6|192,t[n++]=63&i|128):55296===(64512&i)&&r+1>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128)}return t},c={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"===typeof atob,encodeByteArray:function(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();for(var n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[],i=0;i>2,f=(3&a)<<4|u>>4,h=(15&u)<<2|l>>6,d=63&l;s||(d=64,o||(h=64)),r.push(n[c],n[f],n[h],n[d])}return r.join("")},encodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(l(e),t)},decodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){for(var t=[],n=0,r=0;n191&&i<224){var a=e[n++];t[r++]=String.fromCharCode((31&i)<<6|63&a)}else if(i>239&&i<365){var o=((7&i)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(o>>10)),t[r++]=String.fromCharCode(56320+(1023&o))}else{var u=e[n++],s=e[n++];t[r++]=String.fromCharCode((15&i)<<12|(63&u)<<6|63&s)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray:function(e,t){this.init_();for(var n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],i=0;i>4;if(r.push(l),64!==u){var c=o<<4&240|u>>2;if(r.push(c),64!==s){var f=u<<6&192|s;r.push(f)}}}return r},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var e=0;e=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}},f=function(e){return function(e){var t=l(e);return c.encodeByteArray(t,!0)}(e).replace(/\./g,"")};var h=function(){function e(){var t=this;Object(u.a)(this,e),this.reject=function(){},this.resolve=function(){},this.promise=new Promise((function(e,n){t.resolve=e,t.reject=n}))}return Object(s.a)(e,[{key:"wrapCallback",value:function(e){var t=this;return function(n,r){n?t.reject(n):t.resolve(r),"function"===typeof e&&(t.promise.catch((function(){})),1===e.length?e(n):e(n,r))}}}]),e}();function d(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');var n=t||"demo-project",r=e.iat||0,i=e.sub||e.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");var a=Object.assign({iss:"https://securetoken.google.com/".concat(n),aud:n,iat:r,exp:r+3600,auth_time:r,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},e);return[f(JSON.stringify({alg:"none",type:"JWT"})),f(JSON.stringify(a)),""].join(".")}function p(){return"undefined"!==typeof navigator&&"string"===typeof navigator.userAgent?navigator.userAgent:""}function v(){return"undefined"!==typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(p())}function y(){var e="object"===typeof chrome?chrome.runtime:"object"===typeof browser?browser.runtime:void 0;return"object"===typeof e&&void 0!==e.id}function g(){return"object"===typeof navigator&&"ReactNative"===navigator.product}function m(){return p().indexOf("Electron/")>=0}function b(){var e=p();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function k(){return p().indexOf("MSAppHost/")>=0}function w(){return!function(){try{return"[object process]"===Object.prototype.toString.call(e.process)}catch(t){return!1}}()&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function E(){return"object"===typeof indexedDB}var O=function(e){Object(i.a)(n,e);var t=Object(a.a)(n);function n(e,i,a){var o;return Object(u.a)(this,n),(o=t.call(this,i)).code=e,o.customData=a,o.name="FirebaseError",Object.setPrototypeOf(Object(r.a)(o),n.prototype),Error.captureStackTrace&&Error.captureStackTrace(Object(r.a)(o),S.prototype.create),o}return n}(Object(o.a)(Error)),S=function(){function e(t,n,r){Object(u.a)(this,e),this.service=t,this.serviceName=n,this.errors=r}return Object(s.a)(e,[{key:"create",value:function(e){var t=(arguments.length<=1?void 0:arguments[1])||{},n="".concat(this.service,"/").concat(e),r=this.errors[e],i=r?T(r,t):"Error",a="".concat(this.serviceName,": ").concat(i," (").concat(n,")."),o=new O(n,a,t);return o}}]),e}();function T(e,t){return e.replace(_,(function(e,n){var r=t[n];return null!=r?String(r):"<".concat(n,"?>")}))}var _=/\{\$([^}]+)}/g;function j(e,t){if(e===t)return!0;for(var n=Object.keys(e),r=Object.keys(t),i=0,a=n;i2&&void 0!==arguments[2]?arguments[2]:v;w(e,t).clearInstance(n)}var O,S=(i={},Object(o.a)(i,"no-app","No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()"),Object(o.a)(i,"bad-app-name","Illegal App name: '{$appName}"),Object(o.a)(i,"duplicate-app","Firebase App named '{$appName}' already exists with different options or config"),Object(o.a)(i,"app-deleted","Firebase App named '{$appName}' already deleted"),Object(o.a)(i,"invalid-app-argument","firebase.{$appName}() takes either no argument or a Firebase App instance."),Object(o.a)(i,"invalid-log-argument","First argument to `onLog` must be null or a function."),i),T=new f.b("app","Firebase",S),_=function(){function e(t,n,r){var i=this;Object(u.a)(this,e),this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new l.a("app",(function(){return i}),"PUBLIC"))}return Object(s.a)(e,[{key:"automaticDataCollectionEnabled",get:function(){return this.checkDestroyed(),this._automaticDataCollectionEnabled},set:function(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}},{key:"name",get:function(){return this.checkDestroyed(),this._name}},{key:"options",get:function(){return this.checkDestroyed(),this._options}},{key:"config",get:function(){return this.checkDestroyed(),this._config}},{key:"container",get:function(){return this._container}},{key:"isDeleted",get:function(){return this._isDeleted},set:function(e){this._isDeleted=e}},{key:"checkDestroyed",value:function(){if(this.isDeleted)throw T.create("app-deleted",{appName:this._name})}}]),e}(),j="9.1.2";function I(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"!==typeof t){var n=t;t={name:n}}var r=Object.assign({name:v,automaticDataCollectionEnabled:!1},t),i=r.name;if("string"!==typeof i||!i)throw T.create("bad-app-name",{appName:String(i)});var o=g.get(i);if(o){if(Object(f.d)(e,o.options)&&Object(f.d)(r,o.config))return o;throw T.create("duplicate-app",{appName:i})}var u,s=new l.b(i),c=Object(a.a)(m.values());try{for(c.s();!(u=c.n()).done;){var h=u.value;s.addComponent(h)}}catch(p){c.e(p)}finally{c.f()}var d=new _(e,r,s);return g.set(i,d),d}function x(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v,t=g.get(e);if(!t)throw T.create("no-app",{appName:e});return t}function C(e,t,n){var r,i=null!==(r=y[e])&&void 0!==r?r:e;n&&(i+="-".concat(n));var a=i.match(/\s|\//),o=t.match(/\s|\//);if(a||o){var u=['Unable to register library "'.concat(i,'" with version "').concat(t,'":')];return a&&u.push('library name "'.concat(i,'" contains illegal characters (whitespace or "/")')),a&&o&&u.push("and"),o&&u.push('version name "'.concat(t,'" contains illegal characters (whitespace or "/")')),void p.warn(u.join(" "))}k(new l.a("".concat(i,"-version"),(function(){return{library:i,version:t}}),"VERSION"))}k(new l.a("platform-logger",(function(e){return new h(e)}),"PRIVATE")),C(d,"0.7.3",O),C("fire-js","")},function(e,t,n){"use strict";function r(e){return r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},r(e)}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(24);var i=n(20);function a(e){return function(e){if(Array.isArray(e))return Object(r.a)(e)}(e)||function(e){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||Object(i.a)(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},function(e,t,n){"use strict";n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return p})),n.d(t,"c",(function(){return v})),n.d(t,"d",(function(){return y}));var r,i,a=n(4),o=n(0),u=n(2),s=n(9),l=[];!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(i||(i={}));var c={debug:i.DEBUG,verbose:i.VERBOSE,info:i.INFO,warn:i.WARN,error:i.ERROR,silent:i.SILENT},f=i.INFO,h=(r={},Object(s.a)(r,i.DEBUG,"log"),Object(s.a)(r,i.VERBOSE,"log"),Object(s.a)(r,i.INFO,"info"),Object(s.a)(r,i.WARN,"warn"),Object(s.a)(r,i.ERROR,"error"),r),d=function(e,t){if(!(t2?a-2:0),u=2;u2?r-2:0),u=2;u=(null!==a&&void 0!==a?a:t.logLevel)&&e({level:i[n].toLowerCase(),message:s,args:o,type:t.name})}};for(r.s();!(n=r.n()).done;)o()}catch(u){r.e(u)}finally{r.f()}}},function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return gr})),n.d(t,"b",(function(){return br})),n.d(t,"c",(function(){return mr})),n.d(t,"d",(function(){return wr})),n.d(t,"e",(function(){return kr})),n.d(t,"f",(function(){return Er})),n.d(t,"g",(function(){return Or})),n.d(t,"h",(function(){return vr})),n.d(t,"i",(function(){return yr}));var r,i=n(4),a=n(18),o=n(13),u=n(5),s=n(6),l=n(0),c=n(2),f="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof e?e:"undefined"!==typeof self?self:{},h={},d=d||{},p=f||self;function v(){}function y(e){var t=typeof e;return"array"==(t="object"!=t?t:e?Array.isArray(e)?"array":t:"null")||"object"==t&&"number"==typeof e.length}function g(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}var m="closure_uid_"+(1e9*Math.random()>>>0),b=0;function k(e,t,n){return e.call.apply(e.bind,arguments)}function w(e,t,n){if(!e)throw Error();if(2t?1:0}e:{var R=p.navigator;if(R){var F=R.userAgent;if(F){A=F;break e}}A=""}function M(e,t,n){for(var r in e)t.call(n,e[r],r,e)}function V(e){var t={};for(var n in e)t[n]=e[n];return t}var U="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function z(e,t){for(var n,r,i=1;iparseFloat(X)){q=String(Z);break e}}q=X}var ee,te={};function ne(){return function(e){var t=te;return Object.prototype.hasOwnProperty.call(t,9)?t[9]:t[9]=e(9)}((function(){for(var e=0,t=D(String(q)).split("."),n=D("9").split("."),r=Math.max(t.length,n.length),i=0;0==e&&i>>0);function je(e){return"function"===typeof e?e:(e[_e]||(e[_e]=function(t){return e.handleEvent(t)}),e[_e])}function Ie(){T.call(this),this.i=new de(this),this.P=this,this.I=null}function xe(e,t){var n,r=e.I;if(r)for(n=[];r;r=r.I)n.push(r);if(e=e.P,r=t.type||t,"string"===typeof t)t=new oe(t,e);else if(t instanceof oe)t.target=t.target||e;else{var i=t;z(t=new oe(r,e),i)}if(i=!0,n)for(var a=n.length-1;0<=a;a--){var o=t.g=n[a];i=Ce(o,r,!0,t)&&i}if(i=Ce(o=t.g=e,r,!0,t)&&i,i=Ce(o,r,!1,t)&&i,n)for(a=0;at.h&&(t.h++,e.next=t.g,t.g=e)}Ve=!1}function Be(e,t){Ie.call(this),this.h=e||1,this.g=t||p,this.j=E(this.kb,this),this.l=Date.now()}function qe(e){e.da=!1,e.S&&(e.g.clearTimeout(e.S),e.S=null)}function He(e,t,n){if("function"===typeof e)n&&(e=E(e,n));else{if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=E(e.handleEvent,e)}return 2147483647r.length)){var i=r[1];if(Array.isArray(i)&&!(1>i.length)){var a=i[0];if("noop"!=a&&"stop"!=a&&"close"!=a)for(var o=1;ot.length?Et:(t=t.substr(r,n),e.C=r+n,t))}function It(e){e.Y=Date.now()+e.P,xt(e,e.P)}function xt(e,t){if(null!=e.B)throw Error("WatchDog timer not null");e.B=ut(E(e.eb,e),t)}function Ct(e){e.B&&(p.clearTimeout(e.B),e.B=null)}function Nt(e){0==e.l.G||e.I||rr(e.l,e)}function At(e){Ct(e);var t=e.L;t&&"function"==typeof t.na&&t.na(),e.L=null,qe(e.W),Ye(e.V),e.g&&(t=e.g,e.g=null,t.abort(),t.na())}function Dt(e,t){try{var n=e.l;if(0!=n.G&&(n.g==e||pn(n.i,e)))if(n.I=e.N,!e.J&&pn(n.i,e)&&3==n.G){try{var r=n.Ca.g.parse(t)}catch(a){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){e:if(!n.u){if(n.g){if(!(n.g.F+3e3i[2]&&n.N&&0==n.A&&!n.v&&(n.v=ut(E(n.ab,n),6e3));if(1>=dn(n.i)&&n.ka){try{n.ka()}catch(a){}n.ka=void 0}}else ar(n,11)}else if((e.J||n.g==e)&&nr(n),!N(t))for(i=n.Ca.g.parse(t),t=0;tt)&&(3!=t||W||this.g&&(this.h.h||this.g.ga()||Un(this.g)))){this.I||4!=t||7==n||rt(8==n||0>=r?3:2),Ct(this);var i=this.g.ba();this.N=i;t:if(Tt(this)){var a=Un(this.g);e="";var o=a.length,u=4==Vn(this.g);if(!this.h.i){if("undefined"===typeof TextDecoder){At(this),Nt(this);var s="";break t}this.h.i=new p.TextDecoder}for(n=0;nt)throw Error("Bad port number "+t);e.m=t}else e.m=null}function Ht(e,t,n){t instanceof tn?(e.h=t,function(e,t){t&&!e.j&&(nn(e),e.i=null,e.g.forEach((function(e,t){var n=t.toLowerCase();t!=n&&(rn(this,t),on(this,n,e))}),e)),e.j=t}(e.h,e.g)):(n||(t=Qt(t,Zt)),e.h=new tn(t,e.g))}function Kt(e,t,n){e.h.set(t,n)}function Gt(e){return Kt(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function Wt(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function Qt(e,t,n){return"string"===typeof e?(e=encodeURI(e).replace(t,$t),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function $t(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}Vt.prototype.toString=function(){var e=[],t=this.j;t&&e.push(Qt(t,Yt,!0),":");var n=this.i;return(n||"file"==t)&&(e.push("//"),(t=this.s)&&e.push(Qt(t,Yt,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&e.push(":",String(n))),(n=this.l)&&(this.i&&"/"!=n.charAt(0)&&e.push("/"),e.push(Qt(n,"/"==n.charAt(0)?Jt:Xt,!0))),(n=this.h.toString())&&e.push("?",n),(n=this.o)&&e.push("#",Qt(n,en)),e.join("")};var Yt=/[#\/\?@]/g,Xt=/[#\?:]/g,Jt=/[#\?]/g,Zt=/[#\?@]/g,en=/#/g;function tn(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function nn(e){e.g||(e.g=new Pt,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(var n=0;n2*e.i&&Rt(e)))}function an(e,t){return nn(e),t=un(e,t),Ft(e.g.h,t)}function on(e,t,n){rn(e,t),0=e.j}function dn(e){return e.h?1:e.g?e.g.size:0}function pn(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function vn(e,t){e.g?e.g.add(t):e.h=t}function yn(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function gn(e){if(null!=e.h)return e.i.concat(e.h.D);if(null!=e.g&&0!==e.g.size){var t,n=e.i,r=Object(i.a)(e.g.values());try{for(r.s();!(t=r.n()).done;){var a=t.value;n=n.concat(a.D)}}catch(o){r.e(o)}finally{r.f()}return n}return C(e.i)}function mn(){}function bn(){this.g=new mn}function kn(e,t,n){var r=n||"";try{Lt(e,(function(e,n){var i=e;g(e)&&(i=Ne(e)),t.push(r+n+"="+encodeURIComponent(i))}))}catch(i){throw t.push(r+"type="+encodeURIComponent("_badmap")),i}}function wn(e,t,n,r,i){try{t.onload=null,t.onerror=null,t.onabort=null,t.ontimeout=null,i(r)}catch(a){}}function En(e){this.l=e.$b||null,this.j=e.ib||!1}function On(e,t){Ie.call(this),this.D=e,this.u=t,this.m=void 0,this.readyState=Sn,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}ln.prototype.cancel=function(){if(this.i=gn(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){var e,t=Object(i.a)(this.g.values());try{for(t.s();!(e=t.n()).done;){e.value.cancel()}}catch(n){t.e(n)}finally{t.f()}this.g.clear()}},mn.prototype.stringify=function(e){return p.JSON.stringify(e,void 0)},mn.prototype.parse=function(e){return p.JSON.parse(e,void 0)},S(En,ct),En.prototype.g=function(){return new On(this.l,this.j)},En.prototype.i=(cn={},function(){return cn}),S(On,Ie);var Sn=0;function Tn(e){e.j.read().then(e.Sa.bind(e)).catch(e.ha.bind(e))}function _n(e){e.readyState=4,e.l=null,e.j=null,e.A=null,jn(e)}function jn(e){e.onreadystatechange&&e.onreadystatechange.call(e)}(r=On.prototype).open=function(e,t){if(this.readyState!=Sn)throw this.abort(),Error("Error reopening a connection");this.C=e,this.B=t,this.readyState=1,jn(this)},r.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var t={headers:this.v,method:this.C,credentials:this.m,cache:void 0};e&&(t.body=e),(this.D||p).fetch(new Request(this.B,t)).then(this.Va.bind(this),this.ha.bind(this))},r.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted."),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,_n(this)),this.readyState=Sn},r.Va=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,jn(this)),this.g&&(this.readyState=3,jn(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Ta.bind(this),this.ha.bind(this));else if("undefined"!==typeof p.ReadableStream&&"body"in e){if(this.j=e.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;Tn(this)}else e.text().then(this.Ua.bind(this),this.ha.bind(this))},r.Sa=function(e){if(this.g){if(this.u&&e.value)this.response.push(e.value);else if(!this.u){var t=e.value?e.value:new Uint8Array(0);(t=this.A.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?_n(this):jn(this),3==this.readyState&&Tn(this)}},r.Ua=function(e){this.g&&(this.response=this.responseText=e,_n(this))},r.Ta=function(e){this.g&&(this.response=e,_n(this))},r.ha=function(){this.g&&_n(this)},r.setRequestHeader=function(e,t){this.v.append(e,t)},r.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},r.getAllResponseHeaders=function(){if(!this.h)return"";for(var e=[],t=this.h.entries(),n=t.next();!n.done;)n=n.value,e.push(n[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(On.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}});var In=p.JSON.parse;function xn(e){Ie.call(this),this.headers=new Pt,this.u=e||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=Cn,this.K=this.L=!1}S(xn,Ie);var Cn="",Nn=/^https?$/i,An=["POST","PUT"];function Dn(e){return"content-type"==e.toLowerCase()}function Ln(e,t){e.h=!1,e.g&&(e.l=!0,e.g.abort(),e.l=!1),e.j=t,e.m=5,Pn(e),Fn(e)}function Pn(e){e.D||(e.D=!0,xe(e,"complete"),xe(e,"error"))}function Rn(e){if(e.h&&"undefined"!=typeof d&&(!e.C[1]||4!=Vn(e)||2!=e.ba()))if(e.v&&4==Vn(e))He(e.Fa,0,e);else if(xe(e,"readystatechange"),4==Vn(e)){e.h=!1;try{var t,n=e.ba();e:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break e;default:r=!1}if(!(t=r)){var i;if(i=0===n){var a=String(e.H).match(Mt)[1]||null;if(!a&&p.self&&p.self.location){var o=p.self.location.protocol;a=o.substr(0,o.length-1)}i=!Nn.test(a?a.toLowerCase():"")}t=i}if(t)xe(e,"complete"),xe(e,"success");else{e.m=6;try{var u=2(l-=a))a=Math.max(0,i[s].h-100),u=!1;else try{kn(c,o,"req"+l+"_")}catch(f){r&&r(c)}}if(u){r=o.join("&");break e}}return e=e.l.splice(0,n),t.D=e,r}function Jn(e){e.g||e.u||(e.Y=1,Me(e.Ga,e),e.A=0)}function Zn(e){return!(e.g||e.u||3<=e.A)&&(e.Y++,e.u=ut(E(e.Ga,e),ir(e,e.A)),e.A++,!0)}function er(e){null!=e.B&&(p.clearTimeout(e.B),e.B=null)}function tr(e){e.g=new mt(e,e.h,"rpc",e.Y),null===e.o&&(e.g.H=e.s),e.g.O=0;var t=Ut(e.oa);Kt(t,"RID","rpc"),Kt(t,"SID",e.J),Kt(t,"CI",e.N?"0":"1"),Kt(t,"AID",e.U),Yn(e,t),Kt(t,"TYPE","xmlhttp"),e.o&&e.s&&zn(t,e.o,e.s),e.K&&e.g.setTimeout(e.K);var n=e.g;e=e.la,n.K=1,n.v=Gt(Ut(t)),n.s=null,n.U=!0,St(n,e)}function nr(e){null!=e.v&&(p.clearTimeout(e.v),e.v=null)}function rr(e,t){var n=null;if(e.g==t){nr(e),er(e),e.g=null;var r=2}else{if(!pn(e.i,t))return;n=t.D,yn(e.i,t),r=1}if(e.I=t.N,0!=e.G)if(t.i)if(1==r){n=t.s?t.s.length:0,t=Date.now()-t.F;var i=e.C;xe(r=tt(),new ot(r,n,t,i)),Qn(e)}else Jn(e);else if(3==(i=t.o)||0==i&&0=e.i.j-(e.m?1:0))&&(e.m?(e.l=t.D.concat(e.l),!0):!(1==e.G||2==e.G||e.C>=(e.Xa?0:e.Ya))&&(e.m=ut(E(e.Ha,e,t),ir(e,e.C)),e.C++,!0))}(e,t)||2==r&&Zn(e)))switch(n&&0t?null:"string"===typeof e?e.charAt(t):e[t]}(i.T()),n=p.FormData&&e instanceof p.FormData,!(0<=j(An,t))||r||n||i.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),i.forEach((function(e,t){this.g.setRequestHeader(t,e)}),this),this.J&&(this.g.responseType=this.J),"withCredentials"in this.g&&this.g.withCredentials!==this.L&&(this.g.withCredentials=this.L);try{Mn(this),0=this.O)){var e=2*this.O;this.h.info("BP detection timer enabled: "+e),this.B=ut(E(this.bb,this),e)}},r.bb=function(){this.B&&(this.B=null,this.h.info("BP detection timeout reached."),this.h.info("Buffering proxy detected and switch to long-polling!"),this.N=!1,this.L=!0,at(10),Kn(this),tr(this))},r.ab=function(){null!=this.v&&(this.v=null,Kn(this),Zn(this),at(19))},r.jb=function(e){e?(this.h.info("Successfully pinged google.com"),at(2)):(this.h.info("Failed to ping google.com"),at(1))},(r=lr.prototype).xa=function(){},r.wa=function(){},r.va=function(){},r.ua=function(){},r.Oa=function(){},cr.prototype.g=function(e,t){return new fr(e,t)},S(fr,Ie),fr.prototype.m=function(){this.g.j=this.j,this.A&&(this.g.H=!0);var e=this.g,t=this.l,n=this.h||void 0;e.Wa&&(e.h.info("Origin Trials enabled."),Me(E(e.hb,e,t))),at(0),e.W=t,e.aa=n||{},e.N=e.X,e.F=ur(e,null,e.W),Qn(e)},fr.prototype.close=function(){Hn(this.g)},fr.prototype.u=function(e){if("string"===typeof e){var t={};t.__data__=e,Wn(this.g,t)}else this.v?((t={}).__data__=Ne(e),Wn(this.g,t)):Wn(this.g,e)},fr.prototype.M=function(){this.g.j=null,delete this.j,Hn(this.g),delete this.g,fr.Z.M.call(this)},S(hr,vt),S(dr,yt),S(pr,lr),pr.prototype.xa=function(){xe(this.g,"a")},pr.prototype.wa=function(e){xe(this.g,new hr(e))},pr.prototype.va=function(e){xe(this.g,new dr(e))},pr.prototype.ua=function(){xe(this.g,"b")},cr.prototype.createWebChannel=cr.prototype.g,fr.prototype.send=fr.prototype.u,fr.prototype.open=fr.prototype.m,fr.prototype.close=fr.prototype.close,st.NO_ERROR=0,st.TIMEOUT=8,st.HTTP_ERROR=6,lt.COMPLETE="complete",ht.EventType=pt,pt.OPEN="a",pt.CLOSE="b",pt.ERROR="c",pt.MESSAGE="d",Ie.prototype.listen=Ie.prototype.N,xn.prototype.listenOnce=xn.prototype.O,xn.prototype.getLastError=xn.prototype.La,xn.prototype.getLastErrorCode=xn.prototype.Da,xn.prototype.getStatus=xn.prototype.ba,xn.prototype.getResponseJson=xn.prototype.Qa,xn.prototype.getResponseText=xn.prototype.ga,xn.prototype.send=xn.prototype.ea;var vr=h.createWebChannelTransport=function(){return new cr},yr=h.getStatEventTarget=function(){return tt()},gr=h.ErrorCode=st,mr=h.EventType=lt,br=h.Event=Ze,kr=h.Stat={rb:0,ub:1,vb:2,Ob:3,Tb:4,Qb:5,Rb:6,Pb:7,Nb:8,Sb:9,PROXY:10,NOPROXY:11,Lb:12,Hb:13,Ib:14,Gb:15,Jb:16,Kb:17,nb:18,mb:19,ob:20},wr=h.FetchXmlHttpFactory=En,Er=h.WebChannel=ht,Or=h.XhrIo=xn}).call(this,n(29))},function(e,t,n){"use strict";n.d(t,"a",(function(){return gt})),n.d(t,"b",(function(){return xt})),n.d(t,"c",(function(){return dt}));var r=n(18),i=n(13),a=n(22),o=n(4),u=n(1),s=n.n(u),l=n(3),c=n(5),f=n(6),h=n(23),d=n(14),p=n(0),v=n(2),y=n(12),g=n(19),m=n(15),b=n(8),k=function(){function e(t){Object(p.a)(this,e),this.uid=t}return Object(v.a)(e,[{key:"isAuthenticated",value:function(){return null!=this.uid}},{key:"toKey",value:function(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}},{key:"isEqual",value:function(e){return e.uid===this.uid}}]),e}();k.UNAUTHENTICATED=new k(null),k.GOOGLE_CREDENTIALS=new k("google-credentials-uid"),k.FIRST_PARTY=new k("first-party-uid"),k.MOCK_USER=new k("mock-user");var w="9.1.0",E=new m.b("@firebase/firestore");function O(e){if(E.logLevel<=m.a.DEBUG){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:"Unexpected state",t="FIRESTORE (".concat(w,") INTERNAL ASSERTION FAILED: ")+e;throw S(t),new Error(t)}function I(e,t){e||j()}function x(e,t){return e}var C="ok",N="cancelled",A="unknown",D="invalid-argument",L="deadline-exceeded",P="not-found",R="permission-denied",F="unauthenticated",M="resource-exhausted",V="failed-precondition",U="aborted",z="out-of-range",B="unimplemented",q="internal",H="unavailable",K=function(e){Object(c.a)(n,e);var t=Object(f.a)(n);function n(e,r){var i;return Object(p.a)(this,n),(i=t.call(this,r)).code=e,i.message=r,i.name="FirebaseError",i.toString=function(){return"".concat(i.name,": [code=").concat(i.code,"]: ").concat(i.message)},i}return n}(Object(h.a)(Error)),G=function e(t,n){Object(p.a)(this,e),this.user=n,this.type="OAuth",this.authHeaders={},this.authHeaders.Authorization="Bearer ".concat(t)},W=function(){function e(){Object(p.a)(this,e)}return Object(v.a)(e,[{key:"getToken",value:function(){return Promise.resolve(null)}},{key:"invalidateToken",value:function(){}},{key:"start",value:function(e,t){e.enqueueRetryable((function(){return t(k.UNAUTHENTICATED)}))}},{key:"shutdown",value:function(){}}]),e}(),Q=function(){function e(t){var n=this;Object(p.a)(this,e),this.auth=null,t.onInit((function(e){n.auth=e}))}return Object(v.a)(e,[{key:"getToken",value:function(){var e=this;return this.auth?this.auth.getToken().then((function(t){return t?(I("string"==typeof t.accessToken),new G(t.accessToken,new k(e.auth.getUid()))):null})):Promise.resolve(null)}},{key:"invalidateToken",value:function(){}},{key:"start",value:function(e,t){}},{key:"shutdown",value:function(){}}]),e}(),$=function(){function e(t,n,r){Object(p.a)(this,e),this.t=t,this.i=n,this.o=r,this.type="FirstParty",this.user=k.FIRST_PARTY}return Object(v.a)(e,[{key:"authHeaders",get:function(){var e={"X-Goog-AuthUser":this.i},t=this.t.auth.getAuthHeaderValueForFirstParty([]);return t&&(e.Authorization=t),this.o&&(e["X-Goog-Iam-Authorization-Token"]=this.o),e}}]),e}(),Y=function(){function e(t,n,r){Object(p.a)(this,e),this.t=t,this.i=n,this.o=r}return Object(v.a)(e,[{key:"getToken",value:function(){return Promise.resolve(new $(this.t,this.i,this.o))}},{key:"start",value:function(e,t){e.enqueueRetryable((function(){return t(k.FIRST_PARTY)}))}},{key:"shutdown",value:function(){}},{key:"invalidateToken",value:function(){}}]),e}(),X=function e(t,n,r,i,a,o,u,s){Object(p.a)(this,e),this.databaseId=t,this.appId=n,this.persistenceKey=r,this.host=i,this.ssl=a,this.forceLongPolling=o,this.autoDetectLongPolling=u,this.useFetchStreams=s},J=function(){function e(t,n){Object(p.a)(this,e),this.projectId=t,this.database=n||"(default)"}return Object(v.a)(e,[{key:"isDefaultDatabase",get:function(){return"(default)"===this.database}},{key:"isEqual",value:function(t){return t instanceof e&&t.projectId===this.projectId&&t.database===this.database}}]),e}(),Z=function(){function e(t,n,r){Object(p.a)(this,e),void 0===n?n=0:n>t.length&&j(),void 0===r?r=t.length-n:r>t.length-n&&j(),this.segments=t,this.offset=n,this.len=r}return Object(v.a)(e,[{key:"length",get:function(){return this.len}},{key:"isEqual",value:function(t){return 0===e.comparator(this,t)}},{key:"child",value:function(t){var n=this.segments.slice(this.offset,this.limit());return t instanceof e?t.forEach((function(e){n.push(e)})):n.push(t),this.construct(n)}},{key:"limit",value:function(){return this.offset+this.length}},{key:"popFirst",value:function(e){return e=void 0===e?1:e,this.construct(this.segments,this.offset+e,this.length-e)}},{key:"popLast",value:function(){return this.construct(this.segments,this.offset,this.length-1)}},{key:"firstSegment",value:function(){return this.segments[this.offset]}},{key:"lastSegment",value:function(){return this.get(this.length-1)}},{key:"get",value:function(e){return this.segments[this.offset+e]}},{key:"isEmpty",value:function(){return 0===this.length}},{key:"isPrefixOf",value:function(e){if(e.lengtha)return 1}return e.lengtht.length?1:0}}]),e}(),ee=function(e){Object(c.a)(n,e);var t=Object(f.a)(n);function n(){return Object(p.a)(this,n),t.apply(this,arguments)}return Object(v.a)(n,[{key:"construct",value:function(e,t,r){return new n(e,t,r)}},{key:"canonicalString",value:function(){return this.toArray().join("/")}},{key:"toString",value:function(){return this.canonicalString()}}],[{key:"fromString",value:function(){for(var e=[],t=arguments.length,r=new Array(t),i=0;i=0)throw new K(D,"Invalid segment (".concat(u,"). Paths must not contain // in them."));e.push.apply(e,Object(d.a)(u.split("/").filter((function(e){return e.length>0}))))}return new n(e)}},{key:"emptyPath",value:function(){return new n([])}}]),n}(Z),te=/^[_a-zA-Z][_a-zA-Z0-9]*$/,ne=function(e){Object(c.a)(n,e);var t=Object(f.a)(n);function n(){return Object(p.a)(this,n),t.apply(this,arguments)}return Object(v.a)(n,[{key:"construct",value:function(e,t,r){return new n(e,t,r)}},{key:"canonicalString",value:function(){return this.toArray().map((function(e){return e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),n.isValidIdentifier(e)||(e="`"+e+"`"),e})).join(".")}},{key:"toString",value:function(){return this.canonicalString()}},{key:"isKeyField",value:function(){return 1===this.length&&"__name__"===this.get(0)}}],[{key:"isValidIdentifier",value:function(e){return te.test(e)}},{key:"keyField",value:function(){return new n(["__name__"])}},{key:"fromServerFormat",value:function(e){for(var t=[],r="",i=0,a=function(){if(0===r.length)throw new K(D,"Invalid field path (".concat(e,"). Paths must not be empty, begin with '.', end with '.', or contain '..'"));t.push(r),r=""},o=!1;i=2&&this.path.get(this.path.length-2)===e}},{key:"isEqual",value:function(e){return null!==e&&0===ee.comparator(this.path,e.path)}},{key:"toString",value:function(){return this.path.toString()}}],[{key:"fromPath",value:function(t){return new e(ee.fromString(t))}},{key:"fromName",value:function(t){return new e(ee.fromString(t).popFirst(5))}},{key:"comparator",value:function(e,t){return ee.comparator(e.path,t.path)}},{key:"isDocumentKey",value:function(e){return e.length%2==0}},{key:"fromSegments",value:function(t){return new e(new ee(t.slice()))}}]),e}();function ie(e,t,n){if(!n)throw new K(D,"Function ".concat(e,"() cannot be called with an empty ").concat(t,"."))}function ae(e){if(re.isDocumentKey(e))throw new K(D,"Invalid collection reference. Collection references must have an odd number of segments, but ".concat(e," has ").concat(e.length,"."))}function oe(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return e.length>20&&(e="".concat(e.substring(0,20),"...")),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"==typeof e){if(e instanceof Array)return"an array";var t=function(e){return e.constructor?e.constructor.name:null}(e);return t?"a custom ".concat(t," object"):"an object"}return"function"==typeof e?"a function":j()}function ue(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new K(D,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");var n=oe(e);throw new K(D,"Expected type '".concat(t.name,"', but it was: ").concat(n))}return e}function se(e){return null==e}function le(e){return 0===e&&1/e==-1/0}var ce,fe,he={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery"};function de(e){if(void 0===e)return S("RPC_ERROR","HTTP error has no status"),A;switch(e){case 200:return C;case 400:return V;case 401:return F;case 403:return R;case 404:return P;case 409:return U;case 416:return z;case 429:return M;case 499:return N;case 500:return A;case 501:return B;case 503:return H;case 504:return L;default:return e>=200&&e<300?C:e>=400&&e<500?V:e>=500&&e<600?q:A}}(fe=ce||(ce={}))[fe.OK=0]="OK",fe[fe.CANCELLED=1]="CANCELLED",fe[fe.UNKNOWN=2]="UNKNOWN",fe[fe.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",fe[fe.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",fe[fe.NOT_FOUND=5]="NOT_FOUND",fe[fe.ALREADY_EXISTS=6]="ALREADY_EXISTS",fe[fe.PERMISSION_DENIED=7]="PERMISSION_DENIED",fe[fe.UNAUTHENTICATED=16]="UNAUTHENTICATED",fe[fe.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",fe[fe.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",fe[fe.ABORTED=10]="ABORTED",fe[fe.OUT_OF_RANGE=11]="OUT_OF_RANGE",fe[fe.UNIMPLEMENTED=12]="UNIMPLEMENTED",fe[fe.INTERNAL=13]="INTERNAL",fe[fe.UNAVAILABLE=14]="UNAVAILABLE",fe[fe.DATA_LOSS=15]="DATA_LOSS";var pe=function(e){Object(c.a)(n,e);var t=Object(f.a)(n);function n(e,r){var i;return Object(p.a)(this,n),(i=t.call(this,e)).I=r,i}return Object(v.a)(n,[{key:"T",value:function(e,t){throw new Error("Not supported by FetchConnection")}},{key:"g",value:function(){var e=Object(l.a)(s.a.mark((function e(t,n,r,i){var a,o;return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=JSON.stringify(i),e.prev=1,e.next=4,this.I(n,{method:"POST",headers:r,body:a});case 4:o=e.sent,e.next=10;break;case 7:throw e.prev=7,e.t0=e.catch(1),new K(de(e.t0.status),"Request failed with error: "+e.t0.statusText);case 10:if(o.ok){e.next=12;break}throw new K(de(o.status),"Request failed with error: "+o.statusText);case 12:return e.abrupt("return",o.json());case 13:case"end":return e.stop()}}),e,this,[[1,7]])})));return function(t,n,r,i){return e.apply(this,arguments)}}()}]),n}(function(){function e(t){Object(p.a)(this,e),this.databaseInfo=t,this.databaseId=t.databaseId;var n=t.ssl?"https":"http";this.u=n+"://"+t.host,this.h="projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database+"/documents"}return Object(v.a)(e,[{key:"l",value:function(e,t,n,r){var i=this.m(e,t);O("RestConnection","Sending: ",i,n);var a={};return this.p(a,r),this.g(e,i,a,n).then((function(e){return O("RestConnection","Received: ",e),e}),(function(t){throw T("RestConnection","".concat(e," failed with error: "),t,"url: ",i,"request:",n),t}))}},{key:"v",value:function(e,t,n,r){return this.l(e,t,n,r)}},{key:"p",value:function(e,t){if(e["X-Goog-Api-Client"]="gl-js/ fire/"+w,e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t)for(var n in t.authHeaders)t.authHeaders.hasOwnProperty(n)&&(e[n]=t.authHeaders[n])}},{key:"m",value:function(e,t){var n=he[e];return"".concat(this.u,"/v1/").concat(t,":").concat(n)}}]),e}());function ve(e,t){return et?1:0}function ye(e,t,n){return e.length===t.length&&e.every((function(e,r){return n(e,t[r])}))}var ge=function(){function e(t,n){if(Object(p.a)(this,e),this.seconds=t,this.nanoseconds=n,n<0)throw new K(D,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new K(D,"Timestamp nanoseconds out of range: "+n);if(t<-62135596800)throw new K(D,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new K(D,"Timestamp seconds out of range: "+t)}return Object(v.a)(e,[{key:"toDate",value:function(){return new Date(this.toMillis())}},{key:"toMillis",value:function(){return 1e3*this.seconds+this.nanoseconds/1e6}},{key:"_compareTo",value:function(e){return this.seconds===e.seconds?ve(this.nanoseconds,e.nanoseconds):ve(this.seconds,e.seconds)}},{key:"isEqual",value:function(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}},{key:"toString",value:function(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}},{key:"toJSON",value:function(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}},{key:"valueOf",value:function(){var e=this.seconds- -62135596800;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}],[{key:"now",value:function(){return e.fromMillis(Date.now())}},{key:"fromDate",value:function(t){return e.fromMillis(t.getTime())}},{key:"fromMillis",value:function(t){var n=Math.floor(t/1e3);return new e(n,Math.floor(1e6*(t-1e3*n)))}}]),e}(),me=function(){function e(t){Object(p.a)(this,e),this.timestamp=t}return Object(v.a)(e,[{key:"compareTo",value:function(e){return this.timestamp._compareTo(e.timestamp)}},{key:"isEqual",value:function(e){return this.timestamp.isEqual(e.timestamp)}},{key:"toMicroseconds",value:function(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}},{key:"toString",value:function(){return"SnapshotVersion("+this.timestamp.toString()+")"}},{key:"toTimestamp",value:function(){return this.timestamp}}],[{key:"fromTimestamp",value:function(t){return new e(t)}},{key:"min",value:function(){return new e(new ge(0,0))}}]),e}();function be(e){var t=0;for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function ke(e,t){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}var we=function(){function e(t){Object(p.a)(this,e),this.binaryString=t}return Object(v.a)(e,[{key:"toBase64",value:function(){return e=this.binaryString,btoa(e);var e}},{key:"toUint8Array",value:function(){return function(e){for(var t=new Uint8Array(e.length),n=0;n1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null;Object(p.a)(this,e),this.path=t,this.collectionGroup=n,this.orderBy=r,this.filters=i,this.limit=a,this.startAt=o,this.endAt=u,this.P=null};function Me(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null;return new Fe(e,t,n,r,i,a,o)}var Ve=function e(t,n){Object(p.a)(this,e),this.position=t,this.before=n},Ue=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"asc";Object(p.a)(this,e),this.field=t,this.dir=n};var ze=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"F",u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;Object(p.a)(this,e),this.path=t,this.collectionGroup=n,this.explicitOrderBy=r,this.filters=i,this.limit=a,this.limitType=o,this.startAt=u,this.endAt=s,this.D=null,this.$=null,this.startAt,this.endAt};function Be(e){return!se(e.limit)&&"L"===e.limitType}function qe(e){return e.explicitOrderBy.length>0?e.explicitOrderBy[0].field:null}function He(e){var t,n=Object(o.a)(e.filters);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.N())return r.field}}catch(i){n.e(i)}finally{n.f()}return null}function Ke(e){var t=x(e);if(null===t.D){t.D=[];var n=He(t),r=qe(t);if(null!==n&&null===r)n.isKeyField()||t.D.push(new Ue(n)),t.D.push(new Ue(ne.keyField(),"asc"));else{var i,a=!1,u=Object(o.a)(t.explicitOrderBy);try{for(u.s();!(i=u.n()).done;){var s=i.value;t.D.push(s),s.field.isKeyField()&&(a=!0)}}catch(c){u.e(c)}finally{u.f()}if(!a){var l=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:"asc";t.D.push(new Ue(ne.keyField(),l))}}}return t.D}function Ge(e){var t=x(e);if(!t.$)if("F"===t.limitType)t.$=Me(t.path,t.collectionGroup,Ke(t),t.filters,t.limit,t.startAt,t.endAt);else{var n,r=[],i=Object(o.a)(Ke(t));try{for(i.s();!(n=i.n()).done;){var a=n.value,u="desc"===a.dir?"asc":"desc";r.push(new Ue(a.field,u))}}catch(c){i.e(c)}finally{i.f()}var s=t.endAt?new Ve(t.endAt.position,!t.endAt.before):null,l=t.startAt?new Ve(t.startAt.position,!t.startAt.before):null;t.$=Me(t.path,t.collectionGroup,r,t.filters,t.limit,s,l)}return t.$}var We={asc:"ASCENDING",desc:"DESCENDING"},Qe={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},$e=function e(t,n){Object(p.a)(this,e),this.databaseId=t,this.F=n};function Ye(e){return I(!!e),me.fromTimestamp(function(e){var t=Oe(e);return new ge(t.seconds,t.nanos)}(e))}function Xe(e,t){return function(e){return new ee(["projects",e.projectId,"databases",e.database])}(e).child("documents").child(t).canonicalString()}function Je(e,t){var n,r=function(e){var t=ee.fromString(e);return I(at(t)),t}(t);if(r.get(1)!==e.databaseId.projectId)throw new K(D,"Tried to deserialize key from different project: "+r.get(1)+" vs "+e.databaseId.projectId);if(r.get(3)!==e.databaseId.database)throw new K(D,"Tried to deserialize key from different database: "+r.get(3)+" vs "+e.databaseId.database);return new re((I((n=r).length>4&&"documents"===n.get(4)),n.popFirst(5)))}function Ze(e,t){return Xe(e.databaseId,t)}function et(e,t){var n={structuredQuery:{}},r=t.path;null!==t.collectionGroup?(n.parent=Ze(e,r),n.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(n.parent=Ze(e,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);var i=function(e){if(0!==e.length){var t=e.map((function(e){return function(e){if("=="===e.op){if(Ae(e.value))return{unaryFilter:{field:it(e.field),op:"IS_NAN"}};if(Ne(e.value))return{unaryFilter:{field:it(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(Ae(e.value))return{unaryFilter:{field:it(e.field),op:"IS_NOT_NAN"}};if(Ne(e.value))return{unaryFilter:{field:it(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:it(e.field),op:rt(e.op),value:e.value}}}(e)}));return 1===t.length?t[0]:{compositeFilter:{op:"AND",filters:t}}}}(t.filters);i&&(n.structuredQuery.where=i);var a=function(e){if(0!==e.length)return e.map((function(e){return function(e){return{field:it(e.field),direction:nt(e.dir)}}(e)}))}(t.orderBy);a&&(n.structuredQuery.orderBy=a);var o=function(e,t){return e.F||se(t)?t:{value:t}}(e,t.limit);return null!==o&&(n.structuredQuery.limit=o),t.startAt&&(n.structuredQuery.startAt=tt(t.startAt)),t.endAt&&(n.structuredQuery.endAt=tt(t.endAt)),n}function tt(e){return{before:e.before,values:e.position}}function nt(e){return We[e]}function rt(e){return Qe[e]}function it(e){return{fieldPath:e.canonicalString()}}function at(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}function ot(e){return new $e(e,!0)}var ut=function(e){Object(c.a)(n,e);var t=Object(f.a)(n);function n(e,r,i){var a;return Object(p.a)(this,n),(a=t.call(this)).credentials=e,a.Y=r,a.S=i,a.K=!1,a}return Object(v.a)(n,[{key:"J",value:function(){if(this.K)throw new K(V,"The client has already been terminated.")}},{key:"l",value:function(e,t,n){var r=this;return this.J(),this.credentials.getToken().then((function(i){return r.Y.l(e,t,n,i)})).catch((function(e){throw"FirebaseError"===e.name?(e.code===F&&r.credentials.invalidateToken(),e):new K(A,e.toString())}))}},{key:"v",value:function(e,t,n){var r=this;return this.J(),this.credentials.getToken().then((function(i){return r.Y.v(e,t,n,i)})).catch((function(e){throw"FirebaseError"===e.name?(e.code===F&&r.credentials.invalidateToken(),e):new K(A,e.toString())}))}},{key:"terminate",value:function(){this.K=!0}}]),n}(function(){return function e(){Object(p.a)(this,e)}}());function st(){return(st=Object(l.a)(s.a.mark((function e(t,n){var r,i;return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=x(t),i=et(r.S,Ge(n)),e.next=3,r.v("RunQuery",i.parent,{structuredQuery:i.structuredQuery});case 3:return e.abrupt("return",e.sent.filter((function(e){return!!e.document})).map((function(e){return function(e,t,n){var r=Je(e,t.name),i=Ye(t.updateTime),a=new Pe({mapValue:{fields:t.fields}}),o=Re.newFoundDocument(r,i,a);return o}(r.S,e.document)})));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var lt=new Map;function ct(e){if(e._terminated)throw new K(V,"The client has already been terminated.");if(!lt.has(e)){O("ComponentProvider","Initializing Datastore");var t=function(e){return new pe(e,fetch.bind(null))}((i=e._databaseId,a=e.app.options.appId||"",o=e._persistenceKey,u=e._freezeSettings(),new X(i,a,o,u.host,u.ssl,u.experimentalForceLongPolling,u.experimentalAutoDetectLongPolling,u.useFetchStreams))),n=ot(e._databaseId),r=function(e,t,n){return new ut(e,t,n)}(e._credentials,t,n);lt.set(e,r)}var i,a,o,u;return lt.get(e)}var ft=function(){function e(t){var n;if(Object(p.a)(this,e),void 0===t.host){if(void 0!==t.ssl)throw new K(D,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=t.host,this.ssl=null===(n=t.ssl)||void 0===n||n;if(this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,void 0===t.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new K(D,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.useFetchStreams=!!t.useFetchStreams,function(e,t,n,r){if(!0===t&&!0===r)throw new K(D,"".concat("experimentalForceLongPolling"," and ").concat("experimentalAutoDetectLongPolling"," cannot be used together."))}(0,t.experimentalForceLongPolling,0,t.experimentalAutoDetectLongPolling)}return Object(v.a)(e,[{key:"isEqual",value:function(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}]),e}(),ht=function(){function e(t,n){Object(p.a)(this,e),this._credentials=n,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new ft({}),this._settingsFrozen=!1,t instanceof J?this._databaseId=t:(this._app=t,this._databaseId=function(e){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new K(D,'"projectId" not provided in firebase.initializeApp.');return new J(e.options.projectId)}(t))}return Object(v.a)(e,[{key:"app",get:function(){if(!this._app)throw new K(V,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}},{key:"_initialized",get:function(){return this._settingsFrozen}},{key:"_terminated",get:function(){return void 0!==this._terminateTask}},{key:"_setSettings",value:function(e){if(this._settingsFrozen)throw new K(V,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new ft(e),void 0!==e.credentials&&(this._credentials=function(e){if(!e)return new W;switch(e.type){case"gapi":var t=e.client;return I(!("object"!=typeof t||null===t||!t.auth||!t.auth.getAuthHeaderValueForFirstParty)),new Y(t,e.sessionIndex||"0",e.iamToken||null);case"provider":return e.client;default:throw new K(D,"makeCredentialsProvider failed due to invalid credential type")}}(e.credentials))}},{key:"_getSettings",value:function(){return this._settings}},{key:"_freezeSettings",value:function(){return this._settingsFrozen=!0,this._settings}},{key:"_delete",value:function(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}},{key:"toJSON",value:function(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}},{key:"_terminate",value:function(){return function(e){var t=lt.get(e);t&&(O("ComponentProvider","Removing Datastore"),lt.delete(e),t.terminate())}(this),Promise.resolve()}}]),e}();function dt(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Object(y.e)();return Object(y.b)(e,"firestore/lite").getImmediate()}var pt=function(){function e(t,n,r){Object(p.a)(this,e),this.converter=n,this._key=r,this.type="document",this.firestore=t}return Object(v.a)(e,[{key:"_path",get:function(){return this._key.path}},{key:"id",get:function(){return this._key.path.lastSegment()}},{key:"path",get:function(){return this._key.path.canonicalString()}},{key:"parent",get:function(){return new yt(this.firestore,this.converter,this._key.path.popLast())}},{key:"withConverter",value:function(t){return new e(this.firestore,t,this._key)}}]),e}(),vt=function(){function e(t,n,r){Object(p.a)(this,e),this.converter=n,this._query=r,this.type="query",this.firestore=t}return Object(v.a)(e,[{key:"withConverter",value:function(t){return new e(this.firestore,t,this._query)}}]),e}(),yt=function(e){Object(c.a)(n,e);var t=Object(f.a)(n);function n(e,r,i){var a;return Object(p.a)(this,n),(a=t.call(this,e,r,new ze(i)))._path=i,a.type="collection",a}return Object(v.a)(n,[{key:"id",get:function(){return this._query.path.lastSegment()}},{key:"path",get:function(){return this._query.path.canonicalString()}},{key:"parent",get:function(){var e=this._path.popLast();return e.isEmpty()?null:new pt(this.firestore,null,new re(e))}},{key:"withConverter",value:function(e){return new n(this.firestore,e,this._path)}}]),n}(vt);function gt(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i90)throw new K(D,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(n)||n<-180||n>180)throw new K(D,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=t,this._long=n}return Object(v.a)(e,[{key:"latitude",get:function(){return this._lat}},{key:"longitude",get:function(){return this._long}},{key:"isEqual",value:function(e){return this._lat===e._lat&&this._long===e._long}},{key:"toJSON",value:function(){return{latitude:this._lat,longitude:this._long}}},{key:"_compareTo",value:function(e){return ve(this._lat,e._lat)||ve(this._long,e._long)}}]),e}();var wt=new RegExp("[~\\*/\\[\\]]");function Et(e,t,n){if(t.search(wt)>=0)throw Ot("Invalid field path (".concat(t,"). Paths must not contain '~', '*', '/', '[', or ']'"),e,!1,void 0,n);try{return Object(a.a)(mt,Object(d.a)(t.split(".")))._internalPath}catch(r){throw Ot("Invalid field path (".concat(t,"). Paths must not be empty, begin with '.', end with '.', or contain '..'"),e,!1,void 0,n)}}function Ot(e,t,n,r,i){var a=r&&!r.isEmpty(),o=void 0!==i,u="Function ".concat(t,"() called with invalid data");n&&(u+=" (via `toFirestore()`)"),u+=". ";var s="";return(a||o)&&(s+=" (found",a&&(s+=" in field ".concat(r)),o&&(s+=" in document ".concat(i)),s+=")"),new K(D,u+e+s)}var St=function(){function e(t,n,r,i,a){Object(p.a)(this,e),this._firestore=t,this._userDataWriter=n,this._key=r,this._document=i,this._converter=a}return Object(v.a)(e,[{key:"id",get:function(){return this._key.path.lastSegment()}},{key:"ref",get:function(){return new pt(this._firestore,this._converter,this._key)}},{key:"exists",value:function(){return null!==this._document}},{key:"data",value:function(){if(this._document){if(this._converter){var e=new Tt(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}},{key:"get",value:function(e){if(this._document){var t=this._document.data.field(jt("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}}]),e}(),Tt=function(e){Object(c.a)(n,e);var t=Object(f.a)(n);function n(){return Object(p.a)(this,n),t.apply(this,arguments)}return Object(v.a)(n,[{key:"data",value:function(){return Object(r.a)(Object(i.a)(n.prototype),"data",this).call(this)}}]),n}(St),_t=function(){function e(t,n){Object(p.a)(this,e),this._docs=n,this.query=t}return Object(v.a)(e,[{key:"docs",get:function(){return Object(d.a)(this._docs)}},{key:"size",get:function(){return this.docs.length}},{key:"empty",get:function(){return 0===this.docs.length}},{key:"forEach",value:function(e,t){this._docs.forEach(e,t)}}]),e}();function jt(e,t){return"string"==typeof t?Et(e,t):t instanceof mt?t._internalPath:t._delegate._internalPath}var It=function(e){Object(c.a)(n,e);var t=Object(f.a)(n);function n(e){var r;return Object(p.a)(this,n),(r=t.call(this)).firestore=e,r}return Object(v.a)(n,[{key:"convertBytes",value:function(e){return new bt(e)}},{key:"convertReference",value:function(e){var t=this.convertDocumentKey(e,this.firestore._databaseId);return new pt(this.firestore,null,t)}}]),n}(function(){function e(){Object(p.a)(this,e)}return Object(v.a)(e,[{key:"convertValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none";switch(xe(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Se(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(Te(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 10:return this.convertObject(e.mapValue,t);default:throw j()}}},{key:"convertObject",value:function(e,t){var n=this,r={};return ke(e.fields,(function(e,i){r[e]=n.convertValue(i,t)})),r}},{key:"convertGeoPoint",value:function(e){return new kt(Se(e.latitude),Se(e.longitude))}},{key:"convertArray",value:function(e,t){var n=this;return(e.values||[]).map((function(e){return n.convertValue(e,t)}))}},{key:"convertServerTimestamp",value:function(e,t){switch(t){case"previous":var n=je(e);return null==n?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(Ie(e));default:return null}}},{key:"convertTimestamp",value:function(e){var t=Oe(e);return new ge(t.seconds,t.nanos)}},{key:"convertDocumentKey",value:function(e,t){var n=ee.fromString(e);I(at(n));var r=new J(n.get(1),n.get(3)),i=new re(n.popFirst(5));return r.isEqual(t)||S("Document ".concat(i," contains a document reference within a different database (").concat(r.projectId,"/").concat(r.database,") which is not supported. It will be treated as a reference in the current database (").concat(t.projectId,"/").concat(t.database,") instead.")),i}}]),e}());function xt(e){!function(e){if(Be(e)&&0===e.explicitOrderBy.length)throw new K(B,"limitToLast() queries require specifying at least one orderBy() clause")}((e=ue(e,vt))._query);var t=ct(e.firestore),n=new It(e.firestore);return function(e,t){return st.apply(this,arguments)}(t,e._query).then((function(t){var r=t.map((function(t){return new Tt(e.firestore,n,t.key,t,e.converter)}));return Be(e._query)&&r.reverse(),new _t(e,r)}))}var Ct;Ct="".concat(y.a,"_lite"),w=Ct,Object(y.c)(new g.a("firestore/lite",(function(e,t){var n=t.options,r=e.getProvider("app").getImmediate(),i=new ht(r,new Q(e.getProvider("auth-internal")));return n&&i._setSettings(n),i}),"PUBLIC")),Object(y.g)("firestore-lite","3.1.0","node")},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(13);function i(e,t,n){return i="undefined"!==typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Object(r.a)(e)););return e}(e,t);if(i){var a=Object.getOwnPropertyDescriptor(i,t);return a.get?a.get.call(n):a.value}},i(e,t,n||e)}},function(e,t,n){"use strict";n.d(t,"a",(function(){return l})),n.d(t,"b",(function(){return h}));function r(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{s(r.next(e))}catch(t){a(t)}}function u(e){try{s(r.throw(e))}catch(t){a(t)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,u)}s((r=r.apply(e,t||[])).next())}))}function i(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"===typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===a[0]||2===a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]=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 o(e,t){var n="function"===typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,a=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)o.push(r.value)}catch(u){i={error:u}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return o}function u(e,t,n){if(n||2===arguments.length)for(var r,i=0,a=t.length;ie.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:"Unexpected state",t="FIRESTORE (".concat(O,") INTERNAL ASSERTION FAILED: ")+e;throw j(t),new Error(t)}function N(e,t){e||C()}function A(e,t){return e}var D={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"},L=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(e,r){var i;return Object(v.a)(this,n),(i=t.call(this,r)).code=e,i.message=r,i.name="FirebaseError",i.toString=function(){return"".concat(i.name,": [code=").concat(i.code,"]: ").concat(i.message)},i}return n}(Object(d.a)(Error)),P=function e(){var t=this;Object(v.a)(this,e),this.promise=new Promise((function(e,n){t.resolve=e,t.reject=n}))},R=function e(t,n){Object(v.a)(this,e),this.user=n,this.type="OAuth",this.authHeaders={},this.authHeaders.Authorization="Bearer ".concat(t)},F=function(){function e(){Object(v.a)(this,e)}return Object(y.a)(e,[{key:"getToken",value:function(){return Promise.resolve(null)}},{key:"invalidateToken",value:function(){}},{key:"start",value:function(e,t){e.enqueueRetryable((function(){return t(E.UNAUTHENTICATED)}))}},{key:"shutdown",value:function(){}}]),e}(),M=function(){function e(t){Object(v.a)(this,e),this.t=t,this.currentUser=E.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}return Object(y.a)(e,[{key:"start",value:function(e,t){var n=this,r=this.i,i=function(e){return n.i!==r?(r=n.i,t(e)):Promise.resolve()},a=new P;this.o=function(){n.i++,n.currentUser=n.u(),a.resolve(),a=new P,e.enqueueRetryable((function(){return i(n.currentUser)}))};var o=function(){var t=a;e.enqueueRetryable(Object(c.a)(l.a.mark((function e(){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.promise;case 2:return e.next=4,i(n.currentUser);case 4:case"end":return e.stop()}}),e)}))))},u=function(e){_("FirebaseCredentialsProvider","Auth detected"),n.auth=e,n.auth.addAuthTokenListener(n.o),o()};this.t.onInit((function(e){return u(e)})),setTimeout((function(){if(!n.auth){var e=n.t.getImmediate({optional:!0});e?u(e):(_("FirebaseCredentialsProvider","Auth not yet detected"),a.resolve(),a=new P)}}),0),o()}},{key:"getToken",value:function(){var e=this,t=this.i,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then((function(n){return e.i!==t?(_("FirebaseCredentialsProvider","getToken aborted due to token change."),e.getToken()):n?(N("string"==typeof n.accessToken),new R(n.accessToken,e.currentUser)):null})):Promise.resolve(null)}},{key:"invalidateToken",value:function(){this.forceRefresh=!0}},{key:"shutdown",value:function(){this.auth&&this.auth.removeAuthTokenListener(this.o)}},{key:"u",value:function(){var e=this.auth&&this.auth.getUid();return N(null===e||"string"==typeof e),new E(e)}}]),e}(),V=function(){function e(t,n,r){Object(v.a)(this,e),this.h=t,this.l=n,this.m=r,this.type="FirstParty",this.user=E.FIRST_PARTY}return Object(y.a)(e,[{key:"authHeaders",get:function(){var e={"X-Goog-AuthUser":this.l},t=this.h.auth.getAuthHeaderValueForFirstParty([]);return t&&(e.Authorization=t),this.m&&(e["X-Goog-Iam-Authorization-Token"]=this.m),e}}]),e}(),U=function(){function e(t,n,r){Object(v.a)(this,e),this.h=t,this.l=n,this.m=r}return Object(y.a)(e,[{key:"getToken",value:function(){return Promise.resolve(new V(this.h,this.l,this.m))}},{key:"start",value:function(e,t){e.enqueueRetryable((function(){return t(E.FIRST_PARTY)}))}},{key:"shutdown",value:function(){}},{key:"invalidateToken",value:function(){}}]),e}(),z=function(){function e(t,n){var r=this;Object(v.a)(this,e),this.previousValue=t,n&&(n.sequenceNumberHandler=function(e){return r.g(e)},this.p=function(e){return n.writeSequenceNumber(e)})}return Object(y.a)(e,[{key:"g",value:function(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}},{key:"next",value:function(){var e=++this.previousValue;return this.p&&this.p(e),e}}]),e}();function B(e){var t="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(e);if(t&&"function"==typeof t.getRandomValues)t.getRandomValues(n);else for(var r=0;rt?1:0}function K(e,t,n){return e.length===t.length&&e.every((function(e,r){return n(e,t[r])}))}var G=function(){function e(t,n){if(Object(v.a)(this,e),this.seconds=t,this.nanoseconds=n,n<0)throw new L(D.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new L(D.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(t<-62135596800)throw new L(D.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new L(D.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}return Object(y.a)(e,[{key:"toDate",value:function(){return new Date(this.toMillis())}},{key:"toMillis",value:function(){return 1e3*this.seconds+this.nanoseconds/1e6}},{key:"_compareTo",value:function(e){return this.seconds===e.seconds?H(this.nanoseconds,e.nanoseconds):H(this.seconds,e.seconds)}},{key:"isEqual",value:function(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}},{key:"toString",value:function(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}},{key:"toJSON",value:function(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}},{key:"valueOf",value:function(){var e=this.seconds- -62135596800;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}],[{key:"now",value:function(){return e.fromMillis(Date.now())}},{key:"fromDate",value:function(t){return e.fromMillis(t.getTime())}},{key:"fromMillis",value:function(t){var n=Math.floor(t/1e3);return new e(n,Math.floor(1e6*(t-1e3*n)))}}]),e}(),W=function(){function e(t){Object(v.a)(this,e),this.timestamp=t}return Object(y.a)(e,[{key:"compareTo",value:function(e){return this.timestamp._compareTo(e.timestamp)}},{key:"isEqual",value:function(e){return this.timestamp.isEqual(e.timestamp)}},{key:"toMicroseconds",value:function(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}},{key:"toString",value:function(){return"SnapshotVersion("+this.timestamp.toString()+")"}},{key:"toTimestamp",value:function(){return this.timestamp}}],[{key:"fromTimestamp",value:function(t){return new e(t)}},{key:"min",value:function(){return new e(new G(0,0))}}]),e}();function Q(e){var t=0;for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function $(e,t){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function Y(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}var X=function(){function e(t,n,r){Object(v.a)(this,e),void 0===n?n=0:n>t.length&&C(),void 0===r?r=t.length-n:r>t.length-n&&C(),this.segments=t,this.offset=n,this.len=r}return Object(y.a)(e,[{key:"length",get:function(){return this.len}},{key:"isEqual",value:function(t){return 0===e.comparator(this,t)}},{key:"child",value:function(t){var n=this.segments.slice(this.offset,this.limit());return t instanceof e?t.forEach((function(e){n.push(e)})):n.push(t),this.construct(n)}},{key:"limit",value:function(){return this.offset+this.length}},{key:"popFirst",value:function(e){return e=void 0===e?1:e,this.construct(this.segments,this.offset+e,this.length-e)}},{key:"popLast",value:function(){return this.construct(this.segments,this.offset,this.length-1)}},{key:"firstSegment",value:function(){return this.segments[this.offset]}},{key:"lastSegment",value:function(){return this.get(this.length-1)}},{key:"get",value:function(e){return this.segments[this.offset+e]}},{key:"isEmpty",value:function(){return 0===this.length}},{key:"isPrefixOf",value:function(e){if(e.lengtha)return 1}return e.lengtht.length?1:0}}]),e}(),J=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(){return Object(v.a)(this,n),t.apply(this,arguments)}return Object(y.a)(n,[{key:"construct",value:function(e,t,r){return new n(e,t,r)}},{key:"canonicalString",value:function(){return this.toArray().join("/")}},{key:"toString",value:function(){return this.canonicalString()}}],[{key:"fromString",value:function(){for(var e=[],t=arguments.length,r=new Array(t),i=0;i=0)throw new L(D.INVALID_ARGUMENT,"Invalid segment (".concat(u,"). Paths must not contain // in them."));e.push.apply(e,Object(p.a)(u.split("/").filter((function(e){return e.length>0}))))}return new n(e)}},{key:"emptyPath",value:function(){return new n([])}}]),n}(X),Z=/^[_a-zA-Z][_a-zA-Z0-9]*$/,ee=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(){return Object(v.a)(this,n),t.apply(this,arguments)}return Object(y.a)(n,[{key:"construct",value:function(e,t,r){return new n(e,t,r)}},{key:"canonicalString",value:function(){return this.toArray().map((function(e){return e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),n.isValidIdentifier(e)||(e="`"+e+"`"),e})).join(".")}},{key:"toString",value:function(){return this.canonicalString()}},{key:"isKeyField",value:function(){return 1===this.length&&"__name__"===this.get(0)}}],[{key:"isValidIdentifier",value:function(e){return Z.test(e)}},{key:"keyField",value:function(){return new n(["__name__"])}},{key:"fromServerFormat",value:function(e){for(var t=[],r="",i=0,a=function(){if(0===r.length)throw new L(D.INVALID_ARGUMENT,"Invalid field path (".concat(e,"). Paths must not be empty, begin with '.', end with '.', or contain '..'"));t.push(r),r=""},o=!1;i=2&&this.path.get(this.path.length-2)===e}},{key:"isEqual",value:function(e){return null!==e&&0===J.comparator(this.path,e.path)}},{key:"toString",value:function(){return this.path.toString()}}],[{key:"fromPath",value:function(t){return new e(J.fromString(t))}},{key:"fromName",value:function(t){return new e(J.fromString(t).popFirst(5))}},{key:"comparator",value:function(e,t){return J.comparator(e.path,t.path)}},{key:"isDocumentKey",value:function(e){return e.length%2==0}},{key:"fromSegments",value:function(t){return new e(new J(t.slice()))}}]),e}();function he(e){return"nullValue"in e?0:"booleanValue"in e?1:"integerValue"in e||"doubleValue"in e?2:"timestampValue"in e?3:"stringValue"in e?5:"bytesValue"in e?6:"referenceValue"in e?7:"geoPointValue"in e?8:"arrayValue"in e?9:"mapValue"in e?oe(e)?4:10:C()}function de(e,t){var n=he(e);if(n!==he(t))return!1;switch(n){case 0:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return se(e).isEqual(se(t));case 3:return function(e,t){if("string"==typeof e.timestampValue&&"string"==typeof t.timestampValue&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;var n=re(e.timestampValue),r=re(t.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return function(e,t){return ae(e.bytesValue).isEqual(ae(t.bytesValue))}(e,t);case 7:return e.referenceValue===t.referenceValue;case 8:return function(e,t){return ie(e.geoPointValue.latitude)===ie(t.geoPointValue.latitude)&&ie(e.geoPointValue.longitude)===ie(t.geoPointValue.longitude)}(e,t);case 2:return function(e,t){if("integerValue"in e&&"integerValue"in t)return ie(e.integerValue)===ie(t.integerValue);if("doubleValue"in e&&"doubleValue"in t){var n=ie(e.doubleValue),r=ie(t.doubleValue);return n===r?ce(n)===ce(r):isNaN(n)&&isNaN(r)}return!1}(e,t);case 9:return K(e.arrayValue.values||[],t.arrayValue.values||[],de);case 10:return function(e,t){var n=e.mapValue.fields||{},r=t.mapValue.fields||{};if(Q(n)!==Q(r))return!1;for(var i in n)if(n.hasOwnProperty(i)&&(void 0===r[i]||!de(n[i],r[i])))return!1;return!0}(e,t);default:return C()}}function pe(e,t){return void 0!==(e.values||[]).find((function(e){return de(e,t)}))}function ve(e,t){var n=he(e),r=he(t);if(n!==r)return H(n,r);switch(n){case 0:return 0;case 1:return H(e.booleanValue,t.booleanValue);case 2:return function(e,t){var n=ie(e.integerValue||e.doubleValue),r=ie(t.integerValue||t.doubleValue);return nr?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(e,t);case 3:return ye(e.timestampValue,t.timestampValue);case 4:return ye(se(e),se(t));case 5:return H(e.stringValue,t.stringValue);case 6:return function(e,t){var n=ae(e),r=ae(t);return n.compareTo(r)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){for(var n=e.split("/"),r=t.split("/"),i=0;i1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null;Object(v.a)(this,e),this.path=t,this.collectionGroup=n,this.orderBy=r,this.filters=i,this.limit=a,this.startAt=o,this.endAt=u,this.A=null};function Ie(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null;return new je(e,t,n,r,i,a,o)}function xe(e){var t=A(e);if(null===t.A){var n=t.path.canonicalString();null!==t.collectionGroup&&(n+="|cg:"+t.collectionGroup),n+="|f:",n+=t.filters.map((function(e){return function(e){return e.field.canonicalString()+e.op.toString()+ge(e.value)}(e)})).join(","),n+="|ob:",n+=t.orderBy.map((function(e){return function(e){return e.field.canonicalString()+e.dir}(e)})).join(","),le(t.limit)||(n+="|l:",n+=t.limit),t.startAt&&(n+="|lb:",n+=Be(t.startAt)),t.endAt&&(n+="|ub:",n+=Be(t.endAt)),t.A=n}return t.A}function Ce(e,t){if(e.limit!==t.limit)return!1;if(e.orderBy.length!==t.orderBy.length)return!1;for(var n=0;n":return e>0;case">=":return e>=0;default:return C()}}},{key:"v",value:function(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}}],[{key:"create",value:function(e,t,r){return e.isKeyField()?"in"===t||"not-in"===t?this.R(e,t,r):new De(e,t,r):"array-contains"===t?new Fe(e,r):"in"===t?new Me(e,r):"not-in"===t?new Ve(e,r):"array-contains-any"===t?new Ue(e,r):new n(e,t,r)}},{key:"R",value:function(e,t,n){return"in"===t?new Le(e,n):new Pe(e,n)}}]),n}(function(){return function e(){Object(v.a)(this,e)}}());var De=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(e,r,i){var a;return Object(v.a)(this,n),(a=t.call(this,e,r,i)).key=fe.fromName(i.referenceValue),a}return Object(y.a)(n,[{key:"matches",value:function(e){var t=fe.comparator(e.key,this.key);return this.P(t)}}]),n}(Ae),Le=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(e,r){var i;return Object(v.a)(this,n),(i=t.call(this,e,"in",r)).keys=Re("in",r),i}return Object(y.a)(n,[{key:"matches",value:function(e){return this.keys.some((function(t){return t.isEqual(e.key)}))}}]),n}(Ae),Pe=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(e,r){var i;return Object(v.a)(this,n),(i=t.call(this,e,"not-in",r)).keys=Re("not-in",r),i}return Object(y.a)(n,[{key:"matches",value:function(e){return!this.keys.some((function(t){return t.isEqual(e.key)}))}}]),n}(Ae);function Re(e,t){var n;return((null===(n=t.arrayValue)||void 0===n?void 0:n.values)||[]).map((function(e){return fe.fromName(e.referenceValue)}))}var Fe=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(e,r){return Object(v.a)(this,n),t.call(this,e,"array-contains",r)}return Object(y.a)(n,[{key:"matches",value:function(e){var t=e.data.field(this.field);return ke(t)&&pe(t.arrayValue,this.value)}}]),n}(Ae),Me=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(e,r){return Object(v.a)(this,n),t.call(this,e,"in",r)}return Object(y.a)(n,[{key:"matches",value:function(e){var t=e.data.field(this.field);return null!==t&&pe(this.value.arrayValue,t)}}]),n}(Ae),Ve=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(e,r){return Object(v.a)(this,n),t.call(this,e,"not-in",r)}return Object(y.a)(n,[{key:"matches",value:function(e){if(pe(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;var t=e.data.field(this.field);return null!==t&&!pe(this.value.arrayValue,t)}}]),n}(Ae),Ue=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(e,r){return Object(v.a)(this,n),t.call(this,e,"array-contains-any",r)}return Object(y.a)(n,[{key:"matches",value:function(e){var t=this,n=e.data.field(this.field);return!(!ke(n)||!n.arrayValue.values)&&n.arrayValue.values.some((function(e){return pe(t.value.arrayValue,e)}))}}]),n}(Ae),ze=function e(t,n){Object(v.a)(this,e),this.position=t,this.before=n};function Be(e){return"".concat(e.before?"b":"a",":").concat(e.position.map((function(e){return ge(e)})).join(","))}var qe=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"asc";Object(v.a)(this,e),this.field=t,this.dir=n};function He(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}function Ke(e,t,n){for(var r=0,i=0;i1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"F",u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;Object(v.a)(this,e),this.path=t,this.collectionGroup=n,this.explicitOrderBy=r,this.filters=i,this.limit=a,this.limitType=o,this.startAt=u,this.endAt=s,this.V=null,this.S=null,this.startAt,this.endAt};function Qe(e,t,n,r,i,a,o,u){return new We(e,t,n,r,i,a,o,u)}function $e(e){return new We(e)}function Ye(e){return!le(e.limit)&&"F"===e.limitType}function Xe(e){return!le(e.limit)&&"L"===e.limitType}function Je(e){return e.explicitOrderBy.length>0?e.explicitOrderBy[0].field:null}function Ze(e){var t,n=Object(u.a)(e.filters);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.v())return r.field}}catch(i){n.e(i)}finally{n.f()}return null}function et(e){return null!==e.collectionGroup}function tt(e){var t=A(e);if(null===t.V){t.V=[];var n=Ze(t),r=Je(t);if(null!==n&&null===r)n.isKeyField()||t.V.push(new qe(n)),t.V.push(new qe(ee.keyField(),"asc"));else{var i,a=!1,o=Object(u.a)(t.explicitOrderBy);try{for(o.s();!(i=o.n()).done;){var s=i.value;t.V.push(s),s.field.isKeyField()&&(a=!0)}}catch(c){o.e(c)}finally{o.f()}if(!a){var l=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:"asc";t.V.push(new qe(ee.keyField(),l))}}}return t.V}function nt(e){var t=A(e);if(!t.S)if("F"===t.limitType)t.S=Ie(t.path,t.collectionGroup,tt(t),t.filters,t.limit,t.startAt,t.endAt);else{var n,r=[],i=Object(u.a)(tt(t));try{for(i.s();!(n=i.n()).done;){var a=n.value,o="desc"===a.dir?"asc":"desc";r.push(new qe(a.field,o))}}catch(c){i.e(c)}finally{i.f()}var s=t.endAt?new ze(t.endAt.position,!t.endAt.before):null,l=t.startAt?new ze(t.startAt.position,!t.startAt.before):null;t.S=Ie(t.path,t.collectionGroup,r,t.filters,t.limit,s,l)}return t.S}function rt(e,t,n){return new We(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function it(e,t){return Ce(nt(e),nt(t))&&e.limitType===t.limitType}function at(e){return"".concat(xe(nt(e)),"|lt:").concat(e.limitType)}function ot(e){return"Query(target=".concat(function(e){var t=e.path.canonicalString();return null!==e.collectionGroup&&(t+=" collectionGroup="+e.collectionGroup),e.filters.length>0&&(t+=", filters: [".concat(e.filters.map((function(e){return"".concat((t=e).field.canonicalString()," ").concat(t.op," ").concat(ge(t.value));var t})).join(", "),"]")),le(e.limit)||(t+=", limit: "+e.limit),e.orderBy.length>0&&(t+=", orderBy: [".concat(e.orderBy.map((function(e){return function(e){return"".concat(e.field.canonicalString()," (").concat(e.dir,")")}(e)})).join(", "),"]")),e.startAt&&(t+=", startAt: "+Be(e.startAt)),e.endAt&&(t+=", endAt: "+Be(e.endAt)),"Target(".concat(t,")")}(nt(e)),"; limitType=").concat(e.limitType,")")}function ut(e,t){return t.isFoundDocument()&&function(e,t){var n=t.key.path;return null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n):fe.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n)}(e,t)&&function(e,t){var n,r=Object(u.a)(e.explicitOrderBy);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(!i.field.isKeyField()&&null===t.data.field(i.field))return!1}}catch(a){r.e(a)}finally{r.f()}return!0}(e,t)&&function(e,t){var n,r=Object(u.a)(e.filters);try{for(r.s();!(n=r.n()).done;){if(!n.value.matches(t))return!1}}catch(i){r.e(i)}finally{r.f()}return!0}(e,t)&&function(e,t){return!(e.startAt&&!Ke(e.startAt,tt(e),t))&&(!e.endAt||!Ke(e.endAt,tt(e),t))}(e,t)}function st(e){return function(t,n){var r,i=!1,a=Object(u.a)(tt(e));try{for(a.s();!(r=a.n()).done;){var o=r.value,s=lt(o,t,n);if(0!==s)return s;i=i||o.field.isKeyField()}}catch(l){a.e(l)}finally{a.f()}return 0}}function lt(e,t,n){var r=e.field.isKeyField()?fe.comparator(t.key,n.key):function(e,t,n){var r=t.data.field(e),i=n.data.field(e);return null!==r&&null!==i?ve(r,i):C()}(e.field,t,n);switch(e.dir){case"asc":return r;case"desc":return-1*r;default:return C()}}function ct(e,t){if(e.D){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:ce(t)?"-0":t}}function ft(e){return{integerValue:""+e}}var ht=function e(){Object(v.a)(this,e),this._=void 0};function dt(e,t,n){return e instanceof yt?function(e,t){var n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&(n.fields.__previous_value__=t),{mapValue:n}}(n,t):e instanceof gt?mt(e,t):e instanceof bt?kt(e,t):function(e,t){var n=vt(e,t),r=Et(n)+Et(e.C);return be(n)&&be(e.C)?ft(r):ct(e.N,r)}(e,t)}function pt(e,t,n){return e instanceof gt?mt(e,t):e instanceof bt?kt(e,t):n}function vt(e,t){return e instanceof wt?be(n=t)||function(e){return!!e&&"doubleValue"in e}(n)?t:{integerValue:0}:null;var n}var yt=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(){return Object(v.a)(this,n),t.apply(this,arguments)}return n}(ht),gt=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(e){var r;return Object(v.a)(this,n),(r=t.call(this)).elements=e,r}return n}(ht);function mt(e,t){var n,r=Ot(t),i=Object(u.a)(e.elements);try{var a=function(){var e=n.value;r.some((function(t){return de(t,e)}))||r.push(e)};for(i.s();!(n=i.n()).done;)a()}catch(o){i.e(o)}finally{i.f()}return{arrayValue:{values:r}}}var bt=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(e){var r;return Object(v.a)(this,n),(r=t.call(this)).elements=e,r}return n}(ht);function kt(e,t){var n,r=Ot(t),i=Object(u.a)(e.elements);try{var a=function(){var e=n.value;r=r.filter((function(t){return!de(t,e)}))};for(i.s();!(n=i.n()).done;)a()}catch(o){i.e(o)}finally{i.f()}return{arrayValue:{values:r}}}var wt=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(e,r){var i;return Object(v.a)(this,n),(i=t.call(this)).N=e,i.C=r,i}return n}(ht);function Et(e){return ie(e.integerValue||e.doubleValue)}function Ot(e){return ke(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}function St(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}var Tt=function e(){Object(v.a)(this,e)};function _t(e,t,n){e instanceof Ct?function(e,t,n){var r=e.value.clone(),i=Dt(e.fieldTransforms,t,n.transformResults);r.setAll(i),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(e,t,n):e instanceof Nt?function(e,t,n){if(St(e.precondition,t)){var r=Dt(e.fieldTransforms,t,n.transformResults),i=t.data;i.setAll(At(e)),i.setAll(r),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()}else t.convertToUnknownDocument(n.version)}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function jt(e,t,n){e instanceof Ct?function(e,t,n){if(St(e.precondition,t)){var r=e.value.clone(),i=Lt(e.fieldTransforms,n,t);r.setAll(i),t.convertToFoundDocument(xt(t),r).setHasLocalMutations()}}(e,t,n):e instanceof Nt?function(e,t,n){if(St(e.precondition,t)){var r=Lt(e.fieldTransforms,n,t),i=t.data;i.setAll(At(e)),i.setAll(r),t.convertToFoundDocument(xt(t),i).setHasLocalMutations()}}(e,t,n):function(e,t){St(e.precondition,t)&&t.convertToNoDocument(W.min())}(e,t)}function It(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!function(e,t){return void 0===e&&void 0===t||!(!e||!t)&&K(e,t,(function(e,t){return function(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof gt&&t instanceof gt||e instanceof bt&&t instanceof bt?K(e.elements,t.elements,de):e instanceof wt&&t instanceof wt?de(e.C,t.C):e instanceof yt&&t instanceof yt}(e.transform,t.transform)}(e,t)}))}(e.fieldTransforms,t.fieldTransforms)&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}function xt(e){return e.isFoundDocument()?e.version:W.min()}var Ct=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(e,r,i){var a,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return Object(v.a)(this,n),(a=t.call(this)).key=e,a.value=r,a.precondition=i,a.fieldTransforms=o,a.type=0,a}return n}(Tt),Nt=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(e,r,i,a){var o,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];return Object(v.a)(this,n),(o=t.call(this)).key=e,o.data=r,o.fieldMask=i,o.precondition=a,o.fieldTransforms=u,o.type=1,o}return n}(Tt);function At(e){var t=new Map;return e.fieldMask.fields.forEach((function(n){if(!n.isEmpty()){var r=e.data.field(n);t.set(n,r)}})),t}function Dt(e,t,n){var r=new Map;N(e.length===n.length);for(var i=0;i0&&(t=t.right)}return null}},{key:"indexOf",value:function(e){for(var t=0,n=this.root;!n.isEmpty();){var r=this.comparator(e,n.key);if(0===r)return t+n.left.size;r<0?n=n.left:(t+=n.left.size+1,n=n.right)}return-1}},{key:"isEmpty",value:function(){return this.root.isEmpty()}},{key:"size",get:function(){return this.root.size}},{key:"minKey",value:function(){return this.root.minKey()}},{key:"maxKey",value:function(){return this.root.maxKey()}},{key:"inorderTraversal",value:function(e){return this.root.inorderTraversal(e)}},{key:"forEach",value:function(e){this.inorderTraversal((function(t,n){return e(t,n),!1}))}},{key:"toString",value:function(){var e=[];return this.inorderTraversal((function(t,n){return e.push("".concat(t,":").concat(n)),!1})),"{".concat(e.join(", "),"}")}},{key:"reverseTraversal",value:function(e){return this.root.reverseTraversal(e)}},{key:"getIterator",value:function(){return new Ut(this.root,null,this.comparator,!1)}},{key:"getIteratorFrom",value:function(e){return new Ut(this.root,e,this.comparator,!1)}},{key:"getReverseIterator",value:function(){return new Ut(this.root,null,this.comparator,!0)}},{key:"getReverseIteratorFrom",value:function(e){return new Ut(this.root,e,this.comparator,!0)}}]),e}(),Ut=function(){function e(t,n,r,i){Object(v.a)(this,e),this.isReverse=i,this.nodeStack=[];for(var a=1;!t.isEmpty();)if(a=n?r(t.key,n):1,i&&(a*=-1),a<0)t=this.isReverse?t.left:t.right;else{if(0===a){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}return Object(y.a)(e,[{key:"getNext",value:function(){var e=this.nodeStack.pop(),t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}},{key:"hasNext",value:function(){return this.nodeStack.length>0}},{key:"peek",value:function(){if(0===this.nodeStack.length)return null;var e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}]),e}(),zt=function(){function e(t,n,r,i,a){Object(v.a)(this,e),this.key=t,this.value=n,this.color=null!=r?r:e.RED,this.left=null!=i?i:e.EMPTY,this.right=null!=a?a:e.EMPTY,this.size=this.left.size+1+this.right.size}return Object(y.a)(e,[{key:"copy",value:function(t,n,r,i,a){return new e(null!=t?t:this.key,null!=n?n:this.value,null!=r?r:this.color,null!=i?i:this.left,null!=a?a:this.right)}},{key:"isEmpty",value:function(){return!1}},{key:"inorderTraversal",value:function(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}},{key:"reverseTraversal",value:function(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}},{key:"min",value:function(){return this.left.isEmpty()?this:this.left.min()}},{key:"minKey",value:function(){return this.min().key}},{key:"maxKey",value:function(){return this.right.isEmpty()?this.key:this.right.maxKey()}},{key:"insert",value:function(e,t,n){var r=this,i=n(e,r.key);return(r=i<0?r.copy(null,null,null,r.left.insert(e,t,n),null):0===i?r.copy(null,t,null,null,null):r.copy(null,null,null,null,r.right.insert(e,t,n))).fixUp()}},{key:"removeMin",value:function(){if(this.left.isEmpty())return e.EMPTY;var t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),(t=t.copy(null,null,null,t.left.removeMin(),null)).fixUp()}},{key:"remove",value:function(t,n){var r,i=this;if(n(t,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(t,n),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),0===n(t,i.key)){if(i.right.isEmpty())return e.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(t,n))}return i.fixUp()}},{key:"isRed",value:function(){return this.color}},{key:"fixUp",value:function(){var e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}},{key:"moveRedLeft",value:function(){var e=this.colorFlip();return e.right.left.isRed()&&(e=(e=(e=e.copy(null,null,null,null,e.right.rotateRight())).rotateLeft()).colorFlip()),e}},{key:"moveRedRight",value:function(){var e=this.colorFlip();return e.left.left.isRed()&&(e=(e=e.rotateRight()).colorFlip()),e}},{key:"rotateLeft",value:function(){var t=this.copy(null,null,e.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}},{key:"rotateRight",value:function(){var t=this.copy(null,null,e.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}},{key:"colorFlip",value:function(){var e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}},{key:"checkMaxDepth",value:function(){var e=this.check();return Math.pow(2,e)<=this.size+1}},{key:"check",value:function(){if(this.isRed()&&this.left.isRed())throw C();if(this.right.isRed())throw C();var e=this.left.check();if(e!==this.right.check())throw C();return e+(this.isRed()?0:1)}}]),e}();zt.EMPTY=null,zt.RED=!0,zt.BLACK=!1,zt.EMPTY=new(function(){function e(){Object(v.a)(this,e),this.size=0}return Object(y.a)(e,[{key:"key",get:function(){throw C()}},{key:"value",get:function(){throw C()}},{key:"color",get:function(){throw C()}},{key:"left",get:function(){throw C()}},{key:"right",get:function(){throw C()}},{key:"copy",value:function(e,t,n,r,i){return this}},{key:"insert",value:function(e,t,n){return new zt(e,t)}},{key:"remove",value:function(e,t){return this}},{key:"isEmpty",value:function(){return!0}},{key:"inorderTraversal",value:function(e){return!1}},{key:"reverseTraversal",value:function(e){return!1}},{key:"minKey",value:function(){return null}},{key:"maxKey",value:function(){return null}},{key:"isRed",value:function(){return!1}},{key:"checkMaxDepth",value:function(){return!0}},{key:"check",value:function(){return 0}}]),e}());var Bt=function(){function e(t){Object(v.a)(this,e),this.comparator=t,this.data=new Vt(this.comparator)}return Object(y.a)(e,[{key:"has",value:function(e){return null!==this.data.get(e)}},{key:"first",value:function(){return this.data.minKey()}},{key:"last",value:function(){return this.data.maxKey()}},{key:"size",get:function(){return this.data.size}},{key:"indexOf",value:function(e){return this.data.indexOf(e)}},{key:"forEach",value:function(e){this.data.inorderTraversal((function(t,n){return e(t),!1}))}},{key:"forEachInRange",value:function(e,t){for(var n=this.data.getIteratorFrom(e[0]);n.hasNext();){var r=n.getNext();if(this.comparator(r.key,e[1])>=0)return;t(r.key)}}},{key:"forEachWhile",value:function(e,t){var n;for(n=void 0!==t?this.data.getIteratorFrom(t):this.data.getIterator();n.hasNext();)if(!e(n.getNext().key))return}},{key:"firstAfterOrEqual",value:function(e){var t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}},{key:"getIterator",value:function(){return new qt(this.data.getIterator())}},{key:"getIteratorFrom",value:function(e){return new qt(this.data.getIteratorFrom(e))}},{key:"add",value:function(e){return this.copy(this.data.remove(e).insert(e,!0))}},{key:"delete",value:function(e){return this.has(e)?this.copy(this.data.remove(e)):this}},{key:"isEmpty",value:function(){return this.data.isEmpty()}},{key:"unionWith",value:function(e){var t=this;return t.size2&&void 0!==arguments[2]?arguments[2]:te.EMPTY_BYTE_STRING,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;Object(v.a)(this,e),this.state=t,this.targetIds=n,this.resumeToken=r,this.cause=i},rn=function(){function e(){Object(v.a)(this,e),this.F=0,this.M=un(),this.L=te.EMPTY_BYTE_STRING,this.B=!1,this.U=!0}return Object(y.a)(e,[{key:"current",get:function(){return this.B}},{key:"resumeToken",get:function(){return this.L}},{key:"q",get:function(){return 0!==this.F}},{key:"K",get:function(){return this.U}},{key:"j",value:function(e){e.approximateByteSize()>0&&(this.U=!0,this.L=e)}},{key:"W",value:function(){var e=$t(),t=$t(),n=$t();return this.M.forEach((function(r,i){switch(i){case 0:e=e.add(r);break;case 2:t=t.add(r);break;case 1:n=n.add(r);break;default:C()}})),new Zt(this.L,this.B,e,t,n)}},{key:"G",value:function(){this.U=!1,this.M=un()}},{key:"H",value:function(e,t){this.U=!0,this.M=this.M.insert(e,t)}},{key:"J",value:function(e){this.U=!0,this.M=this.M.remove(e)}},{key:"Y",value:function(){this.F+=1}},{key:"X",value:function(){this.F-=1}},{key:"Z",value:function(){this.U=!0,this.B=!0}}]),e}(),an=function(){function e(t){Object(v.a)(this,e),this.tt=t,this.et=new Map,this.nt=Kt(),this.st=on(),this.it=new Bt(H)}return Object(y.a)(e,[{key:"rt",value:function(e){var t,n=Object(u.a)(e.k);try{for(n.s();!(t=n.n()).done;){var r=t.value;e.$&&e.$.isFoundDocument()?this.ot(r,e.$):this.at(r,e.key,e.$)}}catch(s){n.e(s)}finally{n.f()}var i,a=Object(u.a)(e.removedTargetIds);try{for(a.s();!(i=a.n()).done;){var o=i.value;this.at(o,e.key,e.$)}}catch(s){a.e(s)}finally{a.f()}}},{key:"ct",value:function(e){var t=this;this.forEachTarget(e,(function(n){var r=t.ut(n);switch(e.state){case 0:t.ht(n)&&r.j(e.resumeToken);break;case 1:r.X(),r.q||r.G(),r.j(e.resumeToken);break;case 2:r.X(),r.q||t.removeTarget(n);break;case 3:t.ht(n)&&(r.Z(),r.j(e.resumeToken));break;case 4:t.ht(n)&&(t.lt(n),r.j(e.resumeToken));break;default:C()}}))}},{key:"forEachTarget",value:function(e,t){var n=this;e.targetIds.length>0?e.targetIds.forEach(t):this.et.forEach((function(e,r){n.ht(r)&&t(r)}))}},{key:"ft",value:function(e){var t=e.targetId,n=e.O.count,r=this.dt(t);if(r){var i=r.target;if(Ne(i))if(0===n){var a=new fe(i.path);this.at(t,a,_e.newNoDocument(a,W.min()))}else N(1===n);else this.wt(t)!==n&&(this.lt(t),this.it=this.it.add(t))}}},{key:"_t",value:function(e){var t=this,n=new Map;this.et.forEach((function(r,i){var a=t.dt(i);if(a){if(r.current&&Ne(a.target)){var o=new fe(a.target.path);null!==t.nt.get(o)||t.gt(i,o)||t.at(i,o,_e.newNoDocument(o,e))}r.K&&(n.set(i,r.W()),r.G())}}));var r=$t();this.st.forEach((function(e,n){var i=!0;n.forEachWhile((function(e){var n=t.dt(e);return!n||2===n.purpose||(i=!1,!1)})),i&&(r=r.add(e))}));var i=new Jt(e,n,this.it,this.nt,r);return this.nt=Kt(),this.st=on(),this.it=new Bt(H),i}},{key:"ot",value:function(e,t){if(this.ht(e)){var n=this.gt(e,t.key)?2:0;this.ut(e).H(t.key,n),this.nt=this.nt.insert(t.key,t),this.st=this.st.insert(t.key,this.yt(t.key).add(e))}}},{key:"at",value:function(e,t,n){if(this.ht(e)){var r=this.ut(e);this.gt(e,t)?r.H(t,1):r.J(t),this.st=this.st.insert(t,this.yt(t).delete(e)),n&&(this.nt=this.nt.insert(t,n))}}},{key:"removeTarget",value:function(e){this.et.delete(e)}},{key:"wt",value:function(e){var t=this.ut(e).W();return this.tt.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}},{key:"Y",value:function(e){this.ut(e).Y()}},{key:"ut",value:function(e){var t=this.et.get(e);return t||(t=new rn,this.et.set(e,t)),t}},{key:"yt",value:function(e){var t=this.st.get(e);return t||(t=new Bt(H),this.st=this.st.insert(e,t)),t}},{key:"ht",value:function(e){var t=null!==this.dt(e);return t||_("WatchChangeAggregator","Detected inactive target",e),t}},{key:"dt",value:function(e){var t=this.et.get(e);return t&&t.q?null:this.tt.Et(e)}},{key:"lt",value:function(e){var t=this;this.et.set(e,new rn),this.tt.getRemoteKeysForTarget(e).forEach((function(n){t.at(e,n,null)}))}},{key:"gt",value:function(e,t){return this.tt.getRemoteKeysForTarget(e).has(t)}}]),e}();function on(){return new Vt(fe.comparator)}function un(){return new Vt(fe.comparator)}var sn={asc:"ASCENDING",desc:"DESCENDING"},ln={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},cn=function e(t,n){Object(v.a)(this,e),this.databaseId=t,this.D=n};function fn(e,t){return e.D?"".concat(new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z",""),".").concat(("000000000"+t.nanoseconds).slice(-9),"Z"):{seconds:""+t.seconds,nanos:t.nanoseconds}}function hn(e,t){return e.D?t.toBase64():t.toUint8Array()}function dn(e){return N(!!e),W.fromTimestamp(function(e){var t=re(e);return new G(t.seconds,t.nanos)}(e))}function pn(e,t){return function(e){return new J(["projects",e.projectId,"databases",e.database])}(e).child("documents").child(t).canonicalString()}function vn(e){var t=J.fromString(e);return N(Dn(t)),t}function yn(e,t){var n=vn(t);if(n.get(1)!==e.databaseId.projectId)throw new L(D.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+e.databaseId.projectId);if(n.get(3)!==e.databaseId.database)throw new L(D.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+e.databaseId.database);return new fe(kn(n))}function gn(e,t){return pn(e.databaseId,t)}function mn(e){var t=vn(e);return 4===t.length?J.emptyPath():kn(t)}function bn(e){return new J(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function kn(e){return N(e.length>4&&"documents"===e.get(4)),e.popFirst(5)}function wn(e,t){return{documents:[gn(e,t.path)]}}function En(e,t){var n={structuredQuery:{}},r=t.path;null!==t.collectionGroup?(n.parent=gn(e,r),n.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(n.parent=gn(e,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);var i=function(e){if(0!==e.length){var t=e.map((function(e){return function(e){if("=="===e.op){if(Ee(e.value))return{unaryFilter:{field:xn(e.field),op:"IS_NAN"}};if(we(e.value))return{unaryFilter:{field:xn(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(Ee(e.value))return{unaryFilter:{field:xn(e.field),op:"IS_NOT_NAN"}};if(we(e.value))return{unaryFilter:{field:xn(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:xn(e.field),op:In(e.op),value:e.value}}}(e)}));return 1===t.length?t[0]:{compositeFilter:{op:"AND",filters:t}}}}(t.filters);i&&(n.structuredQuery.where=i);var a=function(e){if(0!==e.length)return e.map((function(e){return function(e){return{field:xn(e.field),direction:jn(e.dir)}}(e)}))}(t.orderBy);a&&(n.structuredQuery.orderBy=a);var o=function(e,t){return e.D||le(t)?t:{value:t}}(e,t.limit);return null!==o&&(n.structuredQuery.limit=o),t.startAt&&(n.structuredQuery.startAt=Tn(t.startAt)),t.endAt&&(n.structuredQuery.endAt=Tn(t.endAt)),n}function On(e){var t=mn(e.parent),n=e.structuredQuery,r=n.from?n.from.length:0,i=null;if(r>0){N(1===r);var a=n.from[0];a.allDescendants?i=a.collectionId:t=t.child(a.collectionId)}var o=[];n.where&&(o=Sn(n.where));var u=[];n.orderBy&&(u=n.orderBy.map((function(e){return function(e){return new qe(Cn(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))}(e)})));var s=null;n.limit&&(s=function(e){var t;return le(t="object"==typeof e?e.value:e)?null:t}(n.limit));var l=null;n.startAt&&(l=_n(n.startAt));var c=null;return n.endAt&&(c=_n(n.endAt)),Qe(t,i,u,o,s,"F",l,c)}function Sn(e){return e?void 0!==e.unaryFilter?[An(e)]:void 0!==e.fieldFilter?[Nn(e)]:void 0!==e.compositeFilter?e.compositeFilter.filters.map((function(e){return Sn(e)})).reduce((function(e,t){return e.concat(t)})):C():[]}function Tn(e){return{before:e.before,values:e.position}}function _n(e){var t=!!e.before,n=e.values||[];return new ze(n,t)}function jn(e){return sn[e]}function In(e){return ln[e]}function xn(e){return{fieldPath:e.canonicalString()}}function Cn(e){return ee.fromServerFormat(e.fieldPath)}function Nn(e){return Ae.create(Cn(e.fieldFilter.field),function(e){switch(e){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return C()}}(e.fieldFilter.op),e.fieldFilter.value)}function An(e){switch(e.unaryFilter.op){case"IS_NAN":var t=Cn(e.unaryFilter.field);return Ae.create(t,"==",{doubleValue:NaN});case"IS_NULL":var n=Cn(e.unaryFilter.field);return Ae.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":var r=Cn(e.unaryFilter.field);return Ae.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":var i=Cn(e.unaryFilter.field);return Ae.create(i,"!=",{nullValue:"NULL_VALUE"});default:return C()}}function Dn(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}function Ln(e){for(var t="",n=0;n0&&(t=Rn(t)),t=Pn(e.get(n),t);return Rn(t)}function Pn(e,t){for(var n=t,r=e.length,i=0;i4&&void 0!==arguments[4]?arguments[4]:W.min(),o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:W.min(),u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:te.EMPTY_BYTE_STRING;Object(v.a)(this,e),this.target=t,this.targetId=n,this.purpose=r,this.sequenceNumber=i,this.snapshotVersion=a,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=u}return Object(y.a)(e,[{key:"withSequenceNumber",value:function(t){return new e(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken)}},{key:"withResumeToken",value:function(t,n){return new e(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,t)}},{key:"withLastLimboFreeSnapshotVersion",value:function(t){return new e(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken)}}]),e}(),nr=function e(t){Object(v.a)(this,e),this.Wt=t};function rr(e){var t=On({parent:e.parent,structuredQuery:e.structuredQuery});return"LAST"===e.limitType?rt(t,t.limit,"L"):t}var ir=function(){function e(){Object(v.a)(this,e),this.Gt=new ar}return Object(y.a)(e,[{key:"addToCollectionParentIndex",value:function(e,t){return this.Gt.add(t),Jn.resolve()}},{key:"getCollectionParents",value:function(e,t){return Jn.resolve(this.Gt.getEntries(t))}}]),e}(),ar=function(){function e(){Object(v.a)(this,e),this.index={}}return Object(y.a)(e,[{key:"add",value:function(e){var t=e.lastSegment(),n=e.popLast(),r=this.index[t]||new Bt(J.comparator),i=!r.has(n);return this.index[t]=r.add(n),i}},{key:"has",value:function(e){var t=e.lastSegment(),n=e.popLast(),r=this.index[t];return r&&r.has(n)}},{key:"getEntries",value:function(e){return(this.index[e]||new Bt(J.comparator)).toArray()}}]),e}();var or=function(){function e(t,n,r){Object(v.a)(this,e),this.cacheSizeCollectionThreshold=t,this.percentileToCollect=n,this.maximumSequenceNumbersToCollect=r}return Object(y.a)(e,null,[{key:"withCacheSize",value:function(t){return new e(t,e.DEFAULT_COLLECTION_PERCENTILE,e.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}}]),e}();or.DEFAULT_COLLECTION_PERCENTILE=10,or.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,or.DEFAULT=new or(41943040,or.DEFAULT_COLLECTION_PERCENTILE,or.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),or.DISABLED=new or(-1,0,0);var ur=function(){function e(t){Object(v.a)(this,e),this.ne=t}return Object(y.a)(e,[{key:"next",value:function(){return this.ne+=2,this.ne}}],[{key:"se",value:function(){return new e(0)}},{key:"ie",value:function(){return new e(-1)}}]),e}();function sr(e){return lr.apply(this,arguments)}function lr(){return(lr=Object(c.a)(l.a.mark((function e(t){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.code===D.FAILED_PRECONDITION&&t.message===Yn){e.next=2;break}throw t;case 2:_("LocalStore","Unexpectedly lost primary lease");case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var cr=function(){function e(t,n){Object(v.a)(this,e),this.mapKeyFn=t,this.equalsFn=n,this.inner={}}return Object(y.a)(e,[{key:"get",value:function(e){var t=this.mapKeyFn(e),n=this.inner[t];if(void 0!==n){var r,i=Object(u.a)(n);try{for(i.s();!(r=i.n()).done;){var a=Object(o.a)(r.value,2),s=a[0],l=a[1];if(this.equalsFn(s,e))return l}}catch(c){i.e(c)}finally{i.f()}}}},{key:"has",value:function(e){return void 0!==this.get(e)}},{key:"set",value:function(e,t){var n=this.mapKeyFn(e),r=this.inner[n];if(void 0!==r){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:null;this.assertNotApplied(),this.changes.set(e,{document:_e.newInvalidDocument(e),readTime:t})}},{key:"getEntry",value:function(e,t){this.assertNotApplied();var n=this.changes.get(t);return void 0!==n?Jn.resolve(n.document):this.getFromCache(e,t)}},{key:"getEntries",value:function(e,t){return this.getAllFromCache(e,t)}},{key:"apply",value:function(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}},{key:"assertNotApplied",value:function(){}}]),e}();var hr=function(){function e(t,n,r){Object(v.a)(this,e),this.He=t,this.In=n,this.Ht=r}return Object(y.a)(e,[{key:"An",value:function(e,t){var n=this;return this.In.getAllMutationBatchesAffectingDocumentKey(e,t).next((function(r){return n.Rn(e,t,r)}))}},{key:"Rn",value:function(e,t,n){return this.He.getEntry(e,t).next((function(e){var t,r=Object(u.a)(n);try{for(r.s();!(t=r.n()).done;){t.value.applyToLocalView(e)}}catch(i){r.e(i)}finally{r.f()}return e}))}},{key:"bn",value:function(e,t){e.forEach((function(e,n){var r,i=Object(u.a)(t);try{for(i.s();!(r=i.n()).done;){r.value.applyToLocalView(n)}}catch(a){i.e(a)}finally{i.f()}}))}},{key:"Pn",value:function(e,t){var n=this;return this.He.getEntries(e,t).next((function(t){return n.vn(e,t).next((function(){return t}))}))}},{key:"vn",value:function(e,t){var n=this;return this.In.getAllMutationBatchesAffectingDocumentKeys(e,t).next((function(e){return n.bn(t,e)}))}},{key:"getDocumentsMatchingQuery",value:function(e,t,n){return function(e){return fe.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}(t)?this.Vn(e,t.path):et(t)?this.Sn(e,t,n):this.Dn(e,t,n)}},{key:"Vn",value:function(e,t){return this.An(e,new fe(t)).next((function(e){var t=Wt();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t}))}},{key:"Sn",value:function(e,t,n){var r=this,i=t.collectionGroup,a=Wt();return this.Ht.getCollectionParents(e,i).next((function(o){return Jn.forEach(o,(function(o){var u=function(e,t){return new We(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(t,o.child(i));return r.Dn(e,u,n).next((function(e){e.forEach((function(e,t){a=a.insert(e,t)}))}))})).next((function(){return a}))}))}},{key:"Dn",value:function(e,t,n){var r,i,a=this;return this.He.getDocumentsMatchingQuery(e,t,n).next((function(n){return r=n,a.In.getAllMutationBatchesAffectingQuery(e,t)})).next((function(t){return i=t,a.Cn(e,i,r).next((function(e){r=e;var t,n=Object(u.a)(i);try{for(n.s();!(t=n.n()).done;){var a,o=t.value,s=Object(u.a)(o.mutations);try{for(s.s();!(a=s.n()).done;){var l=a.value,c=l.key,f=r.get(c);null==f&&(f=_e.newInvalidDocument(c),r=r.insert(c,f)),jt(l,f,o.localWriteTime),f.isFoundDocument()||(r=r.remove(c))}}catch(h){s.e(h)}finally{s.f()}}}catch(h){n.e(h)}finally{n.f()}}))})).next((function(){return r.forEach((function(e,n){ut(t,n)||(r=r.remove(e))})),r}))}},{key:"Cn",value:function(e,t,n){var r,i=$t(),a=Object(u.a)(t);try{for(a.s();!(r=a.n()).done;){var o,s=r.value,l=Object(u.a)(s.mutations);try{for(l.s();!(o=l.n()).done;){var c=o.value;c instanceof Nt&&null===n.get(c.key)&&(i=i.add(c.key))}}catch(h){l.e(h)}finally{l.f()}}}catch(h){a.e(h)}finally{a.f()}var f=n;return this.He.getEntries(e,i).next((function(e){return e.forEach((function(e,t){t.isFoundDocument()&&(f=f.insert(e,t))})),f}))}}]),e}(),dr=function(){function e(t,n,r,i){Object(v.a)(this,e),this.targetId=t,this.fromCache=n,this.Nn=r,this.xn=i}return Object(y.a)(e,null,[{key:"kn",value:function(t,n){var r,i=$t(),a=$t(),o=Object(u.a)(n.docChanges);try{for(o.s();!(r=o.n()).done;){var s=r.value;switch(s.type){case 0:i=i.add(s.doc.key);break;case 1:a=a.add(s.doc.key)}}}catch(l){o.e(l)}finally{o.f()}return new e(t,n.fromCache,i,a)}}]),e}(),pr=function(){function e(){Object(v.a)(this,e)}return Object(y.a)(e,[{key:"$n",value:function(e){this.On=e}},{key:"getDocumentsMatchingQuery",value:function(e,t,n,r){var i=this;return function(e){return 0===e.filters.length&&null===e.limit&&null==e.startAt&&null==e.endAt&&(0===e.explicitOrderBy.length||1===e.explicitOrderBy.length&&e.explicitOrderBy[0].field.isKeyField())}(t)||n.isEqual(W.min())?this.Fn(e,t):this.On.Pn(e,r).next((function(a){var o=i.Mn(t,a);return(Ye(t)||Xe(t))&&i.Ln(t.limitType,o,r,n)?i.Fn(e,t):(T()<=b.a.DEBUG&&_("QueryEngine","Re-using previous result from %s to execute query: %s",n.toString(),ot(t)),i.On.getDocumentsMatchingQuery(e,t,n).next((function(e){return o.forEach((function(t){e=e.insert(t.key,t)})),e})))}))}},{key:"Mn",value:function(e,t){var n=new Bt(st(e));return t.forEach((function(t,r){ut(e,r)&&(n=n.add(r))})),n}},{key:"Ln",value:function(e,t,n,r){if(n.size!==t.size)return!0;var i="F"===e?t.last():t.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(r)>0)}},{key:"Fn",value:function(e,t){return T()<=b.a.DEBUG&&_("QueryEngine","Using full collection scan to execute query:",ot(t)),this.On.getDocumentsMatchingQuery(e,t,W.min())}}]),e}(),vr=function(){function e(t,n,r,i){Object(v.a)(this,e),this.persistence=t,this.Bn=n,this.N=i,this.Un=new Vt(H),this.qn=new cr((function(e){return xe(e)}),Ce),this.Kn=W.min(),this.In=t.getMutationQueue(r),this.jn=t.getRemoteDocumentCache(),this.ze=t.getTargetCache(),this.Qn=new hr(this.jn,this.In,this.persistence.getIndexManager()),this.Je=t.getBundleCache(),this.Bn.$n(this.Qn)}return Object(y.a)(e,[{key:"collectGarbage",value:function(e){var t=this;return this.persistence.runTransaction("Collect garbage","readwrite-primary",(function(n){return e.collect(n,t.Un)}))}}]),e}();function yr(e,t,n,r){return new vr(e,t,n,r)}function gr(e,t){return mr.apply(this,arguments)}function mr(){return(mr=Object(c.a)(l.a.mark((function e(t,n){var r,i,a,o;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=A(t),i=r.In,a=r.Qn,e.next=4,r.persistence.runTransaction("Handle user change","readonly",(function(e){var t;return r.In.getAllMutationBatches(e).next((function(o){return t=o,i=r.persistence.getMutationQueue(n),a=new hr(r.jn,i,r.persistence.getIndexManager()),i.getAllMutationBatches(e)})).next((function(n){var r,i=[],o=[],s=$t(),l=Object(u.a)(t);try{for(l.s();!(r=l.n()).done;){var c=r.value;i.push(c.batchId);var f,h=Object(u.a)(c.mutations);try{for(h.s();!(f=h.n()).done;){var d=f.value;s=s.add(d.key)}}catch(k){h.e(k)}finally{h.f()}}}catch(k){l.e(k)}finally{l.f()}var p,v=Object(u.a)(n);try{for(v.s();!(p=v.n()).done;){var y=p.value;o.push(y.batchId);var g,m=Object(u.a)(y.mutations);try{for(m.s();!(g=m.n()).done;){var b=g.value;s=s.add(b.key)}}catch(k){m.e(k)}finally{m.f()}}}catch(k){v.e(k)}finally{v.f()}return a.Pn(e,s).next((function(e){return{Wn:e,removedBatchIds:i,addedBatchIds:o}}))}))}));case 4:return o=e.sent,e.abrupt("return",(r.In=i,r.Qn=a,r.Bn.$n(r.Qn),o));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function br(e){var t=A(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",(function(e){return t.ze.getLastRemoteSnapshotVersion(e)}))}function kr(e,t){var n=A(e),r=t.snapshotVersion,i=n.Un;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(function(e){var a=n.jn.newChangeBuffer({trackRemovals:!0});i=n.Un;var o=[];t.targetChanges.forEach((function(t,a){var u=i.get(a);if(u){o.push(n.ze.removeMatchingKeys(e,t.removedDocuments,a).next((function(){return n.ze.addMatchingKeys(e,t.addedDocuments,a)})));var s=t.resumeToken;if(s.approximateByteSize()>0){var l=u.withResumeToken(s,r).withSequenceNumber(e.currentSequenceNumber);i=i.insert(a,l),function(e,t,n){return N(t.resumeToken.approximateByteSize()>0),0===e.resumeToken.approximateByteSize()||(t.snapshotVersion.toMicroseconds()-e.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0)}(u,l,t)&&o.push(n.ze.updateTargetData(e,l))}}}));var u=Kt();if(t.documentUpdates.forEach((function(r,i){t.resolvedLimboDocuments.has(r)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(e,r))})),o.push(wr(e,a,t.documentUpdates,r,void 0).next((function(e){u=e}))),!r.isEqual(W.min())){var s=n.ze.getLastRemoteSnapshotVersion(e).next((function(t){return n.ze.setTargetsMetadata(e,e.currentSequenceNumber,r)}));o.push(s)}return Jn.waitFor(o).next((function(){return a.apply(e)})).next((function(){return n.Qn.vn(e,u)})).next((function(){return u}))})).then((function(e){return n.Un=i,e}))}function wr(e,t,n,r,i){var a=$t();return n.forEach((function(e){return a=a.add(e)})),t.getEntries(e,a).next((function(e){var a=Kt();return n.forEach((function(n,o){var u=e.get(n),s=(null==i?void 0:i.get(n))||r;o.isNoDocument()&&o.version.isEqual(W.min())?(t.removeEntry(n,s),a=a.insert(n,o)):!u.isValidDocument()||o.version.compareTo(u.version)>0||0===o.version.compareTo(u.version)&&u.hasPendingWrites?(t.addEntry(o,s),a=a.insert(n,o)):_("LocalStore","Ignoring outdated watch update for ",n,". Current version:",u.version," Watch version:",o.version)})),a}))}function Er(e,t){var n=A(e);return n.persistence.runTransaction("Allocate target","readwrite",(function(e){var r;return n.ze.getTargetData(e,t).next((function(i){return i?(r=i,Jn.resolve(r)):n.ze.allocateTargetId(e).next((function(i){return r=new tr(t,i,0,e.currentSequenceNumber),n.ze.addTargetData(e,r).next((function(){return r}))}))}))})).then((function(e){var r=n.Un.get(e.targetId);return(null===r||e.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.Un=n.Un.insert(e.targetId,e),n.qn.set(t,e.targetId)),e}))}function Or(e,t,n){return Sr.apply(this,arguments)}function Sr(){return(Sr=Object(c.a)(l.a.mark((function e(t,n,r){var i,a,o;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=A(t),a=i.Un.get(n),o=r?"readwrite":"readwrite-primary",e.prev=1,e.t0=r,e.t0){e.next=6;break}return e.next=6,i.persistence.runTransaction("Release target",o,(function(e){return i.persistence.referenceDelegate.removeTarget(e,a)}));case 6:e.next=13;break;case 8:if(e.prev=8,e.t1=e.catch(1),Zn(e.t1)){e.next=12;break}throw e.t1;case 12:_("LocalStore","Failed to update sequence numbers for target ".concat(n,": ").concat(e.t1));case 13:i.Un=i.Un.remove(n),i.qn.delete(a.target);case 14:case"end":return e.stop()}}),e,null,[[1,8]])})))).apply(this,arguments)}function Tr(e,t,n){var r=A(e),i=W.min(),a=$t();return r.persistence.runTransaction("Execute query","readonly",(function(e){return function(e,t,n){var r=A(e),i=r.qn.get(n);return void 0!==i?Jn.resolve(r.Un.get(i)):r.ze.getTargetData(t,n)}(r,e,nt(t)).next((function(t){if(t)return i=t.lastLimboFreeSnapshotVersion,r.ze.getMatchingKeysForTargetId(e,t.targetId).next((function(e){a=e}))})).next((function(){return r.Bn.getDocumentsMatchingQuery(e,t,n?i:W.min(),n?a:$t())})).next((function(e){return{documents:e,Gn:a}}))}))}var _r=function(){function e(t){Object(v.a)(this,e),this.N=t,this.Yn=new Map,this.Xn=new Map}return Object(y.a)(e,[{key:"getBundleMetadata",value:function(e,t){return Jn.resolve(this.Yn.get(t))}},{key:"saveBundleMetadata",value:function(e,t){var n;return this.Yn.set(t.id,{id:(n=t).id,version:n.version,createTime:dn(n.createTime)}),Jn.resolve()}},{key:"getNamedQuery",value:function(e,t){return Jn.resolve(this.Xn.get(t))}},{key:"saveNamedQuery",value:function(e,t){return this.Xn.set(t.name,function(e){return{name:e.name,query:rr(e.bundledQuery),readTime:dn(e.readTime)}}(t)),Jn.resolve()}}]),e}(),jr=function(){function e(){Object(v.a)(this,e),this.Zn=new Bt(Ir.ts),this.es=new Bt(Ir.ns)}return Object(y.a)(e,[{key:"isEmpty",value:function(){return this.Zn.isEmpty()}},{key:"addReference",value:function(e,t){var n=new Ir(e,t);this.Zn=this.Zn.add(n),this.es=this.es.add(n)}},{key:"ss",value:function(e,t){var n=this;e.forEach((function(e){return n.addReference(e,t)}))}},{key:"removeReference",value:function(e,t){this.rs(new Ir(e,t))}},{key:"os",value:function(e,t){var n=this;e.forEach((function(e){return n.removeReference(e,t)}))}},{key:"cs",value:function(e){var t=this,n=new fe(new J([])),r=new Ir(n,e),i=new Ir(n,e+1),a=[];return this.es.forEachInRange([r,i],(function(e){t.rs(e),a.push(e.key)})),a}},{key:"us",value:function(){var e=this;this.Zn.forEach((function(t){return e.rs(t)}))}},{key:"rs",value:function(e){this.Zn=this.Zn.delete(e),this.es=this.es.delete(e)}},{key:"hs",value:function(e){var t=new fe(new J([])),n=new Ir(t,e),r=new Ir(t,e+1),i=$t();return this.es.forEachInRange([n,r],(function(e){i=i.add(e.key)})),i}},{key:"containsKey",value:function(e){var t=new Ir(e,0),n=this.Zn.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)}}]),e}(),Ir=function(){function e(t,n){Object(v.a)(this,e),this.key=t,this.ls=n}return Object(y.a)(e,null,[{key:"ts",value:function(e,t){return fe.comparator(e.key,t.key)||H(e.ls,t.ls)}},{key:"ns",value:function(e,t){return H(e.ls,t.ls)||fe.comparator(e.key,t.key)}}]),e}(),xr=function(){function e(t,n){Object(v.a)(this,e),this.Ht=t,this.referenceDelegate=n,this.In=[],this.fs=1,this.ds=new Bt(Ir.ts)}return Object(y.a)(e,[{key:"checkEmpty",value:function(e){return Jn.resolve(0===this.In.length)}},{key:"addMutationBatch",value:function(e,t,n,r){var i=this.fs;this.fs++,this.In.length>0&&this.In[this.In.length-1];var a=new er(i,t,n,r);this.In.push(a);var o,s=Object(u.a)(r);try{for(s.s();!(o=s.n()).done;){var l=o.value;this.ds=this.ds.add(new Ir(l.key,i)),this.Ht.addToCollectionParentIndex(e,l.key.path.popLast())}}catch(c){s.e(c)}finally{s.f()}return Jn.resolve(a)}},{key:"lookupMutationBatch",value:function(e,t){return Jn.resolve(this.ws(t))}},{key:"getNextMutationBatchAfterBatchId",value:function(e,t){var n=t+1,r=this._s(n),i=r<0?0:r;return Jn.resolve(this.In.length>i?this.In[i]:null)}},{key:"getHighestUnacknowledgedBatchId",value:function(){return Jn.resolve(0===this.In.length?-1:this.fs-1)}},{key:"getAllMutationBatches",value:function(e){return Jn.resolve(this.In.slice())}},{key:"getAllMutationBatchesAffectingDocumentKey",value:function(e,t){var n=this,r=new Ir(t,0),i=new Ir(t,Number.POSITIVE_INFINITY),a=[];return this.ds.forEachInRange([r,i],(function(e){var t=n.ws(e.ls);a.push(t)})),Jn.resolve(a)}},{key:"getAllMutationBatchesAffectingDocumentKeys",value:function(e,t){var n=this,r=new Bt(H);return t.forEach((function(e){var t=new Ir(e,0),i=new Ir(e,Number.POSITIVE_INFINITY);n.ds.forEachInRange([t,i],(function(e){r=r.add(e.ls)}))})),Jn.resolve(this.gs(r))}},{key:"getAllMutationBatchesAffectingQuery",value:function(e,t){var n=t.path,r=n.length+1,i=n;fe.isDocumentKey(i)||(i=i.child(""));var a=new Ir(new fe(i),0),o=new Bt(H);return this.ds.forEachWhile((function(e){var t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===r&&(o=o.add(e.ls)),!0)}),a),Jn.resolve(this.gs(o))}},{key:"gs",value:function(e){var t=this,n=[];return e.forEach((function(e){var r=t.ws(e);null!==r&&n.push(r)})),n}},{key:"removeMutationBatch",value:function(e,t){var n=this;N(0===this.ys(t.batchId,"removed")),this.In.shift();var r=this.ds;return Jn.forEach(t.mutations,(function(i){var a=new Ir(i.key,t.batchId);return r=r.delete(a),n.referenceDelegate.markPotentiallyOrphaned(e,i.key)})).next((function(){n.ds=r}))}},{key:"te",value:function(e){}},{key:"containsKey",value:function(e,t){var n=new Ir(t,0),r=this.ds.firstAfterOrEqual(n);return Jn.resolve(t.isEqual(r&&r.key))}},{key:"performConsistencyCheck",value:function(e){return this.In.length,Jn.resolve()}},{key:"ys",value:function(e,t){return this._s(e)}},{key:"_s",value:function(e){return 0===this.In.length?0:e-this.In[0].batchId}},{key:"ws",value:function(e){var t=this._s(e);return t<0||t>=this.In.length?null:this.In[t]}}]),e}(),Cr=function(){function e(t,n){Object(v.a)(this,e),this.Ht=t,this.ps=n,this.docs=new Vt(fe.comparator),this.size=0}return Object(y.a)(e,[{key:"addEntry",value:function(e,t,n){var r=t.key,i=this.docs.get(r),a=i?i.size:0,o=this.ps(t);return this.docs=this.docs.insert(r,{document:t.clone(),size:o,readTime:n}),this.size+=o-a,this.Ht.addToCollectionParentIndex(e,r.path.popLast())}},{key:"removeEntry",value:function(e){var t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}},{key:"getEntry",value:function(e,t){var n=this.docs.get(t);return Jn.resolve(n?n.document.clone():_e.newInvalidDocument(t))}},{key:"getEntries",value:function(e,t){var n=this,r=Kt();return t.forEach((function(e){var t=n.docs.get(e);r=r.insert(e,t?t.document.clone():_e.newInvalidDocument(e))})),Jn.resolve(r)}},{key:"getDocumentsMatchingQuery",value:function(e,t,n){for(var r=Kt(),i=new fe(t.path.child("")),a=this.docs.getIteratorFrom(i);a.hasNext();){var o=a.getNext(),u=o.key,s=o.value,l=s.document,c=s.readTime;if(!t.path.isPrefixOf(u.path))break;c.compareTo(n)<=0||ut(t,l)&&(r=r.insert(l.key,l.clone()))}return Jn.resolve(r)}},{key:"Es",value:function(e,t){return Jn.forEach(this.docs,(function(e){return t(e)}))}},{key:"newChangeBuffer",value:function(e){return new Nr(this)}},{key:"getSize",value:function(e){return Jn.resolve(this.size)}}]),e}(),Nr=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(e){var r;return Object(v.a)(this,n),(r=t.call(this)).Se=e,r}return Object(y.a)(n,[{key:"applyChanges",value:function(e){var t=this,n=[];return this.changes.forEach((function(r,i){i.document.isValidDocument()?n.push(t.Se.addEntry(e,i.document,t.getReadTime(r))):t.Se.removeEntry(r)})),Jn.waitFor(n)}},{key:"getFromCache",value:function(e,t){return this.Se.getEntry(e,t)}},{key:"getAllFromCache",value:function(e,t){return this.Se.getEntries(e,t)}}]),n}(fr),Ar=function(){function e(t){Object(v.a)(this,e),this.persistence=t,this.Ts=new cr((function(e){return xe(e)}),Ce),this.lastRemoteSnapshotVersion=W.min(),this.highestTargetId=0,this.Is=0,this.As=new jr,this.targetCount=0,this.Rs=ur.se()}return Object(y.a)(e,[{key:"forEachTarget",value:function(e,t){return this.Ts.forEach((function(e,n){return t(n)})),Jn.resolve()}},{key:"getLastRemoteSnapshotVersion",value:function(e){return Jn.resolve(this.lastRemoteSnapshotVersion)}},{key:"getHighestSequenceNumber",value:function(e){return Jn.resolve(this.Is)}},{key:"allocateTargetId",value:function(e){return this.highestTargetId=this.Rs.next(),Jn.resolve(this.highestTargetId)}},{key:"setTargetsMetadata",value:function(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.Is&&(this.Is=t),Jn.resolve()}},{key:"ae",value:function(e){this.Ts.set(e.target,e);var t=e.targetId;t>this.highestTargetId&&(this.Rs=new ur(t),this.highestTargetId=t),e.sequenceNumber>this.Is&&(this.Is=e.sequenceNumber)}},{key:"addTargetData",value:function(e,t){return this.ae(t),this.targetCount+=1,Jn.resolve()}},{key:"updateTargetData",value:function(e,t){return this.ae(t),Jn.resolve()}},{key:"removeTargetData",value:function(e,t){return this.Ts.delete(t.target),this.As.cs(t.targetId),this.targetCount-=1,Jn.resolve()}},{key:"removeTargets",value:function(e,t,n){var r=this,i=0,a=[];return this.Ts.forEach((function(o,u){u.sequenceNumber<=t&&null===n.get(u.targetId)&&(r.Ts.delete(o),a.push(r.removeMatchingKeysForTargetId(e,u.targetId)),i++)})),Jn.waitFor(a).next((function(){return i}))}},{key:"getTargetCount",value:function(e){return Jn.resolve(this.targetCount)}},{key:"getTargetData",value:function(e,t){var n=this.Ts.get(t)||null;return Jn.resolve(n)}},{key:"addMatchingKeys",value:function(e,t,n){return this.As.ss(t,n),Jn.resolve()}},{key:"removeMatchingKeys",value:function(e,t,n){this.As.os(t,n);var r=this.persistence.referenceDelegate,i=[];return r&&t.forEach((function(t){i.push(r.markPotentiallyOrphaned(e,t))})),Jn.waitFor(i)}},{key:"removeMatchingKeysForTargetId",value:function(e,t){return this.As.cs(t),Jn.resolve()}},{key:"getMatchingKeysForTargetId",value:function(e,t){var n=this.As.hs(t);return Jn.resolve(n)}},{key:"containsKey",value:function(e,t){return Jn.resolve(this.As.containsKey(t))}}]),e}(),Dr=function(){function e(t,n){var r=this;Object(v.a)(this,e),this.bs={},this.Le=new z(0),this.Be=!1,this.Be=!0,this.referenceDelegate=t(this),this.ze=new Ar(this),this.Ht=new ir,this.He=function(e,t){return new Cr(e,(function(e){return r.referenceDelegate.Ps(e)}))}(this.Ht),this.N=new nr(n),this.Je=new _r(this.N)}return Object(y.a)(e,[{key:"start",value:function(){return Promise.resolve()}},{key:"shutdown",value:function(){return this.Be=!1,Promise.resolve()}},{key:"started",get:function(){return this.Be}},{key:"setDatabaseDeletedListener",value:function(){}},{key:"setNetworkEnabled",value:function(){}},{key:"getIndexManager",value:function(){return this.Ht}},{key:"getMutationQueue",value:function(e){var t=this.bs[e.toKey()];return t||(t=new xr(this.Ht,this.referenceDelegate),this.bs[e.toKey()]=t),t}},{key:"getTargetCache",value:function(){return this.ze}},{key:"getRemoteDocumentCache",value:function(){return this.He}},{key:"getBundleCache",value:function(){return this.Je}},{key:"runTransaction",value:function(e,t,n){var r=this;_("MemoryPersistence","Starting transaction:",e);var i=new Lr(this.Le.next());return this.referenceDelegate.vs(),n(i).next((function(e){return r.referenceDelegate.Vs(i).next((function(){return e}))})).toPromise().then((function(e){return i.raiseOnCommittedEvent(),e}))}},{key:"Ss",value:function(e,t){return Jn.or(Object.values(this.bs).map((function(n){return function(){return n.containsKey(e,t)}})))}}]),e}(),Lr=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(e){var r;return Object(v.a)(this,n),(r=t.call(this)).currentSequenceNumber=e,r}return n}(Xn),Pr=function(){function e(t){Object(v.a)(this,e),this.persistence=t,this.Ds=new jr,this.Cs=null}return Object(y.a)(e,[{key:"xs",get:function(){if(this.Cs)return this.Cs;throw C()}},{key:"addReference",value:function(e,t,n){return this.Ds.addReference(n,t),this.xs.delete(n.toString()),Jn.resolve()}},{key:"removeReference",value:function(e,t,n){return this.Ds.removeReference(n,t),this.xs.add(n.toString()),Jn.resolve()}},{key:"markPotentiallyOrphaned",value:function(e,t){return this.xs.add(t.toString()),Jn.resolve()}},{key:"removeTarget",value:function(e,t){var n=this;this.Ds.cs(t.targetId).forEach((function(e){return n.xs.add(e.toString())}));var r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,t.targetId).next((function(e){e.forEach((function(e){return n.xs.add(e.toString())}))})).next((function(){return r.removeTargetData(e,t)}))}},{key:"vs",value:function(){this.Cs=new Set}},{key:"Vs",value:function(e){var t=this,n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return Jn.forEach(this.xs,(function(r){var i=fe.fromPath(r);return t.ks(e,i).next((function(e){e||n.removeEntry(i)}))})).next((function(){return t.Cs=null,n.apply(e)}))}},{key:"updateLimboDocument",value:function(e,t){var n=this;return this.ks(e,t).next((function(e){e?n.xs.delete(t.toString()):n.xs.add(t.toString())}))}},{key:"Ps",value:function(e){return 0}},{key:"ks",value:function(e,t){var n=this;return Jn.or([function(){return Jn.resolve(n.Ds.containsKey(t))},function(){return n.persistence.getTargetCache().containsKey(e,t)},function(){return n.persistence.Ss(e,t)}])}}],[{key:"Ns",value:function(t){return new e(t)}}]),e}();var Rr=function(){function e(){Object(v.a)(this,e),this.activeTargetIds=Xt()}return Object(y.a)(e,[{key:"Fs",value:function(e){this.activeTargetIds=this.activeTargetIds.add(e)}},{key:"Ms",value:function(e){this.activeTargetIds=this.activeTargetIds.delete(e)}},{key:"Os",value:function(){var e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}]),e}(),Fr=function(){function e(){Object(v.a)(this,e),this.yi=new Rr,this.pi={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}return Object(y.a)(e,[{key:"addPendingMutation",value:function(e){}},{key:"updateMutationState",value:function(e,t,n){}},{key:"addLocalQueryTarget",value:function(e){return this.yi.Fs(e),this.pi[e]||"not-current"}},{key:"updateQueryState",value:function(e,t,n){this.pi[e]=t}},{key:"removeLocalQueryTarget",value:function(e){this.yi.Ms(e)}},{key:"isLocalQueryTarget",value:function(e){return this.yi.activeTargetIds.has(e)}},{key:"clearQueryState",value:function(e){delete this.pi[e]}},{key:"getAllActiveQueryTargets",value:function(){return this.yi.activeTargetIds}},{key:"isActiveQueryTarget",value:function(e){return this.yi.activeTargetIds.has(e)}},{key:"start",value:function(){return this.yi=new Rr,Promise.resolve()}},{key:"handleUserChange",value:function(e,t,n){}},{key:"setOnlineState",value:function(e){}},{key:"shutdown",value:function(){}},{key:"writeSequenceNumber",value:function(e){}},{key:"notifyBundleLoaded",value:function(){}}]),e}(),Mr=function(){function e(){Object(v.a)(this,e)}return Object(y.a)(e,[{key:"Ei",value:function(e){}},{key:"shutdown",value:function(){}}]),e}(),Vr=function(){function e(){var t=this;Object(v.a)(this,e),this.Ti=function(){return t.Ii()},this.Ai=function(){return t.Ri()},this.bi=[],this.Pi()}return Object(y.a)(e,[{key:"Ei",value:function(e){this.bi.push(e)}},{key:"shutdown",value:function(){window.removeEventListener("online",this.Ti),window.removeEventListener("offline",this.Ai)}},{key:"Pi",value:function(){window.addEventListener("online",this.Ti),window.addEventListener("offline",this.Ai)}},{key:"Ii",value:function(){_("ConnectivityMonitor","Network connectivity changed: AVAILABLE");var e,t=Object(u.a)(this.bi);try{for(t.s();!(e=t.n()).done;){(0,e.value)(0)}}catch(n){t.e(n)}finally{t.f()}}},{key:"Ri",value:function(){_("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");var e,t=Object(u.a)(this.bi);try{for(t.s();!(e=t.n()).done;){(0,e.value)(1)}}catch(n){t.e(n)}finally{t.f()}}}],[{key:"bt",value:function(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}]),e}(),Ur={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery"},zr=function(){function e(t){Object(v.a)(this,e),this.vi=t.vi,this.Vi=t.Vi}return Object(y.a)(e,[{key:"Si",value:function(e){this.Di=e}},{key:"Ci",value:function(e){this.Ni=e}},{key:"onMessage",value:function(e){this.xi=e}},{key:"close",value:function(){this.Vi()}},{key:"send",value:function(e){this.vi(e)}},{key:"ki",value:function(){this.Di()}},{key:"$i",value:function(e){this.Ni(e)}},{key:"Oi",value:function(e){this.xi(e)}}]),e}(),Br=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(e){var r;return Object(v.a)(this,n),(r=t.call(this,e)).forceLongPolling=e.forceLongPolling,r.autoDetectLongPolling=e.autoDetectLongPolling,r.useFetchStreams=e.useFetchStreams,r}return Object(y.a)(n,[{key:"qi",value:function(e,t,n,r){return new Promise((function(i,a){var o=new w.g;o.listenOnce(w.c.COMPLETE,(function(){try{switch(o.getLastErrorCode()){case w.a.NO_ERROR:var t=o.getResponseJson();_("Connection","XHR received:",JSON.stringify(t)),i(t);break;case w.a.TIMEOUT:_("Connection",'RPC "'+e+'" timed out'),a(new L(D.DEADLINE_EXCEEDED,"Request time out"));break;case w.a.HTTP_ERROR:var n=o.getStatus();if(_("Connection",'RPC "'+e+'" failed with status:',n,"response text:",o.getResponseText()),n>0){var r=o.getResponseJson().error;if(r&&r.status&&r.message){var u=function(e){var t=e.toLowerCase().replace(/_/g,"-");return Object.values(D).indexOf(t)>=0?t:D.UNKNOWN}(r.status);a(new L(u,r.message))}else a(new L(D.UNKNOWN,"Server responded with status "+o.getStatus()))}else a(new L(D.UNAVAILABLE,"Connection failed."));break;default:C()}}finally{_("Connection",'RPC "'+e+'" completed.')}}));var u=JSON.stringify(r);o.send(t,"POST",u,n,15)}))}},{key:"ji",value:function(e,t){var n=[this.Fi,"/","google.firestore.v1.Firestore","/",e,"/channel"],r=Object(w.h)(),i=Object(w.i)(),a={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/".concat(this.databaseId.projectId,"/databases/").concat(this.databaseId.database)},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling};this.useFetchStreams&&(a.xmlHttpFactory=new w.d({})),this.Ui(a.initMessageHeaders,t),Object(k.k)()||Object(k.l)()||Object(k.h)()||Object(k.i)()||Object(k.n)()||Object(k.g)()||(a.httpHeadersOverwriteParam="$httpHeaders");var o=n.join("");_("Connection","Creating WebChannel: "+o,a);var u=r.createWebChannel(o,a),s=!1,l=!1,c=new zr({vi:function(e){l?_("Connection","Not sending because WebChannel is closed:",e):(s||(_("Connection","Opening WebChannel transport."),u.open(),s=!0),_("Connection","WebChannel sending:",e),u.send(e))},Vi:function(){return u.close()}}),f=function(e,t,n){e.listen(t,(function(e){try{n(e)}catch(e){setTimeout((function(){throw e}),0)}}))};return f(u,w.f.EventType.OPEN,(function(){l||_("Connection","WebChannel transport opened.")})),f(u,w.f.EventType.CLOSE,(function(){l||(l=!0,_("Connection","WebChannel transport closed"),c.$i())})),f(u,w.f.EventType.ERROR,(function(e){l||(l=!0,I("Connection","WebChannel transport errored:",e),c.$i(new L(D.UNAVAILABLE,"The operation could not be completed")))})),f(u,w.f.EventType.MESSAGE,(function(e){var t;if(!l){var n=e.data[0];N(!!n);var r=n,i=r.error||(null===(t=r[0])||void 0===t?void 0:t.error);if(i){_("Connection","WebChannel received error:",i);var a=i.status,o=function(e){var t=Pt[e];if(void 0!==t)return Mt(t)}(a),s=i.message;void 0===o&&(o=D.INTERNAL,s="Unknown error status: "+a+" with message "+i.message),l=!0,c.$i(new L(o,s)),u.close()}else _("Connection","WebChannel received:",n),c.Oi(n)}})),f(i,w.b.STAT_EVENT,(function(e){e.stat===w.e.PROXY?_("Connection","Detected buffering proxy"):e.stat===w.e.NOPROXY&&_("Connection","Detected no buffering proxy")})),setTimeout((function(){c.ki()}),0),c}}]),n}(function(){function e(t){Object(v.a)(this,e),this.databaseInfo=t,this.databaseId=t.databaseId;var n=t.ssl?"https":"http";this.Fi=n+"://"+t.host,this.Mi="projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database+"/documents"}return Object(y.a)(e,[{key:"Li",value:function(e,t,n,r){var i=this.Bi(e,t);_("RestConnection","Sending: ",i,n);var a={};return this.Ui(a,r),this.qi(e,i,a,n).then((function(e){return _("RestConnection","Received: ",e),e}),(function(t){throw I("RestConnection","".concat(e," failed with error: "),t,"url: ",i,"request:",n),t}))}},{key:"Ki",value:function(e,t,n,r){return this.Li(e,t,n,r)}},{key:"Ui",value:function(e,t){if(e["X-Goog-Api-Client"]="gl-js/ fire/"+O,e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t)for(var n in t.authHeaders)t.authHeaders.hasOwnProperty(n)&&(e[n]=t.authHeaders[n])}},{key:"Bi",value:function(e,t){var n=Ur[e];return"".concat(this.Fi,"/v1/").concat(t,":").concat(n)}}]),e}());function qr(){return"undefined"!=typeof document?document:null}function Hr(e){return new cn(e,!0)}var Kr=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1.5,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:6e4;Object(v.a)(this,e),this.Oe=t,this.timerId=n,this.Qi=r,this.Wi=i,this.Gi=a,this.zi=0,this.Hi=null,this.Ji=Date.now(),this.reset()}return Object(y.a)(e,[{key:"reset",value:function(){this.zi=0}},{key:"Yi",value:function(){this.zi=this.Gi}},{key:"Xi",value:function(e){var t=this;this.cancel();var n=Math.floor(this.zi+this.Zi()),r=Math.max(0,Date.now()-this.Ji),i=Math.max(0,n-r);i>0&&_("ExponentialBackoff","Backing off for ".concat(i," ms (base delay: ").concat(this.zi," ms, delay with jitter: ").concat(n," ms, last attempt: ").concat(r," ms ago)")),this.Hi=this.Oe.enqueueAfterDelay(this.timerId,i,(function(){return t.Ji=Date.now(),e()})),this.zi*=this.Wi,this.zithis.Gi&&(this.zi=this.Gi)}},{key:"tr",value:function(){null!==this.Hi&&(this.Hi.skipDelay(),this.Hi=null)}},{key:"cancel",value:function(){null!==this.Hi&&(this.Hi.cancel(),this.Hi=null)}},{key:"Zi",value:function(){return(Math.random()-.5)*this.zi}}]),e}(),Gr=function(){function e(t,n,r,i,a,o){Object(v.a)(this,e),this.Oe=t,this.er=r,this.nr=i,this.credentialsProvider=a,this.listener=o,this.state=0,this.sr=0,this.ir=null,this.stream=null,this.rr=new Kr(t,n)}return Object(y.a)(e,[{key:"ar",value:function(){return 1===this.state||2===this.state||4===this.state}},{key:"cr",value:function(){return 2===this.state}},{key:"start",value:function(){3!==this.state?this.auth():this.ur()}},{key:"stop",value:function(){var e=Object(c.a)(l.a.mark((function e(){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.ar(),!e.t0){e.next=4;break}return e.next=4,this.close(0);case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"hr",value:function(){this.state=0,this.rr.reset()}},{key:"lr",value:function(){var e=this;this.cr()&&null===this.ir&&(this.ir=this.Oe.enqueueAfterDelay(this.er,6e4,(function(){return e.dr()})))}},{key:"wr",value:function(e){this._r(),this.stream.send(e)}},{key:"dr",value:function(){var e=Object(c.a)(l.a.mark((function e(){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.cr()){e.next=2;break}return e.abrupt("return",this.close(0));case 2:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"_r",value:function(){this.ir&&(this.ir.cancel(),this.ir=null)}},{key:"close",value:function(){var e=Object(c.a)(l.a.mark((function e(t,n){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._r(),this.rr.cancel(),this.sr++,3!==t?this.rr.reset():n&&n.code===D.RESOURCE_EXHAUSTED?(j(n.toString()),j("Using maximum backoff delay to prevent overloading the backend."),this.rr.Yi()):n&&n.code===D.UNAUTHENTICATED&&this.credentialsProvider.invalidateToken(),null!==this.stream&&(this.mr(),this.stream.close(),this.stream=null),this.state=t,e.next=8,this.listener.Ci(n);case 8:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"mr",value:function(){}},{key:"auth",value:function(){var e=this;this.state=1;var t=this.gr(this.sr),n=this.sr;this.credentialsProvider.getToken().then((function(t){e.sr===n&&e.yr(t)}),(function(n){t((function(){var t=new L(D.UNKNOWN,"Fetching auth token failed: "+n.message);return e.pr(t)}))}))}},{key:"yr",value:function(e){var t=this,n=this.gr(this.sr);this.stream=this.Er(e),this.stream.Si((function(){n((function(){return t.state=2,t.listener.Si()}))})),this.stream.Ci((function(e){n((function(){return t.pr(e)}))})),this.stream.onMessage((function(e){n((function(){return t.onMessage(e)}))}))}},{key:"ur",value:function(){var e=this;this.state=4,this.rr.Xi(Object(c.a)(l.a.mark((function t(){return l.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.state=0,e.start();case 1:case"end":return t.stop()}}),t)}))))}},{key:"pr",value:function(e){return _("PersistentStream","close with error: ".concat(e)),this.stream=null,this.close(3,e)}},{key:"gr",value:function(e){var t=this;return function(n){t.Oe.enqueueAndForget((function(){return t.sr===e?n():(_("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())}))}}}]),e}(),Wr=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(e,r,i,a,o){var u;return Object(v.a)(this,n),(u=t.call(this,e,"listen_stream_connection_backoff","listen_stream_idle",r,i,o)).N=a,u}return Object(y.a)(n,[{key:"Er",value:function(e){return this.nr.ji("Listen",e)}},{key:"onMessage",value:function(e){this.rr.reset();var t=function(e,t){var n;if("targetChange"in t){t.targetChange;var r=function(e){return"NO_CHANGE"===e?0:"ADD"===e?1:"REMOVE"===e?2:"CURRENT"===e?3:"RESET"===e?4:C()}(t.targetChange.targetChangeType||"NO_CHANGE"),i=t.targetChange.targetIds||[],a=function(e,t){return e.D?(N(void 0===t||"string"==typeof t),te.fromBase64String(t||"")):(N(void 0===t||t instanceof Uint8Array),te.fromUint8Array(t||new Uint8Array))}(e,t.targetChange.resumeToken),o=t.targetChange.cause,u=o&&function(e){var t=void 0===e.code?D.UNKNOWN:Mt(e.code);return new L(t,e.message||"")}(o);n=new nn(r,i,a,u||null)}else if("documentChange"in t){t.documentChange;var s=t.documentChange;s.document,s.document.name,s.document.updateTime;var l=yn(e,s.document.name),c=dn(s.document.updateTime),f=new Te({mapValue:{fields:s.document.fields}}),h=_e.newFoundDocument(l,c,f),d=s.targetIds||[],p=s.removedTargetIds||[];n=new en(d,p,h.key,h)}else if("documentDelete"in t){t.documentDelete;var v=t.documentDelete;v.document;var y=yn(e,v.document),g=v.readTime?dn(v.readTime):W.min(),m=_e.newNoDocument(y,g),b=v.removedTargetIds||[];n=new en([],b,m.key,m)}else if("documentRemove"in t){t.documentRemove;var k=t.documentRemove;k.document;var w=yn(e,k.document),E=k.removedTargetIds||[];n=new en([],E,w,null)}else{if(!("filter"in t))return C();t.filter;var O=t.filter;O.targetId;var S=O.count||0,T=new Ft(S),_=O.targetId;n=new tn(_,T)}return n}(this.N,e),n=function(e){if(!("targetChange"in e))return W.min();var t=e.targetChange;return t.targetIds&&t.targetIds.length?W.min():t.readTime?dn(t.readTime):W.min()}(e);return this.listener.Tr(t,n)}},{key:"Ir",value:function(e){var t={};t.database=bn(this.N),t.addTarget=function(e,t){var n,r=t.target;return(n=Ne(r)?{documents:wn(e,r)}:{query:En(e,r)}).targetId=t.targetId,t.resumeToken.approximateByteSize()>0?n.resumeToken=hn(e,t.resumeToken):t.snapshotVersion.compareTo(W.min())>0&&(n.readTime=fn(e,t.snapshotVersion.toTimestamp())),n}(this.N,e);var n=function(e,t){var n=function(e,t){switch(t){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return C()}}(0,t.purpose);return null==n?null:{"goog-listen-tags":n}}(this.N,e);n&&(t.labels=n),this.wr(t)}},{key:"Ar",value:function(e){var t={};t.database=bn(this.N),t.removeTarget=e,this.wr(t)}}]),n}(Gr),Qr=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(e,r,i){var a;return Object(v.a)(this,n),(a=t.call(this)).credentials=e,a.nr=r,a.N=i,a.Dr=!1,a}return Object(y.a)(n,[{key:"Cr",value:function(){if(this.Dr)throw new L(D.FAILED_PRECONDITION,"The client has already been terminated.")}},{key:"Li",value:function(e,t,n){var r=this;return this.Cr(),this.credentials.getToken().then((function(i){return r.nr.Li(e,t,n,i)})).catch((function(e){throw"FirebaseError"===e.name?(e.code===D.UNAUTHENTICATED&&r.credentials.invalidateToken(),e):new L(D.UNKNOWN,e.toString())}))}},{key:"Ki",value:function(e,t,n){var r=this;return this.Cr(),this.credentials.getToken().then((function(i){return r.nr.Ki(e,t,n,i)})).catch((function(e){throw"FirebaseError"===e.name?(e.code===D.UNAUTHENTICATED&&r.credentials.invalidateToken(),e):new L(D.UNKNOWN,e.toString())}))}},{key:"terminate",value:function(){this.Dr=!0}}]),n}(function(){return function e(){Object(v.a)(this,e)}}()),$r=function(){function e(t,n){Object(v.a)(this,e),this.asyncQueue=t,this.onlineStateHandler=n,this.state="Unknown",this.Nr=0,this.kr=null,this.$r=!0}return Object(y.a)(e,[{key:"Or",value:function(){var e=this;0===this.Nr&&(this.Fr("Unknown"),this.kr=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(function(){return e.kr=null,e.Mr("Backend didn't respond within 10 seconds."),e.Fr("Offline"),Promise.resolve()})))}},{key:"Lr",value:function(e){"Online"===this.state?this.Fr("Unknown"):(this.Nr++,this.Nr>=1&&(this.Br(),this.Mr("Connection failed 1 times. Most recent error: ".concat(e.toString())),this.Fr("Offline")))}},{key:"set",value:function(e){this.Br(),this.Nr=0,"Online"===e&&(this.$r=!1),this.Fr(e)}},{key:"Fr",value:function(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}},{key:"Mr",value:function(e){var t="Could not reach Cloud Firestore backend. ".concat(e,"\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.");this.$r?(j(t),this.$r=!1):_("OnlineStateTracker",t)}},{key:"Br",value:function(){null!==this.kr&&(this.kr.cancel(),this.kr=null)}}]),e}(),Yr=function e(t,n,r,i,a){var o=this;Object(v.a)(this,e),this.localStore=t,this.datastore=n,this.asyncQueue=r,this.remoteSyncer={},this.Ur=[],this.qr=new Map,this.Kr=new Set,this.jr=[],this.Qr=a,this.Qr.Ei((function(e){r.enqueueAndForget(Object(c.a)(l.a.mark((function e(){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=ui(o),!e.t0){e.next=5;break}return _("RemoteStore","Restarting streams for network reachability change."),e.next=5,function(){var e=Object(c.a)(l.a.mark((function e(t){var n;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=A(t)).Kr.add(4),e.next=4,Zr(n);case 4:return n.Wr.set("Unknown"),n.Kr.delete(4),e.next=8,Xr(n);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()(o);case 5:case"end":return e.stop()}}),e)}))))})),this.Wr=new $r(r,i)};function Xr(e){return Jr.apply(this,arguments)}function Jr(){return(Jr=Object(c.a)(l.a.mark((function e(t){var n,r,i;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!ui(t)){e.next=18;break}n=Object(u.a)(t.jr),e.prev=2,n.s();case 4:if((r=n.n()).done){e.next=10;break}return i=r.value,e.next=8,i(!0);case 8:e.next=4;break;case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(2),n.e(e.t0);case 15:return e.prev=15,n.f(),e.finish(15);case 18:case"end":return e.stop()}}),e,null,[[2,12,15,18]])})))).apply(this,arguments)}function Zr(e){return ei.apply(this,arguments)}function ei(){return(ei=Object(c.a)(l.a.mark((function e(t){var n,r,i;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Object(u.a)(t.jr),e.prev=1,n.s();case 3:if((r=n.n()).done){e.next=9;break}return i=r.value,e.next=7,i(!1);case 7:e.next=3;break;case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),n.e(e.t0);case 14:return e.prev=14,n.f(),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[1,11,14,17]])})))).apply(this,arguments)}function ti(e,t){var n=A(e);n.qr.has(t.targetId)||(n.qr.set(t.targetId,t),oi(n)?ai(n):bi(n).cr()&&ri(n,t))}function ni(e,t){var n=A(e),r=bi(n);n.qr.delete(t),r.cr()&&ii(n,t),0===n.qr.size&&(r.cr()?r.lr():ui(n)&&n.Wr.set("Unknown"))}function ri(e,t){e.Gr.Y(t.targetId),bi(e).Ir(t)}function ii(e,t){e.Gr.Y(t),bi(e).Ar(t)}function ai(e){e.Gr=new an({getRemoteKeysForTarget:function(t){return e.remoteSyncer.getRemoteKeysForTarget(t)},Et:function(t){return e.qr.get(t)||null}}),bi(e).start(),e.Wr.Or()}function oi(e){return ui(e)&&!bi(e).ar()&&e.qr.size>0}function ui(e){return 0===A(e).Kr.size}function si(e){e.Gr=void 0}function li(e){return ci.apply(this,arguments)}function ci(){return(ci=Object(c.a)(l.a.mark((function e(t){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t.qr.forEach((function(e,n){ri(t,e)}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function fi(e,t){return hi.apply(this,arguments)}function hi(){return(hi=Object(c.a)(l.a.mark((function e(t,n){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:si(t),oi(t)?(t.Wr.Lr(n),ai(t)):t.Wr.set("Unknown");case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function di(e,t,n){return pi.apply(this,arguments)}function pi(){return pi=Object(c.a)(l.a.mark((function e(t,n,r){var i;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.Wr.set("Online"),!(n instanceof nn&&2===n.state&&n.cause)){e.next=13;break}return e.prev=1,e.next=4,function(){var e=Object(c.a)(l.a.mark((function e(t,n){var r,i,a,o;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=n.cause,i=Object(u.a)(n.targetIds),e.prev=2,i.s();case 4:if((a=i.n()).done){e.next=14;break}if(o=a.value,e.t0=t.qr.has(o),!e.t0){e.next=12;break}return e.next=10,t.remoteSyncer.rejectListen(o,r);case 10:t.qr.delete(o),t.Gr.removeTarget(o);case 12:e.next=4;break;case 14:e.next=19;break;case 16:e.prev=16,e.t1=e.catch(2),i.e(e.t1);case 19:return e.prev=19,i.f(),e.finish(19);case 22:case"end":return e.stop()}}),e,null,[[2,16,19,22]])})));return function(t,n){return e.apply(this,arguments)}}()(t,n);case 4:e.next=11;break;case 6:return e.prev=6,e.t0=e.catch(1),_("RemoteStore","Failed to remove targets %s: %s ",n.targetIds.join(","),e.t0),e.next=11,vi(t,e.t0);case 11:case 22:e.next=29;break;case 13:if(n instanceof en?t.Gr.rt(n):n instanceof tn?t.Gr.ft(n):t.Gr.ct(n),r.isEqual(W.min())){e.next=29;break}return e.prev=14,e.next=17,br(t.localStore);case 17:if(i=e.sent,e.t1=r.compareTo(i)>=0,!e.t1){e.next=22;break}return e.next=22,function(e,t){var n=e.Gr._t(t);return n.targetChanges.forEach((function(n,r){if(n.resumeToken.approximateByteSize()>0){var i=e.qr.get(r);i&&e.qr.set(r,i.withResumeToken(n.resumeToken,t))}})),n.targetMismatches.forEach((function(t){var n=e.qr.get(t);if(n){e.qr.set(t,n.withResumeToken(te.EMPTY_BYTE_STRING,n.snapshotVersion)),ii(e,t);var r=new tr(n.target,t,1,n.sequenceNumber);ri(e,r)}})),e.remoteSyncer.applyRemoteEvent(n)}(t,r);case 24:return e.prev=24,e.t2=e.catch(14),_("RemoteStore","Failed to raise snapshot:",e.t2),e.next=29,vi(t,e.t2);case 29:case"end":return e.stop()}}),e,null,[[1,6],[14,24]])}))),pi.apply(this,arguments)}function vi(e,t,n){return yi.apply(this,arguments)}function yi(){return(yi=Object(c.a)(l.a.mark((function e(t,n,r){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zn(n)){e.next=2;break}throw n;case 2:return t.Kr.add(1),e.next=5,Zr(t);case 5:t.Wr.set("Offline"),r||(r=function(){return br(t.localStore)}),t.asyncQueue.enqueueRetryable(Object(c.a)(l.a.mark((function e(){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return _("RemoteStore","Retrying IndexedDB access"),e.next=3,r();case 3:return t.Kr.delete(1),e.next=6,Xr(t);case 6:case"end":return e.stop()}}),e)}))));case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function gi(e,t){return mi.apply(this,arguments)}function mi(){return(mi=Object(c.a)(l.a.mark((function e(t,n){var r;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=A(t),!n){e.next=7;break}return r.Kr.delete(2),e.next=5,Xr(r);case 5:e.next=13;break;case 7:if(e.t0=n,e.t0){e.next=13;break}return r.Kr.add(2),e.next=12,Zr(r);case 12:r.Wr.set("Unknown");case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function bi(e){return e.zr||(e.zr=function(e,t,n){var r=A(e);return r.Cr(),new Wr(t,r.nr,r.credentials,r.N,n)}(e.datastore,e.asyncQueue,{Si:li.bind(null,e),Ci:fi.bind(null,e),Tr:di.bind(null,e)}),e.jr.push(function(){var t=Object(c.a)(l.a.mark((function t(n){return l.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!n){t.next=4;break}e.zr.hr(),oi(e)?ai(e):e.Wr.set("Unknown"),t.next=7;break;case 4:return t.next=6,e.zr.stop();case 6:si(e);case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())),e.zr}var ki=function(){function e(t,n,r,i,a){Object(v.a)(this,e),this.asyncQueue=t,this.timerId=n,this.targetTimeMs=r,this.op=i,this.removalCallback=a,this.deferred=new P,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((function(e){}))}return Object(y.a)(e,[{key:"start",value:function(e){var t=this;this.timerHandle=setTimeout((function(){return t.handleDelayElapsed()}),e)}},{key:"skipDelay",value:function(){return this.handleDelayElapsed()}},{key:"cancel",value:function(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new L(D.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}},{key:"handleDelayElapsed",value:function(){var e=this;this.asyncQueue.enqueueAndForget((function(){return null!==e.timerHandle?(e.clearTimeout(),e.op().then((function(t){return e.deferred.resolve(t)}))):Promise.resolve()}))}},{key:"clearTimeout",value:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}))}],[{key:"createAndSchedule",value:function(t,n,r,i,a){var o=new e(t,n,Date.now()+r,i,a);return o.start(r),o}}]),e}();function wi(e,t){if(j("AsyncQueue","".concat(t,": ").concat(e)),Zn(e))return new L(D.UNAVAILABLE,"".concat(t,": ").concat(e));throw e}var Ei=function(){function e(t){Object(v.a)(this,e),this.comparator=t?function(e,n){return t(e,n)||fe.comparator(e.key,n.key)}:function(e,t){return fe.comparator(e.key,t.key)},this.keyedMap=Wt(),this.sortedSet=new Vt(this.comparator)}return Object(y.a)(e,[{key:"has",value:function(e){return null!=this.keyedMap.get(e)}},{key:"get",value:function(e){return this.keyedMap.get(e)}},{key:"first",value:function(){return this.sortedSet.minKey()}},{key:"last",value:function(){return this.sortedSet.maxKey()}},{key:"isEmpty",value:function(){return this.sortedSet.isEmpty()}},{key:"indexOf",value:function(e){var t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}},{key:"size",get:function(){return this.sortedSet.size}},{key:"forEach",value:function(e){this.sortedSet.inorderTraversal((function(t,n){return e(t),!1}))}},{key:"add",value:function(e){var t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}},{key:"delete",value:function(e){var t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}},{key:"isEqual",value:function(t){if(!(t instanceof e))return!1;if(this.size!==t.size)return!1;for(var n=this.sortedSet.getIterator(),r=t.sortedSet.getIterator();n.hasNext();){var i=n.getNext().key,a=r.getNext().key;if(!i.isEqual(a))return!1}return!0}},{key:"toString",value:function(){var e=[];return this.forEach((function(t){e.push(t.toString())})),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"}},{key:"copy",value:function(t,n){var r=new e;return r.comparator=this.comparator,r.keyedMap=t,r.sortedSet=n,r}}],[{key:"emptySet",value:function(t){return new e(t.comparator)}}]),e}(),Oi=function(){function e(){Object(v.a)(this,e),this.Jr=new Vt(fe.comparator)}return Object(y.a)(e,[{key:"track",value:function(e){var t=e.doc.key,n=this.Jr.get(t);n?0!==e.type&&3===n.type?this.Jr=this.Jr.insert(t,e):3===e.type&&1!==n.type?this.Jr=this.Jr.insert(t,{type:n.type,doc:e.doc}):2===e.type&&2===n.type?this.Jr=this.Jr.insert(t,{type:2,doc:e.doc}):2===e.type&&0===n.type?this.Jr=this.Jr.insert(t,{type:0,doc:e.doc}):1===e.type&&0===n.type?this.Jr=this.Jr.remove(t):1===e.type&&2===n.type?this.Jr=this.Jr.insert(t,{type:1,doc:n.doc}):0===e.type&&1===n.type?this.Jr=this.Jr.insert(t,{type:2,doc:e.doc}):C():this.Jr=this.Jr.insert(t,e)}},{key:"Yr",value:function(){var e=[];return this.Jr.inorderTraversal((function(t,n){e.push(n)})),e}}]),e}(),Si=function(){function e(t,n,r,i,a,o,u,s){Object(v.a)(this,e),this.query=t,this.docs=n,this.oldDocs=r,this.docChanges=i,this.mutatedKeys=a,this.fromCache=o,this.syncStateChanged=u,this.excludesMetadataChanges=s}return Object(y.a)(e,[{key:"hasPendingWrites",get:function(){return!this.mutatedKeys.isEmpty()}},{key:"isEqual",value:function(e){if(!(this.fromCache===e.fromCache&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&it(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;var t=this.docChanges,n=e.docChanges;if(t.length!==n.length)return!1;for(var r=0;r=0&&(o.listeners.splice(u,1),a=0===o.listeners.length),!a){e.next=6;break}return e.abrupt("return",(r.queries.delete(i),r.onUnlisten(i)));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ni(e,t){var n,r=A(e),i=!1,a=Object(u.a)(t);try{for(a.s();!(n=a.n()).done;){var o=n.value,s=o.query,l=r.queries.get(s);if(l){var c,f=Object(u.a)(l.listeners);try{for(f.s();!(c=f.n()).done;){c.value.no(o)&&(i=!0)}}catch(h){f.e(h)}finally{f.f()}l.Xr=o}}}catch(h){a.e(h)}finally{a.f()}i&&Di(r)}function Ai(e,t,n){var r=A(e),i=r.queries.get(t);if(i){var a,o=Object(u.a)(i.listeners);try{for(o.s();!(a=o.n()).done;){a.value.onError(n)}}catch(s){o.e(s)}finally{o.f()}}r.queries.delete(t)}function Di(e){e.Zr.forEach((function(e){e.next()}))}var Li=function(){function e(t,n,r){Object(v.a)(this,e),this.query=t,this.so=n,this.io=!1,this.ro=null,this.onlineState="Unknown",this.options=r||{}}return Object(y.a)(e,[{key:"no",value:function(e){if(!this.options.includeMetadataChanges){var t,n=[],r=Object(u.a)(e.docChanges);try{for(r.s();!(t=r.n()).done;){var i=t.value;3!==i.type&&n.push(i)}}catch(o){r.e(o)}finally{r.f()}e=new Si(e.query,e.docs,e.oldDocs,n,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0)}var a=!1;return this.io?this.oo(e)&&(this.so.next(e),a=!0):this.ao(e,this.onlineState)&&(this.co(e),a=!0),this.ro=e,a}},{key:"onError",value:function(e){this.so.error(e)}},{key:"eo",value:function(e){this.onlineState=e;var t=!1;return this.ro&&!this.io&&this.ao(this.ro,e)&&(this.co(this.ro),t=!0),t}},{key:"ao",value:function(e,t){if(!e.fromCache)return!0;var n="Offline"!==t;return(!this.options.uo||!n)&&(!e.docs.isEmpty()||"Offline"===t)}},{key:"oo",value:function(e){if(e.docChanges.length>0)return!0;var t=this.ro&&this.ro.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}},{key:"co",value:function(e){e=Si.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache),this.io=!0,this.so.next(e)}}]),e}();var Pi=function e(t){Object(v.a)(this,e),this.key=t},Ri=function e(t){Object(v.a)(this,e),this.key=t},Fi=function(){function e(t,n){Object(v.a)(this,e),this.query=t,this._o=n,this.mo=null,this.current=!1,this.yo=$t(),this.mutatedKeys=$t(),this.po=st(t),this.Eo=new Ei(this.po)}return Object(y.a)(e,[{key:"To",get:function(){return this._o}},{key:"Io",value:function(e,t){var n=this,r=t?t.Ao:new Oi,i=t?t.Eo:this.Eo,a=t?t.mutatedKeys:this.mutatedKeys,o=i,u=!1,s=Ye(this.query)&&i.size===this.query.limit?i.last():null,l=Xe(this.query)&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal((function(e,t){var c=i.get(e),f=ut(n.query,t)?t:null,h=!!c&&n.mutatedKeys.has(c.key),d=!!f&&(f.hasLocalMutations||n.mutatedKeys.has(f.key)&&f.hasCommittedMutations),p=!1;c&&f?c.data.isEqual(f.data)?h!==d&&(r.track({type:3,doc:f}),p=!0):n.Ro(c,f)||(r.track({type:2,doc:f}),p=!0,(s&&n.po(f,s)>0||l&&n.po(f,l)<0)&&(u=!0)):!c&&f?(r.track({type:0,doc:f}),p=!0):c&&!f&&(r.track({type:1,doc:c}),p=!0,(s||l)&&(u=!0)),p&&(f?(o=o.add(f),a=d?a.add(e):a.delete(e)):(o=o.delete(e),a=a.delete(e)))})),Ye(this.query)||Xe(this.query))for(;o.size>this.query.limit;){var c=Ye(this.query)?o.last():o.first();o=o.delete(c.key),a=a.delete(c.key),r.track({type:1,doc:c})}return{Eo:o,Ao:r,Ln:u,mutatedKeys:a}}},{key:"Ro",value:function(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}},{key:"applyChanges",value:function(e,t,n){var r=this,i=this.Eo;this.Eo=e.Eo,this.mutatedKeys=e.mutatedKeys;var a=e.Ao.Yr();a.sort((function(e,t){return function(e,t){var n=function(e){switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return C()}};return n(e)-n(t)}(e.type,t.type)||r.po(e.doc,t.doc)})),this.bo(n);var o=t?this.Po():[],u=0===this.yo.size&&this.current?1:0,s=u!==this.mo;return this.mo=u,0!==a.length||s?{snapshot:new Si(this.query,e.Eo,i,a,e.mutatedKeys,0===u,s,!1),vo:o}:{vo:o}}},{key:"eo",value:function(e){return this.current&&"Offline"===e?(this.current=!1,this.applyChanges({Eo:this.Eo,Ao:new Oi,mutatedKeys:this.mutatedKeys,Ln:!1},!1)):{vo:[]}}},{key:"Vo",value:function(e){return!this._o.has(e)&&!!this.Eo.has(e)&&!this.Eo.get(e).hasLocalMutations}},{key:"bo",value:function(e){var t=this;e&&(e.addedDocuments.forEach((function(e){return t._o=t._o.add(e)})),e.modifiedDocuments.forEach((function(e){})),e.removedDocuments.forEach((function(e){return t._o=t._o.delete(e)})),this.current=e.current)}},{key:"Po",value:function(){var e=this;if(!this.current)return[];var t=this.yo;this.yo=$t(),this.Eo.forEach((function(t){e.Vo(t.key)&&(e.yo=e.yo.add(t.key))}));var n=[];return t.forEach((function(t){e.yo.has(t)||n.push(new Ri(t))})),this.yo.forEach((function(e){t.has(e)||n.push(new Pi(e))})),n}},{key:"So",value:function(e){this._o=e.Gn,this.yo=$t();var t=this.Io(e.documents);return this.applyChanges(t,!0)}},{key:"Do",value:function(){return Si.fromInitialDocuments(this.query,this.Eo,this.mutatedKeys,0===this.mo)}}]),e}(),Mi=function e(t,n,r){Object(v.a)(this,e),this.query=t,this.targetId=n,this.view=r},Vi=function e(t){Object(v.a)(this,e),this.key=t,this.Co=!1},Ui=function(){function e(t,n,r,i,a,o){Object(v.a)(this,e),this.localStore=t,this.remoteStore=n,this.eventManager=r,this.sharedClientState=i,this.currentUser=a,this.maxConcurrentLimboResolutions=o,this.No={},this.xo=new cr((function(e){return at(e)}),it),this.ko=new Map,this.$o=new Set,this.Oo=new Vt(fe.comparator),this.Fo=new Map,this.Mo=new jr,this.Lo={},this.Bo=new Map,this.Uo=ur.ie(),this.onlineState="Unknown",this.qo=void 0}return Object(y.a)(e,[{key:"isPrimaryClient",get:function(){return!0===this.qo}}]),e}();function zi(e,t){return Bi.apply(this,arguments)}function Bi(){return(Bi=Object(c.a)(l.a.mark((function e(t,n){var r,i,a,o,u,s;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=sa(t),!(o=r.xo.get(n))){e.next=6;break}i=o.targetId,r.sharedClientState.addLocalQueryTarget(i),a=o.view.Do(),e.next=15;break;case 6:return e.next=8,Er(r.localStore,nt(n));case 8:return u=e.sent,s=r.sharedClientState.addLocalQueryTarget(u.targetId),i=u.targetId,e.next=13,qi(r,n,i,"current"===s);case 13:a=e.sent,r.isPrimaryClient&&ti(r.remoteStore,u);case 15:return e.abrupt("return",a);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qi(e,t,n,r){return Hi.apply(this,arguments)}function Hi(){return Hi=Object(c.a)(l.a.mark((function e(t,n,r,i){var a,o,u,s,f,h;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.Ko=function(e,n,r){return function(){var e=Object(c.a)(l.a.mark((function e(t,n,r,i){var a,o,u;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=n.view.Io(r),e.t0=a.Ln,!e.t0){e.next=6;break}return e.next=5,Tr(t.localStore,n.query,!1).then((function(e){var t=e.documents;return n.view.Io(t,a)}));case 5:a=e.sent;case 6:return o=i&&i.targetChanges.get(n.targetId),u=n.view.applyChanges(a,t.isPrimaryClient,o),e.abrupt("return",(ea(t,n.targetId,u.vo),u.snapshot));case 8:case"end":return e.stop()}}),e)})));return function(t,n,r,i){return e.apply(this,arguments)}}()(t,e,n,r)},e.next=3,Tr(t.localStore,n,!0);case 3:return a=e.sent,o=new Fi(n,a.Gn),u=o.Io(a.documents),s=Zt.createSynthesizedTargetChangeForCurrentChange(r,i&&"Offline"!==t.onlineState),f=o.applyChanges(u,t.isPrimaryClient,s),ea(t,r,f.vo),h=new Mi(n,r,o),e.abrupt("return",(t.xo.set(n,h),t.ko.has(r)?t.ko.get(r).push(n):t.ko.set(r,[n]),f.snapshot));case 11:case"end":return e.stop()}}),e)}))),Hi.apply(this,arguments)}function Ki(e,t){return Gi.apply(this,arguments)}function Gi(){return(Gi=Object(c.a)(l.a.mark((function e(t,n){var r,i,a;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=A(t),i=r.xo.get(n),!((a=r.ko.get(i.targetId)).length>1)){e.next=3;break}return e.abrupt("return",(r.ko.set(i.targetId,a.filter((function(e){return!it(e,n)}))),void r.xo.delete(n)));case 3:if(!r.isPrimaryClient){e.next=11;break}if(r.sharedClientState.removeLocalQueryTarget(i.targetId),e.t0=r.sharedClientState.isActiveQueryTarget(i.targetId),e.t0){e.next=9;break}return e.next=9,Or(r.localStore,i.targetId,!1).then((function(){r.sharedClientState.clearQueryState(i.targetId),ni(r.remoteStore,i.targetId),Ji(r,i.targetId)})).catch(sr);case 9:e.next=14;break;case 11:return Ji(r,i.targetId),e.next=14,Or(r.localStore,i.targetId,!0);case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Wi(e,t){return Qi.apply(this,arguments)}function Qi(){return(Qi=Object(c.a)(l.a.mark((function e(t,n){var r,i;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=A(t),e.prev=1,e.next=4,kr(r.localStore,n);case 4:return i=e.sent,n.targetChanges.forEach((function(e,t){var n=r.Fo.get(t);n&&(N(e.addedDocuments.size+e.modifiedDocuments.size+e.removedDocuments.size<=1),e.addedDocuments.size>0?n.Co=!0:e.modifiedDocuments.size>0?N(n.Co):e.removedDocuments.size>0&&(N(n.Co),n.Co=!1))})),e.next=8,ra(r,i,n);case 8:e.next=14;break;case 10:return e.prev=10,e.t0=e.catch(1),e.next=14,sr(e.t0);case 14:case"end":return e.stop()}}),e,null,[[1,10]])})))).apply(this,arguments)}function $i(e,t,n){var r=A(e);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){var i=[];r.xo.forEach((function(e,n){var r=n.view.eo(t);r.snapshot&&i.push(r.snapshot)})),function(e,t){var n=A(e);n.onlineState=t;var r=!1;n.queries.forEach((function(e,n){var i,a=Object(u.a)(n.listeners);try{for(a.s();!(i=a.n()).done;){i.value.eo(t)&&(r=!0)}}catch(o){a.e(o)}finally{a.f()}})),r&&Di(n)}(r.eventManager,t),i.length&&r.No.Tr(i),r.onlineState=t,r.isPrimaryClient&&r.sharedClientState.setOnlineState(t)}}function Yi(e,t,n){return Xi.apply(this,arguments)}function Xi(){return(Xi=Object(c.a)(l.a.mark((function e(t,n,r){var i,a,o,u,s,c;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((i=A(t)).sharedClientState.updateQueryState(n,"rejected",r),a=i.Fo.get(n),!(o=a&&a.key)){e.next=14;break}return u=(u=new Vt(fe.comparator)).insert(o,_e.newNoDocument(o,W.min())),s=$t().add(o),c=new Jt(W.min(),new Map,new Bt(H),u,s),e.next=9,Wi(i,c);case 9:i.Oo=i.Oo.remove(o),i.Fo.delete(n),na(i),e.next=16;break;case 14:return e.next=16,Or(i.localStore,n,!1).then((function(){return Ji(i,n,r)})).catch(sr);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ji(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e.sharedClientState.removeLocalQueryTarget(t);var r,i=Object(u.a)(e.ko.get(t));try{for(i.s();!(r=i.n()).done;){var a=r.value;e.xo.delete(a),n&&e.No.jo(a,n)}}catch(o){i.e(o)}finally{i.f()}e.ko.delete(t),e.isPrimaryClient&&e.Mo.cs(t).forEach((function(t){e.Mo.containsKey(t)||Zi(e,t)}))}function Zi(e,t){e.$o.delete(t.path.canonicalString());var n=e.Oo.get(t);null!==n&&(ni(e.remoteStore,n),e.Oo=e.Oo.remove(t),e.Fo.delete(n),na(e))}function ea(e,t,n){var r,i=Object(u.a)(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;a instanceof Pi?(e.Mo.addReference(a.key,t),ta(e,a)):a instanceof Ri?(_("SyncEngine","Document no longer in limbo: "+a.key),e.Mo.removeReference(a.key,t),e.Mo.containsKey(a.key)||Zi(e,a.key)):C()}}catch(o){i.e(o)}finally{i.f()}}function ta(e,t){var n=t.key,r=n.path.canonicalString();e.Oo.get(n)||e.$o.has(r)||(_("SyncEngine","New document in limbo: "+n),e.$o.add(r),na(e))}function na(e){for(;e.$o.size>0&&e.Oo.size2&&void 0!==arguments[2]?arguments[2]:{},r=new P;return e.asyncQueue.enqueueAndForget(Object(c.a)(l.a.mark((function i(){return l.a.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.t0=function(e,t,n,r,i){var a=new fa({next:function(n){t.enqueueAndForget((function(){return xi(e,o)})),n.fromCache&&"server"===r.source?i.reject(new L(D.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):i.resolve(n)},error:function(e){return i.reject(e)}}),o=new Li(n,a,{includeMetadataChanges:!0,uo:!0});return ji(e,o)},i.next=3,wa(e);case 3:return i.t1=i.sent,i.t2=e.asyncQueue,i.t3=t,i.t4=n,i.t5=r,i.abrupt("return",(0,i.t0)(i.t1,i.t2,i.t3,i.t4,i.t5));case 9:case"end":return i.stop()}}),i)})))),r.promise}var Sa=function e(t,n,r,i,a,o,u,s){Object(v.a)(this,e),this.databaseId=t,this.appId=n,this.persistenceKey=r,this.host=i,this.ssl=a,this.forceLongPolling=o,this.autoDetectLongPolling=u,this.useFetchStreams=s},Ta=function(){function e(t,n){Object(v.a)(this,e),this.projectId=t,this.database=n||"(default)"}return Object(y.a)(e,[{key:"isDefaultDatabase",get:function(){return"(default)"===this.database}},{key:"isEqual",value:function(t){return t instanceof e&&t.projectId===this.projectId&&t.database===this.database}}]),e}(),_a=new Map;function ja(e,t,n){if(!n)throw new L(D.INVALID_ARGUMENT,"Function ".concat(e,"() cannot be called with an empty ").concat(t,"."))}function Ia(e){if(fe.isDocumentKey(e))throw new L(D.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but ".concat(e," has ").concat(e.length,"."))}function xa(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return e.length>20&&(e="".concat(e.substring(0,20),"...")),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"==typeof e){if(e instanceof Array)return"an array";var t=function(e){return e.constructor?e.constructor.name:null}(e);return t?"a custom ".concat(t," object"):"an object"}return"function"==typeof e?"a function":C()}function Ca(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new L(D.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");var n=xa(e);throw new L(D.INVALID_ARGUMENT,"Expected type '".concat(t.name,"', but it was: ").concat(n))}return e}var Na=function(){function e(t){var n;if(Object(v.a)(this,e),void 0===t.host){if(void 0!==t.ssl)throw new L(D.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=t.host,this.ssl=null===(n=t.ssl)||void 0===n||n;if(this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,void 0===t.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new L(D.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.useFetchStreams=!!t.useFetchStreams,function(e,t,n,r){if(!0===t&&!0===r)throw new L(D.INVALID_ARGUMENT,"".concat(e," and ").concat(n," cannot be used together."))}("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling)}return Object(y.a)(e,[{key:"isEqual",value:function(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}]),e}(),Aa=function(){function e(t,n){Object(v.a)(this,e),this._credentials=n,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Na({}),this._settingsFrozen=!1,t instanceof Ta?this._databaseId=t:(this._app=t,this._databaseId=function(e){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new L(D.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Ta(e.options.projectId)}(t))}return Object(y.a)(e,[{key:"app",get:function(){if(!this._app)throw new L(D.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}},{key:"_initialized",get:function(){return this._settingsFrozen}},{key:"_terminated",get:function(){return void 0!==this._terminateTask}},{key:"_setSettings",value:function(e){if(this._settingsFrozen)throw new L(D.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new Na(e),void 0!==e.credentials&&(this._credentials=function(e){if(!e)return new F;switch(e.type){case"gapi":var t=e.client;return N(!("object"!=typeof t||null===t||!t.auth||!t.auth.getAuthHeaderValueForFirstParty)),new U(t,e.sessionIndex||"0",e.iamToken||null);case"provider":return e.client;default:throw new L(D.INVALID_ARGUMENT,"makeCredentialsProvider failed due to invalid credential type")}}(e.credentials))}},{key:"_getSettings",value:function(){return this._settings}},{key:"_freezeSettings",value:function(){return this._settingsFrozen=!0,this._settings}},{key:"_delete",value:function(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}},{key:"toJSON",value:function(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}},{key:"_terminate",value:function(){return function(e){var t=_a.get(e);t&&(_("ComponentProvider","Removing Datastore"),_a.delete(e),t.terminate())}(this),Promise.resolve()}}]),e}();var Da=function(){function e(t,n,r){Object(v.a)(this,e),this.converter=n,this._key=r,this.type="document",this.firestore=t}return Object(y.a)(e,[{key:"_path",get:function(){return this._key.path}},{key:"id",get:function(){return this._key.path.lastSegment()}},{key:"path",get:function(){return this._key.path.canonicalString()}},{key:"parent",get:function(){return new Pa(this.firestore,this.converter,this._key.path.popLast())}},{key:"withConverter",value:function(t){return new e(this.firestore,t,this._key)}}]),e}(),La=function(){function e(t,n,r){Object(v.a)(this,e),this.converter=n,this._query=r,this.type="query",this.firestore=t}return Object(y.a)(e,[{key:"withConverter",value:function(t){return new e(this.firestore,t,this._query)}}]),e}(),Pa=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(e,r,i){var a;return Object(v.a)(this,n),(a=t.call(this,e,r,$e(i)))._path=i,a.type="collection",a}return Object(y.a)(n,[{key:"id",get:function(){return this._query.path.lastSegment()}},{key:"path",get:function(){return this._query.path.canonicalString()}},{key:"parent",get:function(){var e=this._path.popLast();return e.isEmpty()?null:new Da(this.firestore,null,new fe(e))}},{key:"withConverter",value:function(e){return new n(this.firestore,e,this._path)}}]),n}(La);function Ra(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i0&&this.rr.Xi((function(){return t.Aa()}));case 14:case"end":return e.stop()}}),e,this,[[1,8]])})));return function(){return e.apply(this,arguments)}}()},{key:"Ia",value:function(e){var t=this,n=this.fa.then((function(){return t.ga=!0,e().catch((function(e){throw t.ma=e,t.ga=!1,j("INTERNAL UNHANDLED ERROR: ",function(e){var t=e.message||"";return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t}(e)),e})).then((function(e){return t.ga=!1,e}))}));return this.fa=n,n}},{key:"enqueueAfterDelay",value:function(e,t,n){var r=this;this.Ta(),this.pa.indexOf(e)>-1&&(t=0);var i=ki.createAndSchedule(this,e,t,n,(function(e){return r.Ra(e)}));return this._a.push(i),i}},{key:"Ta",value:function(){this.ma&&C()}},{key:"verifyOperationInProgress",value:function(){}},{key:"ba",value:function(){var e=Object(c.a)(l.a.mark((function e(){var t;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.fa,e.next=3,t;case 3:if(t!==this.fa){e.next=0;break}case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"Pa",value:function(e){var t,n=Object(u.a)(this._a);try{for(n.s();!(t=n.n()).done;){if(t.value.timerId===e)return!0}}catch(r){n.e(r)}finally{n.f()}return!1}},{key:"va",value:function(e){var t=this;return this.ba().then((function(){t._a.sort((function(e,t){return e.targetTimeMs-t.targetTimeMs}));var n,r=Object(u.a)(t._a);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.skipDelay(),"all"!==e&&i.timerId===e)break}}catch(a){r.e(a)}finally{r.f()}return t.ba()}))}},{key:"Va",value:function(e){this.pa.push(e)}},{key:"Ra",value:function(e){var t=this._a.indexOf(e);this._a.splice(t,1)}}]),e}();var Ma=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(e,r){var i;return Object(v.a)(this,n),(i=t.call(this,e,r)).type="firestore",i._queue=new Fa,i._persistenceKey="name"in e?e.name:"[DEFAULT]",i}return Object(y.a)(n,[{key:"_terminate",value:function(){return this._firestoreClient||za(this),this._firestoreClient.terminate()}}]),n}(Aa);function Va(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Object(g.e)();return Object(g.b)(e,"firestore").getImmediate()}function Ua(e){return e._firestoreClient||za(e),e._firestoreClient.verifyNotTerminated(),e._firestoreClient}function za(e){var t,n=e._freezeSettings(),r=function(e,t,n,r){return new Sa(e,t,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,r.useFetchStreams)}(e._databaseId,(null===(t=e._app)||void 0===t?void 0:t.options.appId)||"",e._persistenceKey,n);e._firestoreClient=new ha(e._credentials,e._queue,r)}var Ba=function(){function e(){Object(v.a)(this,e);for(var t=arguments.length,n=new Array(t),r=0;r90)throw new L(D.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(n)||n<-180||n>180)throw new L(D.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=t,this._long=n}return Object(y.a)(e,[{key:"latitude",get:function(){return this._lat}},{key:"longitude",get:function(){return this._long}},{key:"isEqual",value:function(e){return this._lat===e._lat&&this._long===e._long}},{key:"toJSON",value:function(){return{latitude:this._lat,longitude:this._long}}},{key:"_compareTo",value:function(e){return H(this._lat,e._lat)||H(this._long,e._long)}}]),e}();var Ka=new RegExp("[~\\*/\\[\\]]");function Ga(e,t,n){if(t.search(Ka)>=0)throw Wa("Invalid field path (".concat(t,"). Paths must not contain '~', '*', '/', '[', or ']'"),e,!1,void 0,n);try{return Object(r.a)(Ba,Object(p.a)(t.split(".")))._internalPath}catch(i){throw Wa("Invalid field path (".concat(t,"). Paths must not be empty, begin with '.', end with '.', or contain '..'"),e,!1,void 0,n)}}function Wa(e,t,n,r,i){var a=r&&!r.isEmpty(),o=void 0!==i,u="Function ".concat(t,"() called with invalid data");n&&(u+=" (via `toFirestore()`)"),u+=". ";var s="";return(a||o)&&(s+=" (found",a&&(s+=" in field ".concat(r)),o&&(s+=" in document ".concat(i)),s+=")"),new L(D.INVALID_ARGUMENT,u+e+s)}var Qa=function(){function e(t,n,r,i,a){Object(v.a)(this,e),this._firestore=t,this._userDataWriter=n,this._key=r,this._document=i,this._converter=a}return Object(y.a)(e,[{key:"id",get:function(){return this._key.path.lastSegment()}},{key:"ref",get:function(){return new Da(this._firestore,this._converter,this._key)}},{key:"exists",value:function(){return null!==this._document}},{key:"data",value:function(){if(this._document){if(this._converter){var e=new $a(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}},{key:"get",value:function(e){if(this._document){var t=this._document.data.field(Ya("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}}]),e}(),$a=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(){return Object(v.a)(this,n),t.apply(this,arguments)}return Object(y.a)(n,[{key:"data",value:function(){return Object(i.a)(Object(a.a)(n.prototype),"data",this).call(this)}}]),n}(Qa);function Ya(e,t){return"string"==typeof t?Ga(e,t):t instanceof Ba?t._internalPath:t._delegate._internalPath}var Xa=function(){function e(t,n){Object(v.a)(this,e),this.hasPendingWrites=t,this.fromCache=n}return Object(y.a)(e,[{key:"isEqual",value:function(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}]),e}(),Ja=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(e,r,i,a,o,u){var s;return Object(v.a)(this,n),(s=t.call(this,e,r,i,a,u))._firestore=e,s._firestoreImpl=e,s.metadata=o,s}return Object(y.a)(n,[{key:"exists",value:function(){return Object(i.a)(Object(a.a)(n.prototype),"exists",this).call(this)}},{key:"data",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._document){if(this._converter){var t=new Za(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}},{key:"get",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._document){var n=this._document.data.field(Ya("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}}]),n}(Qa),Za=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(){return Object(v.a)(this,n),t.apply(this,arguments)}return Object(y.a)(n,[{key:"data",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object(i.a)(Object(a.a)(n.prototype),"data",this).call(this,e)}}]),n}(Ja),eo=function(){function e(t,n,r,i){Object(v.a)(this,e),this._firestore=t,this._userDataWriter=n,this._snapshot=i,this.metadata=new Xa(i.hasPendingWrites,i.fromCache),this.query=r}return Object(y.a)(e,[{key:"docs",get:function(){var e=[];return this.forEach((function(t){return e.push(t)})),e}},{key:"size",get:function(){return this._snapshot.docs.size}},{key:"empty",get:function(){return 0===this.size}},{key:"forEach",value:function(e,t){var n=this;this._snapshot.docs.forEach((function(r){e.call(t,new Za(n._firestore,n._userDataWriter,r.key,r,new Xa(n._snapshot.mutatedKeys.has(r.key),n._snapshot.fromCache),n.query.converter))}))}},{key:"docChanges",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new L(D.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(e,t){if(e._snapshot.oldDocs.isEmpty()){var n=0;return e._snapshot.docChanges.map((function(t){return{type:"added",doc:new Za(e._firestore,e._userDataWriter,t.doc.key,t.doc,new Xa(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter),oldIndex:-1,newIndex:n++}}))}var r=e._snapshot.oldDocs;return e._snapshot.docChanges.filter((function(e){return t||3!==e.type})).map((function(t){var n=new Za(e._firestore,e._userDataWriter,t.doc.key,t.doc,new Xa(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter),i=-1,a=-1;return 0!==t.type&&(i=r.indexOf(t.doc.key),r=r.delete(t.doc.key)),1!==t.type&&(a=(r=r.add(t.doc)).indexOf(t.doc.key)),{type:to(t.type),doc:n,oldIndex:i,newIndex:a}}))}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}}]),e}();function to(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return C()}}function no(e){if(Xe(e)&&0===e.explicitOrderBy.length)throw new L(D.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}var ro=function(){function e(){Object(v.a)(this,e)}return Object(y.a)(e,[{key:"convertValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none";switch(he(e)){case 0:return null;case 1:return e.booleanValue;case 2:return ie(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(ae(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 10:return this.convertObject(e.mapValue,t);default:throw C()}}},{key:"convertObject",value:function(e,t){var n=this,r={};return $(e.fields,(function(e,i){r[e]=n.convertValue(i,t)})),r}},{key:"convertGeoPoint",value:function(e){return new Ha(ie(e.latitude),ie(e.longitude))}},{key:"convertArray",value:function(e,t){var n=this;return(e.values||[]).map((function(e){return n.convertValue(e,t)}))}},{key:"convertServerTimestamp",value:function(e,t){switch(t){case"previous":var n=ue(e);return null==n?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(se(e));default:return null}}},{key:"convertTimestamp",value:function(e){var t=re(e);return new G(t.seconds,t.nanos)}},{key:"convertDocumentKey",value:function(e,t){var n=J.fromString(e);N(Dn(n));var r=new Ta(n.get(1),n.get(3)),i=new fe(n.popFirst(5));return r.isEqual(t)||j("Document ".concat(i," contains a document reference within a different database (").concat(r.projectId,"/").concat(r.database,") which is not supported. It will be treated as a reference in the current database (").concat(t.projectId,"/").concat(t.database,") instead.")),i}}]),e}();var io=function(e){Object(f.a)(n,e);var t=Object(h.a)(n);function n(e){var r;return Object(v.a)(this,n),(r=t.call(this)).firestore=e,r}return Object(y.a)(n,[{key:"convertBytes",value:function(e){return new qa(e)}},{key:"convertReference",value:function(e){var t=this.convertDocumentKey(e,this.firestore._databaseId);return new Da(this.firestore,null,t)}}]),n}(ro);function ao(e){e=Ca(e,La);var t=Ca(e.firestore,Ma),n=Ua(t),r=new io(t);return no(e._query),Oa(n,e._query).then((function(n){return new eo(t,r,e,n)}))}var oo;oo=g.a,O=oo,Object(g.c)(new m.a("firestore",(function(e,t){var n=t.options,r=e.getProvider("app").getImmediate(),i=new Ma(r,new M(e.getProvider("auth-internal")));return n=Object.assign({useFetchStreams:!0},n),i._setSettings(n),i}),"PUBLIC")),Object(g.g)("@firebase/firestore","3.1.0",undefined)}).call(this,n(38))},function(e,t,n){"use strict";var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;function o(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(i){return!1}}()?Object.assign:function(e,t){for(var n,u,s=o(e),l=1;l